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

ID 767251
Date 3/31/2023
Public

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

Document Table of Contents

NOTHING

OpenMP* Fortran Compiler Directive: Provides documentary clarity in conditionally compiled code or conditional OpenMP* code. It has no effect on the semantics or execution of the program. This feature is only available for ifx.

Syntax

!$OMP NOTHING

The NOTHING directive is a utility directive that provides documentary clarity in conditionally compiled code or conditional OpenMP code. The statement by itself does nothing and has no effect on program results or execution sequence.

The directive is PURE; so it can appear in a PURE procedure.

In a conditional context, the NOTHING directive can be used to verify that no OpenMP actions are taken in that conditional block of code.

Example

The following subroutine tests the loop trip count. If it is sufficiently large, a parallelized, vectorized loop is executed. If the loop trip count is small, no OpenMP transformation is performed, as noted by use of the OpenMP NOTHING directive. Otherwise, an OpenMP SIMD directive is applied to vectorize the loop.


  SUBROUTINE sub (a, b, c, d, n)
  INTEGER           :: i, n
  REAL,DIMENSION(n) :: a, b, c, d
  IF (n > 4096)
    !$OMP PARALLEL DO SIMD
      DO i = 1, n
        a(i) = a(i) + b(i) * c(i) – d(i)
      END DO
    !$OMP END PARALLEL DO SIMD
  ELSE IF (N < 4)
    !$OMP NOTHING     ! Run a scalar loop
      DO i = 1, n
        a(i) = a(i) + b(i) * c(i) – d(i)
      END DO
  ELSE
    !$OMP SIMD
      DO i = 1, n
        a(i) = a(i) + b(i) * c(i) – d(i)
      END DO
    !$OMP END SIMD  
  END SUBROUTINE sub