software:cosmo

Installing COSMO

http://www.cosmo-model.org/

This is a short summary of a simple install of cosmo and its necessary dependencies on Mogon. We used gcc 4.4.7 and mvapich2/2.1 for this (module load mpi/mvapich2/2.1). We might try other builds using different compiler/mpi selection and/or newer netcdf including netcdf4/hdf5 depending on the needs.

The tarballs used were: jasper-1.900.1.zip netcdf-4.1.1.tar.gz DWD-libgrib1_110128.tar.gz grib_api-1.13.1.tar int2lm_150611_2.02.tar.bz2 cosmo_141128_5.01.tar (reference_data_5.01.tar.bz2)

Start with

module load data/netCDF/4.4.1.1-intel-2017.02-HDF5-1.8.18  \
    data/netCDF-Fortran/4.4.4-intel-2017.02-HDF5-1.8.18 \
    data/grib_api/1.21.0-intel-2017.02 devel/CMake/3.7.2

This will load the intel compilers and IntelMPI as well as HDF5 and Netcdf. CMake is also loaded because it's needed at least for Cosmo.

Fopts for int2lm

#########
#  INTEL MOGON
#########
#
 
# compiler
F90          = mpiifort -c -fpp \
               -I$(SRCDIR) -I$(EBROOTNETCDF)/include -I$(EBROOTNETCDFMINFORTRAN)/include \
               -I$(EBROOTGRIB_API)/include   \
               -I$(DWDDIR)/include \
                -DGRIBAPI -DGRIBDWD -DNETCDF 
#
# linker
LDPAR        = mpiifort 
LDSEQ        = ifort 
#LDSEQ        = ifort -static
#
#
# standard binary
PROGRAM      = int2lm_exe
#
COMFLG1      = -O2
COMFLG2      = -O2
COMFLG3      = -O2
COMFLG4      = -O2
#
LIB          = $(DWDDIR)/libgrib1.a \
               $(EBROOTGRIB_API)/lib/libgrib_api_f90.a \
               $(EBROOTGRIB_API)/lib/libgrib_api.a  \
               $(EBROOTNETCDFMINFORTRAN)/lib/libnetcdff.so \
               $(EBROOTNETCDF)/lib64/libnetcdf.so \
               -L$(EBROOTGRIB_API)/lib \
               -L$(EBROOTNETCDF)/lib64 \
                -L$(EBROOTNETCDFMINFORTRAN)/lib \
                -lm -lpng -lcurl -ljasper -lgrib_api -lnetcdff  -lnetcdf 

Run this in the folder where the subfolders int2lm and cosmo are located cosmo_5.04_mvapich

#!/bin/bash
 
export BASEDIR=`pwd`
 
## load the necessary modules
## the modules load their dependencies recursively
module load data/netCDF/4.4.1.1-intel-2017.02-HDF5-1.8.18  
module load data/netCDF-Fortran/4.4.4-intel-2017.02-HDF5-1.8.18 
module load data/grib_api/1.21.0-intel-2017.02 devel/CMake/3.7.2
 
cd int2lm 
 
if [ -e Fopts ]; then 
	echo "Found Fopts, moving it aside" 
	mv Fopts Fopts.$( date '+%F-%T')
fi
 
cat > Fopts <<EOF 
#########
#  INTEL MOGON
#########
#
DWDDIR       = \$(BASEDIR)/DWD-libgrib1_20110128
# compiler
F90          = mpiifort -c -fpp \
 	       -I\$(SRCDIR) -I\$(EBROOTNETCDF)/include -I\$(EBROOTNETCDFMINFORTRAN)/include \
               -I\$(EBROOTGRIB_API)/include   \
               -I\$(DWDDIR)/include \
		-DGRIBAPI -DGRIBDWD -DNETCDF 
 
