Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!urz.unibas.ch!doelz From: doelz@urz.unibas.ch (Reinhard Doelz) Newsgroups: comp.sys.sgi Subject: RE: FORTRAN Optimization Message-ID: <176*doelz@urz.unibas.ch> Date: 4 Jan 90 13:06:29 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 27 One could try variuos things to spped up F77. One main drawback is the fixed memory allocation. Within molecular dynamics routines I found out that much time is lost by swapping the memory. If one uses arrays one should keep them as small as possible. I.e., if you store integers in a real array it takes much more space. But even the dimensions of large arrays could influence the spped in an unexplained way. I recognized that it results in higher spped if you set large dimensions for an array more frequently used: it is processed faster than with the (smaller) dimensions needed. The indices are essential: x(3,4) is stored as X11 X21 X31 X21 X22 X32 etc. (Sorry if this is trivial). It is possible the other way round as well. The IRIS will do it, however, kill itself by swapping. You could also try to use multiple assignments to memory, instead or reassigning variables, with EQUIVALENCES (dangerous but sppeds things up a lot, and saves space, too.) We fool around a bit with structures, but that is more for convenience than improving speed. another possibility to make things go faster is to use /dev/mem, but I think MIPS F77 does not support the mem calls of C. Another useful thing is to think about trigonometric functions. If they're used without challenging accuracy too much (e.g., we need horrible ammounts of sines and cosines for the normals in lighting models), it is worth to set up a table once containing the values in, lets say, 180 steps and to skip the time-consuming sin(x) by simply pointing to the table. Maybe this helps a little, Reinhard