# Zero Copy Access CUDA Pipeline

**URL:** <https://forums.developer.nvidia.com/t/zero-copy-access-cuda-pipeline/50855>\
**Category:** Jetson TX2\
**Created:** [June 16, 2017, 8:44pm UTC](https://forums.developer.nvidia.com/t/zero-copy-access-cuda-pipeline/50855 "2017-06-16T20:44:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mk\_opc](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mk\_opc](https://forums.developer.nvidia.com/u/mk_opc)\
**Post date:** [June 16, 2017, 8:44pm UTC](https://forums.developer.nvidia.com/t/zero-copy-access-cuda-pipeline/50855/1 "2017-06-16T20:44:55Z")

</div>

Hello all,

I have some code which executes the same function on the host, and then on the device, and outputs each to a file (it’s just some array arithmetic, nothing exciting).

I was using the standard method of allocating memory on the device, and then copying the array contents from the host (see “Standard CUDA pipeline”: [http://arrayfire.com/zero-copy-on-tegra-k1/](http://arrayfire.com/zero-copy-on-tegra-k1/))

I was unhappy with the results, as it was not much faster than the CPU, so I implemented the “Zero Copy Access” method and got a tremendous improvement in speed (and verified that the 2 outputs, from CPU and GPU were the same).

HOWEVER: This DRASTICALLY slowed down the HOST (CPU) execution speed… by an order of magnitude!!!

Why is the CPU execution on the host arrays so slow when using this zero copy access method???

Thanks for the help

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [June 19, 2017, 3:18am UTC](https://forums.developer.nvidia.com/t/zero-copy-access-cuda-pipeline/50855/2 "2017-06-19T03:18:17Z")

</div>

Hi,

cudaHostAlloc doesn’t guarantee fast speed, check  
[url][Programming Guide :: CUDA Toolkit Documentation](http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#um-unified-memory-programming-hd%5B/url%5D)

Unified Memory offers a “single-pointer-to-data” model that is conceptually similar to CUDA’s zero-copy memory. One key difference between the two is that with zero-copy allocations the physical location of memory is pinned in CPU system memory such that a program may have fast or slow access to it depending on where it is being accessed from. Unified Memory, on the other hand, decouples memory and execution spaces so that all data accesses are fast.

---

<div class="post-metadata">

**Author:** ![mk\_opc](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mk\_opc](https://forums.developer.nvidia.com/u/mk_opc)\
**Post date:** [June 19, 2017, 6:42am UTC](https://forums.developer.nvidia.com/t/zero-copy-access-cuda-pipeline/50855/3 "2017-06-19T06:42:38Z")

</div>

> [@](#):
>
> Hi,
> 
> cudaHostAlloc doesn’t guarantee fast speed, check  
> [http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#um-unified-memory-programming-hd](http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#um-unified-memory-programming-hd)
> 
> Unified Memory offers a “single-pointer-to-data” model that is conceptually similar to CUDA’s zero-copy memory. One key difference between the two is that with zero-copy allocations the physical location of memory is pinned in CPU system memory such that a program may have fast or **slow** access to it depending on where it is being accessed from. Unified Memory, on the other hand, decouples memory and execution spaces so that all data accesses are fast.

extremely helpful, thank you!!

---

<div class="post-metadata">

**Author:** ![nadeemm](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nadeemm/32/367020_2.png) [@nadeemm](https://forums.developer.nvidia.com/u/nadeemm)\
**Post date:** [October 18, 2021, 6:26pm UTC](https://forums.developer.nvidia.com/t/zero-copy-access-cuda-pipeline/50855/4 "2021-10-18T18:26:23Z")

</div>

Closed on October 18, 2021, 6:26pm UTC


