Skip to content
Snippets Groups Projects
Commit 20a8ba84 authored by Giuliano Taffoni's avatar Giuliano Taffoni
Browse files

vlbi pipeline

parent 1a871b00
No related branches found
No related tags found
No related merge requests found
FROM morgan1971/vlbi-base:0.0.1
MAINTAINER Giuliano Taffoni <giuliano.taffoni@inaf.it>
ENV CONTAINER_NAME='lovarVLBISoftware'
USER root
ENV J=40
ENV INSTALLDIR=/opt/lofar
ENV PYTHON_VERSION=2.7
# Path to where the patch for python-casacore's setup is stored.
ENV PYTHON_CASACORE_PATCH=$INSTALLDIR/python-casacore/python_casacore_setup_patch.patch
ENV PATCH_LOFAR=$INSTALLDIR/lofar/lofar.patch
# Settings relevant to the installed software.
ENV AOFLAGGER_VERSION=v2.15.0
ENV ARMADILLO_VERSION=9.900.3
ENV BLAS_VERSION=3.8.0
ENV BOOST_VERSION=1.69.0
ENV CASACORE_VERSION=v2.4.1
ENV # Leave at latest, release versions crash for some reason.
ENV CASAREST_VERSION=latest
ENV CFITSIO_VERSION=7.3.47
ENV DPPP_VERSION=v4.2
ENV DYSCO_VERSION=v1.2
#export EVERYBEAM_VERSION=0cc64a81
ENV EVERYBEAM_VERSION=master
ENV FFTW_VERSION=3.5.8
ENV HDF5_VERSION=1.10.5
ENV IDG_VERSION=master
ENV LAPACK_VERSION=3.8.0
ENV LOFAR_VERSION=3_2_18
# Don't change LOSOTO2_VERSION. This is the last commit that plays nice with Python 2.
ENV LOSOTO2_VERSION=c8fbd61
ENV LOSOTO3_VERSION=latest
ENV LSMTOOL_VERSION=v1.4.2
ENV OPENBLAS_VERSION=3.8.0
ENV PYBDSF_VERSION=master
ENV PYTHON_CASACORE_VERSION=v2.2.1
ENV RMEXTRACT_VERSION=4c61232
ENV SUPERLU_VERSION=5.2.1
ENV WSCLEAN_VERSION=latest
ENV WCSLIB_VERSION=6.4
ENV HDF5_USE_FILE_LOCKING=FALSE
# Symlinks required for Fedora 31
RUN ln -s /usr/lib64/libboost_python37.so /usr/lib64/libboost_python3.so
RUN ln -s /usr/lib64/libboost_numpy37.so /usr/lib64/libboost_numpy3.so
RUN ln -s /usr/lib64/libboost_python27.so /usr/lib64/libboost_python.so
RUN ln -s /usr/lib64/libboost_numpy27.so /usr/lib64/libboost_numpy.so
RUN ln -s /usr/lib64/libnsl.so.2.0.0 /usr/lib64/libnsl.so
#
# Setup the compiliong enviroment
#
#ARG CFLAGS="-mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512ifma -mno-avx512vbmi"
#ARG CXXFLAGS="-std=c++11 -mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512ifma -mno-avx512vbmi"
# Use below to optimize for a specific architecture
#export CFLAGS="-march=skylake-avx512 -mtune=skylake-avx512"
#export CXXFLAGS="-march=skylake-avx512 -mtune=skylake-avx512"
ARG CPLUS_INCLUDE_PATH="/usr/include/openmpi-x86_64:/usr/include/c++/9:$CPLUS_INCLUDE_PATH:/usr/include/python2.7:$INSTALLDIR/casacore/include:/usr/include/boost:/usr/include/cfitsio:$INSTALLDIR/EveryBeam/include"
ARG CPATH="/usr/include/openmpi-x86_64/:/opt/intel/mkl/include:${INSTALLDIR}/casacore/include:$INSTALLDIR/LOFARBeam/include:$INSTALLDIR/idg/include:$INSTALLDIR/aoflagger/include:$INSTALLDIR/EveryBeam/include:$CPATH"
ARG CMAKE_PREFIX_PATH="$INSTALLDIR/aoflagger:$INSTALLDIR/casacore:$INSTALLDIR/lofar:$INSTALLDIR/LOFARBeam:/usr/lib64/openmpi:$INSTALLDIR/EveryBeam"
ARG LD_LIBRARY_PATH="$INSTALLDIR/aoflagger/lib:$INSTALLDIR/casacore/lib:$INSTALLDIR/idg/lib:$INSTALLDIR/LOFARBeam/lib:/usr/lib64/openmpi/lib/:$INSTALLDIR/EveryBeam/lib:LD_LIBRARY_PATH"
ARG PATH="/usr/lib64/openmpi/bin:$PATH"
#ARG make=`which make`
ARG OLD_PYTHONPATH=$PYTHONPATH
#
# Setup the Python environment.
#
RUN wget https://raw.githubusercontent.com/tikk3r/lofar-grid-hpccloud/fedora/requirements.txt -O $INSTALLDIR/requirements.txt
RUN wget https://raw.githubusercontent.com/tikk3r/lofar-grid-hpccloud/fedora/requirements3.txt -O $INSTALLDIR/requirements3.txt
RUN pip install xmlrunner
RUN pip3 install xmlrunner
RUN echo lofar-h5plot >> $INSTALLDIR/requirements3.txt
RUN pip --no-cache-dir install "virtualenv<20"
RUN virtualenv $INSTALLDIR/pyenv-py3 --python=python3
RUN source $INSTALLDIR/pyenv-py3/bin/activate && export HDF5_VERSION=1.10.5 && pip install numpy && pip install --no-binary h5py h5py && \
pip install -r $INSTALLDIR/requirements3.txt && deactivate
RUN virtualenv $INSTALLDIR/pyenv-py2 --python=python2
RUN source $INSTALLDIR/pyenv-py2/bin/activate && export HDF5_VERSION=1.10.5 && pip install numpy && pip install --no-binary h5py h5py && \
pip install -r $INSTALLDIR/requirements.txt && pip install --no-deps "reproject==0.5.1"
#
# Install Montage
#
RUN mkdir -p /opt/montage && cd /opt/montage && wget https://github.com/Caltech-IPAC/Montage/archive/v6.0.tar.gz -O Montage_v6.0.tar.gz && \
tar xf Montage_v6.0.tar.gz && cd Montage-6.0 && make -j $J
#
# Install difmap
#
RUN mkdir -p $INSTALLDIR/difmap && cd $INSTALLDIR/difmap && wget ftp://ftp.astro.caltech.edu/pub/difmap/difmap2.5e.tar.gz && \
tar zxf difmap2.5e.tar.gz && cd uvf_difmap && \
wget https://raw.githubusercontent.com/nealjackson/loop3_difmap/master/corplt.c -O difmap_src/corplt.c && \
sed -i.bak -e '97d' configure && \
sed -i.bak -e '97 i PGPLOT_LIB=/usr/lib64/libpgplot.so.5' configure && \
./configure linux-i486-gcc && export PGPLOT_LIB=/usr/lib64/libpgplot.so.5 && export CFLAGS="-L/usr/lib64/libpgplot.so.5" && \
./makeall
RUN rm -rf $INSTALLDIR/difmap/*.tar.gz
#
# Install PyBDSF
#
#ARG CFLAGS="-mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512ifma -mno-avx512vbmi"
RUN mkdir -p ${INSTALLDIR}/pybdsf && cd ${INSTALLDIR}/pybdsf && git clone https://github.com/lofar-astron/pybdsf pybdsf
RUN if [ "${PYBDSF_VERSION}" != "latest" ]; then cd ${INSTALLDIR}/pybdsf/pybdsf && git checkout ${PYBDSF_VERSION}; fi
RUN cd ${INSTALLDIR}/pybdsf/pybdsf && python setup.py install
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/pybdsf/pybdsf
#
# Install CASAcore
#
# Casacore 2.4.1 does not seem to deal well with AVX512 instructions, so disable them if needed
#export CFLAGS="-march=skylake -mtune=skylake -mno-avx512f"
#export CXXFLAGS="-march=skylake -mtune=skylake -mno-avx512f"
RUN mkdir -p ${INSTALLDIR}/casacore/build && mkdir -p ${INSTALLDIR}/casacore/data
RUN cd $INSTALLDIR/casacore && git clone https://github.com/casacore/casacore.git src
RUN if [ "${CASACORE_VERSION}" != "latest" ]; then cd ${INSTALLDIR}/casacore/src && git checkout tags/${CASACORE_VERSION}; fi
# Backport patch UVFITS for LOFAR. This is fixed in recent versions > May 26 2020
# wget https://patch-diff.githubusercontent.com/raw/casacore/casacore/pull/1033.patch -O $INSTALLDIR/casacore/1033.patch
# cd $INSTALLDIR/casacore/src && patch --fuzz 3 -p1 < $INSTALLDIR/casacore/1033.patch
RUN cd ${INSTALLDIR}/casacore/data && wget --retry-connrefused ftp://anonymous@ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar
RUN cd ${INSTALLDIR}/casacore/data && tar xf WSRT_Measures.ztar && rm WSRT_Measures.ztar
RUN cd ${INSTALLDIR}/casacore/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/casacore/ -DDATA_DIR=${INSTALLDIR}/casacore/data -DBUILD_PYTHON=True -DUSE_OPENMP=True -DUSE_FFTW3=TRUE -DUSE_HDF5=True -DBUILD_PYTHON3=False ../src/
RUN cd ${INSTALLDIR}/casacore/build && make -s -j ${J} && make install
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/casacore/build && rm -rf $INSTALLDIR/casacore/src
#
# Install Python-CASAcore
#
RUN mkdir ${INSTALLDIR}/python-casacore && cd ${INSTALLDIR}/python-casacore && git clone https://github.com/casacore/python-casacore
RUN if [ "$PYTHON_CASACORE_VERSION" != "latest" ]; then cd ${INSTALLDIR}/python-casacore/python-casacore && git checkout tags/${PYTHON_CASACORE_VERSION}; fi
RUN source $INSTALLDIR/pyenv-py2/bin/activate && cd ${INSTALLDIR}/python-casacore/python-casacore && python setup.py build_ext -I${INSTALLDIR}/casacore/include/:/usr/include/python2.7:/usr/include/cfitsio -L${INSTALLDIR}/casacore/lib/:/usr/lib64/ && python setup.py install #--prefix=${INSTALLDIR}/python-casacore/
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/python-casacore/python-casacore
# and then reset the flags again if needed
#export CFLAGS="-march=skylake-avx512 -mtune=skylake-avx512"
#export CXXFLAGS="-march=skylake-avx512 -mtune=skylake-avx512"
#
# Install Dysco
#
RUN mkdir -p $INSTALLDIR/dysco/build
RUN cd $INSTALLDIR/dysco && git clone https://github.com/aroffringa/dysco.git src && cd src
RUN if [ "$DYSCO_VERSION" != "latest" ]; then cd $INSTALLDIR/dysco/src && git checkout $DYSCO_VERSION; fi
RUN cd $INSTALLDIR/dysco/build && cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR/dysco -DCASACORE_ROOT_DIR=$INSTALLDIR/casacore -DPORTABLE=True ../src && make -s -j $J && make install
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/dysco/build && rm -rf $INSTALLDIR/dysco/src
#
# Install AOFlagger
#
RUN mkdir -p ${INSTALLDIR}/aoflagger/build && cd ${INSTALLDIR}/aoflagger && git clone git://git.code.sf.net/p/aoflagger/code aoflagger && cd ${INSTALLDIR}/aoflagger/aoflagger
RUN if [ "${AOFLAGGER_VERSION}" != "latest" ]; then cd ${INSTALLDIR}/aoflagger/aoflagger && git checkout tags/${AOFLAGGER_VERSION}; fi
RUN source $INSTALLDIR/pyenv-py2/bin/activate && cd ${INSTALLDIR}/aoflagger/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/aoflagger/ -DCASACORE_ROOT_DIR=${INSTALLDIR}/casacore -DBUILD_SHARED_LIBS=ON -DPORTABLE=True ../aoflagger
RUN source $INSTALLDIR/pyenv-py2/bin/activate && cd ${INSTALLDIR}/aoflagger/build && make -s -j ${J} && make install
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/aoflagger/aoflagger && rm -rf $INSTALLDIR/aoflagger/build && rm -rf $INSTALLDIR/aoflagger/src
#
# Install LOFAR
#
RUN mkdir -p ${INSTALLDIR}/lofar/build/gnucxx11_opt
RUN if [ "${LOFAR_VERSION}" = "latest" ]; then cd ${INSTALLDIR}/lofar && svn checkout https://svn.astron.nl/LOFAR/trunk src; fi
RUN if [ "${LOFAR_VERSION}" != "latest" ]; then cd ${INSTALLDIR}/lofar && svn checkout https://svn.astron.nl/LOFAR/tags/LOFAR-Release-${LOFAR_VERSION} src; fi
RUN cd $INSTALLDIR/lofar && svn update --depth=infinity $INSTALLDIR/lofar/src/CMake
RUN cd $INSTALLDIR/lofar/ && wget https://raw.githubusercontent.com/tikk3r/lofar-grid-hpccloud/master/patches/lofar.patch && \
patch $INSTALLDIR/lofar/src/CMake/variants/GNUCXX11.cmake $PATCH_LOFAR && \
cd ${INSTALLDIR}/lofar/build/gnucxx11_opt
#cmake -DCMAKE_PREFIX_PATH=$INSTALLDIR/aoflagger:$INSTALLDIR/casacore:$INSTALLDIR/dysco -DBUILD_PACKAGES="StationResponse pystationresponse ParmDB pyparmdb Pipeline MS" -DCMAKE_INSTALL_PREFIX=$INSTALLDIR/lofar/ -DUSE_LOG4CPLUS=OFF -DUSE_OPENMP=True ${INSTALLDIR}/lofar/src/
ARG CMAKE_C_COMPILER=/usr/bin/gcc
ARG CMAKE_CXX_COMPILER=/usr/bin/g++
ARG CC=/usr/bin/gcc
ARG CXX=/usr/bin/g++
RUN source $INSTALLDIR/pyenv-py2/bin/activate && cd ${INSTALLDIR}/lofar/build/gnucxx11_opt && CC=/usr/bin/gcc && CXX=/usr/bin/g++ && cmake -DCMAKE_PREFIX_PATH=$INSTALLDIR/aoflagger:$INSTALLDIR/casacore:$INSTALLDIR/dysco -DBUILD_PACKAGES="Pipeline" -DCMAKE_INSTALL_PREFIX=$INSTALLDIR/lofar/ -DUSE_LOG4CPLUS=OFF -DUSE_OPENMP=True -DBUILD_PYTHON3=OFF ${INSTALLDIR}/lofar/src/ && make -s -j $J && make install
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/lofar/build && rm -rf $INSTALLDIR/lofar/src
#
# Install msoverview separately
#
RUN mkdir -p $INSTALLDIR/msoverview/src
RUN cd $INSTALLDIR/msoverview/src && svn export https://svn.astron.nl/LOFAR/tags/LOFAR-Release-3_2_18/CEP/MS/src/msoverview.cc && \
source $INSTALLDIR/pyenv-py2/bin/activate && gcc -I/opt/lofar/casacore/include/casacore/ -L/opt/lofar/casacore/lib msoverview.cc \
-o $INSTALLDIR/lofar/bin/msoverview -lcasa_casa -lcasa_ms -lcasa_tables -lstdc++
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/msoverview
#
# Install the standalone StationResponse libraries.
#
RUN mkdir -p $INSTALLDIR/LOFARBeam/build && cd $INSTALLDIR/LOFARBeam && git clone https://github.com/lofar-astron/LOFARBeam.git src
RUN source $INSTALLDIR/pyenv-py2/bin/activate && cd $INSTALLDIR/LOFARBeam/build && cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR/lofar ../src && make -j $J && make install
RUN touch /opt/lofar/lofar/lib64/python2.7/site-packages/lofar/__init__.py
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/LOFARBeam/build && rm -rf $INSTALLDIR/LOFARBeam/src
#
# Install EveryBeam library
#
RUN mkdir -p $INSTALLDIR/EveryBeam/build && cd $INSTALLDIR/EveryBeam && git clone https://git.astron.nl/RD/EveryBeam.git src && \
cd src && git checkout $EVERYBEAM_VERSION && \
cd $INSTALLDIR/EveryBeam/build && \
cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR/EveryBeam ../src && \
make -j $J && make install
#
# Install DPPP
#
RUN mkdir -p $INSTALLDIR/DPPP/build && git clone https://github.com/lofar-astron/DP3.git $INSTALLDIR/DPPP/src && \
cd $INSTALLDIR/DPPP/src && git checkout tags/${DPPP_VERSION}
RUN cd $INSTALLDIR/DPPP/build && cmake3 -DCMAKE_CXX_FLAGS="-D_GLIB_USE_CXX_ABI=1 -DBOOST_NO_CXX11_SCOPED_ENUMS" -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLDIR/DPPP -DLOFAR_STATION_RESPONSE_DIR:PATH=$INSTALLDIR/lofar/include -DLOFAR_STATION_RESPONSE_LIB:FILEPATH=$INSTALLDIR/lofar/lib/libstationresponse.so -DIDGAPI_LIBRARIES=$INSTALLDIR/idg/lib/libidg-api.so -DIDGAPI_INCLUDE_DIRS=$INSTALLDIR/idg/include -DAOFLAGGER_INCLUDE_DIR=$INSTALLDIR/aoflagger/include -DAOFLAGGER_LIB=$INSTALLDIR/aoflagger/lib/libaoflagger.so ../src && make -s -j $J && make install
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/DPPP/build && rm -rf $INSTALLDIR/DPPP/src
############################################
# Install Python packages for Python 2 now #
############################################
#
# Install RMextract
#
RUN mkdir -p $INSTALLDIR/RMextract/build && cd $INSTALLDIR/RMextract/build && git clone https://github.com/lofar-astron/RMextract.git src && \
cd src && if [ "$RMEXTRACT_VERSION" != "latest" ]; then git checkout $RMEXTRACT_VERSION; fi
RUN source $INSTALLDIR/pyenv-py2/bin/activate && cd $INSTALLDIR/RMextract/build/src && python setup.py build --add-lofar-utils && \
python setup.py install --add-lofar-utils && deactivate
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/RMextract
#
# Install LoSoTo
#
RUN mkdir -p $INSTALLDIR/losoto/build && cd ${INSTALLDIR}/losoto/build && \
git clone https://github.com/revoltek/losoto.git src && \
cd src && if [ "$LOSOTO2_VERSION" != "latest" ]; then git checkout $LOSOTO2_VERSION; fi
RUN source $INSTALLDIR/pyenv-py2/bin/activate && cd ${INSTALLDIR}/losoto/build/src && python setup.py build && \
python setup.py install && deactivate
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/losoto
#
# Install LSMTool.
#
RUN mkdir -p $INSTALLDIR/lsmtool && cd $INSTALLDIR/lsmtool && \
git clone https://github.com/darafferty/LSMTool.git lsmtool && \
cd $INSTALLDIR/lsmtool/lsmtool && \
if [ "$LSMTOOL_VERSION" != "latest" ]; then git checkout $LSMTOOL_VERSION; fi
RUN source $INSTALLDIR/pyenv-py2/bin/activate && cd $INSTALLDIR/lsmtool/lsmtool && python setup.py install && deactivate
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/lsmtool
############################################
# Install Python packages for Python 3 now #
############################################
#
# Install LoSoTo
#
RUN mkdir -p $INSTALLDIR/losoto/build && \
cd $INSTALLDIR/losoto/build && \
git clone https://github.com/revoltek/losoto.git src
RUN cd $INSTALLDIR/losoto/build/src && source $INSTALLDIR/pyenv-py3/bin/activate && \
python setup.py build && \
python setup.py install && deactivate
RUN cd $INSTALLDIR && rm -rf $INSTALLDIR/losoto
# Switch back to py2 to wrap up installation
#
# Install-WSClean
#
RUN mkdir $INSTALLDIR/wsclean && cd ${INSTALLDIR}/wsclean && git clone https://gitlab.com/aroffringa/wsclean.git && \
if [ "$WSCLEAN_VERSION" != "latest" ]; then cd ${INSTALLDIR}/wsclean/wsclean && git checkout $WSCLEAN_VERSION; fi
RUN cd ${INSTALLDIR}/wsclean/wsclean && mkdir build && cd build
ARG CC=/usr/lib64/openmpi/bin/mpicc
ARG CXX=/usr/lib64/openmpi/bin/mpic++
RUN source $INSTALLDIR/pyenv-py2/bin/activate && cd ${INSTALLDIR}/wsclean/wsclean/build && cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR/wsclean -DPORTABLE=True -DIDGAPI_LIBRARIES=$INSTALLDIR/idg/lib/libidg-api.so -DIDGAPI_INCLUDE_DIRS=$INSTALLDIR/idg/include .. && \
make -j ${J} && \
make install && \
cd $INSTALLDIR && rm -rf $INSTALLDIR/wsclean/wsclean
#
# Switch back to normal compilers
ARG CC=/usr/bin/gcc
ARG CXX=/usr/bin/g++
#
#
# Install DS9
#
RUN mkdir -p $INSTALLDIR/ds9/bin && cd $INSTALLDIR/ds9 && \
wget http://ds9.si.edu/download/fedora30/ds9.fedora30.8.2.tar.gz && \
tar xf ds9*.tar.gz -C $INSTALLDIR/ds9/bin && \
rm ds9*.tar.gz
#
# Finaly cleanup of unnecessary stuff
#
ENV PYTHONPATH=$OLD_PYTHONPATH
RUN rm -rf /var/cache/dnf/* && \
rm -rf /var/cache/yum/* && \
rm -rf /var/log/* && \
dnf -y clean all
#
# init-lofar
#
RUN ln -s /opt/lofar/DPPP/bin/DPPP /opt/lofar/lofar/bin/NDPPP && \
ln -s /opt/lofar/DPPP/bin/makesourcedb /opt/lofar/lofar/bin/makesourcedb &&\
ln -s $INSTALLDIR/pyenv-py3/bin/h5plot /usr/bin/h5plot
COPY files/post_init /tmp/post_init
RUN cat /tmp/post_init >> $INSTALLDIR/init.sh
RUN sed -e 's/\\\$/\$/g' /opt/lofar/init.sh
USER metauser
FROM fedora:31
MAINTAINER Giuliano Taffoni <giuliano.taffoni@inaf.it>
ENV CONTAINER_NAME='lovarVLBIbase'
USER root
#
# Set enviroment
#
ENV J=4
ENV INSTALLDIR=/opt/lofar
ENV PYTHON_VERSION=2.7
# Settings relevant to the installed software.
ENV ARMADILLO_VERSION=9.900.3
ENV BLAS_VERSION=3.8.0
ENV BOOST_DOT_VERSION=1.69.0
ENV BOOST_VERSION=1_69_0
ENV CFITSIO_VERSION=7.3.47
ENV FFTW_VERSION=3.5.8
ENV HDF5_VERSION=1.10.5
ENV LAPACK_VERSION=3.8.0
ENV OPENBLAS_VERSION=3.8.0
ENV SUPERLU_VERSION=5.2.1
ENV WCSLIB_VERSION=6.4
ENV DEBIAN_FRONTEND=noninteractive
#
# System installs
#
RUN dnf -y update
RUN dnf -y install dnf-plugins-core
RUN dnf -y install patch sudo yum-utils git svn wget vim nano emacs
RUN dnf -y install automake autoconf cmake cmake3 make gcc gcc-c++ gcc-gfortran
RUN dnf -y install arpack-devel python-devel python3-devel lapack-devel libpng-devel libxml2-devel readline-devel ncurses-devel f2py bzip2-devel libicu-devel python3-scipy python-setuptools gsl gsl-devel gdal gdal-devel libpqxx libpqxx-devel
RUN dnf -y install bison flex ncurses tar bzip2 which gettext hdf5 hdf5-devel
RUN dnf -y install python python3-devel python-pip python2-tkinter python3-tkinter
RUN dnf -y install libsigc++20-devel gtkmm30-devel
RUN dnf -y install lua lua-devel
RUN dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
RUN dnf -y install pgplot python3-numpy-f2py perf qt5
#
# Install Boost
#
RUN dnf -y install boost boost-devel boost-python2 boost-python2-devel boost-python3 boost-python3-devel
#
# Install FFTW
#
RUN dnf -y install fftw-devel fftw-libs
# Install OpenBLAS
#
RUN dnf -y install blas-devel
#
# Install SuperLU
#
RUN dnf -y install SuperLU SuperLU-devel
#
# Install Armadillo
#
RUN dnf -y install armadillo armadillo-devel
#
# Install cfitsio
#
RUN dnf -y install cfitsio cfitsio-devel
#
# Install wcslib
#
RUN dnf -y install wcslib wcslib-devel
#
# Fedora packages to install
#
RUN dnf -y install rsync
RUN dnf -y install openmpi openmpi-devel
RUN dnf -y install htop mariadb-devel
RUN dnf -y install python3-pybind11 pybind11-devel
###################
# Source installs #
###################
RUN mkdir -p $INSTALLDIR
#
# Install Image Domain Gridder (IDG)
#
RUN mkdir -p $INSTALLDIR/idg && cd $INSTALLDIR/idg
# Use these flags instead for an architecture optimized build.
#export CFLAGS="-march=skylake-avx512 -mtune=skylake-avx512"
#export CXXFLAGS="-march=skylake-avx512 -mtune=skylake-avx512"
# Disable AVX512 instructions and build a generic architecture.
#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"
RUN export CC=`which gcc` && export CXX=`which g++` && export make=`which make` && \
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/opt/intel/mkl/lib/intel64:$LD_LIBRARY_PATH && \
export CMAKE_PREFIX_PATH=/usr/local/cuda/lib64:/opt/intel/mkl/lib/intel64:$CMAKE_PREFIX_PATH && \
export CPATH=/usr/local/cuda/include:/opt/intel/mkl/include:$CPATH && \
git clone https://gitlab.com/astron-idg/idg.git src && cd src && git checkout $IDG_VERSION && mkdir build && cd build && \
cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR/idg .. && make -j $J && make install
RUN rm -rf $INSTALLDIR/idg/src
#
# Wrap up installation, remove unnecessary stuff.
RUN dnf -y autoremove
RUN dnf -y clean all
#
# init-lofar
#
RUN echo export INSTALLDIR=$INSTALLDIR > $INSTALLDIR/init.sh
RUN echo export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64/:\$LD_LIBRARY_PATH >> $INSTALLDIR/init.sh
#------------------------
# Local User
#------------------------
# Add group. We chose GID 65527 to try avoiding conflicts.
RUN groupadd -g 65527 metagroup
# Add user. We chose UID 65527 to try avoiding conflicts.
RUN useradd metauser -d /home/metauser -u 65527 -g 65527 -m -s /bin/bash
# Add metuaser user to sudoers
RUN usermod -a -G wheel metauser
RUN sed -i 's/^%wheel/#%wheel/' /etc/sudoers
RUN sed -i 's/^# %wheel/%wheel/' /etc/sudoers
# Rename user home folder as a "vanilla" home folder
RUN mv /home/metauser /metauser_home_vanilla
RUN echo "export PATH=/usr/local/cuda/bin:\$PATH" >> $INSTALLDIR/init.sh
RUN echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/opt/intel/mkl/lib/intel64/:\$LD_LIBRARY_PATH" >> $INSTALLDIR/init.sh
# Give write access to anyone to the home folder so the entrypoint will be able
# to copy over the /home/matauser_vanilla into /home/metauser (for Singularity)
RUN chmod 777 /home
#----------------------
# Entrypoint
#----------------------
# Copy entrypoint
COPY entrypoint.sh /
# Give right permissions
RUN chmod 755 /entrypoint.sh
# Set entrypoint
ENTRYPOINT ["/entrypoint.sh"]
# Set user lofar
USER metauser
#!/bin/bash
if [ 'xxx${VERSION}' == 'xxx' ]; then
VERSION='latest'
fi
docker build -t morgan1971/vlbi-base:${VERSION} -f Dockerfile.base .
#!/bin/bash
if [ 'xxx${VERSION}' == 'xxx' ]; then
VERSION='latest'
fi
docker build -t morgan1971/skadc-software:${VERSION} -f Dockerfile .
#!/bin/bash
# Exit on any error. More complex stuff could be done in future
# (see https://stackoverflow.com/questions/4381618/exit-a-script-on-error)
set -e
if [ "x$SAFE_MODE" == "xTrue" ]; then
echo ""
echo "[INFO] Not executing entrypoint as we are in safe mode, just opening a Bash shell."
exec /bin/bash
else
#---------------------
# Setup home
#---------------------
if [ ! -f "/home/metauser/.initialized" ]; then
echo "[INFO] Setting up home"
[ ! -d "/home/metauser" ] && mkdir -p /home/metauser
# Copy over vanilla home contents
for x in /metauser_home_vanilla/* /metauser_home_vanilla/.[!.]* /metauser_home_vanilla/..?*; do
if [ -e "$x" ]; then cp -a "$x" /home/metauser/; fi
done
echo source $INSTALLDIR/init.sh >> $HOME/.bashrc
# Mark as initialized
[ ! -f "/home/metauser/.initialized" ] && touch /home/metauser/.initialized
fi
#---------------------
# Save env
#---------------------
echo "[INFO] Dumping env"
# Save env vars for later usage (e.g. ssh)
env | \
while read env_var; do
if [[ $env_var == HOME\=* ]]; then
: # Skip HOME var
elif [[ $env_var == PWD\=* ]]; then
: # Skip PWD var
else
echo "export $env_var" >> /tmp/env.sh
fi
done
echo ""
echo "[INFO] Executing entrypoint..."
if [ "xxx$@" == "xxx" ]; then
COMMAND="/bin/bash"
else
COMMAND="$@"
fi
# Start!
echo -n "[INFO] Will execute entrypoint command: "
echo $COMMAND
echo ""
echo "=============================================================="
echo ""
echo " Welcome to the LOFAR $CONTAINER_NAME container!"
echo ""
echo "=============================================================="
echo ""
echo "You are now in /home/metauser with write access as user \"$(whoami)\"."
echo ""
echo "Remember that contents inside this container, unless stored"
echo "on a persistent volume mounted from you host machine, will"
echo "be wiped out when exiting the container."
echo ""
echo "This image acts as a base for the LOFAR installationi."
echo "It has Fedora 31 setup, with the required dependencies installed:"
echo " * Armadillo 9.900.3"
echo " * Boost 1.69.0"
echo " * Armadillo 9.900.3"
echo " * Boost 1.69.0"
echo " * CFITSIO 7.3.47"
echo " * FFTW 3.5.8"
echo " * HDF5 1.10.5"
echo " * LAPACK 3.8.0"
echo " * OpenBLAS 3.8.0"
echo " * SuperLU 5.2.1"
echo " * WCSLIB 6.4"
echo " * Armadillo 9.900.3"
echo " * Boost 1.69.0"
echo " * Armadillo 9.900.3"
echo " * Boost 1.69.0"
echo " * CFITSIO 7.3.47"
echo " * FFTW 3.5.8"
echo " * HDF5 1.10.5"
echo " * LAPACK 3.8.0"
echo " * OpenBLAS 3.8.0"
echo " * SuperLU 5.2.1"
echo " * WCSLIB 6.4"
echo ""
cd /home/metauser
$COMMAND
fi
export INSTALLDIR=$INSTALLDIR
export HDF5_USE_FILE_LOCKING=FALSE
source $INSTALLDIR/lofar/lofarinit.sh
export PYTHONPATH=$INSTALLDIR/dppp:$INSTALLDIR/lofar/lib64/python2.7/site-packages
export PATH=/opt/montage/Montage-6.0/bin:$PATH
export PATH=$INSTALLDIR/aoflagger/bin:$PATH
export PATH=$INSTALLDIR/casacore/bin:$PATH
export PATH=$INSTALLDIR/ds9/bin:$PATH
export PATH=$INSTALLDIR/DPPP/bin:$PATH
export PATH=$INSTALLDIR/difmap/uvf_difmap:$PATH
export PATH=$INSTALLDIR/dysco/bin:$PATH
export PATH=$INSTALLDIR/lofar/bin:$PATH
export PATH=$INSTALLDIR/wsclean/bin:$PATH
export PATH=/usr/lib64/openmpi/bin:$PATH
export LD_LIBRARY_PATH=$INSTALLDIR/aoflagger/lib:$INSTALLDIR/casacore/lib:$INSTALLDIR/DPPP/lib:$INSTALLDIR/dysco/lib:$INSTALLDIR/EveryBeam/lib:$INSTALLDIR/idg/lib:$INSTALLDIR/lofar/lib:$INSTALLDIR/lofar/lib64:$INSTALLDIR/LOFARBeam/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib/:$LD_LIBRARY_PATH
export OPENBLAS_NUM_THREADS=64
export OPENBLAS_MAX_THREADS=64
export OMP_NUM_THREADS=64
export OMP_MAX_THREADS=64
export PYTHONPATH=$INSTALLDIR/dppp:$INSTALLDIR/lofar/lib64/python2.7/site-packages:$PYTHONPATH
source $INSTALLDIR/pyenv-py2/bin/activate
measures.directory: $INSTALLDIR/casacore/data
export CASARCFILES=$INSTALLDIR/.casarc
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment