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

unformatted read/writes

Justin_v_
Beginner
656 Views

My application has recently stopped being able to read unformatted files that are greater than 2.1GB in size.  Specifically, the read command of the following subroutine fails (iostat=-1) if jj = 2900 (file size 2.15GB), but works (iostat=0) if jj=2800 (file size 2.08GB).

ii = 95000
jj = 4000
allocate ( store_huge(ii, jj), STAT = istat )
store_huge = 0.0

open( newunit = file_id, file = outputfilename, form = 'unformatted', action='write', iostat = istat )
write(file_id, IOSTAT=istat) store_huge
close(file_id)

store_huge = 1.0
open(newunit=file_id, FILE=outputfilename, form = 'unformatted', action='read', iostat = istat)
read(file_id, IOSTAT=istat) store_huge
close(file_id)

deallocate( store_huge )

This problem only appeared recently, and may be due to a recent Windows update (which we can no longer control, and which have been driving me crazy).  I have Windows 10 (including the most recent automated updates), am using VS2017 (which may be the problem, though I have been using this for a couple of months without issue), and Visual Fortran Compiler 17.0.4.210.

0 Kudos
22 Replies
Justin_v_
Beginner
35 Views

andrew_4619 wrote:

And now I am confused as the examples in this thread use real(8) and not the defunct real*8. I don't get Surely removing IOSTAT=  that means I program crashes on error rather than you being able to handle the error.

 

Running a program from the command window sometimes generates useful run-time detail on a crash - but in this case, the IOSTAT already seemed to be pretty clear.

I will try to be more careful in the future, when copying code snippets to the forum.

andrew_4619
Honored Contributor II
35 Views
Ok, not confused now.....
Reply