-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathubuntu20.04-hpc-stack.def
110 lines (102 loc) · 4.27 KB
/
ubuntu20.04-hpc-stack.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
##############################################################################
# README
#
# === Create Container
#
# sudo singularity build --sandbox ./ubuntu-ufs ./ubuntu20.04-ufs.def
#
#############################################################################
Bootstrap: docker
From: ubuntu:20.04
%labels
AUTHOR Redline Performance Solutions LLC (from Penguin Computing recipe)
%setup
mkdir -p /opt
# set noninteractive installation
# export DEBIAN_FRONTEND=noninteractive
# #install tzdata package
# apt install -y lmod
%environment
rm /bin/sh
ln -s /bin/bash /bin/sh
export PATH=/usr/local/sbin:/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH
export CC=mpicc
export FC=mpifort
export CXX=mpicxx
source /usr/share/lmod/6.6/init/bash
%post
export DEBIAN_FRONTEND=noninteractive
apt update -y --allow-unauthenticated
#install tzdata package
apt install -y lmod
export DEBIAN_FRONTEND=noninteractive
apt-get install -y tzdata
# set your timezone
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata
apt -y install build-essential gfortran git openmpi-bin vim cmake python3 wget libexpat1-dev lmod
# Mount point for external files: e.g. ICS, etc.
mkdir /extmount || true
mkdir /lustre || true
mkdir /public || true
mkdir /gpfs || true
mkdir -p /home
cd /opt
git clone -b feature/singularity https://github.com/noaa-emc/hpc-stack.git
cd hpc-stack
yes | ./setup_modules.sh -p /opt/hpc-modules -c config/config_custom.sh
sed -i "10 a source /usr/share/lmod/6.6/init/bash" ./build_stack.sh
sed -i "10 a export PATH=/usr/local/sbin:/usr/local/bin:$PATH" ./build_stack.sh
sed -i "10 a export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH" ./build_stack.sh
./build_stack.sh -p /opt/hpc-modules -c config/config_custom.sh -y stack/stack_noaa.yaml -m
cd /opt
ln -s /usr/bin/python3 /usr/bin/python
git clone https://github.com/ufs-community/ufs-srweather-app.git
cd ufs-srweather-app || true
./manage_externals/checkout_externals || true
/bin/bash
set +H
echo "#!/bin/bash" > build_srw.sh
echo "source /usr/share/lmod/6.6/init/bash" >> build_srw.sh
echo "module purge" >> build_srw.sh
echo "module use /opt/hpc-modules/modulefiles/stack" >> build_srw.sh
echo "module load hpc hpc-gnu hpc-openmpi" >> build_srw.sh
echo "module load cmake" >> build_srw.sh
echo "module load jasper" >> build_srw.sh
echo "module load zlib" >> build_srw.sh
echo "module load png" >> build_srw.sh
echo "module load hdf5" >> build_srw.sh
echo "module load netcdf" >> build_srw.sh
echo "module load pio" >> build_srw.sh
echo "module load esmf" >> build_srw.sh
echo "module load fms/2020.04.03" >> build_srw.sh
echo "module load bacio" >> build_srw.sh
echo "module load crtm" >> build_srw.sh
echo "module load g2" >> build_srw.sh
echo "module load g2tmpl" >> build_srw.sh
echo "module load ip" >> build_srw.sh
echo "module load nemsio" >> build_srw.sh
echo "module load sp" >> build_srw.sh
echo "module load w3emc" >> build_srw.sh
echo "module load w3nco" >> build_srw.sh
echo "module load upp" >> build_srw.sh
echo "module load gfsio" >> build_srw.sh
echo "module load sfcio" >> build_srw.sh
echo "module load sigio" >> build_srw.sh
echo "module load landsfcutil" >> build_srw.sh
echo "module load nemsiogfs" >> build_srw.sh
echo "module load wgrib2" >> build_srw.sh
echo "export CMAKE_C_COMPILER=mpicc" >> build_srw.sh
echo "export CMAKE_CXX_COMPILER=mpicxx" >> build_srw.sh
echo "export CMAKE_Fortran_COMPILER=mpif90" >> build_srw.sh
echo "export CMAKE_Platform=singularity.gnu" >> build_srw.sh
echo "sed -i 's/wgrib2_lib/wgrib2/g' ./src/UFS_UTILS/sorc/chgres_cube.fd/CMakeLists.txt" >> build_srw.sh
echo "sed -i '/wgrib2_api/d' ./src/UFS_UTILS/sorc/chgres_cube.fd/CMakeLists.txt" >> build_srw.sh
echo "mkdir build" >> build_srw.sh
echo "cd build " >> build_srw.sh
echo "cmake -DCMAKE_INSTALL_PREFIX=.. .." >> build_srw.sh
echo "make -j 8 install" >> build_srw.sh
chmod +x ./build_srw.sh
./build_srw.sh || true
exit 0