Intel® Fortran Compiler 16.0 User and Reference Guide

ATTRIBUTES CONCURRENCY_SAFE

The ATTRIBUTES directive option CONCURRENCY_SAFE specifies that there are no unacceptable side effects and no illegal (or improperly synchronized) memory access interferences among multiple invocations of a routine or between an invocation of the specified routine and other statements in the program if they were executed concurrently.

!DIR$ ATTRIBUTES CONCURRENCY_SAFE [: clause] :: routine-name-list

clause

Is one of the following:

  • profitable

  • cost (int-cycle-count)

int-cycle-count

Is an integer scalar constant expression.

routine-name-list

Is a comma-separated list of function and subroutine names.

When a CONCURRENCY_SAFE routine is called from parallelized code, you can ignore assumed cross-block or cross-iteration dependencies and side effects of calling the specified routine from parallelized code.

The profitable clause indicates that the loops or blocks that contain calls to the routine can be safely executed in parallel if the loop or blocks are legal to be parallelized; that is, if it is profitable to parallelize them.

The cost clause indicates the execution cycles of the routine where the compiler can perform parallelization profitability analysis while compiling its enclosing loops or blocks.

The attribute can appear in the declaration of the routine; for example:

function f(x)
!DIR$ attributes concurrency_safe :: f

The attribute can also appear in the code of the caller; for example:

main m
integer f
external f
!dir$ attributes concurrency_safe :: f   ! or it could be in an interface block describing f
...
Print *, f(x)

Note

For every routine named in routine-name-list, you should ensure that any possible side effects are acceptable or expected, and the memory access interferences are properly synchronized.

See Also