4.1 OMP_ALLOCATOR – Set the default allocator

ICV: def-allocator-var
Scope: data environment
Description:

Sets the default allocator that is used when no allocator has been specified in the allocate or allocator clause or if an OpenMP memory routine is invoked with the omp_null_allocator allocator. If unset, omp_default_mem_alloc is used.

The value can either be a predefined allocator or a predefined memory space or a predefined memory space followed by a colon and a comma-separated list of memory trait and value pairs, separated by =.

Note: The corresponding device environment variables are currently not supported. Therefore, the non-host def-allocator-var ICVs are always initialized to omp_default_mem_alloc. However, on all devices, the omp_set_default_allocator API routine can be used to change value.

Predefined allocatorsAssociated predefined memory spaces
omp_default_mem_allocomp_default_mem_space
omp_large_cap_mem_allocomp_large_cap_mem_space
omp_const_mem_allocomp_const_mem_space
omp_high_bw_mem_allocomp_high_bw_mem_space
omp_low_lat_mem_allocomp_low_lat_mem_space
omp_cgroup_mem_allocomp_low_lat_mem_space (implementation defined)
omp_pteam_mem_allocomp_low_lat_mem_space (implementation defined)
omp_thread_mem_allocomp_low_lat_mem_space (implementation defined)
ompx_gnu_pinned_mem_allocomp_default_mem_space (GNU extension)

The predefined allocators use the default values for the traits, as listed below. Except that the last three allocators have the access trait set to cgroup, pteam, and thread, respectively.

TraitAllowed valuesDefault value
sync_hintcontended, uncontended, serialized, privatecontended
alignmentPositive integer being a power of two1 byte
accessall, cgroup, pteam, threadall
pool_sizePositive integerSee Memory allocation
fallbackdefault_mem_fb, null_fb, abort_fb, allocator_fbSee below
fb_dataunsupported as it needs an allocator handle(none)
pinnedtrue, falseSee below
partitionenvironment, nearest, blocked, interleavedenvironment

For the fallback trait, the default value is null_fb for the omp_default_mem_alloc allocator and any allocator that is associated with device memory; for all other allocators, it is default_mem_fb by default.

For the pinned trait, the default value is true for predefined allocator ompx_gnu_pinned_mem_alloc (a GNU extension), and false for all others.

Examples:

OMP_ALLOCATOR=omp_high_bw_mem_alloc
OMP_ALLOCATOR=omp_large_cap_mem_space
OMP_ALLOCATOR=omp_low_lat_mem_space:pinned=true,partition=nearest
See also:

Memory allocation, omp_get_default_allocator – Get the default allocator, omp_set_default_allocator – Set the default allocator, Offload-Target Specifics

Reference:

OpenMP specification v5.0, Section 6.21