Main menu

Navigation

Error when building a test case on a new machine: undefined reference to MPI and others

1 post / 0 new
chenyzvest@...
Error when building a test case on a new machine: undefined reference to MPI and others

Hi all,

Excuse for taking some of your time.

I am trying to porting a earlier version of CESM, 1.0.4 to a new machine. The compile environment including Fortran compiler, MPI and NetCDF were prepared. The F compiler is ifort, MPI is mpiifort, NetCDF is 4.1.3. The Macros, env_machopt and mkbatch files were modified based on the set of the local machine. Then I create a newcase, configure and build following the instruction on the offical user guide. However, The ccsm build log had hundreds of undefined reference errors, some are from the "nc" and some are from "MPI", I attached some of them here, the full log file was also submitted.

nc4var.c:(.text+0x29b2): undefined reference to `ncmpi_put_vara_uchar'

nc4var.c:(.text+0x29d0): undefined reference to `ncmpi_put_vara_double'

nc4var.c:(.text+0x29ee): undefined reference to `ncmpi_put_vara_float'

nc4var.c:(.text+0x2a0c): undefined reference to `ncmpi_put_vara_int'

nc4var.c:(.text+0x2a2a): undefined reference to `ncmpi_put_vara_short'

nc4var.c:(.text+0x2a48): undefined reference to `ncmpi_put_vara_text'

nc4var.c:(.text+0x2a66): undefined reference to `ncmpi_put_vara_schar'

nc4var.c:(.text+0x2aac): undefined reference to `ncmpi_put_vara_uchar_all'

nc4var.c:(.text+0x2aca): undefined reference to `ncmpi_put_vara_double_all'

nc4var.c:(.text+0x2ae8): undefined reference to `ncmpi_put_vara_float_all'

nc4var.c:(.text+0x2b06): undefined reference to `ncmpi_put_vara_int_all'

nc4var.c:(.text+0x2b21): undefined reference to `ncmpi_put_vara_short_all'

nc4var.c:(.text+0x2b3c): undefined reference to `ncmpi_put_vara_text_all'

 

nc4var.c:(.text+0x2b57): undefined reference to `ncmpi_put_vara_schar_all'

