Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

REQUIRES

OpenMP* Fortran Compiler Directive: Lists the features that an implementation must support so that the program compiles and runs correctly. This feature is only available for ifx.

Syntax

!$OMP REQUIRES [clause[[,] clause]... ]

clause

Is one or more of the following:

  • ATOMIC_DEFAULT_MEM_ORDER (SEQ_CST | ACQ_REL | RELAXED)

    Specifies the default memory ordering behavior that an implementation must support for ATOMIC constructs.

    If more than one REQUIRES directive contains an ATOMIC_DEFAULT_MEM_ORDER clause, each REQUIRES directive in the same compilation unit that specifies ATOMIC_DEFAULT_MEM_ORDER must specify the same parameter for that clause.

    When this clause is specified, it must appear lexically prior to any ATOMIC construct that does not contain a memory order clause.

    For information about settings SEQ_CST, ACQ_REL, and RELAXED, see the ATOMIC construct.

  • DYNAMIC_ALLOCATORS

    Tells the compiler that the USES_ALLOCATORS clause is optional in TARGET constructs that use allocators in the corresponding TARGET regions.

    If DYNAMIC_ALLOCATORS are supported:

    • Calls to OMP_INIT_ALLOCATOR and OMP_DESTROY_ALLOCATOR are permitted in TARGET regions.

    • Default allocators can be used by ALLOCATE directives and clauses, and in the OMP_ALLOC routines in TARGET regions.

  • UNIFIED_ADDRESS

    Tells the compiler that all devices available through OpenMP* directives and API procedures must have a unified address space.

    A pointer to this address space will refer to the same memory location when referenced from all available devices. OpenMP* mechanisms returning device pointers, return device addresses supporting pointer arithmetic.

    When this clause is specified, the IS_DEVICE_POINTER clause is not needed to obtain device addresses from device pointers for use in TARGET regions.

    Host device pointers can be passed as device pointer arguments to device memory procedures, and device pointers can be passed as host pointer arguments to device procedures. A non-host device may have discreet memory. In this case, referencing a host pointer on such a device or referencing a device pointer on the host will result in unspecified behavior.

    Memory local to a specific execution context may be exempt from the UNIFIED_ADDRESS requirements. It may adhere to the requirements of locality to a given thread, contention group, or execution context.

  • UNIFIED_SHARED_MEMORY

    This clause implies the UNIFIED_ADDRESS clause. It also causes memory addresses to be accessible to threads on all available devices, with the exception of memory that is local to a specific execution context as described in UNIFIED_ADDRESS.

    All device addresses referring to memory allocated through OpenMP* device memory routines are valid host pointers that may be dereferenced.

    If UNIFIED_SHARED_MEMORY is supported:

    • The MAP clause in TARGET constructs is optional.

    • The DECLARE TARGET directive is optional for static variables accessed in procedures to which a DECLARE TARGET directive is applied.

    By default, scalar variables are FIRSTPRIVATE inside TARGET constructs.

    A value stored to memory by one device may not be visible to another device until the two devices have synchronized, or both devices synchronize with the host.

Only one occurrence of each clause is permitted in the REQUIRES directive. At least one clause is required.

The REQUIRES directive identifies the requirements needed for execution of the code in the compilation unit in which the directive appears.

The REQUIRES directive must appear in the specification part of the program unit, lexically following all USE, IMPORT, and IMPLICIT statements.

The clauses specified in the REQUIRES directive are added to the requires trait in the OpenMP* context for all points in the compilation unit.