-
Notifications
You must be signed in to change notification settings - Fork 0
/
pulsar_container.def
184 lines (169 loc) · 5.62 KB
/
pulsar_container.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
Bootstrap: library
From: ubuntu:16.04
%environment
# Export environment variables here.
PSR64=/usr/local/pulsar64
PYTHONBASE=/usr
PYTHONVER=2.7
export GUPPI_DIR=$PSR64/src/guppi_daq
export PSRCAT_FILE=$PSR64/share/psrcat.db
export PGPLOT_DIR=/usr/local/pulsar64/src/pgplot
export PRESTO=$PSR64/src/presto
export TEMPO=$PSR64/src/tempo
export TEMPO2=$PSR64/src/tempo2
export PSRCHIVE=$PSR64/src/psrchive
export BLDSPSR=$PSR64/src/bl-dspsr
export PATH=$PSR64/bin:$PRESTO/bin:$PYTHONBASE/bin:$PATH:$PSR64/share/tempo2/bin
export PYTHONPATH=$PSR64/lib/python$PYTHONVER/site-packages:$PRESTO/lib/python:$PYTHONBASE/lib/python$PYTHONVER:$PYTHONBASE/lib/python$PYTHONVER/site-packages
export LD_LIBRARY_PATH=$PSR64/lib:$PRESTO/lib:$TEMPO2/lib:$PYTHONBASE/lib:/usr/lib/x86_64-linux-gnu:$PRESTO/lib
export LIBRARY_PATH=$PSR64/lib:$PRESTO/lib:$TEMPO2/lib:$PYTHONBASE/lib:/usr/lib/x86_64-linux-gnu
export CPATH=/usr/local/include:/usr/include:$GUPPI_DIR/src
%post
# Export environment variables here.
PSR64=/usr/local/pulsar64
PYTHONBASE=/usr
PYTHONVER=2.7
export GUPPI_DIR=$PSR64/src/guppi_daq
export PSRCAT_FILE=$PSR64/share/psrcat.db
export PGPLOT_DIR=/usr/local/pulsar64/src/pgplot
export PRESTO=$PSR64/src/presto
export TEMPO=$PSR64/src/tempo
export TEMPO2=$PSR64/src/tempo2
export PSRCHIVE=$PSR64/src/psrchive
export BLDSPSR=$PSR64/src/bl-dspsr
export PATH=$PSR64/bin:$PRESTO/bin:$PYTHONBASE/bin:$PATH:$PSR64/share/tempo2/bin
export PYTHONPATH=$PSR64/lib/python$PYTHONVER/site-packages:$PRESTO/lib/python:$PYTHONBASE/lib/python$PYTHONVER:$PYTHONBASE/lib/python$PYTHONVER/site-packages
export LD_LIBRARY_PATH=$PSR64/lib:$PRESTO/lib:$TEMPO2/lib:$PYTHONBASE/lib:/usr/lib/x86_64-linux-gnu
export LIBRARY_PATH=$PSR64/lib:$PRESTO/lib:$TEMPO2/lib:$PYTHONBASE/lib:/usr/lib/x86_64-linux-gnu
export CPATH=/usr/local/include:/usr/include:$GUPPI_DIR/src
apt update
apt -y install git
apt -y install autoconf
apt -y install libtool
apt -y install gcc
apt -y install g++
apt -y install gfortran
apt -y install pgplot5
apt -y install zlib1g-dev
apt -y install make
apt -y install tcsh
apt -y install fftw3-dev
apt -y install libcfitsio-dev
apt -y install libgsl-dev
apt -y install wget
apt -y install apt-utils
apt -y install pkg-config
apt -y install libx11-dev
apt -y install libpng16-dev
apt -y install libglib2.0-dev
apt -y install latex2html # this is ridiculous - adds 1GB for "pstoimg" command
apt -y install cmake socket vim libreadline-dev curl libxml2-dev swig libomp-dev
apt -y install python
apt -y install python-pip
# note: need to upgrade pip but due to python2.7 support disappearing pip 21.0 stopped working
pip install --upgrade "pip < 21.0"
pip install numpy pandas cython astropy
# locale stuff (to avoid annoying warnings)
apt -y install locales
locale-gen en_US.UTF-8
update-locale
### this takes too long!!! do we need it?
# make fftw wisdom?
# mkdir /etc/fftw
# fftw-wisdom -v -c -o /etc/fftw/wisdom
### bl_sigproc
cd /usr/local
git clone https://github.com/UCBerkeleySETI/bl_sigproc.git
cd bl_sigproc
./bootstrap
./configure
make -j8
make install
### set up pulsar64 - download everything first into $PSR64/src
mkdir -p $PSR64/src
cd $PSR64/src
# tempo
git clone git://git.code.sf.net/p/tempo/tempo
# tempo2
git clone https://bitbucket.org/psrsoft/tempo2.git
# presto - get bl version
git clone https://github.com/UCBerkeleySETI/presto.git
# dspsr - get bl-dspsr version
git clone https://github.com/UCBerkeleySETI/bl-dspsr.git
# psrcat
wget https://www.atnf.csiro.au/research/pulsar/psrcat/downloads/psrcat_pkg.tar.gz
tar xvfz psrcat_pkg.tar.gz
rm psrcat_pkg.tar.gz
# psrchive
git clone git://git.code.sf.net/p/psrchive/code psrchive
# guppi_daq
git clone https://github.com/UCBerkeleySETI/guppi_daq.git
### psrcat install
cd $PSR64/src/psrcat_tar
mkdir $PSR64/share
mkdir $PSR64/bin
cp ./*.db $PSR64/share/.
./makeit
cp psrcat $PSR64/bin/.
### guppi_daq
cd $PSR64/src/guppi_daq
python setup.py install --install-lib=$PSR64/src/guppi_daq
### tempo
cd $TEMPO
./prepare
./configure --prefix=$PSR64
make -j8
make install
### tempo2
cd $TEMPO2
./bootstrap
./configure --prefix=$PSR64
make -j8
make install
make plugins
make plugins-install
ln -s $PSR64/include
ln -s $PSR64/lib
### presto
cd $PRESTO/src
# hack: there is some chicken/egg silliness - you have to build libsla.so by hand
# and copy it to a standard location before running the full make
cd slalib
gfortran -g -fPIC -fno-second-underscore -c -I. *.f *.F
gfortran -shared -o $PRESTO/lib/libsla.so -fno-second-underscore *.o
cp $PRESTO/lib/libsla.so /usr/lib/.
# anyway... going back to the beginning
cd $PRESTO/src
make makewisdom
make -j8
# now all the python stuff
cd $PRESTO
pip install .
python setup.py install
#### psrchive
# hack: need to add stdint.h include to get this to compile
cd $PSRCHIVE/Base/Formats/PSRFITS
sed '1 i\#include "stdint.h"' ProfileColumn.C > ProfileColumn.C.fixed
mv -vf ProfileColumn.C.fixed ProfileColumn.C
# okay that was stupid - now onto the normal stuff
cd $PSRCHIVE
./bootstrap
./configure --prefix=$PSR64 --with-psrcat=psrcat --enable-shared
make clean
make -j8
make install
#### dspsr
echo "apsr asp bcpm bpsr caspsr cpsr cpsr2 dummy fits kat lbadr lbadr64 lump lwa mwa pdev s2 sigproc ska1" > $BLDSPSR/backends.list
export PATH=$PSR64/bin:$PATH
cd $BLDSPSR
./bootstrap
./configure --prefix=$PSR64 GUPPI_DIR=
# add the guppi back in after the configure... since we do not care about guppi_daq shared memory buffer stuff which breaks the current build
echo "apsr asp bcpm bpsr caspsr cpsr cpsr2 dummy fits guppi kat lbadr lbadr64 lump lwa mwa pdev s2 sigproc ska1" > $BLDSPSR/backends.list
make -j8
make install
%runscript
# Enable passing arguments into container via commandline
echo "Container Created"
echo "Args: $*"
exec "$@"