31 using namespace kaldi;
36 template<
typename Real>
38 return (
sizeof(Real) == 8 ?
"<double>" :
"<float>");
43 std::ostringstream os;
48 template<
typename Real>
50 std::ostringstream os;
56 return std::string(
"mean ") +
ToString(mean) +
", std-dev " +
ToString(std::sqrt(var));
59 template<
typename Real>
61 std::ostringstream os;
62 Real mean = v.
Sum() / v.
Dim();
66 Real var = tmp.
Sum() / tmp.
Dim();
67 return std::string(
"mean ") +
ToString(mean) +
", std-dev " +
ToString(std::sqrt(var));
71 template <
typename Real>
85 KALDI_LOG << __func__ << NameOf<Real>()
86 <<
" Speed was " << flops <<
" rand_elems/s. " 90 template <
typename Real>
104 KALDI_LOG << __func__ << NameOf<Real>()
105 <<
" Speed was " << flops <<
" rand_elems/s. " 109 template <
typename Real>
123 KALDI_LOG << __func__ << NameOf<Real>()
124 <<
" Speed was " << flops <<
" rand_elems/s. " 128 template <
typename Real>
142 KALDI_LOG << __func__ << NameOf<Real>()
143 <<
" Speed was " << flops <<
" rand_elems/s. " 147 template <
typename Real>
161 KALDI_LOG << __func__ << NameOf<Real>()
162 <<
" Speed was " << flops <<
" rand_elems/s. " 166 template <
typename Real>
180 KALDI_LOG << __func__ << NameOf<Real>()
181 <<
" Speed was " << flops <<
" rand_elems/s. " 191 for (
int32 loop = 0; loop < 2; loop++) {
192 CuDevice::Instantiate().SetDebugStrideMode(
true);
194 CuDevice::Instantiate().SelectGpuId(
"no");
196 CuDevice::Instantiate().SelectGpuId(
"yes");
201 kaldi::CuRandUniformMatrixSpeedTest<float>(iter);
202 kaldi::CuRandUniformMatrixBaseSpeedTest<float>(iter);
203 kaldi::CuRandUniformVectorSpeedTest<float>(iter);
204 kaldi::CuRandGaussianMatrixSpeedTest<float>(iter);
205 kaldi::CuRandGaussianMatrixBaseSpeedTest<float>(iter);
206 kaldi::CuRandGaussianVectorSpeedTest<float>(iter);
207 fprintf(stderr,
"---\n");
209 kaldi::CuRandUniformMatrixSpeedTest<double>(iter);
210 kaldi::CuRandUniformMatrixBaseSpeedTest<double>(iter);
211 kaldi::CuRandUniformVectorSpeedTest<double>(iter);
212 kaldi::CuRandGaussianMatrixSpeedTest<double>(iter);
213 kaldi::CuRandGaussianMatrixBaseSpeedTest<double>(iter);
214 kaldi::CuRandGaussianVectorSpeedTest<double>(iter);
215 fprintf(stderr,
"--- ELAPSED %fs.\n\n", t.
Elapsed());
218 CuDevice::Instantiate().PrintProfile();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void ApplyPow(Real power)
std::string MeanVariance(const CuMatrixBase< Real > &m)
void RandUniform(CuMatrixBase< Real > *tgt)
Fill with uniform [0..1] floats,.
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
void CuRandUniformMatrixSpeedTest(const int32 iter)
void RandGaussian(CuMatrixBase< Real > *tgt)
Fill with Normal random numbers,.
void CuRandGaussianMatrixBaseSpeedTest(const int32 iter)
void ApplyPow(Real power)
void CuRandUniformVectorSpeedTest(const int32 iter)
void CuRandGaussianVectorSpeedTest(const int32 iter)
void CuRandUniformMatrixBaseSpeedTest(const int32 iter)
Matrix for CUDA computing.
MatrixIndexT NumCols() const
void CuRandGaussianMatrixSpeedTest(const int32 iter)
std::string ToString(const T &t)
MatrixIndexT NumRows() const
Dimensions.
double Elapsed() const
Returns time in seconds.
MatrixIndexT Dim() const
Dimensions.
Vector for CUDA computing.