30 using namespace kaldi;
    36 template<
typename Real>
    38   return (
sizeof(Real) == 8 ? 
"<double>" : 
"<float>");
    42   int32 num_matrices = 256;
    45   std::vector<std::pair<int32, int32> > sizes(num_matrices);
    47   for (
int32 i = 0; 
i < num_matrices; 
i++) {
    50     num_rows *= size_multiple;
    53     num_cols *= size_multiple;
    54     sizes[
i].first = num_rows;
    55     sizes[
i].second = num_rows;
    58   std::vector<CuMatrix<BaseFloat> > matrices(num_matrices);
    61   size_t num_floats_processed = 0;
    62   for (;tim.
Elapsed() < time_in_secs; ) {
    64     if (matrices[matrix].NumRows() == 0) {
    65       int32 num_rows = sizes[matrix].first,
    66           num_cols = sizes[matrix].second;
    67       matrices[matrix].Resize(num_rows, num_cols, 
kUndefined);
    68       num_floats_processed += num_rows * num_cols;
    70       matrices[matrix].Resize(0, 0);
    76   KALDI_LOG << 
"For CuMatrix::Resize" << NameOf<Real>() << 
", for size_multiple = "    77             << size_multiple << 
", speed was " << gflops << 
" gigaflops.";
    80 template <
typename Real>
    82   std::vector<int32> sizes;
    92   int32 ns = sizes.size();
    93   for (
int32 s = 0; s < ns; s++)
    94     TestCuMatrixResize<Real>(sizes[s]);
   104   for (
int32 loop = 0; loop < 2; loop++) {
   105     CuDevice::Instantiate().SetDebugStrideMode(
true);
   107       CuDevice::Instantiate().SelectGpuId(
"no");
   109       CuDevice::Instantiate().SelectGpuId(
"yes");
   112     kaldi::CudaMatrixResizeTest<float>();
   114     if (CuDevice::Instantiate().DoublePrecisionSupported()) {
   115       kaldi::CudaMatrixResizeTest<double>();
   117       KALDI_WARN << 
"Double precision not supported";
   120     kaldi::CudaMatrixResizeTest<double>();
   125   CuDevice::Instantiate().PrintProfile();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
void CudaMatrixResizeTest()
 
void TestCuMatrixResize(int32 size_multiple)
 
void SetVerboseLevel(int32 i)
This should be rarely used, except by programs using Kaldi as library; command-line programs set the ...
 
double Elapsed() const
Returns time in seconds. 
 
int32 RandInt(int32 min_val, int32 max_val, struct RandomState *state)