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

mct build failed

bdavis@usgs_gov

New Member
openmpi has been rebuilt with intel development suite.I feel like I am spinning out of control, just attempting the setting of random environment variables.  I am not a novice. I now get:d /dev/shm/bdavis/cesm/mct;          /data/bdavis/software/projects/CESM_1.2.1/cesm1_2_1/models/utils/mct/configure  CC="" FC="" MPICC="" MPIFC="" FCFLAGS="  -I.  -I/dev/shm/bdavis/cesm/pio -I/usr/local/bin/include -I/usr/local/bin/include -I/dev/shm/bdavis/cesm/mct/mct -I/dev/shm/bdavis/cesm/mct/mpeu -I/dev/shm/bdavis/cesm/pio -I/dev/shm/bdavis/cesm/gptl -I/data/bdavis/software/projects/CESM_1.2.1/cesm1_2_1/models/utils/pio -I/dev/shm/bdavis/cesm/lib/include" CPPDEFS=" -DLinux  -DMCT_INTERFACE -DHAVE_MPI -DLinux -DCPRMPIF90 " CFLAGS=" -DLinux  -DMCT_INTERFACE -DHAVE_MPI -DLinux -DCPRMPIF90  -I.. -I.  -I/dev/shm/bdavis/cesm/pio -I/usr/local/bin/include -I/usr/local/bin/include -I/dev/shm/bdavis/cesm/mct/mct -I/dev/shm/bdavis/cesm/mct/mpeu -I/dev/shm/bdavis/cesm/pio -I/dev/shm/bdavis/cesm/gptl -I/data/bdavis/software/projects/CESM_1.2.1/cesm1_2_1/models/utils/pio -I/dev/shm/bdavis/cesm/lib/include" NETCDF_PATH=/usr/local/bin LDFLAGS="" LIBS="-L/usr/local/lib -lnetcdff -lnetcdf -lopen-pal.so.4"   --srcdir /data/bdavis/software/projects/CESM_1.2.1/cesm1_2_1/models/utils/mctchecking for cc... ccchecking whether the C compiler works... noconfigure: error: in `/dev/shm/bdavis/cesm/mct':configure: error: C compiler cannot create executablesSee `config.log' for more detailsgmake: *** [/dev/shm/bdavis/cesm/mct/Makefile.conf] Error 77cp: cannot stat `Makefile.conf': No such file or directoryMakefile:4: Makefile.conf: No such file or directorygmake: *** No rule to make target `Makefile.conf'.  Stop. 
 

jedwards

CSEG and Liaisons
Staff member
Have you successfully run the hello_world example?     In your latest log you haves/CESM_1.2.1/cesm1_2_1/models/utils/mct/configure
 CC="" FC="" MPICC="" MPIFC="" FCFL

If you are using the intel compiler CC=icc, FC=ifort, MPICC=mpicc, MPIFC=mpif90
if you had carefully followed the porting instructions in the users manual these would have been defined for you.
 

bdavis@usgs_gov

New Member
It would be useful to have examples that work forenv_build.xmlenv_mach_pes.xmlenv_run.xmlenv_mach_specificMacros however none come with the distribution.  Changing the 8 7 variables listed in the User Guide are not enough.  There are multiple other variables which still need to be defined, but I do not know which ones are important, which ones are not, and what the syntax should be for each.  For example: "...set NETCDF_PATH to the path of the netcdf directory".  Does this mean the path the the netCDF libs? or the netCDF executables? 
 

jedwards

CSEG and Liaisons
Staff member
You can generate examples of all of these files by creating a case for any supported machine.  
 

bdavis@usgs_gov

New Member
The user gude states to:3. Build the case> ./test1.userdefined.build However, no file "test1.userdefined.build" gets created by cesm_setup after create_newcase -mach userdefined, only test1.build.
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
Hi Brian,

To try to help you through this, I created two cases on a machine supported by CESM (yellowstone), one using the CESM-defined machine and one as a userdefined machine:

1) ./create_newcase -case ~/projects/cases/test.yellowstone -compset F -res f19_g16 -mach yellowstone

2) ./create_newcase -case ~/projects/cases/test.userdefined -compset F -res f19_g16 -mach userdefined

I then looked at settings in (1) to determine how to define variables in (2). Starting from the top directory of a clean checkout of CESM 1.2.1 (because I thought I saw that flag in some of your error messages), here are the steps I took to be able to build test.userdefined:

* Open http://www.cesm.ucar.edu/models/cesm1.2/cesm/doc/usersguide/x1745.html for reference

(i) Create the new case

$ cd $CESM1.2.1/scripts
$ ./create_newcase -case ~/projects/cases/test.userdefined -compset F -res f19_g16 -mach userdefined

(ii) Run cesm_setup

$ cd ~/projects/cases/test.userdefined
$ ./cesm_setup
ERROR: must set xml variable OS to generate Macros file
ERROR: must set xml variable MPILIB to build the model
ERROR: must set xml variable RUNDIR to build the model
ERROR: must set xml variable DIN_LOC_ROOT to build the model
ERROR: must set xml variable COMPILER to build the model
ERROR: must set xml variable EXEROOT to build the model
ERROR: must set xml variable MAX_TASKS_PER_NODE to build the model

(iii) Define all the variables listed in the error messages above

$ ./xmlchange OS=LINUX
$ ./xmlchange MPILIB=mpich2
$ ./xmlchange RUNDIR=/glade/scratch/mlevy/test.userdefined/run
$ ./xmlchange DIN_LOC_ROOT=/glade/p/cesmdata/cseg/inputdata
$ ./xmlchange COMPILER=intel
$ ./xmlchange EXEROOT=/glade/scratch/mlevy/test.userdefined/bld
$ ./xmlchange MAX_TASKS_PER_NODE=30

(iv) re-run cesm setup

$ ./cesm_setup
[ ... lots of output, success! ]

(v) edit env_mach_specific

Yellowstone uses modules, so much of this involved loading the correct version of compilers, netcdf, ESMF tools, etc. I think loading the netcdf and pnetcdf modules defined environment variables that I refer to in the Macros file. I also set some MP_ environment variables.

(vi) edit Macros

$ diff Macros.orig Macros
9,10d8
< SLIBS+=# USERDEFINED $(shell $(NETCDF_PATH)/bin/nc-config --flibs)
<
13,14d10
< CONFIG_ARGS:=
<
19,20d14
< ESMF_LIBDIR:=
<
31,33c25
< MPICC:= mpicc 
<
< MPICXX:= mpicxx
---
> MPICC:= mpiicc 
35c27
< MPIFC:= mpif90
---
> MPICXX:= mpiicpc
37c29
< MPI_LIB_NAME:=
---
> MPIFC:= mpiifort
39c31
< MPI_PATH:=
---
> NETCDF_PATH:=$(NETCDF)
41c33
< NETCDF_PATH:= USERDEFINED_MUST_EDIT_THIS
---
> PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs
43c35
< PNETCDF_PATH:=
---
> PNETCDF_PATH:=$(PNETCDF)

(vii) Build

$ ./test.userdefined.build
[lots of output]
 CESM BUILDEXE SCRIPT HAS FINISHED SUCCESSFULLY
-------------------------------------------------------------------------

 

bdavis@usgs_gov

New Member
Hi Michael,This is very helpful, and I appreciate your efforts in helping.I have been gone for a couple of weeks (you're welcome).However, I still don't understand the syntax of some things.
Your example Macro differences show you changed:NETCDF_PATH:=toNETCDF_PATH:=${NETCDF)What is the value expected for $NETCDF environment variable?  The path to the libraries, or to the executables? Our netCDF utilities are installed in /usr/local/bin, and our compilte-time and run-time netCDF libraries are in /usr/local/lib64.  Do I set the environment variable NETCDF to the parent of both of these? Also, I have no compiler executable named "intel", though the mpi compilers are now compiled with the intel development environment which was recently installed for me.  Therefore, I don't think it makes to define "COMPILER" as "intel".  Or, it does make sense and I am just not understanding.
 

bdavis@usgs_gov

New Member
Michael,Any idea what I should be using for a C compiler, and C pre-processor?My build fails on the first config check for C compiler.mpicc and gcc do not work.My choices are:/usr/local/bin/mpicc/usr/bin/gcc/usr/bin/g++    configure:2376: checking whether the C compiler worksconfigure:2398: mpicc  -O2 -fp-model precise   -DLINUX  -DMCT_INTERFACE -DHAVE_MPI -DFORTRANUNDERSCORE -DNO_R16 -DLINUX -DCPRINTEL  -DHAVE_SLASHPROC -I.. -I.  -I/home/bdavis/projects/cases/test.userdefined/bld/pio -I/usr/local/lib/include -I/home/bdavis/projects/cases/test.userdefined/bld/mct/mct -I/home/bdavis/projects/cases/test.userdefined/bld/mct/mpeu -I/home/bdavis/projects/cases/test.userdefined/bld/pio -I/home/bdavis/projects/cases/test.userdefined/bld/gptl -I/data/bdavis/software/projects/CESM_1.2.1/cesm1_2_1/models/utils/pio -I/home/bdavis/projects/cases/test.userdefined/bld/lib/include   conftest.c  >&5gcc: precise: No such file or directorycc1: error: unrecognized command line option "-fp-model"configure:2402: $? = 1configure:2440: result: no 
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
NETCDF_PATH assumes it is the root of the NETCDF install, so you should have $(NETCDF_PATH)/lib and $(NETCDF_PATH)/include [I don't know if the build system will look for $(NETCDF_PATH)/lib64 instead, but it might]. An easy work-around would be to make a netcdf directory somewhere and soft-link the libraries into the proper structure. $NETCDF is an environment variable on the NCAR machine, and I believe these are the only files the build system looks for:$ cd $NETCDF
$ find include/ lib/ -type f
include/netcdf.h
include/netcdf_nc_data.mod
include/netcdf_nc_interfaces.mod
include/netcdf_nf_data.mod
include/netcdf_nf_interfaces.mod
include/netcdf_f03.mod
include/netcdf_fortv2_c_interfaces.mod
include/typesizes.mod
include/netcdf.mod
include/netcdf.inc
include/netcdfcpp.h
include/ncvalues.h
include/netcdf.hh
lib/libnetcdf.so.7.2.0
lib/libnetcdf.la
lib/libnetcdf.a
lib/pkgconfig/netcdf.pc
lib/pkgconfig/netcdf-fortran.pc
lib/libnetcdff.so.0.0.0
lib/libnetcdff.la
lib/libnetcdff.a
lib/libnetcdff.so.5.3.1
lib/libnetcdf_c++.so.4.2.0
lib/libnetcdf_c++.la
lib/libnetcdf_c++.a

As for your compiler question: the Intel compilers are ifort and icc, if you are using gfortran and gcc then you want to set$ ./xmlchange COMPILER=gnuIt is important that you use the same compiler to build CESM as was used to build the netCDF library, and you can find this information by running the nc-config routine (it should be in your PATH already). On the NCAR computer, this results in$ nc-config --fc --cc
ifort
icc

As you can see, I'm using an install of netCDF built with the Intel compilers. However, on my laptop, the same command shows the GNU compilers:
$ nc-config --fc --cc
gfortran
gcc
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
The -fp-model is specific to the intel compiler, and it looks like you are using the GNU compiler... so replacing the
$ ./xmlchange COMPILER=intelcall with
$ ./xmlchange COMPILER=gnu in my reply from February 20th should fix this particular error. Also, in your Macros file, you should useMPICC:=mpicc
MPIF90:=mpif90 I don't know if that will be set automatically for you or not by the cesm_setup call.
 

bdavis@usgs_gov

New Member
no luck with gcc either../xmlchange COMPILER=gnu Macros:MPICC:=mpiccMPICXX:=mpiccxxMPIFC:=mpif90SCC:= gccSCXX:=gcc  config.log: configure:2376: checking whether the C compiler worksconfigure:2398: gcc  -O2 -fp-model precise   -DLINUX  -DMCT_INTERFACE -DHAVE_MPI -DFORTRANUNDERSCORE -DNO_R16 -DLINUX -DCPRINTEL  -DHAVE_SLASHPROC -I.. -I.  -I/home/bdavis/projects/cases/test.userdefined/bld/pio -I/usr/local/lib/include -I/home/bdavis/projects/cases/test.userdefined/bld/mct/mct -I/home/bdavis/projects/cases/test.userdefined/bld/mct/mpeu -I/home/bdavis/projects/cases/test.userdefined/bld/pio -I/home/bdavis/projects/cases/test.userdefined/bld/gptl -I/data/bdavis/software/projects/CESM_1.2.1/cesm1_2_1/models/utils/pio -I/home/bdavis/projects/cases/test.userdefined/bld/lib/include   conftest.c  >&5gcc: precise: No such file or directorycc1: error: unrecognized command line option "-fp-model"configure:2402: $? = 1configure:2440: result: no 
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
If you changed the compiler in a directory where you had already tried to build with COMPILER=intel, try the following:$ ./$CASE.clean_build
$ ./cesm_setup -clean
$ ./xmlchange COMPILER=gnu
$ ./cesm_setup
$ ./$CASE.build
 

santos

Member
FYI to everyone, I'm pretty sure that running cesm_setup -clean is not enough, because for some reason it does not remove the Macros file. So to change the compiler, you have to run the .clean_build script, run configure -clean, *and* do "rm ./Macros" in your case directory.Or, at that point, you may as well just start over from create_newcase and specify the right compiler from the very beginning.
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
I don't know if you got an email notification from Sean's response below, but his recommendation to remove the Macros file after running "./cesm_setup -clean" and before running "./cesm_setup" makes a lot of sense - that's the file that contains the compiler flags, and clearly it's still picking up the Intel flags even though you're using gnu.
 
Hi jedwards, I'm having the same problem with liuna0209, mpif90  -c  -I. -I../ -DLINUX -DNDEBUG -DMCT_INTERFACE -DHAVE_MPI -DFORTRANUNDERSCORE -DNO_R16 -DFORTRANUNDERSCORE-DHAVE_SLASHPROC -DSYSLINUX -DCPRGNU -O2  -O -fconvert=big-endian -ffree-line-length-none -ffixed-line-length-none6/fkc/cesm1_2_2/build/gnu/mpich/nodebug/nothreads/include -I/disk6/fkc/cesm1_2_2/build/gnu/mpich/nodebug/nothreadscsm_share -I/disk6/fkc/packman/netcdf_c/4.3.2/0/include -I/disk6/fkc/packman/mpich/3.1.2/0/include -I/disk6/fkc/pncesm1_2_2/build/gnu/mpich/nodebug/nothreads/include -I/disk6/fkc/cesm1_2_2/models/csm_share/shr   /disk6/fkc/cesm1m_List.F90/disk6/fkc/cesm1_2_2/models/utils/mct/mpeu/m_List.F90: In function ?.xporttostring_?./disk6/fkc/cesm1_2_2/models/utils/mct/mpeu/m_List.F90:925: error: conversion to non-scalar type requestedgmake[1]: *** [m_List.o] Error 1gmake[1]: Leaving directory `/disk6/fkc/cesm1_2_2/build/gnu/mpich/nodebug/nothreads/mct/mpeu'gmake: *** [subdirs] Error 2exit 1 I've successfully bulit two test cases in my machine, but failed this time and any time after that. Do you have any suggestions? Thank you in advance.
 

jedwards

CSEG and Liaisons
Staff member
What changed on your system since the successful builds?   Compiler version?  Default path?   Can you still build one of the cases that you suceeded with?  Please report compiler and versions. Thanks,
 
Top