home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16570 < prev    next >
Encoding:
Text File  |  1992-11-15  |  2.0 KB  |  49 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!ornl!sunova!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!caen!umeecs!umn.edu!lynx!zia.aoc.nrao.edu!laphroaig!cflatter
  3. From: cflatter@nrao.edu (Chris Flatters)
  4. Subject: Re: Reasons for using C vs. Fortran or vic
  5. Message-ID: <1992Nov15.231311.20440@zia.aoc.nrao.edu>
  6. Sender: news@zia.aoc.nrao.edu
  7. Reply-To: cflatter@nrao.edu
  8. Organization: NRAO
  9. References: <1992Nov15.201555.20678@thunder.mcrcim.mcgill.edu>
  10. Date: Sun, 15 Nov 92 23:13:11 GMT
  11. Lines: 36
  12.  
  13. In article 20678@thunder.mcrcim.mcgill.edu, mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes:
  14. >In article <1992Nov13.162451.13049@zia.aoc.nrao.edu>, cflatter@nrao.edu (Chris Flatters) writes:
  15. >
  16. >> Storing arrays by column or by row doesn't make any difference
  17. >> whatsoever to the speed of matrix operations: it is merely a notation
  18. >> change.
  19. >
  20. >This is true only in the abstract.  I have experienced (not just heard
  21. >about) multiple orders of magnitude speed differences, because going
  22. >through arrays "the wrong way" had catastrohpically bad VM behavior:
  23. >essentially, every access involved a page fault.  Doing it "the right
  24. >way" stepped through VM in a nice sequential way, with minimal paging.
  25.  
  26. This is true.  The cost of moving data around is often higher than the cost
  27. of computation.  Generally speaking you want to keep accesses that are close
  28. together in time close together in memory: VM isn't the only constraint ---
  29. you make the most out of modern RISC machines by working in cache as much as
  30. possible.
  31.  
  32. Storing arrays by column or row doesn't actually make much difference here
  33. (although not knowing which convention you are using can hurt you).  For
  34. large linear algebra problems blocked algorithms (as used in LAPACK) are
  35. the methods of choice (see, for example "Solving Linear Systems on
  36. Vector and Shared Memory Computers" by Jack Dongarra and several others
  37. (SIAM, 1991)).
  38.  
  39.  
  40. >                    der Mouse
  41.                     ^^^
  42.  
  43. Like Matthias Blume, I've always been curious about this.
  44.  
  45.     Chris Flatters
  46.     cflatter@nrao.edu
  47.  
  48.  
  49.