🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.fortran
Article #4448

Re: Fast I/O

#4448
From: Michel Olagnon, Ifremer DITI GO,...
Date: Thu, 21 Jan 1993 08:11
37 lines
1813 bytes
In article 1jhqkhINNno3@bigboote.WPI.EDU, ustundag@blakey.WPI.EDU (Afsin Ustundag) writes:
>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
>  


Many Fortran compilers are not efficient on I/O with implied DO loops.
Replacing 
      write (lu) (a (j), j=1,n)
with
      call fstwrt (lu, a, n)
         .
         .
      subroutine fstwrt (lu, a, n)
      double precision a (n)
      write (lu) a
      return
usually gives dramatic improvement.

I have a follow-up question : why don't compilers execute this optimization ?

---
| Michel OLAGNON            | email : Michel.Olagnon@ifremer.fr         |
| IFREMER: Institut Francais de Recherches pour l'Exploitation de la Mer|
Technical Details
Message-ID: <1993Jan21.081105.4047@molene.ifremer.fr>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!julienas!molene!ditigo!molagnon
References: <1jhqkhINNno3@bigboote.WPI.EDU>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.fortran
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!julienas!molene!ditigo!molagnon
From: molagnon@ditigo.ifremer.fr (Michel Olagnon, Ifremer DITI GO, 98.22.41.44)
Subject: Re: Fast I/O
Message-ID: <1993Jan21.081105.4047@molene.ifremer.fr>
Sender: news@molene.ifremer.fr
Reply-To: molagnon@ditigo.ifremer.fr
Organization: Ifremer   
References: <1jhqkhINNno3@bigboote.WPI.EDU>
Date: Thu, 21 Jan 93 08:11:05 GMT
Lines: 39