Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

CESM regional case not building

When I am trying to build a regional case. It is showing some error that I couldn't understand. please find the CESM build log.
 

Attachments

  • cesm_bldlog.txt
    101.5 KB · Views: 6

mlevy

Michael Levy
CSEG and Liaisons
Staff member
Your build is trying to link with pnetcdf, but not with netcdf. Note this line right before the errors (I modified the spacing a little bit for slightly better readability):

Code:
mpif90  -o /home/user/Documents/CESM_Ubuntu/cesm-port-master/Cases/CLM_spinup/workspace/regional/bld/cesm.exe ccsm_comp_mod.o 
ccsm_driver.o mrg_mod.o seq_avdata_mod.o seq_diag_mct.o seq_domain_mct.o seq_flux_mct.o seq_frac_mct.o seq_hist_mod.o seq_map_esmf.o 
seq_map_mod.o seq_mctext_mod.o seq_rest_mod.o  
-L/home/user/Documents/CESM_Ubuntu/cesm-port-master/Cases/CLM_spinup/workspace/regional/bld/lib/ -latm  
-L/home/user/Documents/CESM_Ubuntu/cesm-port-master/Cases/CLM_spinup/workspace/regional/bld/lib/ -lice  
-L/home/user/Documents/CESM_Ubuntu/cesm-port-master/Cases/CLM_spinup/workspace/regional/bld/lib/ -llnd  
-L/home/user/Documents/CESM_Ubuntu/cesm-port-master/Cases/CLM_spinup/workspace/regional/bld/lib/ -locn  
-L/home/user/Documents/CESM_Ubuntu/cesm-port-master/Cases/CLM_spinup/workspace/regional/bld/lib/ -lrof  
-L/home/user/Documents/CESM_Ubuntu/cesm-port-master/Cases/CLM_spinup/workspace/regional/bld/lib/ -lglc  
-L/home/user/Documents/CESM_Ubuntu/cesm-port-master/Cases/CLM_spinup/workspace/regional/bld/lib/ -lwav 
-L/home/user/Documents/CESM_Ubuntu/cesm-port-master/Cases/CLM_spinup/workspace/regional/bld/gnu/openmpi/nodebug/nothreads/MCT/noesmf/a1l1r1i1o1g1w1/csm_share -lcsm_share 
-L/home/user/Documents/CESM_Ubuntu/cesm-port-master/Cases/CLM_spinup/workspace/regional/bld/gnu/openmpi/nodebug/nothreads/lib -lpio -lgptl -lmct -lmpeu 
-L/home/user/anaconda3/envs/ncl_stable/lib -L/usr/lib -lpnetcdf -L/usr -llapack -lblas -L/usr/lib -lmpi  
-L/home/user/Documents/Build_WRF/LIBRARIES/grib2/lib

-L/usr/lib -lpnetcdf is looking for libpnetcdf.a in /usr/lib but you also need to specify the location of libnetcdf.a and libnetcdff.a. What version of CESM are you using? Did you set up config_compilers yourself? You may need a block like

Code:
  <SLIBS>
    <append> -L${NETCDF_PATH}/lib -lnetcdf -lnetcdff </append>
  </SLIBS>
 
Tq for the reply Michael,
I am trying to work with CESM along with DART. For the same reason, I am trying to run CESM 1.2.2 in my Ubuntu machine just for testing things out. I am trying a very small regional case/PTCLM case in my ubuntu machine. We have got our own HPC where I need to set the model up. Please can you check whether I have ported properly? I am hereby enclosing my config_compilers.xml and config_machines.xml files respectively.



XML:
<?xml version="1.0"?>
<config_compilers>

<!--
===========================
This file defines compiler flags for building CESM.  General flags are listed first
followed by flags specific to particular operating systems, followed by particular machines.

More general flags are replaced by more specific flags.
Flags of the sort ADD_FLAG indicate that the field should be appended to an already existing FLAG definition. 

Attributes indicate that an if clause should be added to the Macros so that these flags are added
only under the conditions described by the attribute(s).

The env_mach_specific file may set environment variables or load modules which set environment variables
which are then  used in the Makefile.   For example the NETCDF_PATH on many machines is set by a module.

Do not use variables CPPDEFS and SLIBS here, instead use ADD_CPPDEFS and ADD_SLIBS

========================================================================
 Serial/MPI compiler specification
========================================================================

SCC   and  SFC specifies the serial compiler
MPICC and  MPICC specifies the mpi compiler

if $MPILIB is set to mpi-serial then
   CC = $SCC   
   FC = $SFC 
   MPICC = $SCC
   MPIFC = $SFC
   INC_MPI = $(CODEROOT)/utils/mct/mpi-serial


========================================================================
 Options for including C++ code in the build
========================================================================

SUPPORTS_CXX (TRUE/FALSE): Whether we have defined all the necessary
settings for including C++ code in the build for this compiler (or
this compiler/machine combination). See below for a description of the
necessary settings.

