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

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!mcsun!julienas!edf.edf.fr!cli74aa!cabhhmm
  3. From: cabhhmm@cli74aa.NoSubdomain.NoDomain (Michele Morin 5115 A408)
  4. Subject: Re: Fast I/O
  5. Message-ID: <1993Jan21.125413.6571@edf.fr>
  6. Sender: cabhhmm@cli74aa (Michele Morin 5115 A408)
  7. Organization: EDF Direction des Etudes et Recherches
  8. References:  <1jhqkhINNno3@bigboote.WPI.EDU>
  9. Date: Thu, 21 Jan 1993 12:54:13 GMT
  10. Lines: 30
  11.  
  12. In article <1jhqkhINNno3@bigboote.WPI.EDU>, you write:
  13. |> I have to write a Fortran program which writes and reads tremendous amount
  14. |> of data to to and from hard-disc.I wrote it in C using binary files and
  15. |> low level I/O.It worked quite well.I tried to use unformatted files in
  16. |> Fortran but they're at least 4 times slower.I used following open, write
  17. |> and read statements
  18. |>     open(8,File='Filename',FORM='unformatted')
  19. |>     write(8)(A(J),J=1,N) 
  20. |>     read(8)(A(J),J=1,N)   ( A is a double )
  21. |> I also tried direct-access unformatted files but i couldn't figure out
  22. |> how to specify RECL most efficiently.
  23. |> I'm working in UNIX.
  24. |> I will greatly appreciate any help that will make I/O in the Fortran 
  25. |> program faster.
  26. |> Please respond to ustundag@blakey.WPI.EDU
  27. |> thanks
  28. |>   
  29.  The first thing to observe is generally the array dimension, because it's
  30. always faster to execute :
  31.       dimension A(N)
  32.       ...
  33.       write(8)A
  34.  
  35. The second is to look about buffering on you computer : if you have big file
  36. perhaps you can find a way to write and read without buffering.
  37. If direct access is not necessary, forget it : it's always lower that sequential one.
  38. Good luck !
  39.  
  40. michele.morin@der.edf.fr
  41.  
  42.