[comp.lang.fortran] Fortran vc. C for numerical work

tang@venus.ycc.yale.edu (12/01/90)

In article <2392:Nov2902:59:0590@kramden.acf.nyu.edu> Dan writes:
>>     With respect to speed, almost all machines that I have used during
>>     the last 25 or so years have had faster multiplications than
>>     memory accesses.
>
>Hmmm. What machines do you use? In my experience (mostly mainframes and
>supers, some micros, and only recently a bit with minis) local memory
>access is up to several times as fast as integer multiplication. (I
>don't like this situation; converting to floating point just to multiply
>quickly on a Cray seems rather silly.)

I do not know where you get your information.  If memory access was faster
than multiplication, then there would be not need for all kinds of
cache!  For your information, memory access on Cray Y-MP takes 4 cycles
whereas multiplication takes only one cycle.  The use of 64 memory banks
is aimed to address memory access problem; otherwise, the pipeline will
not be filled and the machine will not achieve one result per cycle.

>>     Anyway, Dan's answer points out the performance differences in the
>>     array versus pointer access stuff. Personally I just don't user
>>     pointers much because my problems don't call for them. If I had to
>>     access multi-dimensional arrays in random fashion very often, the
>>     pointer solution might be acceptable.
>
>But you really do access random spots in arrays; it's a rare problem
>that always starts from the top left corner of every matrix. Take a
>typical pivot-based algorithm, for instance: you're dealing with
>essentially random rows at each step.

But once you have fixed on one row, the elements of this row will be
accessed sequentially.  The question really is: how much overhead do you
have to pay for random access compared to the overall picture.  I do not
think this is a main issue in this whole discussion.

Tang