Article View: comp.lang.fortran
Article #4450Re: Fast I/O
From: Michele Morin 5115 A408
Date: Thu, 21 Jan 1993 12:54
Date: Thu, 21 Jan 1993 12:54
30 lines
1677 bytes
1677 bytes
In article <1jhqkhINNno3@bigboote.WPI.EDU>, you write:
|> I have to write a Fortran program which writes and reads tremendous amount
|> of data to to and from hard-disc.I wrote it in C using binary files and
|> low level I/O.It worked quite well.I tried to use unformatted files in
|> Fortran but they're at least 4 times slower.I used following open, write
|> and read statements
|> open(8,File='Filename',FORM='unformatted')
|> write(8)(A(J),J=1,N)
|> read(8)(A(J),J=1,N) ( A is a double )
|> I also tried direct-access unformatted files but i couldn't figure out
|> how to specify RECL most efficiently.
|> I'm working in UNIX.
|> I will greatly appreciate any help that will make I/O in the Fortran
|> program faster.
|> Please respond to ustundag@blakey.WPI.EDU
|> thanks
|>
The first thing to observe is generally the array dimension, because it's
always faster to execute :
dimension A(N)
...
write(8)A
The second is to look about buffering on you computer : if you have big file
perhaps you can find a way to write and read without buffering.
If direct access is not necessary, forget it : it's always lower that sequential one.
Good luck !
michele.morin@der.edf.fr
Technical Details
Message-ID:
<1993Jan21.125413.6571@edf.fr>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!julienas!edf.edf.fr!cli74aa!cabhhmmReferences:
<1jhqkhINNno3@bigboote.WPI.EDU>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.fortran Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!julienas!edf.edf.fr!cli74aa!cabhhmm From: cabhhmm@cli74aa.NoSubdomain.NoDomain (Michele Morin 5115 A408) Subject: Re: Fast I/O Message-ID: <1993Jan21.125413.6571@edf.fr> Sender: cabhhmm@cli74aa (Michele Morin 5115 A408) Organization: EDF Direction des Etudes et Recherches References: <1jhqkhINNno3@bigboote.WPI.EDU> Date: Thu, 21 Jan 1993 12:54:13 GMT Lines: 30