cu-sparse-matrix-test.cc File Reference
#include <vector>
#include <algorithm>
#include <cstdlib>
#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "cudamatrix/cu-matrix-lib.h"
Include dependency graph for cu-sparse-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 UnitTestCuSparseMatrixConstructFromIndexes ()
 
template<typename Real >
static void UnitTestCuSparseMatrixSelectRowsAndTranspose ()
 
template<typename Real >
static void UnitTestCuSparseMatrixTraceMatSmat ()
 
template<typename Real >
static void UnitTestCuSparseMatrixSum ()
 
template<typename Real >
static void UnitTestCuSparseMatrixFrobeniusNorm ()
 
template<typename Real >
static void UnitTestCuSparseMatrixCopyToSmat ()
 
template<typename Real >
static void UnitTestCuSparseMatrixSwap ()
 
template<typename Real >
void CudaSparseMatrixUnitTest ()
 
int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 285 of file cu-sparse-matrix-test.cc.

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

285  {
286  int32 loop = 0;
287 #if HAVE_CUDA == 1
288  for (; loop < 2; loop++) {
289  CuDevice::Instantiate().SetDebugStrideMode(true);
290  if (loop == 0)
291  CuDevice::Instantiate().SelectGpuId("no");
292  else
293  CuDevice::Instantiate().SelectGpuId("yes");
294 #endif
295 
296  kaldi::CudaSparseMatrixUnitTest<float>();
297 
298 #if HAVE_CUDA == 1
299  if (CuDevice::Instantiate().DoublePrecisionSupported()) {
300  kaldi::CudaSparseMatrixUnitTest<double>();
301  } else {
302  KALDI_WARN << "Double precision not supported";
303  }
304 #else
305  kaldi::CudaSparseMatrixUnitTest<double>();
306 #endif
307 
308  if (loop == 0)
309  KALDI_LOG << "Tests without GPU use succeeded.";
310  else
311  KALDI_LOG << "Tests with GPU use (if available) succeeded.";
312  SetVerboseLevel(4);
313 #if HAVE_CUDA == 1
314  }
315  CuDevice::Instantiate().PrintProfile();
316 #endif
317  return 0;
318 }
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