# linker
LDPAR        = mpiifort 
LDSEQ        = ifort 
#LDSEQ        = ifort -static
#
# standard binary
PROGRAM      = int2lm_exe
#
COMFLG1      = -O2
COMFLG2      = -O2
COMFLG3      = -O2
COMFLG4      = -O2
#
LIB          = \$(DWDDIR)/libgrib1.a \
	       \$(EBROOTGRIB_API)/lib/libgrib_api_f90.a \
               \$(EBROOTGRIB_API)/lib/libgrib_api.a  \
               \$(EBROOTNETCDFMINFORTRAN)/lib/libnetcdff.so \
               \$(EBROOTNETCDF)/lib64/libnetcdf.so \
	       -L\$(EBROOTGRIB_API)/lib \
	       -L\$(EBROOTNETCDF)/lib64 \
		-L\$(EBROOTNETCDFMINFORTRAN)/lib \
		-lm -lpng -lcurl -ljasper -lgrib_api -lnetcdff  -lnetcdf 
EOF
 
mkdir build
cd build
 
int2lmflag=1
while [ $int2lmflag -eq 1 ]; 
do
	read -p "I'm at $(pwd). Do you wish to delete current build and rebuild?(y,n,a)" yn
	case $yn in 
		[Yy]) install=1; break;;
		[Nn]) install=0; break;;
		[Aa]) echo "Aborting" ; exit;;
	esac
done
if [ $install -eq 1 ]
then 
	rm -rf * && FC=ifort cmake ../ -DNETCDF_LIB=${EBROOTNETCDF}/lib64/libnetcdf.so -DNETCDF_LIBRARIES=${EBROOTNETCDF} -DGRIB1_LIBRARY=${BASEDIR}/DWD-libgrib1_20110128/libgrib1.a -DGRIB_API_LIBRARY=${EBROOTGRIB_API}/lib/libgrib_api.so -DGRIB_API_INCLUDE_DIR=${EBROOTGRIB_API}/include -DGRIB_API_LIB_F77=${EBROOTGRIB_API}/lib/libgrib_api_f77.so -DGRIB_API_LIB_F90=${EBROOTGRIB_API}/lib/libgrib_api_f90.so
	make -j 8
fi
 
cd $BASEDIR/cosmo_5.04_mvapich
 
if [ -e Fopts ]; then 
	echo "Found Fopts, moving it aside" 
	mv Fopts Fopts.$( date '+%F-%T')
fi
 
cat > Fopts << COSMOEOF 
#
#########
#  Intel Mogon
#########
#
DWDDIR       = \$(BASEDIR)/DWD-libgrib1_20110128
#
#
F90          = mpiifort -c  -fpp                                                 \\
               \$(EBROOTGRIB_API)/include                                               \\
               -I\$(EBROOTNETCDF)/include -I\$(EBROOTNETCDFMINFORTRAN)/include                            \\
               -DGRIBDWD -DGRIBAPI -DNETCDF -DNUDGING -D__COSMO__
# LDSEQ        = ifort
#
COMFLG1      = -O2
COMFLG2      = -O2
COMFLG3      = -O2
COMFLG4      = -O2
#
# linker
LDPAR        = mpiifort  -static
LDSEQ        = mpif90 -static
#
# standard binary
PROGRAM      = lmparbin
#
LIB          = -L\$(LD_LIBRARY_PATH) -L\$(LIBDWD)/lib -L\$(EBROOTGRIB_API)/lib         \\
               \$(DWDDIR)/libgrib1.a                               \\
               \$(EBROOTGRIB_API_DIR)/lib/libgrib_api_f90.so    \\
               \$(EBROOTGRIB_API_DIR)/lib/libgrib_api.so        \\
                -lm -lpng                                                     \\
               \$(EBROOTNETCDFMINFORTRAN)/lib/libnetcdff.so \\
               \$(EBROOTNETCDF)/lib64/libnetcdf.so \\
	       -ljasper -lgrib1 -lgrib_api_f90 -lgrib_api -lnetcdff -lm                  
COSMOEOF
 
 
mkdir build 
cd build 
 
 
cosmoflag=1
while [ $int2lmflag -eq 1 ]; 
do
	read -p "I'm at $(pwd). Do you wish to delete current build and rebuild?(y,n,a)" yn
	case $yn in 
		[Yy]) install=1; break;;
		[Nn]) install=0; break;;
		[Aa]) echo "Aborting" ; exit;;
	esac
