C function vs Fortran function performance

g.f.thomas
November 24, 2008 3:58 PM PST
Rate
 
#1
Quoting - shachris23

Hi,

Not trying to start a language war or anything, but I work in a real-time image processing industry where performance is of utmost concern.

Our initial algorithms were written in Fortran back in the 70's/80's, and eventually translated to C. Right now our application uses C++ for infrastructure-related stuff, and C for the algorithms for maximum performance. The C algorithm functions are parallelized using master-worker design pattern. We use Intel compiler. Our platform is Windows x64.

I have never coded in Fortran but heard that it's great for scientific computing, as well as unmatched (?) performance by other language.

So...here's the question: assuming an algorithm is coded efficiently in C and Fortran (i.e. they both describe the same algorithm), would code produced in Fortran be significantly faster than the C counterpart? Assuming that we use Intel compiler for both C and Fortran.

Because if Fortran really is faster, I'm thinking about making an object code out of Fortran and call it from our C++ infrastructure instead.

Thanks!!

S.

It's hard to tell a priori. Modern C (as distinct from C++) and Fortran are comparably fast and which you use can be a personal choice unless local policy dictates otherwise. I'm surrounded by C colleagues but I prefer  that all my bugs be of the Fortran type if only because I can detect and swat them more easily. Fortran is simple to learn and you can quickly recode a C algorithm and see which is faster (for that algorithm only and assuming both codes are equally well written). Did you know that Fortran 2003 is interoperable with C?

Gerry



Intel Software Network Forums Statistics

8474 users have contributed to 31606 threads and 100656 posts to date.
In the past 24 hours, we have 30 new thread(s) 109 new posts(s), and 163 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to gemm(A,A,A) like possible? The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member Kevin Johnson