[comp.lang.fortran] Slow unformatted I/O

rjtg0209@uxa.cso.uiuc.edu (12/04/90)

My programs do a lot of unformatted I/O. I hoped that such an I/O in
FORTRAN is done close to the disk speed but this is not necessarily
true. On some workstations, the I/O speeds have been a magnitude
slower.  I wrote the following program to benchmark the unformatted
I/O:

       integer x(1000)
       open(1,file='scr',form='unformatted')
       do i=1,400
          write(1)x
       enddo
       rewind 1
       do i=1,400
          read(1)x
       enddo
       end

The problem is that the wall clock time for this program is much longer
than the CPU time on several computers that I tested. Foe example, the
CPU on SPARSTATION 1 shows the transfer rate of 2.5 Mbytes/s, while the
wall clock time on the unloaded machine shows only 300 kbytes/s.
Perhaps this is associated with the buffer size allocated for each open
file. The real speed of loaded Cray-2 which has a 256 kbyte buffer is
close to 15 Mbytes/s. The speed of my PC 386/33MhHZ with 640 Mbytes
ESDI disk, using the program above and the Microsoft 5.0 compiler is
200 kbytes/s. However, if one reserves a 32k buffer by the blocksize
option in the open statement, the speed increses four-fold, to 800
kbytes/s.  Does anybody have any experiences with these kinds of
problems? Which compilers have options to increase the buffer size or
do it automatically?

Please send your response to ignacy@uiucvmd.bitnet 

Ignacy Misztal 
University of Illinois