Re: Is C faster than fortran?
- From: "Lane Straatman" <invalid@xxxxxxxxxxx>
- Date: Tue, 27 Mar 2007 21:59:36 -0400
"glen herrmannsfeldt" <gah@xxxxxxxxxxxxxxxx> wrote in message
news:gPWdnZ0Jt4DDIZTbnZ2dnUVZ_hKdnZ2d@xxxxxxxxxxxxxx
user923005 wrote:[follow-up set to c.l.f.]
This OP is well-known for his numerical skills in C. I can't speak toSeriously. Fortran compilers can optimize more aggressively than
C because the language semantics are different. C99 plugs this
gap (mostly) with the "restrict" qualifier, but I don't know how
that plays out in practice and I would love to see data.
We need a Fortran Guru to show me what I am doing wrong, because there
is no feasible explanation for this other than I do not know how to
get performance out of my Fortran compiler.
That is what they say, and maybe on the average it is true.
There are too many variables to make it true in general.
First, the programs should be as similar as possible, and also
the data. In the (snipped) programs, the C version uses arrays of
pointers to arrays of pointers to arrays of pointers, which is not
likely true for Fortran, and might make a difference either way.
The programs are doing matrix inversion of random numbers, which
are generated using system dependent generators. There may be some
data dependence to the timing of matrix inversion, especially
if the hardware timing is different for different data.
Optimization is probably more sensitive to the number of registers
available than to the ability to rearrange expressions.
Do both Fortran and C programs have the array subscripts in the
optimal order? Most compilers won't change that.
optimizing execution speed. If OP would like to see a couple examples from
MR&C on array features, I'll be happy to donate some keystrokes.
--
LS
.
- Prev by Date: Re: variable names for different fortrans
- Next by Date: Re: calculation accuracy
- Previous by thread: calculation accuracy
- Next by thread: Re: Is C faster than fortran?
- Index(es):
Relevant Pages
|
|