cu-math-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 "cudamatrix/cu-math.h"
#include "cudamatrix/cu-array.h"
Include dependency graph for cu-math-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 void UnitTestCuMathRandomize ()
 
template<typename Real >
static void UnitTestEnsureNonzero ()
 
template<typename Real >
static void UnitTestCuMathCopy ()
 
template<typename Real >
static void UnitTestCuMathSplice ()
 
template<typename Real >
static void UnitTestCuMathComputeLstmNonlinearity ()
 
void UnitTestLstmNonlinearity ()
 
template<typename Real >
static void UnitTestBackpropLstmNonlinearity ()
 
template<typename Real >
static void UnitTestCuMathNormalizePerRow ()
 
template<typename Real >
static void UnitTestCuMathNormalizePerRow_v2 ()
 
template<typename Real >
static void UnitTestCuDiffNormalizePerRow ()
 
template<typename Real >
void CudaMathUnitTest ()
 
int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 714 of file cu-math-test.cc.

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

714  {
715  SetVerboseLevel(1);
716  int32 loop = 0;
717 #if HAVE_CUDA == 1
718  for (; loop < 2; loop++) {
719  CuDevice::Instantiate().SetDebugStrideMode(true);
720  if (loop == 0)
721  CuDevice::Instantiate().SelectGpuId("no"); // 0 means no GPU
722  else
723  CuDevice::Instantiate().SelectGpuId("yes"); // 1 .. automatic selection
724 #endif
725  srand(time(NULL));
726  kaldi::CudaMathUnitTest<float>();
727 
728 #if HAVE_CUDA == 1
729  if (CuDevice::Instantiate().DoublePrecisionSupported()) {
730  kaldi::CudaMathUnitTest<double>();
731  } else {
732  KALDI_WARN << "Double precision not supported";
733  }
734 #else
735  kaldi::CudaMathUnitTest<float>();
736 #endif
737 
738  if (loop == 0)
739  KALDI_LOG << "Tests without GPU use succeeded.";
740  else
741  KALDI_LOG << "Tests with GPU use (if available) succeeded.";
742 #if HAVE_CUDA == 1
743  } // No for loop if 'HAVE_CUDA != 1',
744  CuDevice::Instantiate().PrintProfile();
745 #endif
746  return 0;
747 }
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