Constant memory updates at runtime
Constant memory of the GPU is not really constant memory, in that there is no dedicated special area of memory set aside for constant memory. The 64 K limit is exactly a 16-bit offset, allowing very quick 16-bit addressing. This presents some opportunities and some problems. First, constant memory can be updated in chunks or tiles of up to 64 K at a time. This is done with the cudaMemcpyToSymbol API call. Revising our constant program somewhat, let’s look at how this works.
#include "stdio.h"
#include "conio.h"
#include "assert.h"
typedef unsigned short int u16;
typedef unsigned int u32;
#define CUDA_CALL(x) {const cudaError_t a = (x); if (a != cudaSuccess) { printf("\nCUDA Error: %s (err_num=%d) \n", ...
Get CUDA Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.