TinkerTools / tinker-hp

Tinker-HP: High-Performance Massively Parallel Evolution of Tinker on CPUs & GPUs
http://tinker-hp.org/
Other
78 stars 24 forks source link

Facing a minor issue in compilation #18

Closed heman3333 closed 9 months ago

heman3333 commented 10 months ago

I am trying to compile the tinker-hp v1.2 codes in my Centos cluster. After configuration, when I am making the executables by the command 'make -j', it is showing the following error:

decomp_2d.f90:16:6:

use MPI 1 Fatal Error: Cannot read module file ‘mpi.mod’ opened at (1), because it was created by a different version of GNU Fortran compilation terminated.

I tried with other GNU version too, but the same error. Kind suggestions are required.

Thanks !!

lhjolly commented 9 months ago

Hello heman3333,

The first thing I would suggest is,to make a make clean in the 2dcomp_fft directory.

To be able to help you, can you please tell me what configure command you used, and the output it gave ?

Kind regards,

heman3333 commented 9 months ago

Hi lhjolly, Thanks for responding. Here is the command that I used for configuration: "./configure --enable-fft-mkl --with-fftlib=mkl "

And the output was that it gave, is following:

checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking for mpiicpc... no checking for mpic++... mpic++ checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether mpic++ accepts -g... yes checking for style of include used by make... GNU checking dependency style of mpic++... gcc3 checking for ranlib... ranlib checking for tput... ok checking for python... ok checking whether ln -s works... yes checking for mpiifort... no checking for mpif90... mpif90 checking whether we are using the GNU Fortran compiler... yes checking whether mpif90 accepts -g... yes checking for mpiifort... no checking for mpif90... mpif90 checking whether we are using the GNU Fortran 77 compiler... yes checking whether mpif90 accepts -g... yes configure: "mpif90 wrapper will be used to compile Tinker-HP" checking for ifort... no checking for pgfortran... no checking for gfortran... gfortran configure: "The wrapped compiler is gfortran" checking for Fortran flag to compile preprocessed .F files... none checking how to define symbols for preprocessed Fortran... -D checking for Fortran flag needed to accept fixed-form source... none checking for Fortran flag to enable array-bounds checking... -fcheck=bounds checking what type of BLAS the user wants... checking for dgetrs in -lmkl_core... yes checking what FFT Library the user wants... mkl checking for dfftw_plan_dft_c2r_2d in -lmkl_core... yes checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating 2decomp_fft/src/Makefile config.status: creating example/Makefile config.status: creating params/Makefile config.status: creating source/Makefile config.status: creating colvars/Makefile config.status: creating tutorials/Makefile config.status: creating tutorials/SMD/Makefile config.status: creating tutorials/SMD/CFSMD/Makefile config.status: creating tutorials/SMD/CVSMD/Makefile config.status: creating scripts/Makefile config.status: creating scripts/tinkerhp config.status: executing depfiles commands configure: configure: ** configure: configure: Running Mode : NORMAL (No extension for binaries)
configure: MPI Fortran Wrapper : mpif90
configure:
Fortran Compiler : gfortran
configure: Fortran flags : -cpp -O3 -Wno-argument-mismatch -C -fbacktrace
configure:
:
configure: 2decomp Library : -L ../2decomp_fft/src/ -l2decomp_fft
configure:
PLUMED Library :
configure: PLUMED Includes :
configure:
COLVARS Library :
configure: COLVARS Includes :
configure:
TCL Library :
configure: TCL Includes :
configure:
FFTW3 Interface : mkl of the MKL library
configure: FFTW3 Path : /home/heman/intel/oneapi/mkl/2023.1.0/lib/intel64
configure:
FFTW3 Includes : -I /home/heman/intel/oneapi/mkl/2023.1.0/include
configure: FFTW3 Library : -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -ldl
configure:
BLAS Type : MKL
configure: BLAS Path : /home/heman/intel/oneapi/mkl/2023.1.0/lib/intel64
configure:
Prefix installation : /home/heman/softwares/tinker-hp/v1.2
configure: Binaries location : /home/heman/softwares/tinker-hp/v1.2/bin
configure:
configure: ** configure:

