NEMO installation - gher-uliege/Documentation GitHub Wiki
Install dependencies
Install dependencies from package repository
Under Ubuntu 14.04
sudo apt-get install libnetcdf-dev netcdf-bin libopenmpi-dev gfortran build-essential
Install dependencies from source
Intel compilers under Linux in general, and nic4 in particular
- download zlib, szlib, hdf5, netcdf4 and netcdf-fortran libraries
- install them all in the directory of your choice using
configure --prefix=/my/directory
, thenmake
, thenmake install
. - I found that parallel compilation (
make -j
) sometimes fails while a simplemake
will work.
For hdf5, don't forget to configure using --with-zlib=/my/directory --with-szip=/my/directory --enable-parallel
For netcdf4, don't forget to configure using --enable-netcdf-4
.
I found that xios-1.0 does NOT like the couple netcdf-4.4.4 -- hdf5 1.10. I had to revert to hdf5 1.8.2, netcdf 4.3.2 and netcdf-fortran 4.4.3. Don't forget to set the environment variables CC
, FC
, F77
, LDFLAGS
, CFLAGS
, FCFLAGS
, FFLAGS
. For the 3 last ones, I used -fPIC (for hdf5 AND netcdf4 AND netcdf-fortran). Without fPIC netcdf wouldn't compile.
Still, some netcdf-fortran make check
test would NOT pass, but the library works and is used for nco tools, gher tools, gher model, xios and nemo, all without errors.
XIOS 1
cd src
svn co -r 703 http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-1.0 xios-1.0
cd xios-1.0/
./make_xios --arch GCC_LINUX --netcdf_lib netcdf4_seq
If you installed the parallel version of hdf5 and netcdf4, then you don't need the last option in the make_xios command
NEMO
In /home/abarth/src/NEMOGCM/ARCH/OLD/arch-gfortran_linux.fcm
%XIOS_HOME /home/abarth/src/xios-1.0
%XIOS_INC -I%XIOS_HOME/inc
%XIOS_LIB -L%XIOS_HOME/lib -lxios
%NCDF_INC -I/usr/include
%NCDF_LIB -L/usr/lib -lnetcdff -lnetcdf
%FC mpif90
%FCFLAGS -fdefault-real-8 -O3 -funroll-all-loops -fcray-pointer -ffree-line-length-none
%FFLAGS %FCFLAGS
%LD mpif90
%LDFLAGS
%FPPFLAGS -P -traditional
%AR ar
%ARFLAGS -rs
%MK gmake
%USER_INC %XIOS_INC %NCDF_INC
%USER_LIB %XIOS_LIB %NCDF_LIB -lstdc++ -lmpi_cxx
%CPP cpp
%CC cc
%CFLAGS -O0
Generate the NEMO configuration
The following command creates the NEMO configuration and compiles the code:
cd CONFIG
./makenemo -m gfortran_linux -r GYRE -n MY_GYRE add_key "key_iomput key_mpp_mpi"
Recompilation
If you modify the Fortran sources, you can recompile NEMO with:
./makenemo
Clear configuration
./makenemo -m gfortran_linux -r GYRE -n MY_GYRE clean_config
Run NEMO
cd CONFIG/GYRE/EXP00
mpirun ./opa
Troubleshooting
- Many Perl warnings:
Use of uninitialized value in uc at /home/abarth/src/NEMOGCM-git/EXTERNAL/fcm/bin/../lib/Fcm/CfgFile.pm line 234.
They do not seem to be of any consequence.
- CPP error message
Can't exec "%CPP": No such file or directory at /home/abarth/src/NEMOGCM/EXTERNAL/fcm/bin/../lib/Fcm/Util.pm line 454.
add the C preprocessor in arch-gfortran_linux.fcm
%CPP cpp
- Long Fortran lines
4,num_fields), zfoldwk(jpi,4,num_fields), znorthgloio(jpi,4,num_fields,jpni
1
Error: Invalid form of array reference at (1)
use -ffree-line-length-none
as compiler option
- time_origin key
Error message: $ mpirun ./opa
Error [CAttributeMap::operator[](const StdString& key)] : In file '/home/abarth/src/xios-2.0/src/attribute_map.cpp', line 61 -> [ key = time_origin] key not found !
Use XIOS 1 (not XIOS 2, does not work with NEMO 3.6 or with the provided input files) XIOS 2 xml files have a slightly different syntax, which isn't easily obtained from documentation.
Suggestions
How could be process be simpler?
- Use
arch-gfortran_linux.fcm
which works with the recommended defaults (i.e. XIOS, long Fortran lines and CPP preprocessor) - Use
_FillValue
in resulting NetCDF files for land