# cudaMemCpy() and Zero-Copy access

**URL:** <https://forums.developer.nvidia.com/t/cudamemcpy-and-zero-copy-access/9555>\
**Category:** CUDA Programming and Performance\
**Created:** [May 18, 2009, 3:14pm UTC](https://forums.developer.nvidia.com/t/cudamemcpy-and-zero-copy-access/9555 "2009-05-18T15:14:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingofthehill3](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kingofthehill3/32/9825_2.png) [@kingofthehill3](https://forums.developer.nvidia.com/u/kingofthehill3)\
**Post date:** [May 18, 2009, 3:14pm UTC](https://forums.developer.nvidia.com/t/cudamemcpy-and-zero-copy-access/9555/1 "2009-05-18T15:14:47Z")

</div>

Hi,

I want to copy data from linear CUDA memory to pinned memory with zero-copy access. Therefore I get a device pointer by calling cudaHostGetDevicePointer() followed by a cudaMemcpy() operation which reports the device pointer to be invalid.

Is such a copy operation forbidden? Am I supposed to call a kernel for the copy-operation?

Thx,  
Marcel

---

<div class="post-metadata">

**Author:** ![tmurray](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tmurray](https://forums.developer.nvidia.com/u/tmurray)\
**Post date:** [May 18, 2009, 4:15pm UTC](https://forums.developer.nvidia.com/t/cudamemcpy-and-zero-copy-access/9555/2 "2009-05-18T16:15:17Z")

</div>

you’re doing a cudaMemcpyDeviceToDevice? hmmm, never occurred to me! It should work in principle, but I bet it won’t right now. Might be fixed in the next version…

---

<div class="post-metadata">

**Author:** ![seibert](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/seibert/32/520688_2.png) [@seibert](https://forums.developer.nvidia.com/u/seibert)\
**Post date:** [May 18, 2009, 10:23pm UTC](https://forums.developer.nvidia.com/t/cudamemcpy-and-zero-copy-access/9555/3 "2009-05-18T22:23:45Z")

</div>

If cudaMemcpyDeviceToDevice doesn’t work, then I would expect that cudaMemcpyDeviceToHost using the original host pointer would be just as good.

---

<div class="post-metadata">

**Author:** ![tmurray](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tmurray](https://forums.developer.nvidia.com/u/tmurray)\
**Post date:** [May 18, 2009, 11:26pm UTC](https://forums.developer.nvidia.com/t/cudamemcpy-and-zero-copy-access/9555/4 "2009-05-18T23:26:12Z")

</div>

Unless you’re being tricky and writing a framework and passing pointers everywhere… yeah, needs to be looked at. It’s on my whiteboard of things to do.

---

<div class="post-metadata">

**Author:** ![kingofthehill3](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kingofthehill3/32/9825_2.png) [@kingofthehill3](https://forums.developer.nvidia.com/u/kingofthehill3)\
**Post date:** [May 19, 2009, 8:28am UTC](https://forums.developer.nvidia.com/t/cudamemcpy-and-zero-copy-access/9555/5 "2009-05-19T08:28:57Z")

</div>

cudaMemcpyDeviceToHost works for me, thx [External Image](http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/thumbup.gif "Image hosted on another site. Click to open in a new tab.")

I have another question concerning zero-copy access:

If I call a kernel and pass a const device pointer to mapped memory, does the framework recognize that no device-to-host synchronization after the kernel execution is needed (in the dedicated graphics board case)?