done
if [ $install -eq 1 ]
then 
	rm -rf * && FC=ifort cmake ../ -DNETCDF_LIB=${EBROOTNETCDF}/lib64/libnetcdf.so -DNETCDF_LIBRARIES=${EBROOTNETCDF} -DGRIB1_LIBRARY=${BASEDIR}/DWD-libgrib1_20110128/libgrib1.a -DGRIB_API_LIBRARY=${EBROOTGRIB_API}/lib/libgrib_api.so -DGRIB_API_INCLUDE_DIR=${EBROOTGRIB_API}/include -DGRIB_API_LIB_F77=${EBROOTGRIB_API}/lib/libgrib_api_f77.so -DGRIB_API_LIB_F90=${EBROOTGRIB_API}/lib/libgrib_api_f90.so
	make 
fi

Since grib_api needs netcdf and jasper we started with those two packages. For DWD-libgrib1 one has to change the Makefile in the source folder and add appropriate PATH. int2lm and cosmo use Fopt files where one puts compiler flags and library links - our working copy is attached in the appropriate section.

Jasper was build as shared lib. For some reason –enbable-shared didn't work that's why I set the CFLAGS to -fPIC.

CFLAGS="-O2 -fPIC" ./configure --prefix=/project/mettheo/eulerc/src/jasper-1.900.1_build \
--enable-shared=jasper
make
make install 

For the first version, we build netcdf without netcdf4&hdf5 support. Therefore it was straight forward:

 ./configure --prefix=<BASEDIR>/netcdf-4.1.1_build --enable-shared --disable-netcdf4 \
--disable-dap-remote-tests
make
make check
make install

I used cmake for building the api, hence, used module load software/cmake/3.0.2. Since I didn't know which image file format will be used in the end I chose to enable jpeg and png.

cmake ../ -DCMAKE_INSTALL_PREFIX=<BASEDIR>/grib_api-1.13.1_build \
-DNETCDF_PATH=<BASEDIR>/netcdf-4.1.1_build -DJASPER_PATH=<BASEDIR>/src/jasper-1.900.1_build \
-DENABLE_PNG=ON
make 
make check
make install 

module unload software/cmake/3.0.2

For this lib I set the LIBPATH to the main source folder and set the appropriate INCDIR, which points to the include files of the lib and activated the appropriate compiler and flags. In the 'source' folder call

make
make install

The necessary parts of the Makefile look like (main path obscured…):

######################################
# Path of the library
######################################
LIBPATH = BASEDIR/DWD-libgrib1_20110128
INCDIR  = BASEDIR/DWD-libgrib1_20110128/include
 
######################################
# Fortran Files
######################################
#
# Archiver
AR          = ar                # for all other systems
# Compilers
FTN        = gfortran -fno-range-check         # GNU
#
######################################
# C Files
######################################
#
# Compilers
#
C         = gcc -fPIC -D__linux__      # GNU
#
# Options
#
CCFLAGS    =  -O2 -I $(INCDIR) -D__linux__               # GNU, Portland Group
# 
###########################################################################

To build int2lm you need to copy the appropriate Fopts file from LOCAL to the main folder and adapted it to your needs. After that it's just typing:

make exe 

The original Fopts_gfortran looked like: My working copy looks more like:

Fopts
####### THIS ONE'S WORKING ##########################
#########
#  gfortran
#########
#
# Fortran compiler
#
BASEDIR      = The Base Dir
NCDFDIR      = $(BASEDIR)/netcdf-4.1.1_build
GRIB_API_DIR = $(BASEDIR)/grib_api-1.13.1_build
DWDDIR       = $(BASEDIR)/DWD-libgrib1_20110128
JASPERDIR    = $(BASEDIR)/jasper-1.900.1_build
 
F90          = mpif90   -cpp -c -ffree-line-length-none          \
               -static                                                       \
               -ffpe-trap=invalid,zero,overflow -g -fbacktrace  -fdump-core  \
               -I$(SRCDIR)  -I$(NCDFDIR)/include \
               -I$(GRIB_API_DIR)/include   \
               -I$(DWDDIR)/include \
               -DGRIBAPI -DGRIBDWD -DNETCDF
