Main Content

Memory mode

Memory allocation modes for CPU and GPU global memories

Since R2020b

Model Configuration Pane: Code Generation / GPU Code

Description

The Memory mode parameter specifies the memory allocation (malloc) mode to use in the generated CUDA® code.

Dependencies

  • This parameter requires a GPU Coder™ license.

  • To enable this parameter, select Generate GPU code on the Code Generation pane.

Settings

discrete (default) | unified
discrete

The generated code uses the cudaMalloc API for transferring data between the CPU and the GPU. From the programmers point-of-view, the discrete mode has a traditional memory architecture with separate CPU and GPU global memory address space.

unified

The generated code uses the cudaMallocManaged API that uses a shared (unified) CPU and GPU global memory address space. This option is applicable for NVIDIA® embedded targets only. For more information, see Deprecating support for unified memory allocation mode on host (GPU Coder).

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: GPUMallocMode
Type: character vector
Value: 'discrete' | 'unified'
Default: 'discrete'

Version History

Introduced in R2020b

expand all