writing to a file from a CUDA kernel?


I am CUDA-ing FORTRAN code, and there is a critical section that writes information to a file. Is there a way to do that from the GPU? It would seem like trying that would cause way too much overhead trying to copy memory back and forth and defeat the purpose of CUDA, but maybe i’m wrong.

Yes, as far as I know you’ll have to implement that through the CPU. Besides does’nt make sense to do that from the GPU directly anyway, latencies of writing to disk (through CPU) will far exceed cost of transfers from the GPU, is my guess.

You can always try overlap the transfers with the next computation by using streams or asynchronous calls. Also, using memory-mapped files on the host may be able to cut out the latency due to disk writes. But yes, the write calls will have to come from the cpu