Skip to content

Instantly share code, notes, and snippets.

@eschnett
Created July 21, 2020 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eschnett/5390892b6d8348ea3be5ca35d95f4990 to your computer and use it in GitHub Desktop.
Save eschnett/5390892b6d8348ea3be5ca35d95f4990 to your computer and use it in GitHub Desktop.
# Build on the regular Caliban image
FROM gcr.io/blueshift-playground/blueshift:cpu
# Install system packages
# Note: Boost on Ubuntu requires OpenMPI
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get --yes --no-install-recommends install \
build-essential \
ca-certificates \
g++-8 \
gcc-8 \
gfortran-8 \
git \
hdf5-tools \
libboost-all-dev \
libfftw3-dev \
libgsl-dev \
libhdf5-dev \
libhwloc-dev \
libopenblas-dev \
libopenmpi-dev \
libudev-dev \
perl \
pkg-config \
python \
python3 \
rsync \
ssh \
subversion \
vim \
wget \
zlib1g-dev \
&& \
rm -rf /var/lib/apt/lists/*
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 20 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 20 && \
update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-8 20 && \
update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 && \
update-alternatives --set cc /usr/bin/gcc
# CMake
# AMReX requires at least CMake 3.14
RUN mkdir dist && \
(cd dist && \
wget -nv https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0-Linux-x86_64.tar.gz && \
tar xzf cmake-3.18.0-Linux-x86_64.tar.gz -C /usr/local --strip-components 1 && \
true) && \
rm -rf dist
# Install NSIMD
# Note: This assumes that the system has x86_64 CPUs with AVX2 and FMA
RUN mkdir src && \
(cd src && \
git clone -b eschnett/storeu_masked https://github.com/eschnett/nsimd.git && \
cd nsimd && \
python3 egg/hatch.py --all --force --disable-clang-format && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DSIMD=AVX2 -DSIMD_OPTIONALS=FMA -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
make -j$(nproc) && \
make -j$(nproc) install && \
true) && \
rm -rf src
# Install Silo
RUN mkdir src && \
(cd src && \
wget -nv https://wci.llnl.gov/content/assets/docs/simulation/computer-codes/silo/silo-4.10.2/silo-4.10.2-bsd.tar.gz && \
tar xzf silo-4.10.2-bsd.tar.gz && \
cd silo-4.10.2-bsd && \
mkdir build && \
cd build && \
../configure --disable-fortran --enable-optimization --with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial/include,/usr/lib/x86_64-linux-gnu/hdf5/serial/lib --prefix=/usr/local && \
make -j$(nproc) && \
make -j$(nproc) install && \
true) && \
rm -rf src
# Install ssht
# TODO: Use "cmake install" instead of "cp"
RUN mkdir src && \
(git clone https://github.com/astro-informatics/ssht.git && \
mkdir ssht/build && \
cd ssht/build && \
cmake .. && \
make install) && \
rm -fr src
# Install yaml-cpp
RUN mkdir src && \
(cd src && \
wget -nv https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.6.3.tar.gz && \
tar xzf yaml-cpp-0.6.3.tar.gz && \
cd yaml-cpp-yaml-cpp-0.6.3 && \
mkdir build && \
cd build && \
cmake .. && \
make -j$(nproc) && \
make -j$(nproc) install && \
true) && \
rm -rf src
# Install AMReX
RUN mkdir src && \
(cd src && \
wget -nv https://github.com/AMReX-Codes/amrex/archive/20.07.tar.gz && \
tar xzf 20.07.tar.gz && \
cd amrex-20.07 && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_PARTICLES=ON -DENABLE_FORTRAN=OFF -DENABLE_OMP=ON -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
make -j$(nproc) && \
make -j$(nproc) install && \
true) && \
rm -rf src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment