Commit 192bad4b by liyinqiao

Bug fixed.

Fix the bugs in FlushToMem functions.
parent c63a9754
...@@ -104,7 +104,7 @@ void CudaGPUToCPUFlush(XTensor * tensor, int devID, XMem * CPUMem) ...@@ -104,7 +104,7 @@ void CudaGPUToCPUFlush(XTensor * tensor, int devID, XMem * CPUMem)
/* compute the requried memory size */ /* compute the requried memory size */
int size = 0; int size = 0;
if (m->isSparse) if (tensor->isSparse)
size = sizeof(int) + (sizeof(int) + tensor->unitSize) * tensor->unitNumNonZero; size = sizeof(int) + (sizeof(int) + tensor->unitSize) * tensor->unitNumNonZero;
else else
size = tensor->unitSize * tensor->unitNum; size = tensor->unitSize * tensor->unitNum;
......
...@@ -31,7 +31,10 @@ namespace nts { // namespace nts(NiuTrans.Tensor) ...@@ -31,7 +31,10 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
/* flush a list of XTensor to GPU memory */ /* flush a list of XTensor to GPU memory */
void CudaCPUToGPUFlush(TensorList * mList, int devID, XMem * GPUMem); void CudaCPUToGPUFlush(TensorList * mList, int devID, XMem * GPUMem);
/* copy the data from GPU memory to CPU memory */ /* copy the data from GPU memory to CPU memory (memory pool) */
void CudaGPUToCPUFlush(XTensor * tensor, int devID, XMem * CPUMem);
/* copy the data from GPU memory to CPU memory ((dataHost)) and do not delete the data */
void CudaGPUToCPUFlush(XTensor * tensor); void CudaGPUToCPUFlush(XTensor * tensor);
#endif // USE_CUDA #endif // USE_CUDA
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论