PGF90-F-0004-Unable to open MODULE file cam_history_support

Dear PGI experts

I am trying to compile the CESM1.0.3 climate model
with pgfortran 11.7.
I used pgfortran 11.7 to build OpenMPI 1.4.4, then I use the
corresponding mpif90 compiler wrapper to compile CESM1.0.3.
The OS is CentOS 5.2 on AMD x86_64 ‘Shanghai’.
The compilation fails.
I am puzzled, because the same code compiles with Intel ifort 10.1.017
[and same OpenMPI 1.4.4].

Here are the compilation command that fails and the error message:

/home/sw/openmpi/1.4.4/gnu-4.1.2-pgi-11.7/bin/mpif90 -c -I. -I/home/sw/netcdf3/3.6.3/gnu-4.1.2-pgi-11.7/include -I/home/sw/netcdf3/3.6.3/gnu-4.1.2-pgi-11.7/include -I. -I/home/gus/src/CESM1.0/cesm1_0_3_working_copy/scripts/F_8p_gp/SourceMods/src.drv -I/home/gus/src/CESM1.0/cesm1_0_3_working_copy/models/drv/driver -I/scratch4/gus/runs/cesm-1.0.3/F_8p_gp/lib/include -DMCT_INTERFACE -DHAVE_MPI -DCO2A -DLINUX -DSEQ_ -DFORTRANUNDERSCORE -DNO_R16 -DNO_SHR_VMATH -DLDEO_EDDY_STAT -i4 -r8 -Mextend -byteswapio -Mflushz -tp=shanghai-64 -fast -Mfprelaxed -free /home/gus/src/CESM1.0/cesm1_0_3_working_copy/models/drv/driver/ccsm_comp_mod.F90
pgfortran-Warning-Unknown switch: -free
PGF90-F-0004-Unable to open MODULE file cam_history_support.mod (/home/gus/src/CESM1.0/cesm1_0_3_working_copy/models/drv/driver/ccsm_comp_mod.F90: 39)
PGF90/x86-64 Linux 11.7-0: compilation aborted
gmake: *** [ccsm_comp_mod.o] Error 2

I presume ‘39’ refers to the failing line on the source code.
However, line 39 of ccsm_comp_mod.F90 doesn’t really point to the module
in the error message [cam_history_support].
It points to another module [shr_orb_mod, which is actually in one of the
include directories in the compilation command line, ‘…/lib/include’].
See:

$ cat -n /home/gus/src/CESM1.0/cesm1_0_3_working_copy/models/drv/driver/ccsm_comp_mod.F90 | head -n 40|tail -n 3
38 use shr_cal_mod, only: shr_cal_date2ymd
39 use shr_orb_mod, only: shr_orb_params
40 use mct_mod ! mct_ wrappers for mct lib

Am I missing something simple here?

Thank you for your help.

Gus Correa

Hi Gus,

This error means that the compiler can’t find the module file for the corresponding “use” statement. If the module is not in the same directory as the source file that uses it, you need use either a the “-I” or "-module " flag to tell the compiler where to look for it.

It points to another module [shr_orb_mod, which is actually in one of the
include directories in the compilation command line, ‘…/lib/include’].

This indicates that the missing mod file is used by the shr_orb_mod module or one of it decedents. Can you determine where the cam_history_support.mod file is located or which file it’s defined in?

pgfortran-Warning-Unknown switch: -free

FYI, “-free” should be “-Mfree”. Though, free format is the default for “.F90” files, so you could remove this flag as well.

Hope this helps,
Mat

Hi Mat

Thank you for your help and prompt answer.

Yes, I also thought that the chain of module use might be
missing an include directory.
However, I could not confirm that this is the case.

I list the module use chain for shr_orb_mod below.
The chain doesn’t seem to get to the cam_history_support module.
Actually the latter is part of the atmosphere model,
whereas the former is a in a group of source code files that
are shared by all CESM components [atmosphere, ocean, land, etc].
I guess the ‘shr’ code and modules are self-contained, and do not
refer to the modules in specific climate components [atmosphere,
ocean, etc], exactly to prevent a very involved list of module use
dependencies.

\

  1. shr_orb_mod uses these modules:

MODULE shr_orb_mod

use shr_kind_mod
use shr_sys_mod
use shr_const_mod
use shr_log_mod, only: s_loglev => shr_log_Level
use shr_log_mod, only: s_logunit => shr_log_Unit

IMPLICIT none

  1. shr_kind_mod is self-contained, doesn’t use any modules.

  2. shr_const_mod only uses shr_kind_mod.

  3. shr_log_mod only uses shr_kind_mod.

  4. shr_sys_mod uses these modules:

MODULE shr_sys_mod

use shr_kind_mod ! defines real & integer kinds
use shr_mpi_mod ! wraps MPI layer
use shr_log_mod, only: s_loglev => shr_log_Level
use shr_log_mod, only: s_logunit => shr_log_Unit

implicit none

  1. shr_mpi_mod uses these modules:

Module shr_mpi_mod

!-------------------------------------------------------------------------------
! PURPOSE: general layer on MPI functions
!-------------------------------------------------------------------------------

use shr_kind_mod
use shr_log_mod, only: s_loglev => shr_log_Level
use shr_log_mod, only: s_logunit => shr_log_Unit

implicit none


And the module use chain closes here, with no reference
to the cam_history_support module.

Actually, cam_history_support module does exist, was compiled before,
along with all the atmosphere code, but is located in a different
include directory.


Somehow Intel ifort 10.1.017 compiles the CESM code with the same
build scripts, same compilation commands,
and the same list of include directories that I sent you before.

The CESM code is quite large, and I wonder if pgfortran may have trouble
with the large number of symbols it has to handle,
or perhaps memory [the machine has 32GB RAM, though].

I just tried to compile it with the old pgf90 8.0-4 and it fails with an
‘internal compiler error’ before that point [during the
compilation of the land model].


Thank you.
Gus Correa

PS - Yes, I did change -free to -Mfree to avoid the warning. Thank you.

Hi Gus,

I downloaded CESM 1.0.3 and don’t see anything obvious. A few lines down, I do see that the “atm_comp_mct” module does use cam_history_support so it might be as simple as the compiler is off a few line numbers. This would be abnormal and I have not seen it before, but it is possible.

Though, the line number is more of a red herring. The question is why can’t the module file be found. First, I’d try and see if the exists, and if so, then try adding the “-I” flag. A more likely scenario is that the module did not get built. Can you look in your build logs to see if there are any other errors or if you didn’t build CAM?

Finally, can you walk me through the steps you did to build CESM? If I can recreate the error, then it will be easier to diagnose.

Thanks,
Mat