I want to optimize my CUDA program by overlapping data transfer with kernel execution. But the sample program asyncAPI.cu in CUDA SDK is too simple to help.
I did search this problem, and found some tutorials use two CUDA streams to achieve overlapping. In my case, a huge amount of data need to be computed, so I need to loop through and dispatch a portion of data to GPU each iteration. But I don't how to write such a loop, because all operations are asynchronous and I am afraid the transferring data will erase/cover those currently under computing.
Does any one has experienced this?
Any help will be grateful.