Main Content

Memory allocation mode

Description

Specify the memory allocation (malloc) mode to use in the generated CUDA® code.

Category: Code Generation > GPU Code

Settings

Default: discrete

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.

Dependencies

  • This parameter requires a GPU Coder™ license.

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

Command-Line Information

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

Related Topics