-
Notifications
You must be signed in to change notification settings - Fork 0
/
Singularity.05221357
211 lines (178 loc) · 6.45 KB
/
Singularity.05221357
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
Bootstrap: docker
From: ubuntu:16.04
%post
apt-get -y update
apt-get -y install wget
apt-get -y install gawk
apt-get -y install apt-transport-https
#Aug 06 2019 6:24 AM
# Next lines require to download Intel Python
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
wget https://apt.repos.intel.com/setup/intelproducts.list -O /etc/apt/sources.list.d/intelproducts.list
apt-get -y update
# This prevents some questions being asked
export DEBIAN_FRONTEND=noninteractive
apt-get install dialog
date
# Intalling Fortran also gives us C.
apt install -y gfortran
# Installing g++ make installing openmpi easier
apt install -y g++
apt install -y make
date
# Install editors
apt install -y nano
apt install -y vim
# lpr might be needed by enscript
apt install -y lpr
# The next two lines install a perl module needed
# by the backup app installed below.
apt install -y cpanminus
cpan install Term::ANSIColor
# Install Rrrrrrrr
#apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
apt-get -y install software-properties-common
#add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/'
apt update
apt install -y r-base
###### Skip Intel MPI ######
# Intel MPI is huge
# apt-get -y install intel-mpi-2019.3-062 2019.3-062
# Build openmpi from source - should not look for IB fabric
# This will, at best be slow over network and most likely
# will only work for a single node.
# We need ssh for this to work.
apt install -y openssh-server
apt install -y openssh-client
mkdir -p /opt/install
cd /opt/install
wget https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.1.tar.gz
tar -xzf openmpi-4.0.1.tar.gz
cd openmpi-4.0.1
./configure
make
make install
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/bin:$PATH
# Install Rmpi
mkdir -p /opt/install/rlibs
cd /opt/install
wget https://cran.r-project.org/src/contrib/Rmpi_0.6-9.tar.gz
R CMD INSTALL -l /opt/install/rlibs --configure-args=" \
--with-Rmpi-include='/usr/local/include' \
--with-Rmpi-libpath='/usr/local/lib' \
--with-mpi='/usr/local' \
--with-Rmpi-type='OPENMPI' " \
Rmpi_0.6-9.tar.gz
# Install rest of tutorial stuff
cd /opt/install
cat > bonk.R << EOF
install.packages("ggplot2", lib="/opt/install/rlibs", repos="http://cran.r-project.org")
install.packages("ggmap", lib="/opt/install/rlibs", repos="http://cran.r-project.org")
install.packages("maps", lib="/opt/install/rlibs", repos="http://cran.r-project.org")
install.packages("mapdata", lib="/opt/install/rlibs", repos="http://cran.r-project.org")
install.packages("dplyr", lib="/opt/install/rlibs", repos="http://cran.r-project.org")
install.packages("doParallel", lib="/opt/install/rlibs", repos="http://cran.r-project.org")
install.packages("gplots", lib="/opt/install/rlibs", repos="http://cran.r-project.org")
install.packages("foreach", lib="/opt/install/rlibs", repos="http://cran.r-project.org")
install.packages("tictoc", lib="/opt/install/rlibs", repos="http://cran.r-project.org")
install.packages("stringr", lib="/opt/install/rlibs", repos="http://cran.r-project.org")
EOF
Rscript bonk.R
# Install Intel Python
date
apt-get -y install intelpython3
date
#apt-get -y install intelpython2
date
# uninstall and reinstall mpi4py
# so it uses openmpi
cd /opt/intel/intelpython3/bin
rm -rf mpi*
cd /opt/intel/intelpython3/lib
rm -rf libmpi*
#fix next line
cd /opt/intel/intelpython3/lib/python3.6/site-packages
rm -rf mpi4py*
cd /opt/install
export PATH=/opt/intel/intelpython3/bin:$PATH
export CFLAGS="-std=c99"
pip install mpi4py
unset CFLAGS
#
#
# Build a cute calendar app.
# This is a combination of a Fortran and Python program
# The python program creates the input file, calls the
# Fortran program and then post processes the output by
# calling enscript, built below.
# envoke as:
###### mycal
## or
###### mycal 1 2019 1 2020
# creates a "snoopy" calendar as a *ps file
mkdir -p /opt/examples
chmod 755 /opt/examples
wget https://petra.acns.colostate.edu/docs/examples/snoopy/cal.f -O /opt/examples/cal.f
wget https://petra.acns.colostate.edu/docs/examples/snoopy/cal.py -O /opt/examples/mycal
gfortran /opt/examples/cal.f -o /opt/examples/snoopy
chmod 755 /opt/examples/*
#
#### apt install -y enscript
# build enscript manually to get a newest version
cd /opt/examples
wget https://ftp.gnu.org/gnu/enscript/enscript-1.6.6.tar.gz
tar -xzf enscript-1.6.6.tar.gz
cd enscript-1.6.6/
./configure
make
make install
cd /opt/examples
rm -rf enscript*
# Add C and Python matxix inversion examples
cd /opt/examples
wget https://petra.acns.colostate.edu/docs/examples/array/invertc.c
gcc -fopenmp invertc.c -o invertc
wget https://petra.acns.colostate.edu/docs/examples/array/invertp.py
mv invertp.py invertp
chmod 755 invertp
# fix the python version to point to the default installed version
sed -i '1 s,^.*$,#!/usr/bin/env python,' invertp
# Get a few other tools
wget https://petra.acns.colostate.edu/docs/examples/tims_tools/backup
chmod 755 backup
wget https://petra.acns.colostate.edu/docs/examples/tims_tools/stamp
chmod 755 stamp
for t in tymer confidence.py plplot greenbar jlines ; do
wget https://petra.acns.colostate.edu/docs/examples/tims_tools/$t
# fix the python version to point to the default installed version
sed -i '1 s,^.*$,#!/usr/bin/env python,' $t
chmod 755 $t
done
# Get the rest of Tim's examples:
mkdir -p /opt/examples/full
cd /opt/examples/full
wget https://petra.acns.colostate.edu/docs/examples/examples.tgz
tar -xzf examples.tgz
rm examples.tgz
# Do a bit of cleanup. This directory is ~300MB
rm -rf /opt/install/openmpi-4.0.1*
rm -rf /opt/examples/full/*tgz
date
%environment
export LC_ALL=C
# Python order is important if you want both 3 and 2
# because there is "python" under intelpython3 that is
# actually python3
export PATH=/opt/intel/intelpython3/bin:$PATH
#export PATH=/opt/intel/intelpython2/bin:$PATH
export PATH=/opt/install:$PATH
export PATH=/opt/examples:$PATH
export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export export R_LIBS=/opt/install/rlibs/
#export DO_IMPI=/opt/intel/impi/2019.3.199/intel64/bin/mpivars.sh
export DO_IMPI=/opt/examples/stamp
%labels
Author thkphd