Hi Paul,
I see a completely different issue. For me the “i” loop doesn’t get executed unless I make the loop trip count smaller. I can still get generate a 32GB file by putting in an inner loop.
What’s OS are you running? Is it a 32-bit OS? I’ve tried a few different systems but all are 64-bit OS.
% cat big.f90
program big
integer, parameter :: myunit = 42
integer(8), parameter :: N = 2_8**32_8
integer(8) :: i,j
print *, "N=",N
open(unit=myunit, file="foo.big", access="stream")
do i = 1, (N+999)/1000
do j = 1, 1000
write(myunit), (i*1000)+j
end do
end do
close(myunit)
end program big
% pgfortran -V
pgfortran 15.10-0 32-bit target on x86-64 Linux -tp sandybridge
The Portland Group - PGI Compilers and Tools
Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
% pgfortran -Mlfs big.f90
% file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
% ./a.out
N= 4294967296
% du -hs foo.big
33G foo.big
FYI, here’s my test code. Can you give it a try?
program giga
implicit double precision (a-h,o-z)
dimension x(1000)
! print *,"Assume you linked -Mlfs, and "
print *,"We assume you have enough disk space"
! print *,"you have enough disk space"
print *,' Input number of gb to write'
read(*,*)ngig
print *,"will try to create",ngig,"gbyte file bigun"
loops=ngig*1000000/8
value=0.0
open(32,file='bigun',form='unformatted')
do k=1,loops
do i=1,1000
x(i)=value + i
end do
value=value+1000
write(32)(x(j),j=1,1000)
enddo
close(32)
print *,"Looking for file bigun"
i=system("ls -l bigun")
print *,"re-opening bigun for reading"
open(32,file='bigun',form='unformatted')
value=0.0
do k=1,loops
read(32)(x(j),j=1,1000)
do i=1,1000
if(x(i) .ne. i+value) print *,"error! i=",i+value
end do
value=value+1000
enddo
close(32)
! print *,"removing bigun"
! i=system("unlink bigun")
stop
end