cu-sp-matrix-test.cc File Reference
#include <iostream>
#include <vector>
#include <cstdlib>
#include "base/kaldi-common.h"
#include "cudamatrix/cu-device.h"
#include "cudamatrix/cu-sp-matrix.h"
#include "cudamatrix/cu-vector.h"
#include "cudamatrix/cu-math.h"
Include dependency graph for cu-sp-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 void UnitTestCuSpMatrixConstructor ()
 
template<typename Real >
static void UnitTestCuSpMatrixApproxEqual ()
 
template<typename Real >
static void UnitTestCuSpMatrixOperator ()
 
template<typename Real >
static void UnitTestCuSpMatrixAddToDiag ()
 
template<typename Real >
static void UnitTestCuSpMatrixCopyFromMat ()
 
template<typename Real >
static void UnitTestCuSpMatrixInvert ()
 
template<typename Real >
static void UnitTestCuSpMatrixAddVec2 ()
 
template<typename Real >
static void UnitTestCuSpMatrixAddMat2 ()
 
template<typename Real >
static void UnitTestCuSpMatrixAddSp ()
 
template<typename Real , typename OtherReal >
static void UnitTestCuSpMatrixTraceSpSp ()
 
template<typename Real >
void UnitTestCuSpMatrixSetUnit ()
 
template<class Real >
static void UnitTestCuSpMatrixIO ()
 
template<typename Real , typename OtherReal >
static void UnitTestCuSpMatrixAddSp ()
 
template<typename Real >
void CudaSpMatrixUnitTest ()
 
template<typename Real , typename OtherReal >
void CudaSpMatrixUnitTest ()
 
int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 364 of file cu-sp-matrix-test.cc.

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

364  {
365  using namespace kaldi;
366  SetVerboseLevel(1);
367  int32 loop = 0;
368 #if HAVE_CUDA == 1
369  for (; loop < 2; loop++) {
370  CuDevice::Instantiate().SetDebugStrideMode(true);
371  if (loop == 0)
372  CuDevice::Instantiate().SelectGpuId("no"); // -1 means no GPU
373  else
374  CuDevice::Instantiate().SelectGpuId("yes"); // -2 .. automatic selection
375 #endif
376 
377  kaldi::CudaSpMatrixUnitTest<float>();
378  kaldi::CudaSpMatrixUnitTest<float, float>();
379 #if HAVE_CUDA == 1
380  if (CuDevice::Instantiate().DoublePrecisionSupported()) {
381  kaldi::CudaSpMatrixUnitTest<double>();
382  kaldi::CudaSpMatrixUnitTest<float, double>();
383  kaldi::CudaSpMatrixUnitTest<double, float>();
384  kaldi::CudaSpMatrixUnitTest<double, double>();
385  } else {
386  KALDI_WARN << "Double precision not supported";
387  }
388 #else
389  kaldi::CudaSpMatrixUnitTest<float, double>();
390  kaldi::CudaSpMatrixUnitTest<double, float>();
391  kaldi::CudaSpMatrixUnitTest<double, double>();
392 #endif
393 
394  if (loop == 0)
395  KALDI_LOG << "Tests without GPU use succeeded.";
396  else
397  KALDI_LOG << "Tests with GPU use (if available) succeeded.";
398 #if HAVE_CUDA == 1
399  }
400  CuDevice::Instantiate().PrintProfile();
401 #endif
402  return 0;
403 }
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
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