Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

ALLOCATE Clause

Parallel Directive Clause: Specifies the memory allocator to be used for one or more private variables or common blocks of a construct.

Syntax

ALLOCATE ([allocator :] list)

-or-

ALLOCATE (allocator-modifier [, allocator-modifier] : list)

allocator

Is an integer expression with a kind type of omp_allocator_handle_kind.

list

Is a comma-separated list of variables or named common blocks that have been specified in a data sharing clause on the same directive that makes the variable or common block private for the construct. A common block name must be enclosed in slashes (/ /). A list item cannot be repeated in the list.

allocate-modifier

Is one of the following:

  • ALLOCATOR (allocator)

    allocator is an integer expression with a kind type of omp_allocator_handle_kind.

    At most one ALLOCATOR allocate-modifier is permitted in the ALLOCATE clause.

  • ALIGN (alignment)

    alignment is a positive integer scalar expression with a value that is a positive power of two.

    Each list item is allocated with a byte alignment of at least the maximum of the following:

    1. The required alignment specified by Fortran

    2. The alignment trait of the specified allocator

    3. The alignment value specified by the ALIGN allocate-modifier

    If alignment is not specified, each list item is allocated with a byte alignment of at least the maximum of the following:

    1. The required alignment specified by Fortran

    2. The alignment trait of the specified allocator

    At most one ALIGN allocate-modifier is permitted in the ALLOCATE clause.

If allocator is not specified, the list items in the clause will be allocated using the allocator specified by the def-allocator-var internal control variable (ICV).

Each list item must appear in a data sharing clause that creates a private copy of the list item in the directive containing the ALLOCATE clause. The storage for the private copies of an object specified in the list are allocated using the specified memory allocator.

An ALLOCATE clause in a TARGET directive or a directive within a TARGET region must specify an allocator expression unless a REQUIRES directive with the DYNAMIC_ALLOCATORS clause appears in the same compilation unit.

The result of allocating private variables with a memory allocator whose access trait is set to THREAD by a TASK, TASKLOOP, or TARGET directive is undefined.