C function vs Fortran function performance

shachris23
Total Points:
425
Status Points:
375
Green Belt
November 25, 2008 1:58 PM PST
Rate
 
#4 Reply to #3
Quoting - Steve Nuchia

The main differences are

one compiler may simply be better, or better adapted to your particular situation, than the other.

the fortran library is likely to be better tuned for many mathematical operations -- but you can call it from C if you want.

the fortran language permits the compiler to make certain optimizations that are seldom possible in standard C / C++, mainly due to potential aliasing but also to potential recursion / reentrancy issues.  It is usually possible to provide "hints" to a performance-oriented C / C++ compiler that will allow it to make the same optimizations.

In the end, in my opinion, it is easier to express and understand algorithms that involve more advanced data structures in C / C++ than in the fortran that I learned.  Modern fortran may be better but it still feels very combersome to me.  Since better algorithms beat better code every time, use the language that admits the most natural  and most maintainable expression of the algorithm.

I agree with your assertion there. I believe the language that can best solve the given problem should be used.

By the way, let's say if someone use Fortran with C\C++ code, how does one go about debugging it? So if we called a Fortan code from C...how does one go about "stepping into" Fortran code if needed be?

My environment is Windows Visual Studio C++.

Thanks,

S.



Intel Software Network Forums Statistics

8292 users have contributed to 31239 threads and 99116 posts to date.
In the past 24 hours, we have 10 new thread(s) 14 new posts(s), and 23 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to Pipeline buffer between stages? The post with the most views is Very amusing...  Escalated as

Please welcome our newest member amirsam7