Opened 3 years ago

Closed 3 years ago

#882 closed upgrade (Done)

Added option to build and make configuration scripts to use mpiifort

Reported by: arango Owned by:
Priority: major Milestone: Release ROMS/TOMS 4.0
Component: Nonlinear Version: 3.9
Keywords: Cc:

Description

In some computers, the Intel MPI library is installed with the ifort compiler. Thus, we need to use the mpiifort wrapper instead of the generic mpif90. Notice that in some ifort versions, the mpif90 wrapper is also available but linked to gfortran. It is very confusing and the compilation fails with errors like:

gfortran: error: unrecognized command line option ‘-fp-model’
gfortran: error: unrecognized command line option ‘-ip’; did you mean ‘-p’?
gfortran: error: unrecognized command line option ‘-traceback’
gfortran: error: unrecognized command line option ‘-check’; did you mean ‘-fcheck=’?
gfortran: error: unrecognized command line option ‘-check’; did you mean ‘-fcheck=’?
gfortran: error: unrecognized command line option ‘-module’; did you mean ‘-mhle’?

Therefore, the ROMS build scripts (cbuild_roms.csh, cbuild_roms.sh, build_roms.csh, and build_roms.sh) are enhanced to include an option to compile with the mpiifort wrapper. For example, in build_roms.sh, we now have:

# Other user defined environmental variables. See the ROMS makefile for
# details on other options the user might want to set here. Be sure to
# leave the switches meant to be off set to an empty string or commented
# out. Any string value (including off) will evaluate to TRUE in
# conditional if-statements.

 export           USE_MPI=on            # distributed-memory parallelism
 export        USE_MPIF90=on            # compile with mpif90 script
#export         which_MPI=intel         # compile with mpiifort library
#export         which_MPI=mpich         # compile with MPICH library
#export         which_MPI=mpich2        # compile with MPICH2 library
#export         which_MPI=mvapich2      # compile with MVAPICH2 library
 export         which_MPI=openmpi       # compile with OpenMPI library

including an additional value for the environmental variable which_MPI=intel.

Now, in the make configuration script for the ifort compiler (Linux-ifort.mk), the FC macro is initialized to the appropriate wrapper:

ifdef USE_MPI
         CPPFLAGS += -DMPI
 ifdef USE_MPIF90
  ifeq ($(which_MPI), intel)
               FC := mpiifort
  else
               FC := mpif90
  endif
 else
             LIBS += -lfmpi -lmpi
 endif
endif

In compiler_flags_Intel_Fortran.cmake, we need to specify the appropriate compiler wrapper for CMake:

if( MPI )
  if( ${COMM} MATCHES "intel")
    set( CMAKE_Fortran_COMPILER mpiifort )
  else()
    set( CMAKE_Fortran_COMPILER mpif90 )
  endif()
else()
  set( CMAKE_Fortran_COMPILER ifort )
endif()

Change History (1)

comment:1 by arango, 3 years ago

Resolution: Done
Status: newclosed
Note: See TracTickets for help on using tickets.