Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Asynchronous I/O

Harald
Beginner
283 Views

The following code is rejected with a strange error message by several Intel compiler revisions:

program test_aio
  implicit none
  integer, parameter :: nx=1, ny=64, nz=32
  real, asynchronous :: rbuf(nx,ny,nz)
  call random_number (rbuf)
  call async_write   (rbuf)
contains
  subroutine async_write (buf)
    real, intent(in), contiguous :: buf(:,:,:)
    integer :: i, id, iu, irecl
    iu = 11
    inquire (iolength = irecl) buf(:,:,1)
    open (iu, access='direct', recl=irecl, asynchronous="YES")
    do i = 1, size (buf,3)
       write (iu, rec=i, asynchronous="YES", id=id) buf(:,:,i)
       wait  (iu, id=id)
    end do
    wait  (iu)
    close (iu)
  end subroutine async_write
end program test_aio

The error message looks like

ifort_aio.f90(15): warning #8057: Asynchronous input/output is not implemented in internal routines therefore this statement will be executed synchronously.
       write (iu, rec=i, asynchronous="YES", id=id) buf(:,:,i)
-------^
ifort_aio.f90(15): error #7609: If an ID= specifier is present then an ASYNCHRONOUS= specifier with the value YES shall be present.   [ID]
       write (iu, rec=i, asynchronous="YES", id=id) buf(:,:,i)
------------------------------------------------^
compilation aborted for ifort_aio.f90 (code 1)

I do not care much about the warning, but I believe the error message to be wrong.

Removing the ID keyword solves the issue, but this is plain Fortran 2003!

 

0 Kudos
1 Reply
Steve_Lionel
Honored Contributor III
283 Views

I agree, Please report it to the Intel Online Service Center. I wasn't aware that doing asynch I/O in an internal procedure wasn't supported - this never came up while I was doing compiler support. I suppose the concern is that the I/O list can go out of scope before the I/O completes, but that could happen with an external procedure as well so I don't see the point of this restriction. I suggest you add a complaint about this to your bug report.

0 Kudos
Reply