R.U.
R.U.

Reputation: 353

How to compile MPI with gfortran instead of ifort?

A similar question has been asked before but the answers don't directly address the problem I have. I am trying to compile a fortran based application on an HPC machine. The machine has both gfortan and ifort installed and in path. When I use the MPI (Open MPI 1.8.8) wrapper mpifort it automatically uses ifort which is fine. But I, for some reason, want to use gfortran instead. How can I make sure that the mpifortwrapper defaults to gfortraninstead of ifort?

Upvotes: 5

Views: 13684

Answers (2)

zmwang
zmwang

Reputation: 529

mpifort -fc=gfortran main.f90 (or other files you want to compile) can also help change the compiler.

Upvotes: 0

Hristo Iliev
Hristo Iliev

Reputation: 74455

The default Fortran compiler used by Open MPI's mpifort is read from $ompi_root/share/openmpi/mpifort-wrapper-data.txt. The build process stores there the Fortran compiler picked while building the library. It could be overridden by setting the OMPI_FC environment variable. The same applies to the C wrapper (OMPI_CC) and the C++ wrapper (OMPI_CXX).

Example:

$ mpifort -showme:command
ifort
$ env OMPI_FC=gfortran mpifort -showme:command
gfortran

Keep in mind that unlike with C and C++, Intel disagrees with GCC on the Fortran ABI.

Upvotes: 5

Related Questions