[Numpy-discussion] Fortran was dead ... [was Re: rewriting NumPy code in C or C++ or similar]
Sturla Molden
sturla at molden.no
Tue Mar 15 09:45:26 EDT 2011
Den 14.03.2011 23:10, skrev Matthieu Brucher:
>
> Intel Fortran is an excellent Fortran compiler. Why is Fortran still
> better than C and C++?
> - some rules are different, like arrays passed to functions are ALWAYS
> supposed to be independent in Fortran, whereas in C, you have to add a
> restrict keyword
> - due to the last fact, Fortran is a language where its compiler could
> do more work (vectorization, autoparallelization...)
Fortran 90 (and later) has a big room for "autovectorization" but it not
mainly due to aliasing rules. Where, forall, array i/o, pure and
elemental functions, intrisic funtiouns etc. are more important.
Aliasing rules can also be controlled in ANSI C or C++: g++ will
recognize __restrict__, MSVC will recognise __restrict, and MSVC has
compiler pragmans, etc.,
> Nevertheless, when you know C++ correctly, when you want to do
> something really efficient, you don't use Fortran. You can be as
> efficient as in C++, and you can do fancy stuff (I/O, network...).
> Class and templates are also better supported in C++.
You can get supernaturally fast i/o on Windows if you use Windows' i/o
ports and tune the C-kode. But small Fortran statements (open, close,
read, wite) will almost always do the same job. What is fast, and what
is fast enough?
C++ templates maks binaries almost impossible to debug.
Sturla
More information about the NumPy-Discussion
mailing list