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

The gfortran folder inside the oneAPI directory apparently caused problem

st77
Beginner
1,494 Views

I am installing an application that I have specified to use ifort (by setting the appropriate env. variable). But during the build, I got this error 

gfortran: error: unrecognized command line option ‘-i8’; did you mean ‘-k8’?

I never intended to use gfortran. Then I notice that executing source /opt/intel/oneapi/setvars.sh redefines mpif90 wrapper. After sourcing setvars.sh, mpif90 -show produces gfortran -I"/opt/intel/oneapi/mpi/2021.7.1/include/gfortran/8.2.0" -I"/opt/intel/oneapi/mpi/2021.7.1/include", i.e. its underlying fortran compiler becomes gfortran, although before sourcing setvars.sh above, the underlying compiler for mpif90 is ifort. Is this a default behavior? Because of this I got the above error of gfortran not recognizing -i8, since I set this flag with ifort as the underlying compiler in mind.

The full compiler flags and linking option was generated by Intel link line advisor :

-qmkl-ilp64=sequential  ${MKLROOT}/lib/intel64/libmkl_blas95_ilp64.a ${MKLROOT}/lib/intel64/libmkl_lapack95_ilp64.a -lmkl_blacs_openmpi_ilp64  -I${MKLROOT}/include/intel64/ilp64 -i8  -qmkl-ilp64=sequential

0 Kudos
7 Replies
mecej4
Honored Contributor III
1,461 Views

Are you using a makefile to build your application? I suspect that to be the case, and that the default rule for building .o files from .f or .f90 files is causing gFortran to be used. Posting the makefile or the build script that you use may help pinpoint the root cause.

0 Kudos
st77
Beginner
1,435 Views

Well, yes the program uses makefiles to build. The thing is it's a large program consisting of a handful of folders many of which has their own makefiles to allow building locally. So, I don't know which of these many makefiles causes the above behavior. The build script might be more helpful, it is located here: https://github.com/nwchemgit/nwchem/blob/df6c95650b2418501ee788050b969846e0ee7100/contrib/distro-tools/build_nwchem

 .

0 Kudos
mecej4
Honored Contributor III
1,411 Views

The README file in the "distro-tools" Nwchem directory contains this statement (underlining added by me for emphasis), which may explain the behavior that you observed:

 

build_nwchem

    This script sets up a set of environment variables and builds 
    NWChem accordingly. I can easily be adapted to any particular build
    of interest. At present it is set up to build a statically linked
    executable with the GNU compilers.

 

0 Kudos
st77
Beginner
1,400 Views

That part of the documentation is not up-to-date. This is not the first time I build NWChem from source, I have been developing codes in this program for some times using Intel compilers by setting certain variable, and I never ran into the error above. I encountered the issue above when building it on a new computer cluster that uses Intel OneAPI, in my previous institution, their computer cluster didn't use Intel OneAPI apparently.

0 Kudos
andrew_4619
Honored Contributor III
1,392 Views

I am intrigued, does /opt/intel/oneapi/mpi/2021.7.1/include/gfortran/8.2.0 exist? And if so why?

0 Kudos
Arjen_Markus
Honored Contributor I
1,354 Views

Out of curiosity, I checked it on my company's system: such a directory does indeed exist and it has several siblings.

the subdirectories of include/gfortran are:
10.2.0 11.1.0 4.8.0 4.9.0 5.1.0 6.1.0 7.1.0 8.2.0 9.1.0

0 Kudos
Barbara_P_Intel
Employee
1,337 Views

Please note the contents of that include/gfortran directory. It only contains .mod files. No compiler per se. I don't know what part of MPI needs those gfortran .mod files.

The easiest way to compile with ifort and MPI is to use mpiifort. 

 

0 Kudos
Reply