Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/cudamatrix/cu-rand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ void CuRand<Real>::RandUniform(CuMatrixBase<Real> *tgt) {
// may vary).
CuMatrix<Real> tmp(tgt->NumRows(), tgt->NumCols(), kUndefined,
kStrideEqualNumCols);
CURAND_SAFE_CALL(curandGenerateUniformWrap(gen_, tmp.Data(), tmp.NumRows() * tmp.Stride()));
size_t s = static_cast<size_t>(tmp.NumRows()) * static_cast<size_t>(tmp.Stride());
CURAND_SAFE_CALL(curandGenerateUniformWrap(gen_, tmp.Data(), s));
tgt->CopyFromMat(tmp);
CuDevice::Instantiate().AccuProfile(__func__, tim);
} else
Expand All @@ -84,7 +85,8 @@ void CuRand<Real>::RandUniform(CuMatrix<Real> *tgt) {
if (CuDevice::Instantiate().Enabled()) {
CuTimer tim;
// Here we don't need to use 'tmp' matrix,
CURAND_SAFE_CALL(curandGenerateUniformWrap(gen_, tgt->Data(), tgt->NumRows() * tgt->Stride()));
size_t s = static_cast<size_t>(tgt->NumRows()) * static_cast<size_t>(tgt->Stride());
CURAND_SAFE_CALL(curandGenerateUniformWrap(gen_, tgt->Data(), s));
CuDevice::Instantiate().AccuProfile(__func__, tim);
} else
#endif
Expand Down