-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_gpu
255 lines (229 loc) · 12.6 KB
/
Dockerfile_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
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
FROM nvidia/cuda:10.2-cudnn7-devel
SHELL ["/bin/bash", "-l", "-c"]
# Should be updated to the value in the makefile at runtime
ARG BUILD_CORES=8
# Install all required packages available from the disto package manager
RUN apt-get update && \
apt-get install -y software-properties-common apt-utils wget && \
add-apt-repository -y multiverse && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
cd /tmp && wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB && apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB && \
add-apt-repository -y "deb https://apt.repos.intel.com/oneapi all main"
# Handle tzdata dependency asking for input on server location
ARG DEBIAN_FRONTEND=noninteractive
# Install remaining packages; may be excessive after removing some of the install targets.
RUN apt-get update && \
apt-get install -y --no-install-recommends autoconf autogen automake autotools-dev bison cmake csh curl cvs doxygen flex g++-7 g++-9 g++-multilib gcc-7 gcc-9 gcc-multilib gdb gfortran gfortran git gnupg-agent gsl-bin hwloc intel-hpckit intel-oneapi-ipp intel-oneapi-ipp-devel intel-oneapi-mkl intel-oneapi-mkl-devel intel-oneapi-tbb intel-oneapi-tbb-devel intel-oneapi-openmp intel-oneapi-tbb intel-oneapi-tbb-devel libboost-all-dev libblas-dev libbz2-dev libfftw3-3 libfftw3-bin libfftw3-dev libfftw3-single3 libglib2.0-dev libgsl-dev libgslcblas0 libhdf5-dev libhdf5-m* libhdf5-o* libhdf5-s* libicu-dev liblapack-dev libltdl-dev libpcre3-dev libpng-dev libpnglite-dev librdmacm-dev libtool libtool-bin libx11-dev libxml2-dev mlocate nano pgplot5 pkg-config python3-dev python3-matplotlib python3-pip python3-setuptools python3-wheel qt5-default rdma-core rdmacm-utils tcsh tth-common unzip valgrind yodl zstd libzstd-dev && \
apt-get remove -y python2.7* libpython2* libpython-* intel-oneapi-dnn* intel-oneapi-python intel-oneapi-dal* && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 60 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 90 --slave /usr/bin/g++ g++ /usr/bin/g++-7 && \
rm -rf /var/lib/apt/lists/* && \
pip3 install --upgrade pip numpy setuptools sphinx==1.7.9 wheel git+https://github.com/FRBs/sigpyproc3 ipython psrqpy sunpy tqdm
# PSRCHIVE hates the debian name style for hdf5
RUN cd /usr/lib/x86_64-linux-gnu && \
ln -s libhdf5_serial.so libhdf5.so && ln -s libhdf5_serial_hl.so libhdf5_hl.so
# Setup enviroment variables to access installed software
# lstdc++ included in c compiles to workaround a bug in PSRDADA's CUDA compile
ENV SOFT /home/soft
ENV PGPLOT_DIR /usr/lib/pgplot5
ENV PSRCAT_FILE $SOFT/psrcat_tar/psrcat.db
ENV TEMPO $SOFT/tempo
ENV TEMPO2 $SOFT/tempo2/T2runtime
ENV PRESTO $SOFT/presto
ENV PATH $PATH:$SOFT/presto/bin:$SOFT/psrcat_tar/:/usr/local/bin
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/include:$SOFT/presto/lib
ENV CPATH /usr/include/hdf5/serial/:$CPATH
ENV CUDA_HOME /usr/local/cuda
ENV CUDA_TOOLKIT_ROOT_DIR $CUDA_HOME
ENV LIBRARY_PATH $CUDA_HOME/lib64:/usr/local/lib:$LIBRARY_PATH
ENV LD_LIBRARY_PATH $CUDA_HOME/lib64:/usr/local/lib:$LD_LIBRARY_PATH
ENV CFLAGS "-mtune=native -I$CUDA_HOME/include $CFLAGS -lstdc++"
ENV CPPFLAGS "$CFLAGS $CPP_FLAGS"
ENV CUDA_CFLAGS "-I$CUDA_HOME/include $CUDA_CFLAGS -lstdc++"
ENV CUDA_LIBS "-L$CUDA_HOME/lib64 -lcudart $CUDA_LIBS -lstdc++"
ENV PAKCAGES "/usr/local/cuda"
ENV CC icc
ENV CXX icpc
ENV F77 ifort
ENV FC ifort
RUN touch ~/.bash_profile && echo 'unset CMPLR_ROOT; source /opt/intel/oneapi/setvars.sh; alias icc="icx"; alias icpc="icpx"' >> ~/.bash_profile
# Download the software we need to build
# First download relatively slow-to-update / older versions of
# our required stack
WORKDIR /home/soft
RUN git config --global http.postBuffer 1048576000 && \
git clone https://github.com/NVlabs/cub.git cub && \
git clone https://github.com/ajameson/dedisp.git dedisp && \
git clone https://git.code.sf.net/p/heimdall-astro/code heimdall && \
git clone https://github.com/scottransom/psrfits_utils && \
git clone https://github.com/SixByNine/psrxml && \
git clone https://github.com/swig/swig.git swig && \
git clone https://github.com/GPU-correlators/xGPU.git xgpu && \
wget --no-verbose --no-check-certificate https://www.imcce.fr/content/medias/recherche/equipes/asd/calceph/calceph-3.0.0.tar.gz && \
wget --no-verbose http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.48.tar.gz && \
tar -zxvf ./calceph-3.0.0.tar.gz && \
tar -zxvf ./cfitsio-3.48.tar.gz && \
rm ./calceph-3.0.0.tar.gz && \
rm ./cfitsio-3.48.tar.gz
# Get the latest version of in-active-development software
# This arg is updated at build time by the makefile and will cause
# the remainder of this dockerfile to recompile every time it is run
# on a new day
ARG BUILD_DATE=2020-01-10
RUN touch $BUILD_DATE && \
git clone https://github.com/David-McKenna/cdmt.git && \
git clone https://git.code.sf.net/p/dspsr/code dspsr && \
git clone https://github.com/straten/epsic.git && \
git clone https://gist.github.com/799d2873605c189d8261f32b81b3c90c.git /etc/fftw && \
git clone https://gitlab.com/kmrajwade/iqrm_apollo && \
git clone https://github.com/scottransom/presto.git && \
git clone https://git.code.sf.net/p/psrchive/code psrchive && \
git clone https://git.code.sf.net/p/psrdada/code psrdada && \
git clone https://github.com/AA-ALERT/psrdada-python && \
git clone https://github.com/weltevrede/psrsalsa.git && \
git clone https://github.com/v-morello/riptide && \
git clone https://github.com/David-McKenna/sigproc && \
git clone https://git.code.sf.net/p/tempo/tempo && \
git clone https://bitbucket.org/psrsoft/tempo2.git && \
git clone https://github.com/David-McKenna/udpPacketManager.git && \
wget --no-verbose http://www.atnf.csiro.au/people/pulsar/psrcat/downloads/psrcat_pkg.tar.gz && \
tar -zxvf ./psrcat_pkg.tar.gz && \
rm ./psrcat_pkg.tar.gz
# Move CUB into the inclides folder
WORKDIR $SOFT/cub
RUN cp -r ./cub /usr/local/include/ && updatedb && ldconfig
# Build cfitsio, psrfits_utils, psrcat, XGPU, outdated version of swig, calceph and psrxml
WORKDIR $SOFT/cfitsio-3.48
RUN ./configure --prefix=/usr/local --enable-reentrant && make -j $BUILD_CORES && make install && \
cd $SOFT/psrfits_utils && sed -i 's/-Werror//' ./configure.ac && \
./prepare && \
./configure --enable-shared --x-libraries=/usr/lib/x86_64-linux-gnu && \
make install && \
\
cd $SOFT/psrcat_tar && ./makeit && \
\
cd $SOFT/xgpu/src && make CPPFLAGS="" CFLAGS="-I$CUDA_HOME/include -lstdc++" CUDA_ARCH=sm_70 NSTATION=196 -j $BUILD_CORES && make install && \
\
cd $SOFT/swig && \
git reset --hard 1c42135 && \
bash ./autogen.sh && \
./configure --enable-shared --x-libraries=/usr/lib/x86_64-linux-gnu && \
make -j $BUILD_CORES && \
make install && \
updatedb && ldconfig && \
\
cd $SOFT/calceph-3.0.0 && \
./configure --with-pic --enable-shared --enable-static --enable-thread --enable-fortran && \
make -j $BUILD_CORES && \
make install && \
updatedb && ldconfig && \
cd $SOFT/psrxml && autoreconf --install --warnings=none && ./configure && make -j $BUILD_CORES && make install
# Build TEMPO & TEMPO2
WORKDIR $SOFT/tempo
RUN echo " 3801692.284 -528984.335 5076957.630 1 ILOFAR n IL" >> obsys.dat && \
F77=gfortran ./prepare && \
F77=gfortran ./configure --enable-shared --x-libraries=/usr/lib/x86_64-linux-gnu && \
make CFLAGS="$CFLAGS -fPIE" F77=gfortran -j $BUILD_CORES && \
make install && \
updatedb && ldconfig && \
\
cd $SOFT/tempo2 && \
echo "Ielfr n" >> ./T2runtime/observatory/aliases && \
printf "# IE613 LOFAR Station\n 3801633.868 -529022.268 5076996.892 IE613LBA Ielfrlba\n 3801633.868 -529022.268 5076996.892 IE613LBH Ielfrlbh\n 3801692.284 -528984.335 5076957.630 IE613HBA Ielfrhba\n 3801692.284 -528984.335 5076957.630 IE613 Ielfr" >> ./T2runtime/observatory/observatories.dat && \
./bootstrap && \
./configure --with-calceph=/home/soft/calceph-3.0.0 --x-libraries=/usr/lib/x86_64-linux-gnu --prefix=/usr/local && \
make -j $BUILD_CORES && make plugins -j $BUILD_CORES && \
make install && make plugins-install && \
updatedb && ldconfig
# Build PSRDADA
WORKDIR $SOFT/psrdada
ENV FLAGS "-lstdc++"
RUN ./bootstrap && \
./configure --enable-shared --x-libraries=/usr/lib/x86_64-linux-gnu && \
make -j $BUILD_CORES && \
make install
ENV FLAGS ""
# Build PSRCHIVE
# --with-ipp-dir=/opt/intel/oneapi/ipp/latest/
WORKDIR $SOFT/psrchive
RUN git reset --hard 962395 && \
wget https://gist.githubusercontent.com/David-McKenna/6fa0a5df837d9f4072d8bc1daf38966c/raw/72b9cf832f21f64233d308cbbfbff49d78d1cf38/0001-Add-support-for-I-LOFAR-telescope-code.patch && \
git apply 0001-Add-support-for-I-LOFAR-telescope-code.patch && \
./bootstrap && \
./configure --enable-shared --x-libraries=/usr/lib/x86_64-linux-gnu --with-psrxml-dir=/usr/local --enable-static LIBS="-lpsrxml -lxml2" && \
make -j $BUILD_CORES && \
make install && \
updatedb && ldconfig && \
psrchive_config > ~/.psrchive.cfg && \
sed -i "s/# Predictor::default = polyco/Predictor::default = tempo2/" ~/.psrchive.cfg && \
sed -i "s/# Predictor::policy = ephem/Predictor::policy = default/" ~/.psrchive.cfg && \
sed -i "s/# WeightedFrequency::round_to_kHz = 1/WeightedFrequency::round_to_kHz = 0/" ~/.psrchive.cfg
# Build Dedisp
WORKDIR $SOFT/dedisp
RUN sed -i 's/sm_30/sm_70/' ./Makefile.inc && \
sed -i 's/$(HOME)\/linux_64/\/usr\/local/' ./Makefile.inc && \
make -j $BUILD_CORES && \
make install
# Build DSPSR
WORKDIR $SOFT/dspsr
#RUN echo "fits lump sigproc dummy dada puma puma2 spigot wapp mwa ska1" > backends.list
RUN wget https://gist.githubusercontent.com/David-McKenna/dd15cead53a72ccd72b79a6d946f5d71/raw/63fb65a9267b716fff20de9a6532fa7a4a025220/0001-Add-support-for-I-LOFAR-telescope-code.patch && \
git apply 0001-Add-support-for-I-LOFAR-telescope-code.patch && \
echo "dada dummy fits guppi lump sigproc ska1" > backends.list && \
./bootstrap && \
./configure --enable-shared --x-libraries=/usr/lib/x86_64-linux-gnu --with-psrxml-dir=/usr/local --enable-static LIBS="-lpsrxml -lxml2" && \
grep -rl 'restrict throw()' ./ | xargs sed -i 's/restrict throw()/throw()/g' && \
make -j $BUILD_CORES && \
make install && \
updatedb && ldconfig
# Build Heimdall
WORKDIR $SOFT/heimdall
RUN sed -i 's/cat conftest.i/echo "1_65_1"/' ./config/boost.m4 && \
sed -i 's/print command/print(command)/' ./cudalt.py && \
./bootstrap && \
./configure CPPFLAGS="-I$CUDA_HOME/include" CFLAGS="-I$CUDA_HOME/include" --with-boost=/usr && \
sed -i 's/-Xcompiler \"\$(DEFAULT_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS)/-Xcompiler \\\"\$(DEFAULT_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS)\\/g' ./Pipeline/Makefile && \
make -j $BUILD_CORES && \
make install
# Build SIGPROC
WORKDIR $SOFT/sigproc
RUN F77=gfortran CC=gcc CXX=g++ ./bootstrap && \
F77=gfortran CC=gcc CXX=g++ ./configure && \
make F77=gfortran CC=gcc CXX=g++ -j $BUILD_CORES && \
make install && \
updatedb && ldconfig
# Build PRESTO
# PRESTO wisdom seems to just be the fftwf wisdom, so copy it instead
WORKDIR $SOFT/presto/src
RUN cp /etc/fftw/wisdomf $SOFT/presto/lib/fftw_wisdom.txt && \
wget https://gist.githubusercontent.com/David-McKenna/62d3c9c95d5ac36c839d270036e98e8b/raw/54ce1b0778df59af72a0b5e8b4f867a0c4b5ec8d/0001-Add-support-for-I-LOFAR-telescope-to-PRESTO.patch && \
git apply 0001-Add-support-for-I-LOFAR-telescope-to-PRESTO.patch && \
make -j $BUILD_CORES && \
cd .. && CC=gcc pip3 install . && \
python3.6 tests/test_presto_python.py
# Build and install udpPacketManager/mockHeader, riptide, PSRSalsa, CDMT, IQRM, PSRDADA-python
# Comment: I'm compiling udpPacketManager twice here (cdmt clones + compiles on it's own)
WORKDIR $SOFT/udpPacketManager
RUN echo "Building udpPacketManager / mockHeader" && \
\
apt-get update && \
make mockHeader calibration-prep all install && \
rm -rf /var/lib/apt/lists/* && \
\
echo "Building PSRSalsa" && \
cd $SOFT/psrsalsa && sed -i 's/-DGSL_VERSION_NUMBER=115/-DGSL_VERSION_NUMBER=204/g' ./Makefile; make && cd ./bin/; rm README.txt; cp ./* /usr/local/bin/ && \
\
echo "Buidling CDMT" && \
cd $SOFT/cdmt && git pull origin && make cdmt_udp CC=icc && make cdmt_udp_stokesV CC=icc && cp ./cdmt_ud* /usr/local/bin/ && \
\
#echo "Building IQRM" && \
#cd $SOFT/iqrm_apollo && mkdir build && cd build && cmake ../ && make -j $BUILD_CORES && cp ./iqrm_apollo/iqrm_apollo_cli /usr/local/bin/ && \
\
echo "Building riptide" && \
cd $SOFT/riptide && make install CC=gcc CXX=g++ && \
\
echo "Building PSRDADA-python" && \
cd $SOFT/psrdada-python && python3 -m pip install -r ./requirements.txt && make && make test && make install
WORKDIR /home/user
ENTRYPOINT /bin/bash