cu-block-matrix-test.cc File Reference
#include <iostream>
#include <vector>
#include <cstdlib>
#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "cudamatrix/cu-matrix-lib.h"
Include dependency graph for cu-block-matrix-test.cc:

Go to the source code of this file.

Namespaces

 kaldi
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for mispronunciations detection tasks, the reference:
 

Functions

template<typename Real >
static bool ApproxEqual (const CuBlockMatrix< Real > &A, const CuBlockMatrix< Real > &B, float tol=0.001)
 
template<class Real >
static void UnitTestCuBlockMatrixIO ()
 
template<class Real >
static void UnitTestCuBlockMatrixAddMatBlock ()
 
template<class Real >
static void UnitTestCuBlockMatrixAddMatMat ()
 
template<typename Real >
void CuBlockMatrixUnitTest ()
 
int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 183 of file cu-block-matrix-test.cc.

References KALDI_LOG, KALDI_WARN, and kaldi::SetVerboseLevel().

183  {
184  SetVerboseLevel(1);
185  int32 loop = 0;
186 #if HAVE_CUDA == 1
187  for (; loop < 2; loop++) {
188  CuDevice::Instantiate().SetDebugStrideMode(true);
189  if (loop == 0)
190  CuDevice::Instantiate().SelectGpuId("no"); // -1 means no GPU
191  else
192  CuDevice::Instantiate().SelectGpuId("yes"); // -2 .. automatic selection
193 #endif
194 
195  kaldi::CuBlockMatrixUnitTest<float>();
196 #if HAVE_CUDA == 1
197  if (CuDevice::Instantiate().DoublePrecisionSupported()) {
198  kaldi::CuBlockMatrixUnitTest<double>();
199  } else {
200  KALDI_WARN << "Double precision not supported";
201  }
202 #else
203  kaldi::CuBlockMatrixUnitTest<double>();
204 #endif
205 
206  if (loop == 0)
207  KALDI_LOG << "Tests without GPU use succeeded.";
208  else
209  KALDI_LOG << "Tests with GPU use (if available) succeeded.";
210 #if HAVE_CUDA == 1
211  }
212  CuDevice::Instantiate().PrintProfile();
213 #endif
214  return 0;
215 }
kaldi::int32 int32
void SetVerboseLevel(int32 i)
This should be rarely used, except by programs using Kaldi as library; command-line programs set the ...
Definition: kaldi-error.h:64
#define KALDI_WARN
Definition: kaldi-error.h:150
#define KALDI_LOG
Definition: kaldi-error.h:153