cu-vector-test.cc File Reference
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "cudamatrix/cu-matrix.h"
#include "cudamatrix/cu-vector.h"
#include "cudamatrix/cu-tp-matrix.h"
#include "cudamatrix/cu-sp-matrix.h"
#include "cudamatrix/cu-math.h"
Include dependency graph for cu-vector-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<class Real >
static void UnitTestCuVectorIO ()
 
template<typename Real , typename OtherReal >
static void UnitTestCuVectorCopyFromVec ()
 
template<typename Real >
static void UnitTestCuSubVector ()
 
template<typename Real >
static void UnitTestCuVectorMulTp ()
 
template<typename Real >
static void UnitTestCuVectorAddTp ()
 
template<typename Real >
void CuVectorUnitTestVecVec ()
 
template<typename Real >
void CuVectorUnitTestAddVec ()
 
template<typename Real >
void CuVectorUnitTestAddVecCross ()
 
template<typename Real >
void CuVectorUnitTestAddVecExtra ()
 
template<typename Real >
void CuVectorUnitTestCopyElements ()
 
template<typename Real >
void UnitTestVecMatVec ()
 
template<typename Real >
void CuVectorUnitTestAddRowSumMat ()
 
template<typename Real >
void CuVectorUnitTestAddColSumMat ()
 
template<typename Real >
void CuVectorUnitTestApproxEqual ()
 
template<typename Real >
static void UnitTestCuVectorReplaceValue ()
 
template<typename Real >
static void UnitTestCuVectorSum ()
 
template<typename Real >
void CuVectorUnitTestInvertElements ()
 
template<typename Real >
void CuVectorUnitTestSum ()
 
template<typename Real >
void CuVectorUnitTestScale ()
 
template<typename Real >
void CuVectorUnitTestCopyFromMat ()
 
template<typename Real >
void CuVectorUnitTestCopyDiagFromPacked ()
 
template<typename Real >
void CuVectorUnitTestCopyCross ()
 
template<typename Real >
void CuVectorUnitTestCopyCross2 ()
 
template<typename Real >
void CuVectorUnitTestCopyDiagFromMat ()
 
template<typename Real >
void CuVectorUnitTestNorm ()
 
template<typename Real >
void CuVectorUnitTestMin ()
 
template<typename Real >
void CuVectorUnitTestMax ()
 
template<typename Real >
void CuVectorUnitTestApplySoftMax ()
 
template<typename Real >
void CuVectorUnitTestApplyExp ()
 
template<typename Real >
void CuVectorUnitTestApplyLog ()
 
template<typename Real >
void CuVectorUnitTestApplyFloor ()
 
template<typename Real >
void CuVectorUnitTestApplyFloorNoCount ()
 
template<typename Real >
void CuVectorUnitTestApplyCeiling ()
 
template<typename Real >
void CuVectorUnitTestApplyCeilingNoCount ()
 
template<typename Real >
void CuVectorUnitTestApplyPow ()
 
template<typename Real >
void CuVectorUnitTestAddVecVec ()
 
template<typename Real >
void CuVectorUnitTestAddDiagMat2 ()
 
template<typename Real >
static void CuVectorUnitTestAddDiagMatMat ()
 
template<typename Real >
void CuVectorUnitTestAddMatVec ()
 
template<typename Real >
void CuVectorUnitTestAddSpVec ()
 
template<typename Real >
void CuVectorUnitTest ()
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 831 of file cu-vector-test.cc.

References KALDI_LOG, KALDI_WARN, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), ParseOptions::Register(), and kaldi::SetVerboseLevel().

831  {
832  using namespace kaldi;
833  SetVerboseLevel(1);
834  const char *usage = "Usage: cu-vector-test [options]";
835 
836  ParseOptions po(usage);
837  std::string use_gpu = "yes";
838  po.Register("use-gpu", &use_gpu, "yes|no|optional");
839  po.Read(argc, argv);
840 
841  if (po.NumArgs() != 0) {
842  po.PrintUsage();
843  exit(1);
844  }
845 
846  int32 loop = 0;
847 #if HAVE_CUDA == 1
848  for (; loop < 2; loop++) {
849  CuDevice::Instantiate().SetDebugStrideMode(true);
850  if (loop == 0)
851  CuDevice::Instantiate().SelectGpuId("no"); // -1 means no GPU
852  else
853  CuDevice::Instantiate().SelectGpuId(use_gpu);
854 #endif
855 
856  kaldi::CuVectorUnitTest<float>();
857 #if HAVE_CUDA == 1
858  if (CuDevice::Instantiate().DoublePrecisionSupported()) {
859  kaldi::CuVectorUnitTest<double>();
860  } else {
861  KALDI_WARN << "Double precision not supported";
862  }
863 #else
864  kaldi::CuVectorUnitTest<double>();
865 #endif
866 
867  if (loop == 0)
868  KALDI_LOG << "Tests without GPU use succeeded.";
869  else
870  KALDI_LOG << "Tests with GPU use (if available) succeeded.";
871 #if HAVE_CUDA == 1
872  }
873  CuDevice::Instantiate().PrintProfile();
874 #endif
875  return 0;
876 }
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
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
#define KALDI_WARN
Definition: kaldi-error.h:150
#define KALDI_LOG
Definition: kaldi-error.h:153