-qswapomp

Category

Portability and migration

Purpose

Specifies that the compiler should recognize and substitute OpenMP routines in XL Fortran programs.

The OpenMP routines for Fortran and C have different interfaces. To support multi-language applications that use OpenMP routines, the compiler needs to recognize OpenMP routine names and substitute them with the XL Fortran versions of these routines, regardless of the existence of other implementations of such routines.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-swapomp---.   
>>- -q--+-noswapomp-+------------------------------------------><

@PROCESS:

@PROCESS SWAPOMP | NOSWAPOMP

Defaults

-qswapomp

Usage

The compiler does not perform substitution of OpenMP routines when you specify the -qnoswapomp option.

The -qswapomp and -qnoswapomp options only affect Fortran subprograms that reference OpenMP routines that exist in the program.

Rules

Examples

In the following example, the OpenMP routines are declared in an INTERFACE statement.

@PROCESS SWAPOMP

         INTERFACE
            FUNCTION OMP_GET_THREAD_NUM()
                INTEGER OMP_GET_THREAD_NUM
            END FUNCTION OMP_GET_THREAD_NUM

            FUNCTION OMP_GET_NUM_THREADS()
                INTEGER OMP_GET_NUM_THREADS
            END FUNCTION OMP_GET_NUM_THREADS
         END INTERFACE

         IAM = OMP_GET_THREAD_NUM()
         NP = OMP_GET_NUM_THREADS()
         PRINT *, IAM, NP
         END

Related information

See the OpenMP execution environment, lock and timing routines section.