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

Fortran/C compatibility

Jay_B_
Beginner
848 Views

As some of my recent posts indicate, I am porting a system of g77 applications to Intel Fortran (about 30-40 programs).  These apps were previously ported from Alpha OpenVMS.

The original "porter" had to make many low-level tweaks to existing and new low-level C code.  At the moment, all code compiles and links under Intel Fortran (after some small changes), and a few high-level apps execute successfully.  But for some applications, segfaults, loops, hangs, etc., seem to occur in the lowest-level code, e.g., raw terminal input.

My general question: Are there potential advantages in using Intel C/C++ for the low-level C code than gnu C?  I know that there is no way to answer this definitively for every case, but have developers found this to be advisable?

Jay

0 Kudos
4 Replies
Steven_L_Intel1
Employee
848 Views

Intel Fortran for Linux can be mixed with code compiled by either Intel C++ or GNU C/C++ (or a mix of all three if you are so inclined.) Intel C++ typically provides better performance and has advanced parallelism features.

0 Kudos
Jay_B_
Beginner
848 Views

So no particular advantage in terms of compatibility, e.g., when passing arguments from Fortran to low-level C functions?  I'm thinking not, i.e., you still have the same fundamental language issues to resolve, e.g., pass-by-reference vs. pass-by-value.  But in case my managers ask:  "Would these interfaces be easier if you used Intel C?", I think the answer is no -- Intel C/C++ would be chosen for performance and parallelism.

Thanks,
Jay

0 Kudos
TimP
Honored Contributor III
848 Views

It's difficult to make a definitive statement about choice between gcc and icc.

Software vendors I've worked with don't require the performance features of current gcc or icc and are satisfied with the gcc supplied with even the oldest linux distros.  Also, when using open source MPI, it may be easier to deal with the combination of ifort and gcc than to get icpc involved.   Some of the past difficulties with icc have gone away with the more recent system of keeping ifort and icc versions in lock step.  You will still have trouble if you don't update them together.

Intel comparisons usually assume the oldest available version of gcc (vs. the latest icc), in part because you take on some responsibility yourself for maintaining gcc when you update.  Another reason is that Intel personnel may be familiar with the idiosyncracies of icc vectorization but not the corresponding ones of gcc.

The Intel OpenMP library for linux handles all the OpenMP calls from gcc, so there's no problem with using gcc together with ifort OpenMP as long as you take care not to link libgomp in addition to (or in place of) libiomp5.  On linux, icc and gcc are sufficiently interoperable that you can mix them effectively.

0 Kudos
Steven_L_Intel1
Employee
848 Views

There's no difference in call compatibility between Intel C++ and gcc. I do recommend using the C Interoperability features of Fortran 2003, supported by Intel Fortran, for the best result. Your choice of C/C++ compilers is independent of Fortran. Intel C++ will tend to give you the best performance overall, but from Fortran's perspective they are interchangeable.

0 Kudos
Reply