CCTM compilation

The log file contains the following error which has prevented the bldmake executable to be created.

mpifort: Command not found.

Please try to use the following command

which mpifort

output on my system is:

/nas/longleaf/apps-dogwood/mpi/gcc_9.1.0/openmpi_4.0.1/bin/mpifort

This will determine if your system has mpifort available on your system

If it is available use the following command to determine what compiler it is referencing

 mpifort --version

output on my system is:

GNU Fortran (GCC) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.

If it isnā€™t found, then you may need to load a module on your system.
Use the command

module list

to determine what modules are available

If you donā€™t have modules available, then please ask your system administrator to install openmpi or, you may need to install it yourself.

Hi~lizadams

Thanks for your reply.

Iā€™ve used the command ā€˜which mpifortā€™, output on my system is:

/usr/bin/which: no mpifort in (/usr/local/bin/bin:/home/cmaq/cmaq_zl/installsf/netcdf_install/hdf5/bin:/usr/local/bin/bin:/home/cmaq/cmaq_zl/installsf/netcdf_install/hdf5/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/cmaq/.local/bin:/home/cmaq/bin:/usr/local/git/bin:/home/cmaq/cmaq_zl/installsf/mpich-install/bin:/usr/local/netcdf4.1.3/bin:/usr/local/netcdf4.1.3/include:/usr/local/netcdf4.1.3/lib:/usr/local/git/bin:/home/cmaq/cmaq_zl/installsf/mpich-install/bin:/usr/local/netcdf4.1.3/bin:/usr/local/netcdf4.1.3/include:/usr/local/netcdf4.1.3/lib)

And then I check the version of my complier using ā€˜gcc -vā€™&ā€™ gfortran -vā€™ :

COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.4.0/lto-wrapper

COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper

So my questions are:

**Do I have to upgrade gcc or/and gfortran to the latest versions? **
Do I need to reinstall the mpich-3.2.1 or install openmpi?
Which libraries need to be reinstalled or compiled?

Kindly help, please.

Hi~ Catalyst2682

I got a similar error as you when compling CCTM:

Error: Syntax error in COMMON statement at (1)
STATE3.EXT:191:27:
Error: Syntax error in COMMON statement at (1)
make: *** [pshut3.o] Error 1
ERROR while running make command

How did you solve this problem?
Kindly help me, please~

Hello @zhuli,

I have sent you a message regarding this.

Regards,

Catalyst

You will need to download and install openmpi if you donā€™t have it installed already on your system.
https://www.open-mpi.org/

Hi,lizadams
Iā€™m trying to compile CCTM with PGI but got an error as follows:

mpifort -c -Mfixed -Mextend -mcmodel=medium -tp px -O3 -I /home/cmaq/MOD/CMAQv5.3/zlpgi_CMAQ/lib/x86_64/pgi/ioapi/lib -I /home/cmaq/MOD/CMAQv5.3/zlpgi_CMAQ/lib/x86_64/pgi/ioapi/include_files -I /home/cmaq/MOD/CMAQv5.3/zlpgi_CMAQ/lib/x86_64/pgi/mpi -I. pio_init.f
PGF90-F-0004-Corrupt or Old Module file /home/cmaq/MOD/CMAQv5.3/zlpgi_CMAQ/lib/x86_64/pgi/ioapi/lib/m3utilio.mod (pio_init.f: 151)
PGF90/x86-64 Linux 19.4-0: compilation aborted
make: *** [pio_init.o] error 2

Could you give me some help?
Thanks a lot.

zhuli

Hi Zhuli,

I have pgi available on our servers, I will install openmpi to try and reproduce the issue that you are seeing.
The error message states that you are using a Corrupt or Old Module file: ioapi/lib/m3utilio.mod.

Can you report the versions of underlying software that you are using to compile CMAQ and confirm that you have used the same pgf90 compiler to build openmpi, netCDF, and I/O API following instructions similar to the following draft tutorial