The following are required for a compiler to support the inclusion of
C++ code:

SCXX: serial C++ compiler

MPICXX: mpi C++ compiler

CXX_LINKER (CXX/FORTRAN): When C++ code is included in the build, do
we use a C++ or Fortran linker?

In addition, some compilers require additional libraries or link-time
flags, specified via CXX_LIBS or CXX_LDFLAGS, as in the following
examples:

<CXX_LIBS> -L/path/to/directory -lfoo </CXX_LIBS>

or

<CXX_LDFLAGS> -cxxlib </CXX_LDFLAGS>

Note that these libraries or LDFLAGS will be added on the link line,
regardless of whether we are using a C++ or Fortran linker. For
example, if CXX_LINKER=CXX, then the above CXX_LIBS line should
specify extra libraries needed when linking C++ and fortran code using
a C++ linker. If CXX_LINKER=FORTRAN, then the above CXX_LDFLAGS line
should specify extra LDFLAGS needed when linking C++ and fortran code
using a fortran linker.

These should NOT be specified via <ADD_SLIBS USE_CXX="true"> or
<ADD_LDFLAGS USE_CXX="true">, because those mess up the configure step
for mct, etc.


===========================
-->
<!-- Define default values that can be overridden by specific
     compilers -->
<compiler>
  <SUPPORTS_CXX>FALSE</SUPPORTS_CXX>
</compiler>

