50 likes | 185 Vues
Constant memory is a specialized memory type in NVIDIA hardware, providing 64 KB of read-only storage accessible by the processor. It is stored in DRAM but can be cached, making it ideal for frequently read data. You can define global variables using `__constant__` and copy data into constant memory from the main memory using `cudaMemcpyToSymbol()`. This guide illustrates how to use constant memory effectively in your kernels with practical examples in CUDA.
E N D
Constant Memory • NVIDIA hardware provides 64 Kb of constant memory • Read-only by processor • Stored in DRAM but can be cached • Can be useful if something is read repeatedly by the processor
Constant Memory • Define “global” variable with __constant__: __constant__ c_array[N]; • Copy data into the constant memory from main cudaMemcpyToSymbol(c_array, source, size); • Use variable in your kernel
Class Example • Example in class with GA