23 #ifndef KALDI_CUDAMATRIX_CU_PACKED_MATRIX_H_    24 #define KALDI_CUDAMATRIX_CU_PACKED_MATRIX_H_    50 template<
typename Real>
    53 class CuPackedMatrix {
    82   void Scale(Real alpha); 
   102   void Read(std::istream &in, 
bool binary);
   104   void Write(std::ostream &out, 
bool binary) 
const;
   117     if (static_cast<UnsignedMatrixIndexT>(c) >
   118         static_cast<UnsignedMatrixIndexT>(r))
   121                  static_cast<UnsignedMatrixIndexT>(this->
num_rows_));
   123     if (CuDevice::Instantiate().Enabled()) {    
   125       CU_SAFE_CALL(cudaMemcpyAsync(&value, this->
data_ + (r * (r+1)) / 2 + c,
   126                                    sizeof(Real), cudaMemcpyDeviceToHost,
   127                                    cudaStreamPerThread));
   128       CU_SAFE_CALL(cudaStreamSynchronize(cudaStreamPerThread));
   132     return this->
data_[(r * (r+1)) / 2 + c];
   140     size_t nr = 
static_cast<size_t>(
num_rows_),
   141       num_bytes = ((nr * (nr+1)) / 2) * 
sizeof(Real);
   171 template<
typename Real>
   172 std::ostream &operator << (std::ostream &out, const CuPackedMatrix<Real> &mat);
 
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
CuPackedMatrix(MatrixIndexT r, MatrixResizeType resize_type=kSetZero)
 
const PackedMatrix< Real > & Mat() const
 
void Swap(CuPackedMatrix< Real > *other)
Swaps the contents of *this and *other. Shallow swap. 
 
void AddPacked(const Real alpha, const CuPackedMatrix< Real > &M)
 
void SetDiag(Real alpha)
< Set to random values of a normal distribution 
 
MatrixIndexT NumRows() const
 
CuPackedMatrix(const CuPackedMatrix< Real > &orig)
 
void CopyToPacked(PackedMatrix< Real > *dst) const
 
void AddToDiag(Real r)
< Set the diagonal value to alpha 
 
void swap(basic_filebuf< CharT, Traits > &x, basic_filebuf< CharT, Traits > &y)
 
const Real * Data() const
 
void SetRandn()
< Set to unit matrix. 
 
Packed matrix: base class for triangular and symmetric matrices. 
 
void Read(std::istream &in, bool binary)
 
PackedMatrix< Real > & operator=(const PackedMatrix< Real > &other)
 
void SetUnit()
< Set to zero 
 
This class is used for a piece of a CuMatrix. 
 
size_t SizeInBytes() const
Returns size in bytes of the data held by the matrix. 
 
CuPackedMatrix(const PackedMatrix< Real > &orig)
 
void ScaleDiag(Real alpha)
 
Matrix for CUDA computing. 
 
#define KALDI_ASSERT(cond)
 
Matrix for CUDA computing. 
 
PackedMatrix< Real > & Mat()
 
void Resize(MatrixIndexT nRows, MatrixResizeType resize_type=kSetZero)
Set packed matrix to a specified size (can be zero). 
 
void Write(std::ostream &out, bool binary) const
 
MatrixIndexT NumCols() const
 
Real operator()(MatrixIndexT r, MatrixIndexT c) const
 
void CopyFromPacked(const CuPackedMatrix< Real > &src)
 
Vector for CUDA computing.