OMP_ALLOCATOR
– Set the default allocator ¶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 allocators | Associated predefined memory spaces |
---|---|
omp_default_mem_alloc | omp_default_mem_space |
omp_large_cap_mem_alloc | omp_large_cap_mem_space |
omp_const_mem_alloc | omp_const_mem_space |
omp_high_bw_mem_alloc | omp_high_bw_mem_space |
omp_low_lat_mem_alloc | omp_low_lat_mem_space |
omp_cgroup_mem_alloc | omp_low_lat_mem_space (implementation defined) |
omp_pteam_mem_alloc | omp_low_lat_mem_space (implementation defined) |
omp_thread_mem_alloc | omp_low_lat_mem_space (implementation defined) |
ompx_gnu_pinned_mem_alloc | omp_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.
Trait | Allowed values | Default value |
---|---|---|
sync_hint | contended , uncontended ,
serialized , private | contended |
alignment | Positive integer being a power of two | 1 byte |
access | all , cgroup ,
pteam , thread | all |
pool_size | Positive integer | See Memory allocation |
fallback | default_mem_fb , null_fb ,
abort_fb , allocator_fb | See below |
fb_data | unsupported as it needs an allocator handle | (none) |
pinned | true , false | See below |
partition | environment , nearest ,
blocked , interleaved | environment |
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
Memory allocation, omp_get_default_allocator
– Get the default allocator,
omp_set_default_allocator
– Set the default allocator, Offload-Target Specifics
OpenMP specification v5.0, Section 6.21