зеркало из https://github.com/mozilla/kaldi.git
trunk,cudamatrix: bugfix, we should use GPU memory caching via CuDevice for CuArray too...
git-svn-id: https://svn.code.sf.net/p/kaldi/code/trunk@3309 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
This commit is contained in:
Родитель
48984495c4
Коммит
29e2e8e207
|
@ -50,7 +50,11 @@ void CuArray<T>::Resize(MatrixIndexT dim, MatrixResizeType resize_type) {
|
|||
|
||||
#if HAVE_CUDA == 1
|
||||
if (CuDevice::Instantiate().Enabled()) {
|
||||
CU_SAFE_CALL(cudaMalloc((void**)&data_, dim*sizeof(T)));
|
||||
Timer tim;
|
||||
this->data_ = static_cast<T*>(CuDevice::Instantiate().Malloc(dim * sizeof(T)));
|
||||
this->dim_ = dim;
|
||||
if (resize_type == kSetZero) this->SetZero();
|
||||
CuDevice::Instantiate().AccuProfile("CuArray::Resize", tim.Elapsed());
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
@ -75,7 +79,7 @@ void CuArray<T>::Destroy() {
|
|||
#if HAVE_CUDA == 1
|
||||
if (CuDevice::Instantiate().Enabled()) {
|
||||
if (data_ != NULL) {
|
||||
CU_SAFE_CALL(cudaFree(data_));
|
||||
CuDevice::Instantiate().Free(this->data_);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче