Cannot open include file 'mpif.h'

Hi everyone,
I have been compiling the CMAQ_V5.3.2 with Intel Compiler, however, when compiled CCTM, I got the error related to the MPI like that:

Blockquotese_global_min_module.f(75): error #5102: Cannot open include file ‘mpif.h’
include “mpif.h”

The detail of this error is attached in the log file which I included in the below.
Please help me to resolve this problem.
Thanks all,

bldit_cctm.csh (29.9 KB)
config_cmaq.csh (11.0 KB)
Log.txt (154.5 KB)

If you use modules on your system, verify that you are loading the correct MPI module.
Once the module is loaded, use the following command to identify the full path where the mpirun executable is located

which mpirun

The error you are seeing may occur due to an assumption that the MPI include directory is located under

In your case you set
setenv MPI_LIB_DIR /work/apps/intel/mvapich2/2.3.2

So the next thing to check is if the following directory contains the mpi.h

ls /work/apps/intel/mvapich2/2.3.2/include/mpi.h

If the include directory is located in a different place than under the specified MPI_DIR
, then I would comment out the following lines in your config_cmaq.csh

replace lines 204-205

if (   -e $MPI_DIR  ) rm -rf $MPI_DIR
    ln -s $MPI_LIB_DIR $MPI_DIR


## if (   -e $MPI_DIR  ) rm -rf $MPI_DIR
##     ln -s $MPI_LIB_DIR $MPI_DIR

You may also need to go to the following directory on your system to create the links to the include and bin directories

cd /work/users/weather/user/manh/cmaq/Build_CMAQ/Intel_Compiler/CMAQ_v5.3.2_2/lib/x86_64/intel

and verify that the link to mpi library and bin directories are set correctly. If not, you can set it manually

Hi Lizadams,
Thank you for your help,
I have set the directory to the include of MPI library of the bldit_cctm.csh program and this problem is solved.
However, I got another error which is described like that:

ld: Warning: size of symbol bstate3_' changed from 14835740 in pshut3.o to 14835744 in /work/users/weather/user/manh/cmaq/Build_CMAQ/Intel_Compiler/CMAQ_v5.3.2_2/lib/x86_64/intel/ioapi/lib/libioapi.a(initblk3.o) se_data_send_module.o: In function se_data_send_module_mp_se_1d_data_send_’:
/work/users/weather/user/manh/cmaq/Build_CMAQ/Intel_Compiler/CMAQ_v5.3.2_2/CCTM/scripts/BLD_CCTM_v532_intel/se_data_send_module.f:106: undefined reference to `mpi_send_’

All of the compiling process is attached in the log file which I have included in the below.
Please help me to solve this problem.
Thank you very much!
bldit.cctm.txt (156.5 KB)
bldit_cctm.csh (29.9 KB)
config_cmaq.csh (11.0 KB)

It looks like you do not have the mpi library linked
The following output is towards the end of your bldit.cctm.txt

-L/work/users/weather/user/manh/cmaq/Build_CMAQ/Intel_Compiler/CMAQ_v5.3.2_2/lib/x86_64/intel/ioapi/lib -lioapi -L/work/users/weather/user/manh/cmaq/Build_CMAQ/Intel_Compiler/CMAQ_v5.3.2_2/lib/x86_64/intel/netcdff/lib -lnetcdff -L/work/users/weather/user/manh/cmaq/Build_CMAQ/Intel_Compiler/CMAQ_v5.3.2_2/lib/x86_64/intel/netcdf/lib -lnetcdf  -o CCTM_v532.exe

Please edit your config_cmaq.csh change the following line

setenv mpi_lib "-lmpich"


 setenv mpi_lib "-lmpi" #> -lmpich or -lmvapich