Notice
Recent Posts
Recent Comments
Link
«   2026/05   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Tags
more
Archives
Today
Total
관리 메뉴

Hwa-Jin Choi

XIOS 2.5 and NEMO 4.0.6 본문

NEMO/Set-up

XIOS 2.5 and NEMO 4.0.6

hjchoi0620 2024. 3. 29. 01:07

XIOS 2.5

It is recommended to use XIOS 2.5 release. This version should be more stable (in terms of future code changes) than the XIOS trunk. It is also the one used by the NEMO system team when testing all developments and new releases.

This particular version has its branch and can be checked out with:

svn co https://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-2.5

 

To get XIOS to compile, the compilers and packages need to be pointed to first, via modifying files in arch. Since I am using gcc, I did the following just to make a fresh copy:

cd xios2.5/arch
cp arch-GCC_LINUX.env arch-GCC_local.env
cp arch-GCC_LINUX.fcm arch-GCC_local.fcm
cp arch-GCC_LINUX.path arch-GCC_local.path

Below 3 files are different from the original files. If you want to know specific reasons for the added options, follow this reference link.

(https://nemo-related.readthedocs.io/en/latest/compilation_notes/nemo40.html)

arch-GCC_local.path

NETCDF_INCDIR="-I $NETCDF_INC_DIR"
NETCDF_LIBDIR="-Wl,'--allow-multiple-definition' -L $NETCDF_LIB_DIR"
NETCDF_LIB="-lnetcdff -lnetcdf"

MPI_INCDIR=""
MPI_LIBDIR=""
MPI_LIB="-lcurl"

HDF5_INCDIR="-I $HDF5_INC_DIR"
HDF5_LIBDIR="-L $HDF5_LIB_DIR"
HDF5_LIB="-lhdf5_hl -lhdf5 -lhdf5 -lz"

BOOST_INCDIR="-I $BOOST_INC_DIR"
BOOST_LIBDIR="-L $BOOST_LIB_DIR"
BOOST_LIB=""

OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1"
OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib"
OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu"

arch-GCC_local.env

#export HDF5_INC_DIR=$HOME/hdf5/hdf5/include
#export HDF5_LIB_DIR=$HOME/hdf5/hdf5/lib

export HDF5_INC_DIR=/media/cmlws/Data1/hjc/Tools/install/include
export HDF5_LIB_DIR=/media/cmlws/Data1/hjc/Tools/install/lib

#export NETCDF_INC_DIR=$HOME/netcdf4/include
#export NETCDF_LIB_DIR=$HOME/netcdf4/lib

export NETCDF_INC_DIR=/media/cmlws/Data1/hjc/Tools/install/include
export NETCDF_LIB_DIR=/media/cmlws/Data1/hjc/Tools/install/lib

export BOOST_INC_DIR=$HOME/boost
export BOOST_LIB_DIR=$HOME/boost

arch-GCC_local.fcm

################################################################################
###################                Projet XIOS               ###################
################################################################################

%CCOMPILER      /media/cmlws/Data1/hjc/Tools/install/bin/mpicc
%FCOMPILER      /media/cmlws/Data1/hjc/Tools/install/bin/mpif90
%LINKER         /media/cmlws/Data1/hjc/Tools/install/bin/mpif90

%BASE_CFLAGS    -ansi -w -D_GLIBCXX_USE_CXX11_ABI=0
%PROD_CFLAGS    -O3 -DBOOST_DISABLE_ASSERTS
%DEV_CFLAGS     -g -O2
%DEBUG_CFLAGS   -g

%BASE_FFLAGS    -D__NONE__ -ffree-line-length-none
%PROD_FFLAGS    -O3
%DEV_FFLAGS     -g -O2
%DEBUG_FFLAGS   -g

%BASE_INC       -D__NONE__
%BASE_LD        -lstdc++

%CPP            /usr/bin/cpp-9
%FPP            /usr/bin/cpp-9 -P
%MAKE           make

 

I went into bld.cfg, found the line

bld::tool::cflags    %CFLAGS %CBASE_INC -I${PWD}/extern/src_netcdf -I${PWD}/extern/boost/include -I${PWD}/extern/rapidxml/include -I${PWD}/extern/blitz/include

and changed src_netcdf to src_netcdf4

Compile XIOS

cd ../
./make_xios --full --prod --arch GCC_local -j2 |& tee compile_log.txt

 

The j2 option uses two processors to build. The tee command is to keep logs of potential errors (the |& is short for 2>&1 |) for debugging errors that may arise.

 

NEMO 4.0.6

Download the NEMO sources

svn co https://forge.ipsl.jussieu.fr/nemo/svn/NEMO/releases/r4.0/r4.0.6

Setup your architecture configuration file

All compiler options in NEMO are controlled using files in ./arch/arch-

'gfortran_local'.fcm where ”gfortran_local” is the name of the computing architecture (generally following the pattern HPCC-compiler or OS-compiler). It is recommended to copy and rename a configuration file from an architecture similar to your owns. You will need to set appropriate values for all of the variables in the file. In particular, the FCM variables: %NCDF_HOME; %HDF5_HOME and %XIOS_HOME should be set to the installation directories used for XIOS installation (”gfortran_local” can be changed)

# arch-gfortran_local.fcm

# generic gfortran compiler options for linux
#
# NCDF_HOME   root directory containing lib and include subdirectories for netcdf4
# HDF5_HOME   root directory containing lib and include subdirectories for HDF5
# XIOS_HOME   root directory containing lib for XIOS
# OASIS_HOME  root directory containing lib for OASIS
#
# NCDF_INC    netcdf4 include file
# NCDF_LIB    netcdf4 library
# XIOS_INC    xios include file    (taken into accound only if key_xios is activated)
# XIOS_LIB    xios library         (taken into accound only if key_xios is activated)
# OASIS_INC   oasis include file   (taken into accound only if key_oasis3 is activated)
# OASIS_LIB   oasis library        (taken into accound only if key_oasis3 is activated)
#
# FC          Fortran compiler command
# FCFLAGS     Fortran compiler flags
# FFLAGS      Fortran 77 compiler flags
# LD          linker
# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries
# FPPFLAGS    pre-processing flags
# AR          assembler
# ARFLAGS     assembler flags
# MK          make
# USER_INC    complete list of include files
# USER_LIB    complete list of libraries to pass to the linker
# CC          C compiler used to compile conv for AGRIF
# CFLAGS      compiler flags used with CC
#
# Note that:
#  - unix variables "$..." are accpeted and will be evaluated before calling fcm.
#  - fcm variables are starting with a % (and not a $)
#
#%NCDF_HOME           /home/hjc/anaconda3
#%HDF5_HOME           /home/hjc/anaconda3
%NCDF_HOME           /media/cmlws/Data1/hjc/Tools/install
%HDF5_HOME           /media/cmlws/Data1/hjc/Tools/install
%XIOS_HOME           /media/cmlws/Data1/hjc/xios-2.5
%OASIS_HOME          /not/defined

%NCDF_INC            -I%NCDF_HOME/include -I%HDF5_HOME/include
%NCDF_LIB            -L%NCDF_HOME -lnetcdff -lnetcdf -lstdc++
%XIOS_INC            -I%XIOS_HOME/inc
%XIOS_LIB            -L%XIOS_HOME/lib -lxios -L/usr/lib/gcc/x86_64-linux-gnu/9 -lstdc++

%OASIS_INC           -I%OASIS_HOME/build/lib/mct -I%OASIS_HOME/build/lib/psmile.MPI1
%OASIS_LIB           -L%OASIS_HOME/lib -lpsmile.MPI1 -lmct -lmpeu -lscrip

%CPP                 /usr/bin/cpp-9 -Dkey_nosignedzero
%CPPFLAGS            -P -traditional

%FC                  /media/cmlws/Data1/hjc/Tools/install/bin/mpif90
%FCFLAGS             -fdefault-real-8 -funroll-all-loops -cpp -fcray-pointer -ffree-line-length-none -g -O0 -fbacktrace -fbounds-check
%FFLAGS              %FCFLAGS
#%LD                  /usr/bin/mpif90 -Wl,-rpath=$HOME/INSTALL/lib:/usr/lib
%LD                  /media/cmlws/Data1/hjc/Tools/install/bin/mpif90
%LDFLAGS
%FPPFLAGS            -P -C -traditional
%AR                  ar
%ARFLAGS             -rs
%MK                  make
%USER_INC            %XIOS_INC %OASIS_INC %NCDF_INC
%USER_LIB            %XIOS_LIB %OASIS_LIB %NCDF_LIB

%CC                  gcc
%CFLAGS              -O0 -fbacktrace
  • added %NCDF_HOME to point to where NetCDF lives
  • added %XIOS_* keys to point to where XIOS lives
  • added %CPP and flags, consistent with using gcc9
  • added the lnetcdff and lstdc++ flags to NetCDF flags
  • using mpif90 which is a MPI binding of gfortran-9
  • added cpp and ffree-line-length-none to Fortran flags
  • swapped out gmake with make

Reference

https://nemo-related.readthedocs.io/en/latest/compilation_notes/nemo40.html

 

NEMO 4.0 (beta) + XIOS 2.5 — J Mak NEMO notes documentation

There is a restructuring of folders (see the official annoucement for details) so the commands below will reflect this. Check out a version of NEMO. I have another folder separate to the XIOS folders to contain the NEMO codes and binaries: This checks out

nemo-related.readthedocs.io

 

'NEMO > Set-up' 카테고리의 다른 글

BOUNDARY DATA  (0) 2024.04.01
HOW TO REBUILD RESTART FILES  (0) 2024.03.29
SETTING UP  (0) 2024.03.29
Installing Libraries  (0) 2024.03.29