Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

C to Fortran conversion

rdabra
Beginner
772 Views
I am developing an application using smarteiffel (compiled with and using icc) acessing some fortran routines (compiled with ifort). I have found a numerical multidimensional function integrator written in C (800 lines of code). My first thought is to translate manually the integrator to fortran in order to obtain better performance (for me, this is critical). Before start doing this, which will require a big effort, I would like to ask some opinion about this decision. Is it worth translating to fortran or not ?
0 Kudos
3 Replies
Steven_L_Intel1
Employee
772 Views
My personal opinion is that if you have working code, it's almost never a good idea to translate it. Write the application using the C code, mixing Fortran and C is easy. Then analyze the performance with Intel VTune or some other performance analyzer and see where the program is spending most of its time. If some of the C code seems to be an issue, you can try rewriting it, but the results may not be worth the effort.
0 Kudos
TimP
Honored Contributor III
772 Views
You don't give much information. If it is potentially vectorizable code, and you have rules against the changes in C code which might be required to make it run well, but no rules against efficient Fortran, you may wish to consider the translation.
0 Kudos
hajek
Beginner
772 Views
Mixed programming is a burden, but sometimes it is worth the effort.
Another option for you is to simply find a multidimensional integrator in Fortran. Try GAMS and Netlib.
0 Kudos
Reply