24.05.2014 Views

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

-qswapomp Option<br />

Syntax<br />

-qswapomp | -qnoswapomp<br />

SWAPOMP | NOSWAPOMP<br />

Specifies that the compiler should recognize and substitute OpenMP routines in <strong>XL</strong><br />

<strong>Fortran</strong> programs.<br />

The OpenMP routines <strong>for</strong> <strong>Fortran</strong> and C have different interfaces. To support<br />

multi-language applications that use OpenMP routines, the compiler needs to<br />

recognize OpenMP routine names and substitute them with the <strong>XL</strong> <strong>Fortran</strong><br />

versions of these routines, regardless of the existence of other implementations of<br />

such routines.<br />

The compiler does not per<strong>for</strong>m substitution of OpenMP routines when you specify<br />

the -qnoswapomp option.<br />

Restrictions<br />

The -qswapomp and -qnoswapomp options only affect <strong>Fortran</strong> sub-programs that<br />

reference OpenMP routines that exist in the program.<br />

Rules<br />

v If a call to an OpenMP routine resolves to a dummy procedure, module<br />

procedure, an internal procedure, a direct invocation of a procedure itself, or a<br />

statement function, the compiler will not per<strong>for</strong>m the substitution.<br />

v<br />

v<br />

v<br />

When you specify an OpenMP routine, the compiler substitutes the call to a<br />

different special routine depending upon the setting of the -qintsize option. In<br />

this manner, OpenMP routines are treated as generic intrinsic procedures.<br />

Unlike generic intrinsic procedures, if you specify an OpenMP routine in an<br />

EXTERNAL statement, the compiler will not treat the name as a user-defined<br />

external procedure. Instead, the compiler will still substitute the call to a special<br />

routine depending upon the setting of the -qintsize option.<br />

An OpenMP routine cannot be extended or redefined, unlike generic intrinsic<br />

procedures.<br />

Examples<br />

In the following example, the OpenMP routines are declared in an INTERFACE<br />

statement.<br />

@PROCESS SWAPOMP<br />

INTERFACE<br />

FUNCTION OMP_GET_THREAD_NUM()<br />

INTEGER OMP_GET_THREAD_NUM<br />

END FUNCTION OMP_GET_THREAD_NUM<br />

FUNCTION OMP_GET_NUM_THREADS()<br />

INTEGER OMP_GET_NUM_THREADS<br />

END FUNCTION OMP_GET_NUM_THREADS<br />

END INTERFACE<br />

IAM = OMP_GET_THREAD_NUM()<br />

NP = OMP_GET_NUM_THREADS()<br />

PRINT *, IAM, NP<br />

END<br />

<strong>XL</strong> <strong>Fortran</strong> Compiler-Option Reference 247

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!