3

I'm trying to compile RegCM4.5 my configuration looks like have no errors but while compiling (by make command) I get this error

File ‘mpi.mod’ opened at (1) is not a GNU Fortran module file

I have installed mpich by dnf install package manager. How can I solve this problem?

5
  • 1
    Welcome to Stack Overflow. Read here for more information about how to create a Minimal, Complete and Verifiable question. Commented Jul 31, 2016 at 16:25
  • 2
    @Toby a MCVE will be very likely just use mpi; end. Commented Jul 31, 2016 at 17:51
  • 1
    Do you have any other Fortran compilers installed? Do you know which compiler was used to compile MPICH? Could you try to compile a program which contains use mpi and nothing else? Commented Jul 31, 2016 at 18:16
  • dear Vlademir thanks for your attention. I dont know which compiler is used for MPICH! how can I know this? and I didnt get what you meant with use mpi !!! can you please give me more guide? Commented Jul 31, 2016 at 18:22
  • Try the program I requested. Commented Jul 31, 2016 at 23:12

1 Answer 1

2

I had this problem recently. The problem was that I had different versions of the gfortran compiler and openmpi was not pointing to the right one, aka. the one being used for compiling my program. So using the use mpi statement would lead to that error. Typing in the following command will indicate which Fortran compilers are currently installed:

dpkg -l | grep Fortran

My output was

ii  gfortran                                    4:5.3.1-1ubuntu1                              amd64        GNU Fortran 95 compiler
ii  gfortran-4.8                                4.8.5-4ubuntu2                                amd64        GNU Fortran compiler
ii  gfortran-5                                  5.4.1-2ubuntu1~16.04                          amd64        GNU Fortran compiler
ii  libgfortran-4.8-dev:amd64                   4.8.5-4ubuntu2                                amd64        Runtime library for GNU Fortran applications (development files)
ii  libgfortran-5-dev:amd64                     5.4.1-2ubuntu1~16.04                          amd64        Runtime library for GNU Fortran applications (development files)
ii  libgfortran3:amd64                          6.2.0-3ubuntu11~16.04                         amd64        Runtime library for GNU Fortran applications

You can solve this by exporting the fortran compiler you are actually using. In my case it was gfortran-4.8, so I simply had to type

export FC=gfortran-4.8
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.