-
Notifications
You must be signed in to change notification settings - Fork 2
/
Singularity.gpu
167 lines (139 loc) · 6.44 KB
/
Singularity.gpu
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
Bootstrap: docker
From: nvidia/cuda:11.8.0-devel-ubuntu20.04
%post
apt-get update # update and install packages we need for the build
export DEBIAN_FRONTEND=noninteractive
export TZ=Etc/UTC
apt-get -y install autoconf build-essential csh git htop libboost-dev libtool libtool-bin software-properties-common wget
# I can't get your to build in ubuntu's python3.7, llvmlite fails and there is no clear way around this
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh -q
bash ~/miniconda.sh -b -p /usr/local/miniconda
rm ~/miniconda.sh
eval "$(/usr/local/miniconda/bin/conda shell.bash hook)"
conda init
conda create -y --name RT python=3.8
conda activate RT
# As described in https://github.com/hpcng/singularity/issues/5075#issuecomment-594391772
echo "## Activate RT environment" >> /.singularity_bash
echo "source /usr/local/miniconda/etc/profile.d/conda.sh" >> /.singularity_bash
echo "conda activate RT" >> /.singularity_bash
echo "Installing FETCH"
conda install -y -c anaconda "tensorflow-gpu>=2.0,<=2.6"
# https://stackoverflow.com/a/68601733 use 1.3.0 until this is fixed
conda install -y -c anaconda keras pandas==1.3.0 scipy numpy
git clone https://github.com/devanshkv/fetch.git
cd fetch
pip install .
echo "Fetch Built at commit $(git rev-parse HEAD) which was on $(git log -1 --format=%cd)" >> "$SINGULARITY_LABELS"
cd ~ && rm -rf fetch
echo "Installing jupyterlab"
# Not needed for any in particular, but might be useful
conda install -y -c conda-forge jupyterlab
echo "Jupiterlab Built from conda" >> "$SINGULARITY_LABELS"
# Dirs for Heimdall build
mkdir ~/source # build soft
mkdir ~/software # put binaries here
echo "Building Dedisp"
mkdir -p /root/software/dedisp/include # dedisp need these
mkdir -p /root/software/dedisp/lib/
cd ~/source
git clone https://github.com/ajameson/dedisp.git
cd dedisp
sed -i 's/sm_30/all-major/g' Makefile.inc
make INSTALL_DIR=$HOME/software/dedisp install
cp ~/software/dedisp/lib/* /usr/local/lib
export LD_LIBRARY_PATH=LD_LIBRARY_PATH:~/software/dedisp
echo "dedisp Built at commit $(git rev-parse HEAD) which was on $(git log -1 --format=%cd)" >> "$SINGULARITY_LABELS"
echo "Building Psrdada"
# Work around for sf server certificate
apt-get -y install apt-transport-https ca-certificates
update-ca-certificates
cd ~/source
export CFLAGS="-fopenmp -fPIC" # needs to be complied with fPIC for psrdada-python to work
git clone https://git.code.sf.net/p/psrdada/code psrdada
cd psrdada
./bootstrap
./configure --prefix=$HOME/software/psrdada
make
make install
cp -r ~/software/psrdada/bin/* /usr/local/bin
cp -r ~/software/psrdada/lib/* /usr/local/lib
cp -r ~/software/psrdada/include/* /usr/include
echo "psrdada Built at commit $(git rev-parse HEAD) which was on $(git log -1 --format=%cd)" >> "$SINGULARITY_LABELS"
export PATH=$PATH:/usr/local/cuda
echo "Building Heimdall"
cd ~/source
git clone git://git.code.sf.net/p/heimdall-astro/code heimdall
cd heimdall
./bootstrap
./configure --prefix=$HOME/software/heimdall/linux_64 --with-psrdada-dir=$HOME/software/psrdada --with-dedisp-dir=$HOME/software/dedisp --with-cuda-dir=/usr/local/cuda
make install
mv ~/software/heimdall/linux_64/bin/* /usr/local/bin
echo "Heimdall Built at commit $(git rev-parse HEAD) which was on $(git log -1 --format=%cd)" >> "$SINGULARITY_LABELS"
rm -rf software source # clean up after heimdall build
echo "Installing psrdada-python"
cd ~
git clone https://github.com/TRASAL/psrdada-python.git
cd psrdada-python
pip install -r requirements.txt
# add lib and include paths to setup.py
sed -i "51 a LIBRARY_DIRS.append('/usr/local/lib')" setup.py
sed -i "51 a INCLUDE_DIRS.append('/usr/include')" setup.py
make
make install
echo "psrdada-python Built at commit $(git rev-parse HEAD) which was on $(git log -1 --format=%cd)" >> "$SINGULARITY_LABELS"
cd ~ && rm -rf psrdada-python
echo "Installing your"
cd ~
git clone https://github.com/thepetabyteproject/your.git
cd your
pip install .
echo "your Built at commit $(git rev-parse HEAD) which was on $(git log -1 --format=%cd)" >> "$SINGULARITY_LABELS"
cd ~ && rm -rf your
echo "Installing jess"
cd ~
git clone https://github.com/josephwkania/jess.git
cd jess
pip install .[cupy]
echo "jess Built at commit $(git rev-parse HEAD) which was on $(git log -1 --format=%cd)" >> "$SINGULARITY_LABELS"
cd ~ && rm -rf jess
apt-get -y purge autoconf build-essential git wget # remove build time dependencies
apt-get -y autoremove
apt-get -y clean # /var/cache/apt/archives is not emptied on its own,
conda clean --all
echo "Done building!"
%environment
# For conda
action="${0##*/}"
if [ "$action" = "shell" ]; then
if [ "${SINGULARITY_SHELL:-}" = "/bin/bash" ]; then
set -- --noprofile --init-file /.singularity_bash
elif test -z "${SINGULARITY_SHELL:-}"; then
export SINGULARITY_SHELL=/bin/bash
set -- --noprofile --init-file /.singularity_bash
fi
fi
source /usr/local/miniconda/bin/activate RT # sets up conda so we can access outside the container
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH # dedisp libs
export QT_QPA_PLATFORM=offscreen # allows your_viewer to run when --nv is given, see https://github.com/therecipe/qt/issues/775#issuecomment-475900676
%runscript
exec /usr/local/miniconda/RT/bin/"$@"
exec /bin/bash --noprofile --init-file /.singularity_bash "$@"
%help
This container is for running your_heimdall on dada buffers for search for single pulses.
These pulses can be classified with FETCH.
Contains:
CUDA 11.5
fetch https://github.com/devanshkv/fetch
jess https://github.com/josephwkania/jess
jupyterlab https://jupyter.org
heimdall https://sourceforge.net/p/heimdall-astro/wiki/Use/
- dedisp https://github.com/ajameson/dedisp
htop https://htop.dev/
psrdada http://psrdada.sourceforge.net/
psrdada-python https://github.com/TRASAL/psrdada-python
your https://github.com/thepetabyteproject/your
%labels
Author Joseph W Kania
Version v0.1.0
Build-date 27-Nov-2021