HOME
| OPENMP API Specification: Version 5.0 November 2018

2.11.3  allocate Directive

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

SVG-Viewer needed.

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.

SVG-Viewer needed.

SVG-Viewer needed.

The syntax of the allocate directive is as follows:  

 
!$omp allocate(list) [clause]  

or  

 
!$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.

SVG-Viewer needed.

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.

SVG-Viewer needed.

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.

SVG-Viewer needed.

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.

Restrictions

Cross References