- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a test code that writes then subsequently reads a large file (in this case 512MB) in several different records. What I see from strace is that the write are broken into 512KB chunks, while the reads are read in as the size of the record.
Why is this? I tested with both 9.1.036 and 10.1.012.
Thanks,
Craig
program testfortranio
implicit none
integer maxsize,reccnt
parameter(maxsize=32*1024*1024,reccnt=4)
integer i
integer ar(maxsize),ar2(maxsize)
integer lun
lun=11
do i=1,maxsize
ar(i)=i
enddo
open(lun,file="/tg2/jetmgmt/ctierney/myfile.fort",form="unformatted", status="unknown")
do i=1,reccnt
write(lun) ar
enddo
close (lun)
open(lun,file="/tg2/jetmgmt/ctierney/myfile.fort", form="unformatted", status="old")
do i=1,reccnt
read(lun) ar2
enddo
close(lun)
do i=1,maxsize
if (ar(i) .ne. ar2(i)) then
write(*,*) 'The two arrays dont match at ', i
endif
enddo
stop
end
Why is this? I tested with both 9.1.036 and 10.1.012.
Thanks,
Craig
program testfortranio
implicit none
integer maxsize,reccnt
parameter(maxsize=32*1024*1024,reccnt=4)
integer i
integer ar(maxsize),ar2(maxsize)
integer lun
lun=11
do i=1,maxsize
ar(i)=i
enddo
open(lun,file="/tg2/jetmgmt/ctierney/myfile.fort",form="unformatted", status="unknown")
do i=1,reccnt
write(lun) ar
enddo
close (lun)
open(lun,file="/tg2/jetmgmt/ctierney/myfile.fort", form="unformatted", status="old")
do i=1,reccnt
read(lun) ar2
enddo
close(lun)
do i=1,maxsize
if (ar(i) .ne. ar2(i)) then
write(*,*) 'The two arrays dont match at ', i
endif
enddo
stop
end
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Documentation for the current compilers specifies that you must specify BLOCKSIZE in OPEN if you want other than the filesystem default. BLOCKSIZE was not fully supported in 9.1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried blocksize, but I only tried it under 9.1 and saw no difference, so I didn't bother trying it with 10.1.
So why is there even such a setting? Since the data are already allocated, and the
call to the glibc write command takes a pointer, why bother breaking the data up?
Craig
So why is there even such a setting? Since the data are already allocated, and the
call to the glibc write command takes a pointer, why bother breaking the data up?
Craig
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page