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

maximal record length for integer-size 64

Marius_B_
Beginner
657 Views

Hello,

I have the following problem with ifort 15.0.2.164 Build 20150121. Even when using "-integer-size 64" I can not create record lager then integer(4) (2^32-1).  For the older release of ifort Version 13.1.0.146 Build 20130121 this works just fine. For example

program recltest

  implicit none
  
  integer :: reclsize
  
  reclsize=2**31-1
  write(6,*) reclsize
  open(unit=123,file="test.dat",access="direct",recl=reclsize,form="unformatted")
  close(123)
  
  reclsize=2**31
  write(6,*) reclsize
  open(unit=123,file="test.dat",access="direct",recl=reclsize,form="unformatted")
  close(123)

end program recltest

the second open statement works with ifort 13  ( using ifort -integer-size 64  -assume byterecl test.f90 ), while it does not work with ifort 15, giving me the following error message

forrtl: severe (118): The 'RECL=' value in an OPEN statement for unit 123, file test.dat, exceeds the maximum allowed for the file's record type.

Is this a bug or am I doing something wrong ?

Best,

Marius

0 Kudos
5 Replies
jimdempseyatthecove
Honored Contributor III
657 Views

Using integer(4), 2**31 = 0x80000000 = -2147483648, that -1 = +2147483647

The integer size for RECL= is integer(4), at least per the Reference Guide information.

Please use smaller record size and read/write in manageable chunks. This will conserve memory for an unnecessarily large record buffer.

Jim Dempsey

0 Kudos
Marius_B_
Beginner
657 Views

Hello Jim,

Thank you for the answer. I am aware that if I am using integer(4) it will not work but for integer(8) (compiling with -integer-size 64 ) I would have expected it to work as it did in the previous ifort version 13 and ifort 14. Actually the largest record size I can define with ifort 15 is 2**29, so not even full integer(4).  Is this now an intentional limitation introduced in ifort 15 ?

Best,

Marius

0 Kudos
Steven_L_Intel1
Employee
657 Views

It didn't work in the older version - only the low 32 bits of the value were silently used. We fixed that bug. The documented RECL limits are typically 2**31-1 (see the documentation of RECL= in OPEN for details.)

Note that you can read and write longer records using sequential unformatted I/O. But not direct access.

0 Kudos
Marius_B_
Beginner
657 Views

Hi Steve,

I see. Thank you very much, I found the corresponding information in the reference guide

 

Best,

marius

0 Kudos
mecej4
Honored Contributor III
657 Views

Marius B. wrote:
Actually the largest record size I can define with ifort 15 is 2**29, so not even full integer(4).  Is this now an intentional limitation introduced in ifort 15 ?

By default, IFort uses an I/O unit of 1 longword (4 bytes) for unformatted files, unless you specify /assume:byterecl. Since 229 longwords = 231 bytes, the value that you found is at the limit of signed 32-bit integers.

0 Kudos
Reply