<compiler COMPILER="gnu">
  <!-- http://gcc.gnu.org/onlinedocs/gfortran/ -->
  <ADD_CPPDEFS> -DFORTRANUNDERSCORE -DNO_R16</ADD_CPPDEFS>
  <ADD_CFLAGS compile_threaded="true"> -fopenmp </ADD_CFLAGS>
  <ADD_FFLAGS compile_threaded="true"> -fopenmp </ADD_FFLAGS>
  <ADD_LDFLAGS compile_threaded="true"> -fopenmp </ADD_LDFLAGS>
  <ADD_CMAKE_OPTS MODEL="cism"> -D CISM_GNU=ON </ADD_CMAKE_OPTS>
  <FIXEDFLAGS>  -ffixed-form </FIXEDFLAGS>
  <FREEFLAGS> -ffree-form </FREEFLAGS>
  <ADD_FFLAGS DEBUG="TRUE"> -g -Wall </ADD_FFLAGS>
  <!-- -ffree-line-length-none and -ffixed-line-length-none need to be in FFLAGS rather than in FIXEDFLAGS/FREEFLAGS
       so that these are passed to cmake builds (cmake builds don't use FIXEDFLAGS and FREEFLAGS). -->
  <FFLAGS> -O -fconvert=big-endian -ffree-line-length-none -ffixed-line-length-none </FFLAGS>
  <FFLAGS_NOOPT> -O0 </FFLAGS_NOOPT>
  <FC_AUTO_R8> -fdefault-real-8 </FC_AUTO_R8>
  <SFC> gfortran </SFC>
  <SCC> gcc </SCC>
  <SCXX> g++ </SCXX>
  <MPIFC> mpif90 </MPIFC>
  <MPICC> mpicc  </MPICC>
  <MPICXX> mpicxx </MPICXX>
  <CXX_LINKER>FORTRAN</CXX_LINKER>
  <SUPPORTS_CXX>TRUE</SUPPORTS_CXX>
</compiler>

<compiler MACH="userdefined">
  <NETCDF_PATH> USERDEFINED_MUST_EDIT_THIS</NETCDF_PATH>
  <PNETCDF_PATH></PNETCDF_PATH>
  <ADD_SLIBS># USERDEFINED $(shell $(NETCDF_PATH)/bin/nc-config --flibs)</ADD_SLIBS> 
  <ADD_CPPDEFS></ADD_CPPDEFS>
  <CONFIG_ARGS></CONFIG_ARGS>
  <ESMF_LIBDIR></ESMF_LIBDIR>
  <MPI_LIB_NAME></MPI_LIB_NAME>
  <MPI_PATH></MPI_PATH>
</compiler>

<compiler MACH="liyibo">
  <!-- default install location /usr -->
  <NETCDF_PATH>$NETCDF_PATH</NETCDF_PATH>
  <PNETCDF_PATH>/usr</PNETCDF_PATH>
  <ADD_SLIBS>$(shell ${NETCDF_PATH}/bin/nc-config --flibs)</ADD_SLIBS>
  <ADD_FFLAGS>-fno-range-check</ADD_FFLAGS>
  <MPI_LIB_NAME>mpi</MPI_LIB_NAME>
  <MPI_PATH>/usr</MPI_PATH>
  <LAPACK_LIBDIR>/usr</LAPACK_LIBDIR>
</compiler>

</config_compilers>

XML:
<?xml version="1.0"?>

<config_machines>

<!--

 ===============================================================
 COMPILER and COMPILERS
 ===============================================================
 If a machine supports multiple compilers - then
  - the settings for COMPILERS should reflect the supported compilers
    as a comma separated string
  - the setting for COMPILER should be the default compiler
    (which is one of the values in COMPILERS)

 ===============================================================
 MPILIB and MPILIBS
 ===============================================================
 If a machine supports only one MPILIB is supported - then
 the setting for  MPILIB and MPILIBS should be blank ("")
 If a machine supports multiple mpi libraries (e.g. mpich and openmpi)
  - the settings for MPILIBS should reflect the supported mpi libraries
    as a comma separated string

 The default settings for COMPILERS and MPILIBS is blank (in config_machines.xml)

 Normally variable substitutions are not made until the case scripts are run, however variables
 of the form $ENV{VARIABLE_NAME} are substituted in create_newcase from the environment
 variable of the same name if it exists.

 NOTE: The variable CESMSCRATCHROOT must be fully resolved before a case is built so cannot
            contain other variables defined in cesm.

-->
<machine MACH="userdefined">
        <DESC>User Defined Machine</DESC>                                 <!-- can be anything -->
        <OS>USERDEFINED_required_macros</OS>                              <!-- LINUX,Darwin,CNL,AIX,BGL,BGP -->
        <COMPILERS>intel,ibm,pgi,pathscale,gnu,cray,lahey</COMPILERS>     <!-- intel,ibm,pgi,pathscale,gnu,cray,lahey -->
        <MPILIBS>openmpi,mpich,mpt,mpt,ibm,mpi-serial</MPILIBS>                <!-- openmpi, mpich, ibm, mpi-serial -->
        <CESMSCRATCHROOT>USERDEFINED_required_build</CESMSCRATCHROOT>                     <!-- complete path to the 'scratch' directory -->
        <RUNDIR>USERDEFINED_required_build</RUNDIR>                       <!-- complete path to the run directory -->
        <EXEROOT>USERDEFINED_required_build</EXEROOT>                     <!-- complete path to the build directory -->
        <DIN_LOC_ROOT>USERDEFINED_required_build</DIN_LOC_ROOT>           <!-- complete path to the inputdata directory -->
        <DIN_LOC_ROOT_CLMFORC>USERDEFINED_optional_build</DIN_LOC_ROOT_CLMFORC> <!-- path to the optional forcing data for CLM (for CRUNCEP forcing) -->
        <DOUT_S>FALSE</DOUT_S>                                            <!-- logical for short term archiving -->
        <DOUT_S_ROOT>USERDEFINED_optional_run</DOUT_S_ROOT>               <!-- complete path to a short term archiving directory -->
        <DOUT_L_MSROOT>USERDEFINED_optional_run</DOUT_L_MSROOT>           <!-- complete path to a long term archiving directory -->
        <CCSM_BASELINE>USERDEFINED_optional_run</CCSM_BASELINE>           <!-- where the cesm testing scripts write and read baseline results -->
        <CCSM_CPRNC>USERDEFINED_optional_test</CCSM_CPRNC>                <!-- path to the cprnc tool used to compare netcdf history files in testing -->
        <BATCHQUERY>USERDEFINED_optional_run</BATCHQUERY>
        <BATCHSUBMIT>USERDEFINED_optional_run</BATCHSUBMIT>
        <SUPPORTED_BY>USERDEFINED_optional</SUPPORTED_BY>
        <GMAKE_J>1</GMAKE_J>
        <MAX_TASKS_PER_NODE>USERDEFINED_required_build</MAX_TASKS_PER_NODE>
</machine>

<machine MACH="liyibo">
        <DESC>Ubuntu Server 16.04 LTS</DESC>
        <OS>LINUX</OS>
        <COMPILERS>gnu</COMPILERS>
        <MPILIBS>openmpi</MPILIBS>
        <!-- default install location $APP -->
        <CESMSCRATCHROOT>$ENV{APP}/workspace/scratch</CESMSCRATCHROOT>
        <RUNDIR>$ENV{APP}/workspace/$CASE/run</RUNDIR>
        <EXEROOT>$ENV{APP}/workspace/$CASE/bld</EXEROOT>
        <DIN_LOC_ROOT>$ENV{APP}/inputdata</DIN_LOC_ROOT>
        <DIN_LOC_ROOT_CLMFORC>$ENV{APP}/inputdata/atm/datm7</DIN_LOC_ROOT_CLMFORC>
        <DOUT_S_ROOT>$ENV{APP}/archive/$CASE</DOUT_S_ROOT>
        <GMAKE>make</GMAKE>
        <GMAKE_J>1</GMAKE_J>
        <MAX_TASKS_PER_NODE>8</MAX_TASKS_PER_NODE>
</machine>

</config_machines>
 
Top