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

Using F90 modules from within F77

chaudhri__ankit
Beginner
888 Views
Hi;
I have two sets of large codes that I'd like to combine; one written in F90 (highly modular), and one in F77. A handful of these F77 routines are written in mixed F90/F77 mode. For example, a few F77 routines apply "use module_90", which is the primary interface to all of the F90 code. We've been developing code with gfortran in the past and the compiler doesn't complain and is smart enough to handle the mixed language. We have compiled and linked it (in openmp, mpi, and cuda), and have made runs successfully with gfortran. For reasons that are beyond the scope here, I'd like to port the code to ifort. However, I haven't been successful in doing that so far.
The ifort version is 11.1 (on NCSA's Lincoln supercomputer; Redhat). An example of the compile options used, which fail is given below. OmegaFlow is the F90 code, and all its modules/routines (such as utility.o below) are compiled cleanly with ifort and reside in/u/ac/adrin/NEWEST_HYBRID/OMEGAFLOW/build.
Is there a way in ifort to mix and match the two languages without any extra work (as is the case with gfortran)?
Thanks very much in advance
adrin
mpif90 -DUSE_MPI -DD_PRECISION -DOMEGAFLOW -O3 -ip -pad -align -auto -openmp -fp-model precise -fpe0 -ftz -traceback -I/u/ac/adrin/NEWEST_HYBRID/OMEGAFLOW/build -I/usr/local/openmpi-1.2.4-intel-ofed-1.2/include -c omegaGridOut.F
omegaGridOut.F(319): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [UTILITY]
use Utility
----------^
compilation aborted for omegaGridOut.F (code 1)
make[2]: *** [omegaGridOut.o] Error 1
0 Kudos
4 Replies
mecej4
Honored Contributor III
888 Views
Intel Fortran uses the -fpp and -fpp[="option"] compiler options to signify that the preprocessor is to be run. I do not know enough about the mpif90 driver to say whether the driver supplies the -fpp option to the ifort compiler when it encounters a file extension of .F rather than .f . You could try adding the -fpp option to your makefile rules for .F sources and examine the effect.

It causes less confusion to associate .f with fixed format and .f90 with free format source, rather than associating .f with F77 and .f90 with F90+ .
0 Kudos
TimP
Honored Contributor III
888 Views
I don't know from the above if you expect .mod files generated by gfortran to work with ifort. They don't even work across differing major versions of gfortran. Handling .mod files usually involves "extra work."
0 Kudos
jimdempseyatthecove
Honored Contributor III
888 Views
>>Error in opening the compiled module file. Check INCLUDE paths. [UTILITY]

This means your file "Utility.mod" is not found in your include path(s)

Meaning:

a) it was not generated (dependency error, or compilation error)
b) it was generated but written to a location not in your include path(s)

Perform a "clean", then build, then check to see if you have a newly created "Utility.mod", if not, assume a)
If it exists, then assume b) and look where it was created, decide if that is the correct place, if so, then is that place in your include path, if not, then fix your make file.

Note, the output of compiling a .MOD file is to be targeted to an INCLUDE path folder and not an .o folder (that is not also in an include path).

Jim Dempsey
0 Kudos
chaudhri__ankit
Beginner
888 Views
Jim
Thanks very much for the hints. I'd noticed that .mod files were absent in the build directory (which the gfortran component in my makefile handles properly) but I'd thought perhaps the intel compiler was somehow combining it into the .o (not being a compiler expert I thought that might be a possibility!). Sure enough, the .mod files were in the root directory and not sent to build. So, it all works fine now
Best
adrin
0 Kudos
Reply