Following is my code which tries to achieve non-blocking cuda memory copy host to device.
for (i = 0; i < ldu; ++i)
{
cudaMemcpyAsync(dA+i*num_row, &A+i*LDA,
num_row*sizeof(double), cudaMemcpyHostToDevice,streams[0]) ;
}
Average time for each such call is around 10 microseconds. I have tried blocking version which takes 30 microseconds. 10 microseconds, for a non-blocking call seems a lot. A is allocated using cudaHostalloc. I run my code on machine equipped with 1 single Tesla C2050 , and I use cuda version 5.5 to compile the code. I have read that gpu PCI-transfer latency ( a bit irrelevant to non-blocking call, but to give an idea about the order of time) is around 5us. So it return time for a non-blocking call to be 10 us is a bit on higher side. Any thing I can do to speed it up?
Couple of things that I tried were, putting an openmp pragma (which resulted in slow down), sending data using different streams ( which gave around the same average time)
lduis in this range. Here is my test. Below 1000 queued copies, the average overhead is less than 3us. Above 10000 copies, the average overhead is over 20us. However I believe you can replace your copy loop with a single call tocudaMemcpy2DAsync. - Robert Crovella