Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are CUDA arrays stored in GPU memory? Are they physically linear or not?

Tags:

c++

cuda

gpu

nvidia

According to the CUDA TOOLKIT DOCUMENTATION:

https://docs.nvidia.com/cuda/cuda-c-programming-guide/

Device memory can be allocated either as linear memory or as CUDA arrays.

Does this mean that the CUDA arrays are not stored linearly in GPU memory?

In my experiment, I successfully dumped my data from GPU memory based on the cudamemcpy function. If my data is allocated by cudaMallocArray, does it mean that the data are not physically linear in GPU memory and need to be extracted by other API?

like image 620
Phil Janana Avatar asked Oct 28 '22 06:10

Phil Janana


1 Answers

CUDA arrays are indeed stored in GPU device memory ("global" memory), and the bytes are not physically linear in memory. They are an opaque layout optimized for multichannel, multidimensional texture access and texture filtering. The format is undocumented, since it may change between GPU architectures.

like image 169
harrism Avatar answered Nov 15 '22 08:11

harrism