mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

a strange ndarray.asscalar time cost problem

Open hanpum opened this issue 9 years ago • 1 comments

hi, I'm using RNN to train language model on PTB(code here) with K20, the time cost of a batch is about 26s, after profiling, I found that metric.update take about 25s, about 96% of total.

with some print and compare, I found the key problem is: loss.asscalar(), which copy data from GPU to CPU memory, and the under engine function is NDArray::SyncCopyToCPU, and the most time consuming function is Wait_To_Read

so, is this a normal performance?

if this is normal, then another strange problem is time cost of save parameters to file, which is only 0.2s, obviously, save parameter need copy data to CPU also, then, what's the difference of those two scenes???

tks for any help

to reproduce this problem, just add a break here

hanpum avatar Jul 03 '17 08:07 hanpum

This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks!

szha avatar Oct 08 '17 21:10 szha