22 #ifndef KALDI_CUDAMATRIX_CU_VALUE_H_ 23 #define KALDI_CUDAMATRIX_CU_VALUE_H_ 33 template<
typename Real>
41 if (CuDevice::Instantiate().Enabled()) {
43 cudaMemcpyAsync(
data_, other.
data_,
sizeof(Real),
44 cudaMemcpyDeviceToDevice, cudaStreamPerThread));
56 if (CuDevice::Instantiate().Enabled()) {
57 CU_SAFE_CALL(cudaMemcpyAsync(
data_, &r,
sizeof(Real),
58 cudaMemcpyHostToDevice, cudaStreamPerThread));
59 CU_SAFE_CALL(cudaStreamSynchronize(cudaStreamPerThread));
69 inline Real
operator += (Real r) {
return (*
this = r + Real(*
this)); }
70 inline Real
operator -= (Real r) {
return (*
this = Real(*
this) - r); }
73 inline operator Real ()
const {
75 if (CuDevice::Instantiate().Enabled()) {
77 CU_SAFE_CALL(cudaMemcpyAsync(&value,
data_,
sizeof(Real),
78 cudaMemcpyDeviceToHost, cudaStreamPerThread));
79 CU_SAFE_CALL(cudaStreamSynchronize(cudaStreamPerThread));
94 #endif // KALDI_CUDAMATRIX_CU_VALUE_H_ This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
The following class is used to simulate non-const references to Real, e.g.
CuValue operator=(const CuValue< Real > &other)
CuValue(const CuValue &other)