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

DECLARE SIMD

OpenMP* Fortran Compiler Directive: Creates a version of a function that can process multiple arguments using Single Instruction Multiple Data (SIMD) instructions from a single invocation from a SIMD loop.

Syntax

!$OMP DECLARE SIMD(routine-name) [clause[[,] clause]... ]

routine-name

Is the name of a routine (a function or subroutine). It cannot be a generic name; it must be a specific name. It also cannot be a procedure pointer or an entry name.

clause

Is an optional vectorization clause. It can be one or more of the following:

  • ALIGNED (list [:n])

  • INBRANCH | NOTINBRANCH

    The INBRANCH clause specifies that the routine must always be called from inside a conditional statement of a SIMD loop.

    The NOTINBRANCH clause specifies that the routine must never be called from inside a conditional statement of a SIMD loop.

    If neither clause is specified, then the routine may or may not be called from inside a conditional statement of a SIMD loop.

    You can only specify INBRANCH or NOTINBRANCH; you cannot specify both.

  • LINEAR (linear-list[: linear-step])

  • PROCESSOR (cpuid) (an Intel® language extension)

  • SIMDLEN(n)

    Specifies the number of concurrent arguments (n) for the SIMD version of routine-name. The n must be a constant positive integer expression.

    If SIMDLEN is not specified, the number of concurrent arguments for the routine-name is implementation defined.

    Only one SIMDLEN clause can appear in a DECLARE SIMD directive.

  • UNIFORM(list)

    Tells the compiler that the values of the specified arguments have an invariant value for all concurrent invocations of the routine in the execution of a single SIMD loop.

    The list is one or more scalar variables that are dummy arguments in the specified routine.

    Multiple UNIFORM clauses are merged as a union.

The DECLARE SIMD construct enables the creation of SIMD versions of the specified subroutine or function. You can use multiple DECLARE SIMD constructs in a single procedure to produce more than one SIMD version of a procedure. These versions can be used to process multiple arguments from a single invocation from a SIMD loop concurrently.

DECLARE SIMD is a pure directive, so it can appear in a Fortran PURE procedure.

When routine-name is executed, it cannot have any side-effects that would change its execution for concurrent iterations of a SIMD chunk. When the routine is called from a SIMD loop, it cannot cause the execution of any OpenMP* Fortran construct.

If a DECLARE SIMD directive is specified for a routine name with explicit interface and for the definition of the routine, they must match. Otherwise, the result is unspecified.

You cannot use procedure pointers to access routines created by the DECLARE SIMD directive.

You can only specify a particular variable in at most one instance of a UNIFORM or LINEAR clause.