The syntax of the allocate directive is as follows:
#pragma omp allocate(list) [clause] new-line
where clause is one of the following:
allocator(allocator)
where allocator is an expression of omp_allocator_handle_t type.
Summary The allocate directive specifies how a set of variables are allocated. The allocate directive is a declarative directive if it is not associated with an allocation statement.
Syntax
The syntax of the allocate directive is as follows:
!$omp allocate(list) [clause]
!$omp allocate[(list)] clause
[!$omp allocate(list) clause
[...]]
allocate statement
where clause is one of the following:
allocator(allocator)
where allocator is an integer expression of omp_allocator_handle_kindkind.
Description If the directive is not associated with a statement, the storage for each list item that appears in the directive will be provided by an allocation through a memory allocator. If no clause is specified then the memory allocator specified by the def-allocator-var ICV will be used. If the allocator clause is specified, the memory allocator specified in the clause will be used. The allocation of each list item will be byte aligned to at least the alignment required by the base language for the type of that list item.
The scope of this allocation is that of the list item in the base language. At the end of the scope for a given list item the memory allocator used to allocate that list item deallocates the storage.
If the directive is associated with an allocate statement, the same list items appearing in the directive list and the allocate statement list are allocated with the memory allocator of the directive. If no list items are specified then all variables listed in the allocate statement are allocated with the memory allocator of the directive.
For allocations that arise from this directive the null_fb value of the fallback allocator trait will behave as if the abort_fb had been specified.
∙ If a list item has a static storage type, the allocator expression in the allocator clause must be a constant expression that evaluates to one of the predefined memory allocator values. ∙ After a list item has been allocated, the scope that contains the allocate directive must not end abnormally other than through C++ exceptions, such as through a call to the longjmp function.
∙ List items specified in the allocate directive must not have the ALLOCATABLE attribute unless the directive is associated with an allocate statement. ∙ List items specified in an allocate directive that is associated with an allocate statement must be variables that are allocated by the allocate statement. ∙ Multiple directives can only be associated with an allocate statement if list items are specified on each allocate directive. ∙ If a list item has the SAVE attribute, is a common block name, or is declared in the scope of a module, then only predefined memory allocator parameters can be used in the allocator clause. ∙ A type parameter inquiry cannot appear in an allocate directive.