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

**URL:** <https://forum.cmascenter.org/t/i-o-api-bin-create-cannot-find-mpif-h-error/5511>\
**Category:** I/O API\
**Created:** [January 13, 2025, 11:19pm UTC](https://forum.cmascenter.org/t/i-o-api-bin-create-cannot-find-mpif-h-error/5511 "2025-01-13T23:19:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ganghan2000](https://avatars.discourse-cdn.com/v4/letter/g/e9bcb4/32.png) [@ganghan2000](https://forum.cmascenter.org/u/ganghan2000)\
**Post date:** [January 13, 2025, 11:19pm UTC](https://forum.cmascenter.org/t/i-o-api-bin-create-cannot-find-mpif-h-error/5511/1 "2025-01-13T23:19:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [January 14, 2025, 12:28pm UTC](https://forum.cmascenter.org/t/i-o-api-bin-create-cannot-find-mpif-h-error/5511/2 "2025-01-14T12:28:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ganghan2000](https://avatars.discourse-cdn.com/v4/letter/g/e9bcb4/32.png) [@ganghan2000](https://forum.cmascenter.org/u/ganghan2000)\
**Post date:** [January 14, 2025, 2:02pm UTC](https://forum.cmascenter.org/t/i-o-api-bin-create-cannot-find-mpif-h-error/5511/3 "2025-01-14T14:02:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [January 14, 2025, 2:24pm UTC](https://forum.cmascenter.org/t/i-o-api-bin-create-cannot-find-mpif-h-error/5511/4 "2025-01-14T14:24:33Z")

</div>

> .`..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)?]

---

<div class="post-metadata">

**Author:** ![ganghan2000](https://avatars.discourse-cdn.com/v4/letter/g/e9bcb4/32.png) [@ganghan2000](https://forum.cmascenter.org/u/ganghan2000)\
**Post date:** [January 14, 2025, 7:12pm UTC](https://forum.cmascenter.org/t/i-o-api-bin-create-cannot-find-mpif-h-error/5511/5 "2025-01-14T19:12:45Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [January 14, 2025, 7:56pm UTC](https://forum.cmascenter.org/t/i-o-api-bin-create-cannot-find-mpif-h-error/5511/6 "2025-01-14T19:56:33Z")

</div>

Please read the detailed instructions [https://cjcoats.github.io/ioapi/AVAIL.html#build](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…

---

<div class="post-metadata">

**Author:** ![ganghan2000](https://avatars.discourse-cdn.com/v4/letter/g/e9bcb4/32.png) [@ganghan2000](https://forum.cmascenter.org/u/ganghan2000)\
**Post date:** [January 14, 2025, 9:09pm UTC](https://forum.cmascenter.org/t/i-o-api-bin-create-cannot-find-mpif-h-error/5511/7 "2025-01-14T21:09:58Z")

</div>

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