omp_alloc
– Memory allocation with an allocator ¶Allocate memory with the specified allocator, which can either be a predefined
allocator, an allocator handle or omp_null_allocator
. If the allocators
is omp_null_allocator
, the allocator specified by the
def-allocator-var ICV is used. size must be a nonnegative number
denoting the number of bytes to be allocated; if size is zero,
omp_alloc
will return a null pointer. If successful, a pointer to the
allocated memory is returned, otherwise the fallback
trait of the
allocator determines the behavior. The content of the allocated memory is
unspecified.
In target
regions, either the dynamic_allocators
clause must
appear on a requires
directive in the same compilation unit – or the
allocator argument may only be a constant expression with the value of
one of the predefined allocators and may not be omp_null_allocator
.
Memory allocated by omp_alloc
must be freed using omp_free
.
Prototype: | void* omp_alloc(size_t size, |
omp_allocator_handle_t allocator) |
Prototype: | void* omp_alloc(size_t size, |
omp_allocator_handle_t allocator=omp_null_allocator) |
Interface: | type(c_ptr) function omp_alloc(size, allocator) bind(C) |
use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t | |
integer (c_size_t), value :: size | |
integer (omp_allocator_handle_kind), value :: allocator |
OMP_ALLOCATOR
– Set the default allocator, Memory allocation, omp_set_default_allocator
– Set the default allocator,
omp_free
– Freeing memory allocated with OpenMP routines, omp_init_allocator
– Create an allocator
OpenMP specification v5.0, Section 3.7.6