home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / fortran / 5107 next >
Encoding:
Text File  |  1993-01-21  |  1.7 KB  |  52 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!mcsun!julienas!molene!ditigo!molagnon
  3. From: molagnon@ditigo.ifremer.fr (Michel Olagnon, Ifremer DITI GO, 98.22.41.44)
  4. Subject: Re: Fast I/O
  5. Message-ID: <1993Jan21.081105.4047@molene.ifremer.fr>
  6. Sender: news@molene.ifremer.fr
  7. Reply-To: molagnon@ditigo.ifremer.fr
  8. Organization: Ifremer   
  9. References: <1jhqkhINNno3@bigboote.WPI.EDU>
  10. Date: Thu, 21 Jan 93 08:11:05 GMT
  11. Lines: 39
  12.  
  13. In article 1jhqkhINNno3@bigboote.WPI.EDU, ustundag@blakey.WPI.EDU (Afsin Ustundag) writes:
  14. >I have to write a Fortran program which writes and reads tremendous amount
  15. >of data to to and from hard-disc.I wrote it in C using binary files and
  16. >low level I/O.It worked quite well.I tried to use unformatted files in
  17. >Fortran but they're at least 4 times slower.I used following open, write
  18. >and read statements
  19. >    open(8,File='Filename',FORM='unformatted')
  20. >    write(8)(A(J),J=1,N) 
  21. >    read(8)(A(J),J=1,N)   ( A is a double )
  22. >I also tried direct-access unformatted files but i couldn't figure out
  23. >how to specify RECL most efficiently.
  24. >I'm working in UNIX.
  25. >I will greatly appreciate any help that will make I/O in the Fortran 
  26. >program faster.
  27. >Please respond to ustundag@blakey.WPI.EDU
  28. >thanks
  29. >  
  30.  
  31.  
  32. Many Fortran compilers are not efficient on I/O with implied DO loops.
  33. Replacing 
  34.       write (lu) (a (j), j=1,n)
  35. with
  36.       call fstwrt (lu, a, n)
  37.          .
  38.          .
  39.       subroutine fstwrt (lu, a, n)
  40.       double precision a (n)
  41.       write (lu) a
  42.       return
  43. usually gives dramatic improvement.
  44.  
  45. I have a follow-up question : why don't compilers execute this optimization ?
  46.  
  47. ---
  48. | Michel OLAGNON            | email : Michel.Olagnon@ifremer.fr         |
  49. | IFREMER: Institut Francais de Recherches pour l'Exploitation de la Mer|
  50.  
  51.  
  52.