[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: just how bad is Fortran?



Hi,

On Wed, 23 Jul 1997, Dany Dionne wrote:

> Your right, f77 is much more performant in intensive numerical
> computations than c or c++, at least on SGI (IRIX). For example, on a
> Indigo 2, a version of a code in f77 have a peak performance of 270
> MFLOPS. The same code in c/c++ peak at 100 MFLOPS. 

There is something very wrong with your code,
not with f77 or C. To tell the truth, lots of
vendors provide uniform optimizer for all supplied language.
So all vendor compilers (C, F77, Ada) have different front-end but are
sharing the same optimizing back-end. This is just common business
practice. Sun is doing this as well as SGI, i believe
(well, i didn't check latest SGI C and F77 but it was true for
2yo compilers). Basically it means there is impossible to get
any essential difference from well written C or F77 code.

I believe i can attribute so huge difference in your f77 and 
C code to data allocation pattern. F77 and C keep the
matrices in memory in different way (column versus row strategy).
It means that each indexing operator in F77 steps through
continious memory region in your code thus making
L1/L2/L3 cache/memory bus/whatever happy, while C code
trash L1/L2/L3 cache during each indexing. SGI is especially
sensibile to cache hits strategy, alignment etc

I saw counterexamples where C code was faster 
exactly due to the same reasons.

> Ok, maybe the c/c++
> version could be more optimized but the fact is with f77 it's easy to
> obtain a very performant code, so why use c/c++ and lose a lot of time  to
> write a obscur, tricky and slow program?

hmm...

C++ promises to have quite clear code:

A = B*C+D; // A, B, C, D are huge matrices or tensors or ...
           // all n-dimensional loops are hidden


And again, f77 lacks tons of features (pointers and struct)
to write clean and simple code in lots of areas.


YMMV 

OK


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: