I asked a question Memory allocated using cudaMalloc() is accessable by host or not? though the things are much clear to me now, but I am still wondering why it is not possible to access the device pointer in host. My understanding is that the CUDA driver takes care of memory allocation inside GPU DRAM. So this information (that what is my first address of allocated memory in device), can be conveyed to the OS running on host. Then it can be possible to access this device pointer i.e the first address of the allocated device memory. What is wrong with my understanding ? Kindly help me to understand this. Thanks you
Asked
Active
Viewed 196 times
0
-
your GPU has it's own on chip memory, and your CPU has it's own on chip memory some work has to be done in between to transfer the data (which is not cheap) – aaronman Oct 05 '13 at 02:03
-
I am sorry I did not understand how this fact is relevant to my question. Could you please give more details? – user25108 Oct 05 '13 at 02:32
1 Answers
2
The GPU memory lives on the other side of the PCIE bus. The memory controller for the host memory in modern PC architectures is directly attached to the CPU.
Therefore the access methods are quite a bit different. When accessing memory that is on the GPU, the transaction must be framed as a sequence of PCIE cycles. The activity of setting up the PCIE bus to effect this transaction is not built into an ordinary memory fetch cycle in a modern CPU.
Therefore we require software interaction (handled by cudaMemcpy
) to complete the software sequence that will program cycles on the PCIE bus to either send or fetch data that is on the other side of the bus.

Robert Crovella
- 143,785
- 11
- 213
- 257
-
1I think you should make the point that a programming languages could make the transaction seamless but then people might ignore the underlying fact that transferring memory between chips is quite expensive – aaronman Oct 05 '13 at 03:26
-
Yes, my comment was based on the current state of affairs in CUDA. I am not addressing what could be, or what might be, or what is theoretically possible. If you like, you can precede all of my statements with "Today, ..." – Robert Crovella Oct 05 '13 at 03:31
-
What I'm saying is I don't think it would have been hard for them to make it seamless but they chose not to so people wouldn't unwittingly slow down their programs – aaronman Oct 05 '13 at 03:37
-
I don't know that to be true. I don't know that it wouldn't have been hard to make it seamless, and I don't know the reasons why they chose not to. It sounds like speculation to me. I'm trying to make statements that I believe are factual in this case, not speculative. Feel free to add your own answer. It's perfectly legal. – Robert Crovella Oct 05 '13 at 03:51