lhjolly commented 9 months ago

Hi heman3333,

First of all, please forgive me for this too much delayed answer.

I finally succeeded in reproducing your issue. This is related to the way mpi is installed on your machine. Openmpi (and Intelmpi) always embed a (pre)compiled MPI fortran module, so that the fortran MPI functions and variables are exported to the program you're trying to compile. The linking step will take care of resolving the links with the openmpi libraries. Of course, this (pre)compiled MPI fortran module is tagged with the version of the fortran compiler that was used when it was generated.

So, to be able to use any gcc/gfortran compiler, you must use the openmpi version that was specifically compiled with the very same gcc/gfortran compiler.

In your case, either compile with the gcc/gfortran compiler and the basic openmpi that were shipped with your linux machine or compile with another gcc/gfortran compiler and find an openmpi library that fit with this compiler

For example, in one of our clusters, we have this kind of choices for openmpi:

   Libraries/openmpi/3.0.0/Gnu/7.2.0-x86_64              Libraries/openmpi/4.1.1/Gnu/11.1.0-x86_64
   Libraries/openmpi/2.1.2/Gnu/9.1.0-x86_64              Libraries/openmpi/3.0.0/Gnu/7.4.0-x86_64
   Libraries/openmpi/2.1.2/Intel/11.0-x86_64             Libraries/openmpi/3.0.0/Gnu/9.1.0-x86_64

and for Gcc/gfortran compiler:

   Core/Gnu/7.2.0         Core/Intel/latest         Core/Intel/2023                       (D)    Core/Portland/nvhpc/21.3          Core/Portland/2020-llvm
   Core/Gnu/7.4.0         Core/Intel/11.0           Core/Portland/nvhpc-byo-compiler/20.9        Core/Portland/nvhpc/21.5          Core/Portland/2020-nollvm
   Core/Gnu/8.3.0         Core/Intel/18.0.1         Core/Portland/nvhpc-byo-compiler/21.3        Core/Portland/nvhpc/21.9          Core/Portland/2020        (D)
   Core/Gnu/9.1.0  (L)    Core/Intel/19.0.3         Core/Portland/nvhpc-byo-compiler/21.5        Core/Portland/nvhpc/23.3
   Core/Gnu/9.2.0         Core/Intel/2015           Core/Portland/nvhpc-byo-compiler/21.9        Core/Portland/17.10
   Core/Gnu/10.2.0        Core/Intel/2018           Core/Portland/nvhpc-nompi/20.9               Core/Portland/18.4
   Core/Gnu/11.1.0

So, using module framework, we can choose:

module load Libraries/openmpi/4.1.1/Gnu/11.1.0-x86_64 Core/Gnu/11.1.0

which gives:

make[2]: Entering directory `/state/partition1/lhj/neutron/Tinker/VEC/PME/2decomp_fft/src'
mpif90 -cpp -DDOUBLE_PREC -I /usr/local/intel/Compiler/2019/mkl//include -cpp -O3   -C -fbacktrace  -c -o decomp_2d.o decomp_2d.f90
mpif90 -cpp -DDOUBLE_PREC -I /usr/local/intel/Compiler/2019/mkl//include -cpp -O3   -C -fbacktrace  -c -o io.o io.f90

Any other combination results in

mpif90 -cpp -DDOUBLE_PREC -I /usr/local/intel/Compiler/2019/mkl//include -cpp -O3   -C -fbacktrace  -c -o decomp_2d.o decomp_2d.f90
decomp_2d.f90:16:6:

   16 |   use MPI
      |      1
Fatal Error: Cannot read module file 'mpi.mod' opened at (1), because it was created by a different version of GNU Fortran

Kind regards, lhjolly

heman3333 commented 9 months ago

Hi lhjolly, Thanks a lot for your kind help in solving this issue.