# -Wall -Wconversion -Wextra -Wno-surprising -pedantic -std=f2008
#
# linker
LDPAR        = mpif90
LDSEQ        = gfortran
#
#
# standard binary
PROGRAM      = tstint2lm
#
# compile flags
COMFLG1      = -O2 -g
#COMFLG1      = -g
COMFLG2      = $(COMFLG1)
COMFLG3      = $(COMFLG2)
COMFLG4      = -O0
#
LIB          = $(DWDDIR)/libgrib1.a  \
               $(GRIB_API_DIR)/lib/libgrib_api_f90.so \
               $(GRIB_API_DIR)/lib/libgrib_api.so  \
               $(NCDFDIR)/lib/libnetcdff.a \
               $(NCDFDIR)/lib/libnetcdf.a \
               $(JASPERDIR)/lib/libjasper.so \
               -lpng -lcurl 
original_version
*** ORIGINAL VERSION NOT WORKING ON MOGON ***
 
#########
#  gfortran
#########
#
# Fortran compiler
#
#NCDFDIR      = /uwork1/hanlauf/opt/gfortran48/
NCDFDIR      = /usr
F90          = mpif90   -cpp -c -ffree-line-length-none  -fcheck=all         \
               -static                                                       \
               -ffpe-trap=invalid,zero,overflow -g -fbacktrace  -fdump-core  \
               -I$(SRCDIR)  -I$(NCDFDIR)/include                             \
               -I/uwork1/uschaett/lib_gfortran/grib_api-1.11.0/include       \
               -DGRIBAPI -DGRIBDWD -DNETCDF
# -Wall -Wconversion -Wextra -Wno-surprising -pedantic -std=f2008
#
# linker
LDPAR        = mpif90
LDSEQ        = gfortran
#
#
# standard binary
PROGRAM      = tstint2lm
#
# compile flags
COMFLG1      = -O2 -g
#COMFLG1      = -g
COMFLG2      = $(COMFLG1)
COMFLG3      = $(COMFLG2)
COMFLG4      = -O0
#
LIB          = /uwork1/uschaett/lib_gfortran/libgrib1.a                                 \
               /uwork1/uschaett/lib_gfortran/grib_api-1.11.0/lib/libgrib_api_f90.a      \
               /uwork1/uschaett/lib_gfortran/grib_api-1.11.0/lib/libgrib_api.a          \
               -L/usr/lib64 -lm -lpng -ljasper                                                       \
               -L$(NCDFDIR)/lib -lnetcdff  -lnetcdf

Here it's the same as for int2lm. Copy and adapt the Fopts file to your needs. Again here is the orginal Fopts and after that my working version of it. Install with

 make 

Here's the working copy:

Fopts
####### THIS ONE'S WORKING ##########################
#########
# gfortran 
#########
#
BASE_DIR     = The Base Dir
 
F90          = mpif90   -cpp -c  -fno-range-check                                        \
               -ffree-line-length-0                                                      \
               -ffpe-trap=invalid,zero,overflow,denormal -fbacktrace  -fdump-core        \
               -I$(BASE_DIR)/grib_api-1.13.1_build/include                   \
               -I$(SRCDIR) -I/usr/include                                                \
               -I$(BASE_DIR)/netcdf-4.1.1_build/include  \
               -DGRIBDWD -DGRIBAPI -DNETCDF -D__COSMO__
#
#COMFLG1      = -g -fcheck=all
#COMFLG2      = -g -fcheck=all
#COMFLG3      = -g -fcheck=all
#COMFLG4      = -g -fcheck=all
######COMFLG1      = -O2 -g
COMFLG1      = -O0 -D__linux__ -x f95-cpp-input
COMFLG2      = $(COMFLG1)
COMFLG3      = $(COMFLG1)
COMFLG4      = -O0 -g
#
# linker
LDPAR        = mpif90   -g
LDSEQ        = gfortran
#
# standard binary
PROGRAM      = lmparbin
#
LIB          = $(BASE_DIR)/DWD-libgrib1_20110128/libgrib1.a                               \
               $(BASE_DIR)/grib_api-1.13.1_build/lib/libgrib_api_f90.so    \
               $(BASE_DIR)/grib_api-1.13.1_build/lib/libgrib_api.so        \
                -lm -lpng                                                     \
               $(BASE_DIR)/netcdf-4.1.1_build/lib/libnetcdff.so \
               $(BASE_DIR)/netcdf-4.1.1_build/lib/libnetcdf.so \
               $(BASE_DIR)/jasper-1.900.1_build/lib/libjasper.so   
