XL Fortran for AIX 8.1

Language Reference


Noncomment and Comment Form Directives

All XL Fortran directives belong to one of two groups: noncomment form directives and comment form directives.

Noncomment Form Directives

Format



>>-directive---------------------------------------------------><
 
 

directive
is one of the following directives:
@PROCESS - See @PROCESS
#line - See #line
EJECT - See EJECT
INCLUDE - See INCLUDE

Rules

The compiler always recognizes noncomment form directives. They cannot be continued.

Additional statements cannot be included on the same line as a directive.

Source format rules concerning white space apply to directive lines.

Comment Form Directives

Format



>>-trigger_head--trigger_constant--directive-------------------><
 
 

trigger_head
is one of !, *, C, or c for fixed source form and ! for free source form.

trigger_constant
is IBM* by default. If you specify the -qsmp compiler option, IBM*, IBMT, SMP$, $OMP, and IBMP are recognized by default. You can define other trigger_constants with the -qdirective compiler option. See the User's Guide for more details.

directive
is one of the following directives:
ASSERT - See ASSERT
ATOMIC - See ATOMIC
BARRIER - See BARRIER
CACHE_ZERO - See CACHE_ZERO
CNCALL - See CNCALL
COLLAPSE - COLLAPSE
CRITICAL - See CRITICAL / END CRITICAL
DO (work-sharing) - See DO / END DO
DO SERIAL - See DO SERIAL
END CRITICAL - See CRITICAL / END CRITICAL
END DO - See DO / END DO
END MASTER - See MASTER / END MASTER
END ORDERED - See ORDERED / END ORDERED
END PARALLEL - See PARALLEL / END PARALLEL
END PARALLEL DO - See PARALLEL DO / END PARALLEL DO
END PARALLEL SECTIONS - See PARALLEL SECTIONS / END PARALLEL SECTIONS
END PARALLEL WORKSHARE - See PARALLEL WORKSHARE / END PARALLEL WORKSHARE
END SECTIONS - See SECTIONS / END SECTIONS
END SINGLE - See SINGLE / END SINGLE
FLUSH - See FLUSH
INDEPENDENT - See INDEPENDENT
ISYNC - See ISYNC
LIGHT_SYNC - See LIGHT_SYNC
MASTER - See MASTER / END MASTER
ORDERED - See ORDERED / END ORDERED
PARALLEL - See PARALLEL / END PARALLEL
PARALLEL DO - See PARALLEL DO / END PARALLEL DO
PARALLEL SECTIONS - See PARALLEL SECTIONS / END PARALLEL SECTIONS
PERMUTATION - See PERMUTATION
PREFETCH_BY_LOAD, PREFETCH_BY_STREAM, PREFETCH_FOR_LOAD, PREFETCH_FOR_STORE- See PREFETCH
SCHEDULE - See SCHEDULE
SECTION - See SECTIONS / END SECTIONS and PARALLEL SECTIONS / END PARALLEL SECTIONS
SECTIONS- See SECTIONS / END SECTIONS
SINGLE -- See SINGLE / END SINGLE
SOURCEFORM - See SOURCEFORM
SUBSCRIPTORDER - See SUBSCRIPTORDER
THREADLOCAL - See THREADLOCAL
THREADPRIVATE - See THREADPRIVATE
UNROLL - See UNROLL
WORKSHARE - See WORKSHARE

Definitions:

lexical extent
The lexical extent of a directive construct includes all the code that appears directly within the directive construct.

dynamic extent
The dynamic extent of a directive includes the lexical extent of the directive and all subprograms that are called from within the lexical extent.

parallel region
A parallel region is a region of code that is to be executed concurrently by multiple threads. You define a parallel region by enclosing it within a PARALLEL / END PARALLEL construct, a PARALLEL DO / END PARALLEL DO construct, a PARALLEL SECTIONS / END PARALLEL SECTIONS, or a PARALLEL WORKSHARE / END PARALLEL WORKSHARE construct.

synchronization construct
A synchronization construct is a directive construct that controls the synchronization of threads within the construct. The following directive constructs are synchronization constructs:
  • ATOMIC
  • BARRIER
  • CRITICAL / END CRITICAL
  • FLUSH
  • MASTER / END MASTER
  • ORDERED / END ORDERED

work-sharing construct
A work-sharing construct divides the execution of the code that is enclosed within the construct among the members of the team that encounter it. Work-sharing constructs must be enclosed within the dynamic extent of a parallel region. The DO / END DO construct, the SECTIONS / END SECTIONS construct, the SINGLE / END SINGLE and the WORKSHARE / END WORKSHARE construct are all work-sharing constructs. The PARALLEL DO / END PARALLEL DO,PARALLEL SECTIONS / END PARALLEL SECTIONS and PARALLEL WORKSHARE / END PARALLEL WORKSHARE constructs are special cases of the work-sharing construct that also specify that the construct is a new parallel region. Since they define the enclosed region as a parallel region, they do not have to be enclosed within the dynamic extent of another parallel region.