1.0.4/ciesm.model/scripts/intel-esm-soft/lib/libnetcdf.a(liboc_la-http.o): In function `ocfetchurl_file':http.c:(.text+0x52): undefined reference to `curl_easy_setopt'http.c:(.text+0x70): undefined reference to `curl_easy_setopt'http.c:(.text+0x8b): undefined reference to `curl_easy_setopt'http.c:(.text+0xa3): undefined reference to `curl_easy_setopt'http.c:(.text+0xb8): undefined reference to `curl_easy_perform'http.c:(.text+0xe1): undefined reference to `curl_easy_getinfo'http.c:(.text+0xff): undefined reference to `curl_easy_strerror'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPIR_F_FALSE'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Cart_create'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPIX_Comm_failure_get_acked'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Comm_free_keyval'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Comm_get_name'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Info_dup'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Irsend'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Init_thread'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Bcast'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Ssend'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Buffer_attach'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Group_range_incl'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Win_create_dynamic'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_File_iread_at'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPI_Group_translate_ranks'/usr/sw-cluster/mpi2/lib/libmpifort.so: undefined reference to `MPIR_F_MPI_WEIGHTS_EMPTY' 
Then I don't know how to deal with this bug. I checked the solution from climatesight, who used gcc as the compiler (https://climatesight.org/2011/06/16/climate-models-on-ubuntu/):The ccsm build log had hundreds of undefined reference errors as soon as it started to compile fortran. The way I understand it, many of the fortran files reference each other, but gfortran likes to append underscores to user-defined variables, and then it can’t find the file the variable is referencing! You can suppress this using the flag-fno-underscoring.

And it does not work for my case...Does anybody could help me about this? I have been stucked for several days on the debugging. And I really need the version to be worked out recently. Thanks very much!Attached please check the related information.
Paths on the machine:Which ifort:usr/cluster/intel/composer_xe_2013_sp1.4.211/bin/intel64/ifortWhich mpiifort:usr/cluster/mpi2/bin/mpiifortWhich ~/ciesm/ciesm_1.0.4/ciesm.model/scripts/intel-esm-soft/bin/ncdump 

My Macros. file:

#===============================================================================

# The following always need to be set

# SPMD             Whether to build in SPMD mode or not.  [values TRUE FALSE]

# SMP              Set to TRUE to enable building in SMP mode (uses OpenMP).  

# USER_CPPDEFS     CPP definitions (non platform dependent)

#

#===============================================================================

 

# Note that CPPDEFS is set in Macros.cppdefs

CPPDEFS += -DLINUX -DSEQ_$(FRAMEWORK) -DFORTRANUNDERSCORE -DNO_R16 -DNO_SHR_VMATH 

 

ifeq ($(compile_threaded), true)

   CPPDEFS += -DTHREADED_OMP

endif

 

ifeq ($(USE_MPISERIAL),TRUE)

   FC            := ifort

   CC            := icc

else

   FC            := ifort

   CC            := icc

endif

 

#SLIBS += -L$(LIB_NETCDF) -lnetcdff

#=====================================================

# GENERIC_USER

# The netcdf and mpi paths need to be set somewhere.  In CESM, this

# is normally done by setting the NETCDF_PATH and MPICH_PATH

# variables in this Macros file.  But they could also be set in the 

# default user paths, by an explicit addition to the local path 

# in the env_mach_specific file, or via setting NETCDF_PATH 

# and MPICH_PATH environment variables in the env_mach_specific file.  

# Also, review the relative paths of the INC_, LIB_, and MOD_ paths

# below.  Ignore PNETCDF stuff initially, it's not required.

 

ifeq ($(strip $(NETCDF_PATH)),)

   NETCDF_PATH   := ~/ciesm/ciesm_1.0.4/ciesm.model/scripts/intel-esm-soft

endif

INC_NETCDF    := $(NETCDF_PATH)/include

LIB_NETCDF    := $(NETCDF_PATH)/lib

MOD_NETCDF    := $(NETCDF_PATH)/include

ifeq ($(strip $(MPICH_PATH)),)

   MPICH_PATH := /usr/cluster/mpi2

endif

ifeq ($(USE_MPISERIAL),TRUE)

   INC_MPI    := $(CODEROOT)/utils/mct/mpi-serial

   LIB_MPI    := 

else

   LIB_MPI    := $(MPICH_PATH)/lib

   INC_MPI    := $(MPICH_PATH)/include

endif

MPI_LIB_NAME  := mpifort

PNETCDF_PATH  :=

INC_PNETCDF   :=

LIB_PNETCDF   := 

LAPACK_LIBDIR := 

 

#=====================================================

 

CFLAGS        := $(CPPDEFS) 

FXEDFLAGS    := -132 

FREEFLAGS     := -FR

FFLAGS        := $(CPPDEFS) -g -fp-model precise -convert big_endian -assume byterecl -ftz -traceback

FFLAGS_NOOPT  := $(FFLAGS) -O0

FFLAGS_OPT    := -O2

LDFLAGS       := 

AR            := ar

MOD_SUFFIX    := mod

CONFIG_SHELL  :=

 

#===============================================================================

# Set include paths (needed after override for any model specific builds below)

#===============================================================================

 

INCLDIR := -I. 

ifneq ($(strip $(INC_NETCDF)),)

INCLDIR += -I$(INC_NETCDF)

endif

ifneq ($(strip $(MOD_NETCDF)),)

INCLDIR += -I$(MOD_NETCDF)

endif

ifneq ($(strip $(INC_MPI)),)

INCLDIR += -I$(INC_MPI)

endif 

ifneq ($(strip $(INC_PNETCDF)),)

INCLDIR += -I$(INC_PNETCDF)

endif

 

#===============================================================================

# Set model and other specific options

# NOTE - all CPPDEFS options must be defined before this point

#===============================================================================

 

ifeq ($(DEBUG),TRUE)

  FFLAGS       += -CU -check pointers -fpe0 -ftz

  FFLAGS_NOOPT += -CU -check pointers -fpe0 -ftz

else

  FFLAGS += $(FFLAGS_OPT)

endif

 

ifeq ($(compile_threaded), true)

  FFLAGS       += -openmp

  FFLAGS_NOOPT += -openmp

  CFLAGS       += -openmp

  LDFLAGS      += -openmp

endif

 

ifeq ($(strip $(MODEL)),cam)

# These RRTMG files cause a compiler error when using optimization.

# Until mods are made to read the data from files, just remove optimization from

# their compilation.

rrtmg_lw_k_g.o: rrtmg_lw_k_g.f90

$(FC) -c $(CPPDEFS) $(INCLDIR) $(INCS) $(FREEFLAGS) $(FFLAGS_NOOPT) $<

rrtmg_sw_k_g.o: rrtmg_sw_k_g.f90

$(FC) -c $(CPPDEFS) $(INCLDIR) $(INCS) $(FREEFLAGS) $(FFLAGS_NOOPT) $<

endif

 

#=====================================================

# GENERIC_USER

# Options passed to the mct and pio build are set here

 

ifeq ($(MODEL),mct)

        #add arguments for mct configure here

  CONFIG_ARGS += CC="$(CC)" FC="$(FC)" F90="$(FC)" INCLUDEPATH="-I$(INC_MPI)"

endif

 

ifeq ($(MODEL),pio)

  ifneq ($(strip $(PIO_CONFIG_OPTS)),)

    CONFIG_ARGS += $(PIO_CONFIG_OPTS)

  endif 

  CONFIG_ARGS += CC="$(CC)" F90="$(FC)" NETCDF_PATH="$(NETCDF_PATH)" MPI_INC="-I$(INC_MPI)"

endif

#=====================================================

 

 

And the env_machopts file:

#! /bin/csh -f

 

#-------------------------------------------------------------------------------

# GENERIC_USER

# Platform-specific software versions/locations are set here.  This

# might be done via modules or updates to the user PATH.  Some env

# variables might also be set here for use in the Macros file.  Some

# of the things that might be important here are compiler versions or

# mpi and netcdf paths.  Samples are commented out below.

#-------------------------------------------------------------------------------

 

#--- set modules

#source /usr/Modules/init/csh

#module purge

#module load openmpi/1.2.8-intel

#module load netcdf/4.0-intel

#module list

 

#--- set paths

setenv INTEL_PATH /usr/sw-cluster/intel/composer_xe_2013_sp1.4.211/bin

 

#if ($USE_MPISERIAL == "FALSE") then

setenv MPICH_PATH /usr/cluster/mpi2

setenv INC_MPI_PATH /usr/cluster/mpi2

setenv LIB_MPI_PATH /usr/cluster/mpi2

setenv LD_LIBRARY_PATH /usr/cluster/intel/composer_xe_2013_sp1.4.211/compiler

setenv NETCDF_PATH ~/ciesm/ciesm_1.0.4/ciesm.model/scripts/intel-esm-soft

#endif

#setenv PATH ${INTEL_PATH}/fc/11.0.074/bin/intel64:${INTEL_PATH}/cc/11.0.074/bin/intel64:${MPICH_PATH}/bin:${PATH}

#setenv LD_LIBRARY_PATH ${INTEL_PATH}/cc/11.0.074/lib/intel64:${INTEL_PATH}/fc/11.0.074/lib/intel64:${LD_LIBRARY_PATH}

 

#--- set env variables for Macros if needed

#setenv NETCDF_PATH something

 

#-------------------------------------------------------------------------------

# GENERIC_USER

# Machine specific environment variables are set here.  This might be needed

# to set MPI, core file, IO,  memory or many other things.  

#-------------------------------------------------------------------------------

#setenv P4_GLOBMEMSIZE 500000000

 

 

Who's new

  • Nicholas.Davis@...
  • numarsanifa@...
  • bingdian_46@...
  • mxy2832029@...
  • nthg2000@...