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

ID 767251
Date 7/13/2023
Public

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

Document Table of Contents

ASYNCHRONOUS

Statement and Attribute: Specifies that a variable can be used for asynchronous input and output.

The ASYNCHRONOUS attribute can be specified in a type declaration statement or an ASYNCHRONOUS statement, and takes one of the following forms:

Type Declaration Statement:

type, [att-ls,] ASYNCHRONOUS [, att-ls] :: var [, var] ...

Statement:

ASYNCHRONOUS [::] var [, var] ...

type

Is a data type specifier.

att-ls

Is an optional list of attribute specifiers.

var

Is the name of a variable.

Description

Asynchronous I/O, or non-blocking I/O, allows a program to continue processing data while the I/O operation is performed in the background.

A variable can have the ASYNCHRONOUS attribute in a particular scoping unit without necessarily having it in other scoping units. If an object has the ASYNCHRONOUS attribute, then all of its subobjects also have the ASYNCHRONOUS attribute.

The ASYNCHRONOUS attribute can also be implied by use of a variable in an asynchronous READ or WRITE statement.

You can specify variables that are used for asynchronous communication, such as with Message Passing Interface Standard (MPI). Asynchronous communication has the following restrictions:

  • For input, a pending communication affector must not be referenced, become defined, become undefined, become associated with a dummy argument that has the VALUE attribute, or have its pointer association status changed.

  • For output, a pending communication affector must not be redefined, become undefined, or have its pointer association status changed.

Examples

The following example shows how the ASYNCHRONOUS attribute can be applied in an OPEN and READ statement.

program test
integer, asynchronous, dimension(100) :: array
open (unit=1,file='asynch.dat',asynchronous='YES',&
  form='unformatted')
write (1) (i,i=1,100)
rewind (1)
read (1,asynchronous='YES') array
wait(1)
write (*,*) array(1:10)
end