Main menu

Navigation

CESM cannot see netcdf

16 posts / 0 new
Last post
ajpearso@...
CESM cannot see netcdf

I'm trying to get CESM 1.0.2 working on a linux cluster with Intel Compiler Suite 13 and OpenMPI 1.6.3 compiled with (and so accessing) Intel. I've been following this guide.

Everything goes smoothly, and I can run $CASE.$MACH.build until the final step where the executable cesm.exe is being built. At this point, the build fails. Viewing the error file, there is no specific compiler error (the final line is "Error" but with no reason), but there are very many (hundreds of) lines which talk about "undefined reference to" and then refer to something which is evidently related to NetCDF. I assume this means that either the compiler can't see NetCDF or the NetCDF library has not been compiled correctly. All of my environmental variables are set correctly.

I've tried this with NetCDF compiled with Intel as in the above guide, and also compiled via the official Intel NetCDF compilation guide. Both compile, but the result is the same in both cases. I've also tried compiling NetCDF with the OpenMPI compiler wrappers, but I couldn't make this work.

I've tried using CESM 1.0.5 as well, but I can't get to the cesm.exe compilation stage because of other problems that I can't resolve.

Does anyone have any suggestions?

ajpearso@...

OK, answered my own question. In the Makefile in $CESM/scripts/ccsm_utils/Build, you need to add the Fortran netcdf library flag "-lnetcdff" in addition to the existing flag "-lnetcdf".

mbs244@...
Hi I've been having exactly this problem for the last two weeks, and have not been able to resolve it. I tried adding the library tag like you suggested, but that didn't work. Where exactly did you add it? Do you have any other details that might be helpful? Thanks a lot!!

Molly Smith
Cornell University

jedwards
Hi Molly, Can you tell us what cesm version you are using, what netcdf library you are trying to link to and the error you are getting.

CESM Software Engineer

mbs244@...
Hi Right, sorry. I am using cesm 1.0.4, trying to link to netcdf4211. Everything builds properly up to the ccsm component, but then it fails. I am attaching the buildlog for that component, but I really don't know how to make heads or tails of it. Thanks!
Attachment: 

Molly Smith
Cornell University

jedwards
mpif90 -o /localdisk/scratch/mbs244/test1/run/ccsm.exe ccsm_comp_mod.o ccsm_driver.o map_atmatm_mct.o map_atmice_mct.o map_atmlnd_mct.o map_atmocn_mct.o map_glcglc_mct.o map_iceice_mct.o map_iceocn_mct.o map_lndlnd_mct.o map_ocnocn_mct.o map_rofocn_mct.o map_rofrof_mct.o map_snoglc_mct.o map_snosno_mct.o mrg_x2a_mct.o mrg_x2g_mct.o mrg_x2i_mct.o mrg_x2l_mct.o mrg_x2o_mct.o mrg_x2s_mct.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_rearr_mod.o seq_rest_mod.o -L/localdisk/scratch/mbs244/test1/lib -latm -llnd -lice -locn -lglc -L/localdisk/scratch/mbs244/test1/lib -lcsm_share -lmct -lmpeu -lpio -L/usr/local/netcdf4211/lib -lnetcdf -L/usr/lib64/openmpi/lib -lmpi
This is your link line. For netcdf 4.2.1.1 there is an additional library that you need to link so you need to add -lnetcdff. For cesm1_0_4 you would add this flag in the Macros file in your case directory. Look for the -lnetcdf and change it to -lnetcdff -lnetcdf

CESM Software Engineer

mbs244@...
I did a search but the Macros file doesn't seem to contain the -lnetcdf flag anywhere. Am I missing something? I'm attaching the file. Thanks!
Attachment: 

Molly Smith
Cornell University

jedwards
Sorry, it's in scripts/ccsm_utils/Build/Makefile. Look for the lines below and add -lnetcdff
# System libraryies (netcdf, mpi, pnetcdf, esmf) 
ifeq ($(strip $(SLIBS)),)
   SLIBS := -L$(LIB_NETCDF) -lnetcdf 
else
   SLIBS += -L$(LIB_NETCDF) -lnetcdf 
endif


CESM Software Engineer

mbs244@...
Hi Sorry I've taken so long to respond; I had an extremely busy few days. I made the modifications in the Makefile script, but the same error still occured. What I find extremely interesting is that even though Makefile was modified in the way you suggested (and I went and checked, it definetly was the modified version), the newest error log didn't change. It still says -L/usr/local/netcdf4211/lib -lnetcdf -L/usr/lib64/openmpi/lib -lmpi without acknowledging the new flag at all. What could be causing this? Thank you so much for your patience! I've attached the Makefile script and new error log.
Attachment: 

Molly Smith
Cornell University

mbs244@...
And here's the other file.
Attachment: 

Molly Smith
Cornell University

jedwards
Hi Molly, Did you create a new case after making this change? If not please try that.

CESM Software Engineer

mbs244@...
I did not, I will give that a try.

Molly Smith
Cornell University

mbs244@...
That did not work either. Alas. Here's the new error log. Thanks again!
Attachment: 

Molly Smith
Cornell University

jedwards
Actually it did work, this is a different error.   You need to figure out what version of these commands your system supports and add the proper -D flags to your Macros.   

mpif90 -o /localdisk/scratch/mbs244/test3/run/ccsm.exe ccsm_comp_mod.o ccsm_driver.o map_atmatm_mct.o map_atmice_mct.o map_atmlnd_mct.o map_atmocn_mct.o map_glcglc_mct.o map_iceice_mct.o map_iceocn_mct.o map_lndlnd_mct.o map_ocnocn_mct.o map_rofocn_mct.o map_rofrof_mct.o map_snoglc_mct.o map_snosno_mct.o mrg_x2a_mct.o mrg_x2g_mct.o mrg_x2i_mct.o mrg_x2l_mct.o mrg_x2o_mct.o mrg_x2s_mct.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_rearr_mod.o seq_rest_mod.o -L/localdisk/scratch/mbs244/test3/lib -latm -llnd -lice -locn -lglc -L/localdisk/scratch/mbs244/test3/lib -lcsm_share -lmct -lmpeu -lpio  -L/usr/local/netcdf4211/lib -lnetcdff -lnetcdf  -L/usr/lib64/openmpi/lib -lmpi  
/localdisk/scratch/mbs244/test3/lib/libcsm_share.a(shr_sys_mod.o): In function `__shr_sys_mod_MOD_shr_sys_chdir':
/localdisk/cesm1_0_4/models/csm_share/shr/shr_sys_mod.F90:152: undefined reference to `chdir_'
/localdisk/scratch/mbs244/test3/lib/libcsm_share.a(shr_sys_mod.o): In function `__shr_sys_mod_MOD_shr_sys_system':
/localdisk/cesm1_0_4/models/csm_share/shr/shr_sys_mod.F90:83: undefined reference to `system_'



CESM Software Engineer

mbs244@...

Do you know where in the Macros I would do this?

Molly Smith
Cornell University

jedwards
This line:


# Note that CPPDEFS is set in Macros.cppdefs CPPDEFS += -DLINUX -DSEQ_$(FRAMEWORK) -DFORTRANUNDERSCORE -DNO_R16 -DNO_SHR_VMATH

CESM Software Engineer

Log in or register to post comments

Who's new

  • bxz125@...
  • yixiaozhang@...
  • dongxia.yang@...
  • 2017301110179@...
  • zhangpengcheng@...