Rules

The default value for the trigger_constant is IBM*.

The compiler will always recognize comment form directives that use IBM* as the trigger_constant.

By default, the option -qdirective=IBM*:IBMT will be on when compiling using the xlf_r, xlf_r7, xlf90_r, xlf90_r7, xlf95_r or xlf95_r7 invocation commands. By default, if you use the -qsmp compiler option in conjunction with one of these invocation commands, the option -qdirective=IBM*:SMP$:$OMP:IBMP:IBMT will be on. If you specify the -qsmp=omp option this will be as if you set the option -qdirective=$OMP on by default. You can specify an alternate or additional trigger_constant with the -qdirective compiler option. See the -qdirective compiler option in the User's Guide for more details.

The compiler treats all comment form directives, with the exception of the default trigger_constant as comments, unless you define the appropriate trigger_constant using the -qdirective compiler option. As a result, code containing these directives is portable to non-SMP environments.

XLF supports the OpenMP specification, as understood and interpreted by IBM. To ensure the greatest portability of code, we recommend that you use these directives whenever possible. You should use them with the OpenMP trigger_constant, $OMP; but you should not use this trigger_constant with any other directive.

XLF also includes the trigger_constants IBMP and IBMT. The compiler recognizes IBMP if you compile using the -qsmp compiler option. You should use IBMP with the SCHEDULE directive, and IBM extensions to OpenMP directives. The compiler recognizes IBMT if you compile using the -qthreaded compiler option. IBMT is the default for the xlf_r, xlf_r7, xlf90_r, xlf90_r7, xlf95_r or xlf95_r7 invocation commands; we recommend its use with the THREADLOCAL directive.

XLF directives include directives that are common to other vendors. If you use these directives in your code, you can enable whichever trigger_constant that vendor has selected. Specifying the trigger constant by using the -qdirective compiler option will enable the trigger_constant the vendor has selected. Refer to the -qdirective compiler option in the User's Guide for details on specifying alternative trigger_constants.

You can specify a directive as a free source form or fixed source form comment, depending on the current source form.

The trigger_head follows the rules of comment lines either in Fortran 90 free source form or fixed source form. If the trigger_head is !, it does not have to be in column 1. There must be no blanks between the trigger_head and the trigger_constant.

You can specify the directive_trigger (defined as the trigger_head combined with the trigger_constant, !IBM* for example) and any directive keywords in uppercase, lowercase, or mixed case.

You can specify inline comments on directive lines.

!SMP$ INDEPENDENT, NEW(i)    !This is a comment

A directive cannot follow another statement or another directive on the same line.

All comment form directives can be continued. You cannot embed a directive within a continued statement, nor can you embed a statement within a continued directive.

You must specify the directive_trigger on all continuation lines. However, the directive_trigger on a continuation line need not be identical to the directive_trigger that is used in the continued line. For example:

!SMP$ INDEPENDENT &
!IBM*&  , REDUCTION (X)                    &
!SMP$&  , NEW (I)

The above is equivalent to:

!SMP$ INDEPENDENT, REDUCTION (X), NEW (I)

provided both IBM* and SMP$ are active trigger_constants.

For more information, see Lines and Source Formats.

Fixed Source Form Rules

If the trigger_head is one of C, c, or *, it must be in column 1.

The maximum length of the trigger_constant in fixed source form is 4 for directives that are continued on one or more lines. This rule applies to the continued lines only, not to the initial line. Otherwise, the maximum length of the trigger_constant is 15. We recommend that initial line triggers have a maximum length of 4. The maximum allowable length of 15 is permitted for the purposes of backwards compatibility.

If the trigger_constant has a length of 4 or less, the first line of a comment directive must have either white space or a zero in column 6. Otherwise, the character in column 6 is part of the trigger_constant.

The directive_trigger of a continuation line of a comment directive must appear in columns 1-5. Column 6 of a continuation line must have a character that is neither white space nor a zero.

For more information, see Fixed Source Form.

Free Source Form Rules

The maximum length of the trigger_constant is 15.

An ampersand (&) at the end of a line indicates that the directive will continue. When you continue a directive line, a directive_trigger must appear at the beginning of all continuation lines. If you are beginning a continuation line with an ampersand, the directive_trigger must precede the ampersand. For example:

!IBM* INDEPENDENT &
!SMP$&  , REDUCTION (X)           &
!IBM*&  , NEW (I)

For more information, see Free Source Form.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]