The memory sharing between cpu and gpu in Jetson TX2

I am using Jetson TX2 and Xavier. In these two platforms GPU and CPU share same memory.
If I malloc a piece of memory by CPU, Can This piece of memory be accessed by GPU without memory copy from CPU to GPU? Or, I have to do memory copy from CPU to GPU even they are using same memory?

Hi,

You can use pinned memory or unified memory.
More information can be found in our document:
[url]https://docs.nvidia.com/cuda/cuda-for-tegra-appnote/index.html#memory-selection[/url]

Thanks.

Hi @AastaLLL
I tried pinned memory and unified memory.I found pinned memory is even slower than normal memory which with host to device memcpy. Unified memory has no any improvement for the data transferring between host and device. Why unified memory has no effect on the performance even in Jetson tx2?

Hi,

1. Please remember to maximize your device performance:

sudo ./jetson_clocks.sh

2. You don’t need to transfer the data of unified memory.
It’s accessible for both processes.

Thanks.

@AastaLLL,Could you provide which has better performance for hight frequency memory access both in gpu and cpu in Xavier?The pinned memory or unified memory?

Hi,

It depends on the buffer size and the access pattern.
Please find the detail in our document:
[url]https://docs.nvidia.com/cuda/cuda-for-tegra-appnote/index.html#memory-selection[/url]

Thanks.