I/O API bin-create "Cannot find mpif.h error"

Hello, I’m trying to make bin in HiPerGator.

This is my module list for compiling I/O API.

  1. ufrc 4) netcdf-c/4.9.2 7) netcdf/4.7.2 10) hdf5/1.14.4
  2. intel/2020.0.166 5) nco/4.2.1 8) udunits/2.2.17 11) jasper/1.0.4
  3. openmpi/4.1.5 6) idl/8.3 9) ncview/2.1.7 12) conda/24.7.1

I used Makeinclude for Linux2_x86_64ifortmpi, and creating library & fixed-132 has been done. However, when I tried to make bin, modpdata.F90 showed the problem for “include mpif.h”, which is not found.
At least the makefile recognized -qopenmp option, so it should recognize the openmpi module, but I’m not sure for the problem. Is there other way to specify the including mpi library option for the compiling?

What is the complete command-line and its output for the failure?

if [ ! -d /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/Linux2_x86_64 ]; then mkdir -p /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/Linux2_x86_64; fi
cd /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/Linux2_x86_64; gfortran -c -DIOAPI_PNCF=1 -DAUTO_ARRAYS=1 -DF90=1 -DFLDMN=1 -DFSTR_L=int -DIOAPI_NO_STDOUT=1 -DNEED_ARGS=1 -O3 -std=legacy -ffast-math -funroll-loops -m64 -fopenmp -DAUTO_ARRAYS=1 -DF90=1 -DFLDMN=1 -DFSTR_L=int -DIOAPI_NO_STDOUT=1 -DNEED_ARGS=1 -I/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modmpasfio.f90
if [ ! -d /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/Linux2_x86_64 ]; then mkdir -p /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/Linux2_x86_64; fi
cd /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/Linux2_x86_64; gfortran -c -DF90=1 -DIOAPI_PNCF=1 -DAUTO_ARRAYS=1 -DF90=1 -DFLDMN=1 -DFSTR_L=int -DIOAPI_NO_STDOUT=1 -DNEED_ARGS=1 -O3 -std=legacy -ffast-math -funroll-loops -m64 -fopenmp -DAUTO_ARRAYS=1 -DF90=1 -DFLDMN=1 -DFSTR_L=int -DIOAPI_NO_STDOUT=1 -DNEED_ARGS=1 -I/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90:34: Error: Can’t open included file ‘mpif.h’
make[1]: *** [Makefile:276: modpdata.mod] Error 1
make[1]: Leaving directory ‘/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi’
make: *** [Makefile:228: bins] Error 2

Thank you.

...gfortran -c -DF90=1

From Makeinclude.Linux2_x86_64ifortmpi:

FC = mpif90 -auto -warn notruncated_source -Bstatic -static-intel

WTH is gfortran showing up as the compiler here ???

[mpif90 is a wrapper around the actual Fortran-compiler, that knows about all the relevant INCLUDE-files such as mpif.h for that compiler. And that wrapper is built around a specific Fortran-compiler, which may or may not be Intel ifort (which is implied by BIN=Linux2_x86_64ifortmpi); do you know that this “openmpi/4.1.5 6)” is built around Intel ifort (or is it rather built around GNU gfortran, in which case you are mixing incompatible MODULEs)?]

I excluded other BIN options, and only processed with ifort.

cd /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/Linux2_x86_64ifort; ifort -auto -warn notruncated_source -Bstatic -static-intel -c -DF90=1 -DIOAPI_PNCF=1 -DAUTO_ARRAYS=1 -DF90=1 -DFLDMN=1 -DFSTR_L=int -DIOAPI_NO_STDOUT=1 -DAVOID_FLUSH=1 -DBIT32=1  -O3 -unroll -stack_temps -safe_cray_ptr -convert big_endian -assume byterecl  -traceback -xHost                                    -qopenmp       -DAUTO_ARRAYS=1 -DF90=1 -DFLDMN=1 -DFSTR_L=int -DIOAPI_NO_STDOUT=1 -DAVOID_FLUSH=1 -DBIT32=1 -I/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90(34): error #5102: Cannot open include file 'mpif.h'
        INCLUDE "mpif.h"
----------------^
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90(44): error #6683: A kind type parameter must be a compile-time constant.   [MPI_OFFSET_KIND]
    INTEGER( MPI_OFFSET_KIND ), PUBLIC, PARAMETER :: PN_ONE    = 1                  !!  constant, as INTEGER( MPI_OFFSET_KIND )
-------------^
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90(45): error #6683: A kind type parameter must be a compile-time constant.   [MPI_OFFSET_KIND]
    INTEGER( MPI_OFFSET_KIND ), PUBLIC, PARAMETER :: PN_TWO    = 2                  !!  "
-------------^
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90(46): error #6683: A kind type parameter must be a compile-time constant.   [MPI_OFFSET_KIND]
    INTEGER( MPI_OFFSET_KIND ), PUBLIC, PARAMETER :: PN_NAMLEN = NAMLEN3            !!  ", length of name-object
-------------^
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90(47): error #6683: A kind type parameter must be a compile-time constant.   [MPI_OFFSET_KIND]
    INTEGER( MPI_OFFSET_KIND ), PUBLIC, PARAMETER :: PN_MXDLEN = MXDLEN3            !!  " description-line object
-------------^
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90(48): error #6683: A kind type parameter must be a compile-time constant.   [MPI_OFFSET_KIND]
    INTEGER( MPI_OFFSET_KIND ), PUBLIC, PARAMETER :: PN_MXDESC = MXDESC3            !!  " number of history/desc lines
-------------^
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90(49): error #6683: A kind type parameter must be a compile-time constant.   [MPI_OFFSET_KIND]
    INTEGER( MPI_OFFSET_KIND ), PUBLIC, PARAMETER :: PN_DSCLEN = MXDLEN3*MXDESC3    !!  " history and description objects
-------------^
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90(274): error #6404: This name does not have a type, and must have an explicit type.   [MPI_COMM_WORLD]
            CALL MPI_COMM_RANK( MPI_COMM_WORLD, PN_MYPE, IERR )
--------------------------------^
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90(383): error #6404: This name does not have a type, and must have an explicit type.   [MPI_LOGICAL]
            CALL MPI_ALLREDUCE( FLAG, EFLAG, 1, MPI_LOGICAL, MPI_LAND, PN_COL_IO_COMM, IERR )
------------------------------------------------^
/blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90(383): error #6404: This name does not have a type, and must have an explicit type.   [MPI_LAND]
            CALL MPI_ALLREDUCE( FLAG, EFLAG, 1, MPI_LOGICAL, MPI_LAND, PN_COL_IO_COMM, IERR )
-------------------------------------------------------------^
compilation aborted for /blue/mjang/ganghan.kim/CMAQ/ioapi/ioapi-3.2/ioapi/modpdata.F90 (code 1)
make: *** [Makefile:276: modpdata.mod] Error 1

Still, it cannot catch up the mpif.h. Is there any direct link flag for openmp?

Please read the detailed instructions https://cjcoats.github.io/ioapi/AVAIL.html#build in the I/O API Installation Document, playing particular attention to item # 5.
Find out the underlying compiler for your OpenMPI installation, and choose the appropriate Makeinclude.$BIN for that installation.

Also, decide whether you need to enable distributed I/O or not.

If you had been following the instructions, you would not have had “raw” occurrences of either the GNU gfortran nor the Intel ifort compilers…

Thank you. It has some kind of compatible problem. I added the direct including command to the Makeinclude to solve this problem.