Pragma to allocate a variable as persistent memory on the GPU
coder.gpu.persistentMemory(
maps the
persistent MATLAB® variable pvar
)pvar
to the CUDA® enabled NVIDIA® GPU as variable with persistent memory. The variable must be fixed size and of
a data type supported for GPU code generation.
This is a code generation function. It has no effect in MATLAB.
Note
For CUDA MEX, the persistent memory on the GPU is retained during the entirety of
the MATLAB session. For freeing the GPU memory, use the clear mex
MATLAB command. For freeing the GPU memory in static libraries, dynamic
libraries, or executable targets, call the generated <primary function
name>_terminate()
housekeeping function.
MATLAB classes are not supported by the
coder.gpu.persistentMemory
pragma.
The coder.gpu.persistentMemory
pragma is not supported in
Simulink®.
If the persistent variable in MATLAB is variable-sized, the code generator does not map the variable to a persistent memory on the GPU.
codegen
| coder.gpu.constantMemory
| coder.gpu.kernel
| coder.gpu.kernelfun
| coder.gpu.nokernel
| gpucoder.stencilKernel