Also, be sure you are following these instructions once the openmpi, netcdf, netcdff and ioapi libraries are built:

pgf90 --version
mpif90 --version

Also be sure that the paths to the ioapi library are correct under the CMAQv5.3 directory
Here is what I have:
/proj/ie/proj/CMAS/CMAQ/CMAQv5.3_branch_pgi/pgi_19.7_openmpi_4.0.2/lib/x86_64/pgi/ioapi

lib -> /proj/ie/proj/CMAS/CMAQ/CMAQv5.3_branch_pgi/pgi_19.7_openmpi_4.0.2/LIB/ioapi-3.2/Linux2_x86_64_openmpi_4.0.2_pgi_19.7

include_files -> /proj/ie/proj/CMAS/CMAQ/CMAQv5.3_branch_pgi/pgi_19.7_openmpi_4.0.2/LIB/ioapi-3.2/ioapi/fixed_src

Thank you so much, lizadams.

Iā€™ve installed GUN9.1.0 and PGI19.4 on my workstation, and builded netcdf-c-4.7.0, netcdf-f-4.4.5, ioapi3.2 with GUN. Maybe I used PGI because when I ā€œmake checkā€ in installation of netcdf-f, I got an error: Make [2]: pgf77: command not found. So I have to install PGI7.1.6 and then ā€œln -s pgf77 /PGI19.4install/binā€.

Iā€™ve checked the version of OPENMPI which was installed with PGI19.4 is openmpi-3.1.3.

So my questions are:

  1. Do I have to compile CMAQ with GUN only?
  2. Do I need to install OPENMPI with GUN?
  3. What should I do next?

Appreciate your help.
Zhuli

Hi Zhuli,

In general, it is best not to mix compilers. If you are using GNU 9.1.0, then stick with that the whole way, to build everything.
For the make check step, you can set the F77 compiler to use the F90 compiler.

Or, if you have the PGI compiler, then use that for building all of the libraries.

If it is available on your server, use the module load command to set up your environment for the compiler, as the paths are automatically set up, along with the LD_LIBRARY_PATH for that compiler. If you donā€™t have the module load command option for both the compiler, and the openmpi layer, you may need to edit your .cshrc to add the paths so that when you run the configure command that it picks up the correct compiler.

For instance, the command ā€˜module showā€™ allows you to see all of the environment variables that are set by default when you load that module.
module show openmpi_4.0.1/gcc_9.1.0

/nas/longleaf/apps-dogwood/lmod/modulefiles/Core/openmpi_4.0.1/gcc_9.1.0.lua:

whatis(ā€œSet up environment for OPENMPI 4.0.1 and GCC 9.1.0 compiler ā€œ)
family(ā€œmpiā€)
load(ā€œgcc/9.1.0ā€)
setenv(ā€œMVAPICH_HOMEā€,ā€/nas/longleaf/apps-dogwood/mpi/gcc_9.1.0/openmpi_4.0.1ā€)
setenv(ā€œMPICH_HOMEā€,"/nas/longleaf/apps-dogwood/mpi/gcc_9.1.0/openmpi_4.0.1")
setenv(ā€œMPI_HOMEā€,"/nas/longleaf/apps-dogwood/mpi/gcc_9.1.0/openmpi_4.0.1")
prepend_path(ā€œPATHā€,"/nas/longleaf/apps-dogwood/mpi/gcc_9.1.0/openmpi_4.0.1/bin")
prepend_path(ā€œPATHā€,"/nas/longleaf/apps/gcc/9.1.0/bin")
prepend_path(ā€œLD_LIBRARY_PATHā€,"/nas/longleaf/apps-dogwood/mpi/gcc_9.1.0/openmpi_4.0.1/lib")
prepend_path(ā€œLD_LIBRARY_PATHā€,"/nas/longleaf/apps/gcc/9.1.0/lib64")
prepend_path(ā€œLD_LIBRARY_PATHā€,"/nas/longleaf/apps/gcc/9.1.0/lib")
prepend_path(ā€œMANPATHā€,"/nas/longleaf/apps-dogwood/mpi/gcc_9.1.0/openmpi_4.0.1/share/man")
prepend_path(ā€œINCLUDEā€,"/nas/longleaf/apps-dogwood/mpi/gcc_9.1.0/openmpi_4.0.1/include")
prepend_path(ā€œCPATHā€,"/nas/longleaf/apps-dogwood/mpi/gcc_9.1.0/openmpi_4.0.1/include")
help([[ openmpi_gcc/9.1.0 module
****************************************************

      This module sets up the following environment

]])

