-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlofarbase.def
208 lines (179 loc) · 9.47 KB
/
lofarbase.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#Bootstrap: yum
#OSVersion: 7
#MirrorURL: http://mirror.centos.org/centos-%{OSVERSION}/%{OSVERSION}/os/x86_64/
#Include: yum
Bootstrap: docker
From: centos:7
%files
%environment
export INSTALLDIR=/opt/lofar
. $INSTALLDIR/init.sh
%post
# General environment settings.
export J=8
export INSTALLDIR=/opt/lofar
export PYTHON_VERSION=2.7
# Settings relevant to the installed software.
export ARMADILLO_VERSION=8.600.0
export BLAS_VERSION=0.2.17
export BOOST_DOT_VERSION=1.69.0
export BOOST_VERSION=1_69_0
export CFITSIO_VERSION=3410
export FFTW_VERSION=3.3.8
export HDF5_VERSION=1.8.21
export LAPACK_VERSION=3.6.0
export OPENBLAS_VERSION=v0.3.5
# Do not change, Armadillo wants this version of SuperLU.
export SUPERLU_VERSION=v5.2.1
export WCSLIB_VERSION=7.1
yum -y update
yum -y install patch sudo yum-utils
yum -y install git svn wget vim nano
yum -y install automake-devel aclocal autoconf autotools cmake make
yum -y install g++ gcc gcc-c++ gcc-gfortran
yum -y install arpack-devel blas-devel boost boost-devel boost-python fftw3-devel fftw3-libs python-devel lapack-devel libpng-devel libxml2-devel numpy-devel readline-devel ncurses-devel f2py bzip2-devel libicu-devel scipy python-setuptools gsl gsl-devel gdal gdal-devel libpqxx libpqxx-devel
yum -y install bison flex ncurses tar bzip2 which gettext
yum -y install epel-release
yum -y install cmake3
#yum-config-manager --enable epel
#yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install hdf5-devel
#wget --retry-connrefused https://bootstrap.pypa.io/get-pip.py -O - | pythonwget --retry-connrefused https://bootstrap.pypa.io/get-pip.py -O - | python
yum -y install python-pip tkinter
yum -y remove python-numpy python3-numpy
yum -y remove numpy
yum groups mark install "Development Tools"
yum groups mark convert "Development Tools"
yum -y groupinstall "Development Tools"
yum -y install centos-release-scl
yum -y install devtoolset-7-gcc*
scl enable devtoolset-7 bash
# FACTOR requisites.
pip install pyparsing
export CC=`which gcc`
export CXX=`which g++`
export make=$INSTALLDIR/make/bin/make
mkdir -p $INSTALLDIR
export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64:$LD_LIBRARY_PATH
export CMAKE_PREFIX_PATH=/opt/intel/mkl/lib/intel64:$CMAKE_PREFIX_PATH
export CPATH=/opt/intel/mkl/include:$CPATH
export CFLAGS="-mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512ifma -mno-avx512vbmi"
export CXXFLAGS="-mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512ifma -mno-avx512vbmi"
#
# Install GNU Make 4
#
mkdir -p $INSTALLDIR/make && cd $INSTALLDIR/make
wget http://ftp.gnu.org/gnu/make/make-4.2.tar.gz && tar xf make-4.2.tar.gz && cd make-4.2
./configure --prefix=$INSTALLDIR/make && make -j $J && make install
rm -rf $INSTALLDIR/make/make-4.2.tar.gz
#
# Install CMake
#
mkdir -p $INSTALLDIR/cmake && cd $INSTALLDIR/cmake
wget https://github.com/Kitware/CMake/releases/download/v3.13.1/cmake-3.13.1.tar.gz && tar xf cmake-3.13.1.tar.gz && cd cmake-3.13.1
./bootstrap --prefix=$INSTALLDIR/cmake && $make -j $J && $make install
rm -rf $INSTALLDIR/cmake/cmake-*
#
# Install FFTW
#
mkdir -p $INSTALLDIR/fftw
cd $INSTALLDIR/fftw && wget http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz && tar xf fftw*.tar.gz
cd fftw* && ./configure --prefix=$INSTALLDIR/fftw --enable-threads --enable-shared
$make -j $J
$make install
rm -rf $INSTALLDIR/fftw/*.tar.gz
#
# Install HDF5
#
mkdir -p $INSTALLDIR/hdf5
cd $INSTALLDIR/hdf5 && wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.21/src/hdf5-1.8.21.tar.gz && tar xf hdf5*.tar.gz
#cd $INSTALLDIR/hdf5 && wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.4/src/hdf5-1.10.4.tar.gz && tar xf hdf5*.tar.gz
cd hdf5* && ./configure --prefix=$INSTALLDIR/hdf5 --enable-fortran --enable-cxx --enable-threadsfafe --enable-unsupported && $make -j $J && make install
rm -rf $INSTALLDIR/hdf5/hdf5*
#
# Install Boost.Python
#
mkdir -p $INSTALLDIR/boost/src
#cd $INSTALLDIR && wget https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.gz
cd $INSTALLDIR && wget https://downloads.sourceforge.net/project/boost/boost/1.69.0/boost_1_69_0.tar.gz
#wget https://dl.bintray.com/boostorg/release/${BOOST_DOT_VERSION}/source/boost_${BOOST_VERSION}.tar.gz
#cd $INSTALLDIR && tar xzf boost_${BOOST_VERSION}.tar.gz -C boost && cd boost/boost_${BOOST_VERSION} && ./bootstrap.sh --prefix=$INSTALLDIR/boost && ./b2 headers && ./b2 install toolset=gcc cxxflags=-std=c++11 --prefix=$INSTALLDIR/boost --with=all -j $J
cd $INSTALLDIR && tar xzf boost_${BOOST_VERSION}.tar.gz -C boost && cd boost/boost_${BOOST_VERSION} && ./bootstrap.sh --prefix=$INSTALLDIR/boost && ./b2 headers && ./b2 install toolset=gcc cxxflags=-std=c++11 --prefix=$INSTALLDIR/boost --with=all -j $J
rm -rf $INSTALLDIR/boost/src $INSTALLDIR/boost_${BOOST_VERSION}.tar.gz $INSTALLDIR/boost/boost_*
#
# Install OpenBLAS
#
mkdir -p $INSTALLDIR/openblas/
cd $INSTALLDIR/openblas/ && git clone https://github.com/xianyi/OpenBLAS.git src && cd src && git checkout $OPENBLAS_VERSION
cd $INSTALLDIR/openblas/src && $make -j $J && $make install PREFIX=$INSTALLDIR/openblas USE_OPENMP=1 NUM_THREADS=64
rm -rf $INSTALLDIR/openblas/src
#
# Install SuperLU
#
mkdir -p $INSTALLDIR/superlu/build
cd $INSTALLDIR/superlu/ && git clone https://github.com/xiaoyeli/superlu.git src && cd src && git checkout $SUPERLU_VERSION
cd $INSTALLDIR/superlu/build && cmake ../src -DCMAKE_INSTALL_PREFIX=$INSTALLDIR/superlu -DUSE_XSDK_DEFAULTS=TRUE -Denable_blaslib=OFF -DBLAS_LIBRARY=$INSTALLDIR/openblas/lib/libopenblas.so && $make -j $j && $make install
rm -rf $INSTALLDIR/superlu/src
#
# Install Armadillo
#
mkdir -p $INSTALLDIR/armadillo/
cd $INSTALLDIR/armadillo && wget http://sourceforge.net/projects/arma/files/armadillo-$ARMADILLO_VERSION.tar.xz && tar xf armadillo-$ARMADILLO_VERSION.tar.xz && rm armadillo-$ARMADILLO_VERSION.tar.xz
cd $INSTALLDIR/armadillo/armadillo-$ARMADILLO_VERSION && ./configure && cmake . -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLDIR/armadillo -Dopenblas_LIBRARY:FILEPATH=$INSTALLDIR/openblas/lib/libopenblas.so -DSuperLU_INCLUDE_DIR:PATH=$INSTALLDIR/superlu/include -DSuperLU_LIBRARY:FILEPATH=$INSTALLDIR/superlu/lib64/libsuperlu.so && $make -j $J && $make install
rm -rf $INSTALLDIR/armadillo/armadillo-$ARMADILLO_VERSION.tar.xz
#
# install-cfitsio
#
mkdir -p ${INSTALLDIR}/cfitsio/build
cd ${INSTALLDIR}/cfitsio && wget --retry-connrefused https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio${CFITSIO_VERSION}.tar.gz
cd ${INSTALLDIR}/cfitsio && tar xf cfitsio${CFITSIO_VERSION}.tar.gz
cd ${INSTALLDIR}/cfitsio/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/cfitsio/ ../cfitsio
cd ${INSTALLDIR}/cfitsio/build && $make -j ${J}
cd ${INSTALLDIR}/cfitsio/build && $make install
rm -rf $INSTALLDIR/cfitsio/cfitsio${CFITSIO_VERSION}.tar.gz
#
# install-wcslib
#
mkdir ${INSTALLDIR}/wcslib
if [ "${WCSLIB_VERSION}" = "latest" ]; then cd ${INSTALLDIR}/wcslib && wget --retry-connrefused ftp://[email protected]/pub/software/wcslib/wcslib.tar.bz2 -O wcslib-latest.tar.bz2; fi
if [ "${WCSLIB_VERSION}" != "latest" ]; then cd ${INSTALLDIR}/wcslib && wget --retry-connrefused ftp://[email protected]/pub/software/wcslib/wcslib-${WCSLIB_VERSION}.tar.bz2; fi
cd ${INSTALLDIR}/wcslib && tar xf wcslib-*.tar.bz2
#cd ${INSTALLDIR} && mkdir wcslib && cd wcslib && svn checkout https://github.com/astropy/astropy/trunk/cextern/wcslib
cd ${INSTALLDIR}/wcslib/wcslib* && ./configure --prefix=${INSTALLDIR}/wcslib --with-cfitsiolib=${INSTALLDIR}/cfitsio/lib/ --with-cfitsioinc=${INSTALLDIR}/cfitsio/include/ --without-pgplot
cd ${INSTALLDIR}/wcslib/wcslib* && $make -j $J
cd ${INSTALLDIR}/wcslib/wcslib* && $make install
rm -rf $INSTALLDIR/wcslib/wcslib-*.tar.bz2
pip install --upgrade pip
pip install --upgrade setuptools
pip uninstall -y numpy
pip install numpy==1.16.4
#pip install --upgrade numpy astropy scipy matplotlib numexpr
pip install astropy scipy matplotlib numexpr
pip install "tables<3.5"
pip install wheel
pip install --upgrade boost mock pp progressbar python-monetdb xmlrunner unittest2 regions
echo "Installation directory contents:"
ls ${INSTALLDIR}
yum -y clean all
#
# init-lofar
#
echo export INSTALLDIR=$INSTALLDIR > $INSTALLDIR/init.sh
#echo export LD_LIBRARY_PATH=/usr/local/cuda/lib64:\$INSTALLDIR/armadillo/lib64:\$INSTALLDIR/boost/lib:\$INSTALLDIR/cfitsio/lib:\$INSTALLDIR/superlu/lib64:\$INSTALLDIR/wcslib/:\$LD_LIBRARY_PATH >> $INSTALLDIR/init.sh
echo export LD_LIBRARY_PATH=\$INSTALLDIR/armadillo/lib64:\$INSTALLDIR/boost/lib:\$INSTALLDIR/cfitsio/lib:\$INSTALLDIR/superlu/lib64:\$INSTALLDIR/wcslib/:\$LD_LIBRARY_PATH >> $INSTALLDIR/init.sh
#echo export PATH=/usr/local/cuda/bin:\$PATH >> $INSTALLDIR/init.sh
echo export make=/opt/lofar/make/bin/make >> $INSTALLDIR/init.sh
echo export cmake=/opt/lofar/cmake/bin/cmake >> $INSTALLDIR/init.sh
#
# entrypoint
#
%runscript
echo source $INSTALLDIR/init.sh >> $HOME/.bashrc
. $INSTALLDIR/init.sh
%help
This Singularity image acts as a base for the LOFAR installation. It has CentOS 7.5 setup, with the required dependencies installed. These are:
* Armadillo $ARMADILLO_VERSION
* Boost $BOOST_VERSION
* CFITSIO $CFITSIO_VERSION
* SuperLU $SUPERLU_VERSION
* WCSLIB $WCSLIB_VERSION