23 #ifndef KALDI_CUDAMATRIX_CU_COMMON_H_ 24 #define KALDI_CUDAMATRIX_CU_COMMON_H_ 33 #include <cublas_v2.h> 36 #include <cuda_runtime_api.h> 37 #include "nvToolsExt.h" 39 #define CU_SAFE_CALL(fun) \ 42 if ((ret = (fun)) != 0) { \ 43 KALDI_ERR << "cudaError_t " << ret << " : \"" << cudaGetErrorString((cudaError_t)ret) << "\" returned from '" << #fun << "'"; \ 47 #define CUFFT_SAFE_CALL(fun) \ 50 if ((ret = (fun)) != CUFFT_SUCCESS) { \ 51 KALDI_ERR << "cublasResult " << ret << " returned from '" << #fun << "'"; \ 55 #define CUBLAS_SAFE_CALL(fun) \ 58 if ((ret = (fun)) != 0) { \ 59 KALDI_ERR << "cublasStatus_t " << ret << " : \"" << cublasGetStatusString((cublasStatus_t)ret) << "\" returned from '" << #fun << "'"; \ 63 #define CUSOLVER_SAFE_CALL(fun) \ 66 if ((ret = (fun)) != 0) { \ 67 KALDI_ERR << "cusolverStatus_t " << ret << " : \"" << ret << "\" returned from '" << #fun << "'"; \ 72 #define CUSPARSE_SAFE_CALL(fun) \ 75 if ((ret = (fun)) != 0) { \ 76 KALDI_ERR << "cusparseStatus_t " << ret << " : \"" << cusparseGetStatusString((cusparseStatus_t)ret) << "\" returned from '" << #fun << "'"; \ 80 #define CURAND_SAFE_CALL(fun) \ 83 if ((ret = (fun)) != 0) { \ 84 KALDI_ERR << "curandStatus_t " << ret << " : \"" << curandGetStatusString((curandStatus_t)ret) << "\" returned from '" << #fun << "'"; \ 88 #define KALDI_CUDA_ERR(ret, msg) \ 91 KALDI_ERR << msg << ", diagnostics: cudaError_t " << ret << " : \"" << cudaGetErrorString((cudaError_t)ret) << "\", in " << __FILE__ << ":" << __LINE__; \ 101 NvtxTracer(
const char* name);
104 #define NVTX_RANGE(name) NvtxTracer uniq_name_using_macros(name); 106 #define NVTX_RANGE(name) 111 return size / block_size + ((size % block_size == 0)? 0 : 1);
126 void GetBlockSizesForSimpleMatrixOperation(
int32 num_rows,
132 const char* cublasGetStatusString(cublasStatus_t status);
135 const char* cusparseGetStatusString(cusparseStatus_t status);
138 const char* curandGetStatusString(curandStatus_t status);
143 #define NVTX_RANGE(name) 149 template<
typename Real>
class CuVectorBase;
150 template<
typename Real>
class CuVector;
151 template<
typename Real>
class CuSubVector;
154 template<
typename Real>
class CuMatrix;
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
The class CuBlockMatrix holds a vector of objects of type CuMatrix, say, M_1, M_2, .
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
This class is used for a piece of a CuMatrix.
Matrix for CUDA computing.
Matrix for CUDA computing.