Can we directly read/write a file from GPU?

Can we directly read/write a file from GPU instead of doing memcpy from CPU to GPU and GPU to CPU? What is the fastest way to read and write file to and from GPU?

1 Like

The answer to the first question is “No”.

The answer to the second question is probably “it doesn’t really matter because disk I/O is always going to be the bottleneck and the device-host transfers will have negligible impact on overall throughput”. What will be optimal will depend a lot on how much data you are writing. For a small amount of data, zero copy is probably the best approach. For a lot of data, using several pinned allocations and overlapping I/O, device-host-device transfers, and kernel execution is probably the way to hide most of the latency. But ultimately the disk I/O is still going to kill performance compared to anything the GPU does.

Thank you for your suggestion… I am facing a similar problem…GPU is working fast but CPU is limiting the speed and the final result is slow…So I was just curious about how to make processing faster…