-
Notifications
You must be signed in to change notification settings - Fork 2
/
lfric_openmpi_env.def
executable file
·224 lines (187 loc) · 6.84 KB
/
lfric_openmpi_env.def
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
Bootstrap: docker
From: fedora:35
%files
files/mk_arch_files_intel.sh /opt
files/oneAPI.repo /opt
files/keyword.cfg /opt
files/mosrs-cache-password /opt
files/mosrs-check /opt
files/mosrs-setup-gpg-agent /opt
files/psyclone_new.cfg /opt
#### files/container.tgz /opt
%post
# Build stack
#Intel repo
mv /opt/oneAPI.repo /etc/yum.repos.d
#Update and install pre-built software stack.
dnf -y update
dnf -y install ucx ucx-cma ucx-devel ucx-ib ucx-rdmacm libmnl numactl-libs libpsm2 librdmacm librdmacm-utils libibverbs ibutils kmod iproute libibverbs-utils
dnf -y install make cmake git python2 python3-devel python3 python3-pip automake wget subversion perl-URI perl-Text-Balanced perl-core perl-XML-Parser which file zlib-devel libcurl-devel vim gcc gcc-c++ hostname nano procps psmisc rsync python3-sphinx csh bzip2
dnf -y install intel-oneapi-compiler-fortran-2022.1.0
#Setup Intel
. /opt/intel/oneapi/setvars.sh
#set locale
export LC_ALL=C
#### cd /&&tar zxvf /opt/container.tgz
BUILD_DIR=/opt/build
BASE_DIR=/container
mkdir -p $BASE_DIR
mkdir -p $BUILD_DIR
NCORES=8
FCM_VERSION=2017.10.0
CYLC_VERSION=7.8.1
ROSE_VERSION=2019.01.1
OMPI_VERSION=4.1.0
HDF5=1.12.0
NETCDF4=4.3.3.1
NETCDF_FORTRAN=4.4.2
NETCDF_CXX=4.2
YAXT=0.9.3
PFUNIT=3.2.9
PSYCLONE=2.3.1
#fcm
cd $BASE_DIR
wget https://github.com/metomi/fcm/archive/${FCM_VERSION}.tar.gz && \
tar xfz ${FCM_VERSION}.tar.gz && \
rm -f ${FCM_VERSION}.tar.gz fcm && \
ln -s fcm-${FCM_VERSION} fcm
cp /opt/keyword*.cfg fcm/etc/fcm
rm -f /opt/keyword*.cfg
cp /opt/mo* fcm/bin
rm -f /opt/mo*
#cylc
cd $BASE_DIR
wget https://github.com/cylc/cylc/archive/${CYLC_VERSION}.tar.gz && \
tar xfz ${CYLC_VERSION}.tar.gz && \
cd cylc-flow-${CYLC_VERSION} && \
export PATH=$PWD/bin:$PATH && \
make
cd $BASE_DIR && rm -f ${CYLC_VERSION}.tar.gz cylc && ln -s cylc-flow-${CYLC_VERSION} cylc
#rose note:Requires python2, and pip needs to be installed manually.
cd $BASE_DIR
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python2 get-pip.py
python2 -m pip install requests
rm get-pip.py
wget https://github.com/metomi/rose/archive/${ROSE_VERSION}.tar.gz && \
tar xfz ${ROSE_VERSION}.tar.gz && \
rm -f ${ROSE_VERSION}.tar.gz rose && \
ln -s rose-${ROSE_VERSION} rose
export NETCDF_DIR=$BASE_DIR/netcdf
export OMPI_DIR=$BASE_DIR/ompi
export INSTALL_DIR=$BASE_DIR/usr
export CPPFLAGS="-I$INSTALL_DIR/include -I$NETCDF_DIR/include"
export FFLAGS="-I$INSTALL_DIR/include -I$NETCDF_DIR/include"
export FCFLAGS="-I$INSTALL_DIR/include -I$NETCDF_DIR/include"
export LDFLAGS="-L$INSTALL_DIR/lib -L$NETCDF_DIR/lib"
export PATH=$OMPI_DIR/bin:$NETCDF_DIR/bin:$INSTALL_DIR/bin:$PATH
export LD_LIBRARY_PATH=$OMPI_DIR/lib:$NETCDF_DIR/lib:$INSTALL_DIR/lib:$LD_LIBRARY_PATH
#OpenMPI
cd $BUILD_DIR
export OMPI_URL="https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-$OMPI_VERSION.tar.bz2"
# Download
wget -O openmpi-$OMPI_VERSION.tar.bz2 $OMPI_URL && tar -xjf openmpi-$OMPI_VERSION.tar.bz2
# Compile and install
cd openmpi-$OMPI_VERSION && FC=ifort CC=gcc CXX=g++ ./configure --prefix=$OMPI_DIR && make -j$NCORES install
#Install gfortran for external dependencies. Do after MPICH build otherwise
#issues with ISO bindings for gcc/Intel
dnf -y install gcc-gfortran
#hdf5
cd $BUILD_DIR
wget http://www.hdfgroup.org/ftp/HDF5/prev-releases/hdf5-1.12/hdf5-$HDF5/src/hdf5-$HDF5.tar.gz
tar -xzf hdf5-$HDF5.tar.gz
cd $BUILD_DIR/hdf5-$HDF5
CC=mpicc FC=mpif90 ./configure --prefix=$NETCDF_DIR --enable-fortran --enable-fortran2003 --enable-parallel
make -j$NCORES
make install
#netcdf
cd $BUILD_DIR
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-$NETCDF4.tar.gz
tar -xzf netcdf-$NETCDF4.tar.gz
cd $BUILD_DIR/netcdf-$NETCDF4
CC=mpicc CXX=mpicxx FF=mpif90 FC=mpif90 ./configure --prefix=$NETCDF_DIR --disable-dap
make -j$NCORES
make install
export LIBS="-lnetcdf -lhdf5_hl -lhdf5 -ldl -lm -lz"
#netcdf-fortran
cd $BUILD_DIR
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-$NETCDF_FORTRAN.tar.gz
tar -xzf netcdf-fortran-$NETCDF_FORTRAN.tar.gz
cd $BUILD_DIR/netcdf-fortran-$NETCDF_FORTRAN
CC=mpicc CXX=mpicxx FF=mpif90 FC=mpif90 ./configure --prefix=$NETCDF_DIR
make -j$NCORES
make install
#netcdf-cxx
cd $BUILD_DIR
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-cxx-$NETCDF_CXX.tar.gz
tar -xzf netcdf-cxx-$NETCDF_CXX.tar.gz
cd $BUILD_DIR/netcdf-cxx-$NETCDF_CXX
CC=mpicc CXX=mpicxx FF=mpif90 FC=mpif90 ./configure --prefix=$NETCDF_DIR
make -j$NCORES
make install
export LIBS='-lnetcdff -lnetcdf -lhdf5_hl -lhdf5'
#yaxt
cd $BUILD_DIR
wget https://www.dkrz.de/redmine/attachments/download/520/yaxt-$YAXT.tar.gz
tar -xzf yaxt-$YAXT.tar.gz
cd $BUILD_DIR/yaxt-$YAXT
./configure --without-regard-for-quality --prefix=$INSTALL_DIR --with-idxtype=long CC=mpicc FC=mpif90 FPP="mpif90 -E"
make -j$NCORES
make install
#XIOS
#use mk_arch_files.sh
cd $BUILD_DIR
export HDF5_DIR=$NETCDF_DIR
svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/trunk@2252 XIOS
cd $BUILD_DIR/XIOS
/opt/mk_arch_files_intel.sh INTEL_MPI
mv *INTEL_MPI* arch
./make_xios --full --arch INTEL_MPI --job $NCORES
cp -r lib $INSTALL_DIR
cp inc/* $INSTALL_DIR/include
mkdir -p $INSTALL_DIR/bin
cp bin/* $INSTALL_DIR/bin
rm -f /opt/mk_arch_files_intel.sh
#pFUnit
cd $BUILD_DIR
wget https://sourceforge.net/projects/pfunit/files/latest/download/pFUnit-$PFUNIT.tgz
tar -xzf pFUnit-$PFUNIT.tgz
cd pFUnit-$PFUNIT
export F90_VENDOR=Intel
export F90=ifort
export MPIF90=mpif90
#Hack for python2
ln -s /usr/bin/python2 $INSTALL_DIR/bin/python
make -j $NCORES
make install
rm $INSTALL_DIR/bin/python
#Clean up
cd $BASE_DIR
rm -fr $BUILD_DIR
#Psyclone
python3 -m pip install --no-cache-dir --upgrade pip
#python3 -m pip install --upgrade setuptools
python3 -m pip install Jinja2
python3 -m pip install PSyclone==$PSYCLONE
ln -s /usr/bin/python3 $INSTALL_DIR/bin/python
mv /opt/psyclone_new.cfg /container/psyclone_new.cfg
%environment
export LC_ALL=C
export BASE_DIR=/container
export INSTALL_DIR=$BASE_DIR/usr
export OMPI_DIR=$BASE_DIR/ompi
export PFUNIT=$INSTALL_DIR
export NETCDF_DIR=$BASE_DIR/netcdf
export CPPFLAGS="-I$INSTALL_DIR/include -I$NETCDF_DIR/include"
export FFLAGS="-I$INSTALL_DIR/include -I$INSTALL_DIR/mod -I$NETCDF_DIR/include -I$OMPI_DIR/include -I$OMPI_DIR/lib"
export LDFLAGS="-L$INSTALL_DIR/lib -L$NETCDF_DIR/lib"
export PATH=$OMPI_DIR/bin:$NETCDF_DIR/bin:$INSTALL_DIR/bin:/opt/intel/oneapi/compiler/latest/linux/bin/intel64:$BASE_DIR/fcm/bin:$BASE_DIR/rose/bin:$BASE_DIR/clyc/bin:$PATH
export PSYCLONE_CONFIG=/container/psyclone_new.cfg
#Library path
export LD_LIBRARY_PATH="$LOCAL_LD_LIBRARY_PATH:$OMPI_DIR/lib:$NETCDF_DIR/lib:$INSTALL_DIR/lib:/opt/intel/oneapi/compiler/latest/linux/compiler/lib/intel64_lin:$LD_LIBRARY_PATH:/usr/lib64:/usr/lib64/libibverbs:/usr/lib/host"
export FC=ifort
export FPP="cpp -traditional-cpp"
export LDMPI=mpif90
%runscript
#Unset CRAY program env
unset PE_ENV