Fopt_gfortan
*** ORIGINAL VERSION NOT WORKING ON MOGON ***
#########
# gfortran 
#########
#
#-fcheck=all <all|array-temps|bounds|do|mem|pointer|recursion>
#-finit-integer=n
#-finit-real=nan
#-finit-logical=<true|false>
#-fno-range-check 
#F90          = gfortran -x f95-cpp-input -c  -fcheck=all
#               -pedantic -std=f2008
#               -Wall
 
#              -Wall -Wconversion  -pedantic -std=f2008                                  
F90          = mpif90   -cpp -c  -ffree-line-length-0                                    \
               -ffpe-trap=invalid,zero,overflow,denormal -fbacktrace  -fdump-core        \
               -I/uwork1/uschaett/lib_gfortran/grib_api-1.11.0/include                   \
               -I/uwork1/uschaett/lib_gfortran/RTTOV10/include                           \
               -I/uwork1/uschaett/lib_gfortran/RTTOV7/sp/include                         \
               -I$(SRCDIR) -I/usr/include                                                \
               -DGRIBDWD -DGRIBAPI -DNETCDF -DNUDGING -DRTTOV10 -D__COSMO__
#              -DCOSMOART -DPOLLEN
#              -DGRIBDWD -DGRIBAPI -DNETCDF -DRTTOV10 -DNUDGING -DSINGLEPRECISION
#
#  -x f95-cpp-input:   apply C-preprocessor to every file (not only .F90)
#
#COMFLG1      = -g -fcheck=all
#COMFLG2      = -g -fcheck=all
#COMFLG3      = -g -fcheck=all
#COMFLG4      = -g -fcheck=all
COMFLG1      = -O2 -g
COMFLG2      = $(COMFLG1)
COMFLG3      = $(COMFLG1)
COMFLG4      = -O0 -g
#
# linker
LDPAR        = mpif90   -g
LDSEQ        = gfortran
#
# standard binary
PROGRAM      = lmparbin
#
LIB          = /uwork1/uschaett/lib_gfortran/libgrib1.a                               \
               /uwork1/uschaett/lib_gfortran/grib_api-1.11.0/lib/libgrib_api_f90.a    \
               /uwork1/uschaett/lib_gfortran/grib_api-1.11.0/lib/libgrib_api.a        \
                -lm -lpng -ljasper                                                    \
                -lnetcdff  -lnetcdf -L/usr/lib64                                      \
               /uwork1/uschaett/lib_gfortran/RTTOV10/lib/libradiance10.2.a            \
               /uwork1/uschaett/lib_gfortran/RTTOV10/lib/librttov10.2.a
#
#              /uwork1/uschaett/lib_gfortran/RTTOV7/sp/lib/libRTTOV7_synsat_vector_sp.a
#              /uwork1/uschaett/lib_gfortran/RTTOV7/dp/lib/libRTTOV7_synsat_vector_dp.a
#
#              /uwork1/uschaett/lib_gfortran/RTTOV10/lib/libradiance10.2.a            \
#              /uwork1/uschaett/lib_gfortran/RTTOV10/lib/librttov10.2.a
#
#              /home/uschaett/RTTOV/RTTOV9/ifc_for_RTTOV9/librttov9_ifc.a \
#              /home/uschaett/RTTOV/RTTOV9/rttov9_cosmo/rttov9.3-linux_gfortran/lib/librttov9.3.a  \
#              /home/uschaett/RTTOV/RTTOV9/rttov9_cosmo/rttov9.3-linux_gfortran/lib/librttov9.3_parallel.a  \
#
#  for GRIB_API, but only with sunstudio f95
#    Options:  -I/opt/grib_api/include
#              /opt/grib_api/lib/libgrib_api.a            \
#              /opt/grib_api/lib/libgrib_api_f77.a        \
#              /opt/grib_api/lib/libgrib_api_f90.a        \
  • software/cosmo.txt
  • Last modified: 2017/07/18 16:02
  • by henkela