Iā€™m not sure about ioapi, because I used make build, but other libraries and WRF installed with the same compilers.

Hello @Catalyst2682,
Could you please send me the same message?
I have a same problem like:
STATE3.EXT:174.27:
Included at pshut3.F:53:

    COMMON  / BSTATE3 /                                             &
                       1

Error: Syntax error in COMMON statement at (1)
STATE3.EXT:191.27:
Included at pshut3.F:53:

    COMMON  / CSTATE3 /                                             &
                       1

Error: Syntax error in COMMON statement at (1)
make: *** [pshut3.o] Error 1
ERROR while running make command

Could you give some help?
Thanks a lot!
Allen

See this section of the I/O API installation guide: https://cjcoats.github.io/ioapi/AVAIL.html#cmaq:

NOTE for users of CMAQ and SMOKE

According to the ISO Fortran Standard, there are two ā€œsource formatsā€ for Fortran source code ā€“ the older ( f77 ) ā€œfixedā€ format with code in columns 7-72 and continuation markers in column 6, and the ( f90 ) ā€œfreeā€ format, with source in columns 1-132 and ampersand (ā€œ&ā€) for trailing continuation markers, as well as a specification for code which is acceptable to both forms.

Since it is used by various models that use ā€œfreeā€ format, the I/O API carefully follows the Standard in this regard, and uses the ISO-app[roved ā€œboth-formā€ format for its Fortran INCLUDE files.

Some of the modelsā€”in particular, CMAQ and SMOKE however, do notā€”instead using a ā€œfixed-132ā€ format. The I/O API Makefile has a way of dealing with this; the commands

cd /ioapi
make fixed_src
will create a new directory ioapi/fixed_src and populate it with copies of the INCLUDE files that have been edited to work with the non-Standard ā€œfixed-132ā€ format. You will need to use these INCLUDE files with CMAQ and SMOKE.

1 Like

Thank you for reply, but It didnā€™t succeed.
After I make fixed_src, I go back to compile CCTM. It still have the same error message.
Could you please give some advise for this situation?
Thank a lot!
Allen

You have to use those INCLUDE-files in your CMAQ build.

2 Likes

I copy the .EXT files to INCLUDE-files location, and I passed the error.
Successfully compiling CCTM.
Thanks a lot!

Allen

1 Like

@Allen
I am sorry for the late response, I just got your message on this thread.
I am glad youā€™ve compiled it successfully.

Cheers and regards,

Catalyst

Thanks man issue solved tubemate mobdro

Have you figure out this problem? I meet the same problem.
distr_env.c(36): catastrophic error: cannot open source file ā€œmpi.hā€
#include ā€œmpi.hā€
^

compilation aborted for distr_env.c (code 4)
make: *** [distr_env.o] Error 4
ERROR while running make command

Thank you

[General rule: include the full text of the compile-line at which the error occurred.]

Is the compiler mpicc?

If not, it should be.

If so, it indicates a mis-installation of your MPI ā€“ mpicc and mpif90 are really wrappers around other ā€œconventionalā€ compilers, that know about MPI include-files, libraries, etc., and use that knowledge to set up and then execute the conventional compilers, and this ā€œcannot openā€ indicates that either MPI is not correctly installed or else that something is mucking around with the compile-flags to prevent mpicc from working correctly.

And without the text of the compile-line, I donā€™t have a clue which.