Skip to content
Snippets Groups Projects

Add docker ubuntu 22.04 cuda 11.7 image

Merged Jean-Baptiste Keck requested to merge docker_cuda into master
+ 225
0
##
## Copyright (C) HySoP 2011-2022
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
# Test docker for gitlab-ci
FROM nvidia/cuda:11.7.1-devel-ubuntu22.04
MAINTAINER Jean-Baptiste.Keck@imag.fr
# parallel builds
ARG NTHREADS
ENV MAKEFLAGS "-j${NTHREADS}"
# upgrade initial image
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get full-upgrade -y
# get build tools and required libraries
RUN apt-get update && apt-get install -y --no-install-recommends expat unzip xz-utils automake libtool pkg-config cmake rsync git vim ssh curl wget ca-certificates gcc g++ gfortran lsb-core cpio libnuma1 libpciaccess0 libreadline-dev libblas-dev liblapack-dev libgcc-11-dev libgfortran-11-dev libgmp-dev libmpfr-dev libmpc-dev python3.10-dev opencl-headers swig libgmp-dev libmpfr-dev libmpc-dev libcairo-dev libcairomm-1.0-dev python3.10-tk
# python-pip
RUN cd /tmp && \
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python3.10 get-pip.py && \
python3.10 -m pip install --upgrade pip && \
rm -f /tmp/get-pip.py
RUN python3.10 -m pip install --upgrade numpy==1.21.5 setuptools cffi wheel pytest pybind11 cython
# OpenMPI 4.1.2 + mpi4py (enable mpi1 compatibility for mpi4py)
ENV MPI_ROOT "/usr/local"
RUN cd /tmp && \
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.4.tar.gz && \
tar -xvzf openmpi-*.tar.gz && \
rm -f openmpi-*.tar.gz && \
cd openmpi-* && \
./configure --enable-shared --disable-static --enable-ipv6 --prefix="${MPI_ROOT}" --with-hwloc=internal --with-libevent=internal --enable-mpi1-compatibility && \
make && \
make install && \
rm -rf /tmp/openmpi-*
ENV MPICC "${MPI_ROOT}/bin/mpicc"
RUN ldconfig && python3.10 -m pip install --upgrade mpi4py -vvv
# HPTT (CPU tensor permutation library)
RUN cd /tmp && \
git clone https://gitlab.com/keckj/hptt.git && \
cd hptt && \
sed -i "s#-mavx##g" CMakeLists.txt && \
sed -i "s#-march=native##g" CMakeLists.txt && \
sed -i "s#-mtune=native##g" CMakeLists.txt && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make && \
make install && \
cd ../pythonAPI && \
python3.10 -m pip install --upgrade . && \
cd /tmp && \
rm -rf /tmp/hptt
# HDF5 1.12.1 + h5py 3.6.0
RUN cd /tmp && \
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.1/src/hdf5-1.12.1.tar.gz && \
tar -xvzf hdf5-*.tar.gz && \
rm -f hdf5-*.tar.gz && \
cd hdf5-* && \
CC="${MPICC}" ./configure --prefix="${MPI_ROOT}" --enable-parallel --enable-shared=yes --enable-static=no && \
make && \
make install && \
rm -rf /tmp/hdf5-*
RUN CC="${MPICC}" HDF5_MPI="ON" HDF5_VERSION="1.12.1" HDF5_DIR="${MPI_ROOT}" python3.10 -m pip install --upgrade --no-binary=h5py h5py -vvv
# other python packages
RUN python3.10 -m pip install --upgrade scipy sympy matplotlib gmpy2 psutil py-cpuinfo Mako editdistance portalocker colors.py tee pycairo argparse_color_formatter networkx pyvis zarr numcodecs jsonpickle memory-tempfile primefac
# llvm + numba + llvmlite (numba 0.55.1 only supports llvm 11 for now)
RUN apt-get update && \
apt-get install -y llvm-11-dev libclang-11-dev clang-11
ENV LLVM_CONFIG=llvm-config-11
RUN python3.10 -m pip install --upgrade numba llvmlite
# clinfo 3.0.21.02.21 (2021)
ENV LIBRARY_PATH="/usr/local/cuda/targets/x86_64-linux/lib"
RUN cd /tmp && \
wget https://github.com/Oblomov/clinfo/archive/refs/tags/3.0.21.02.21.tar.gz && \
tar -xvzf *.tar.gz && \
rm -f *.tar.gz && \
cd clinfo-* && \
make && \
./clinfo && \
mv ./clinfo /bin/ && \
rm -rf /tmp/clinfo-*
# clpeak 1.1.2 (2022)
RUN cd /tmp && \
wget https://github.com/krrishnarraj/clpeak/archive/1.1.2.tar.gz && \
tar -xvzf *.tar.gz && \
rm -f *.tar.gz && \
cd clpeak-* && \
mkdir build && \
cd build/ && \
cmake .. && \
make && \
mv ./clpeak /bin/ && \
rm -rf /tmp/clpeak-*
# pyopencl
RUN cd /tmp && \
git clone https://github.com/inducer/pyopencl.git && \
cd pyopencl && \
git checkout v2022.2.3 && \
git submodule update --init && \
python3.10 configure.py && \
make && \
python3.10 -m pip install --upgrade . && \
cd - && \
rm -rf /tmp/pyopencl
# oclgrind
RUN cd /tmp && \
git clone https://github.com/jrprice/Oclgrind.git && \
cd Oclgrind && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make && \
make install && \
cd - && \
rm -rf /tmp/Oclgrind
# clFFT
RUN cd /tmp && \
ln -s /usr/local/lib /usr/local/lib64 && \
git clone https://github.com/clMathLibraries/clFFT.git && \
cd clFFT && \
cd src && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make && \
make install && \
cd - && \
rm -rf /tmp/clFFT
# gpyFFT, we need to fix a segfault on weakref.finalize(plan)
# clFFT plans are destroyed when atexit(clFFT.teardown) is called
RUN cd /tmp && \
git clone https://github.com/geggo/gpyfft.git && \
cd gpyfft && \
sed 's#finalize(self, _destroy_plan, self.plan)##' -i gpyfft/gpyfftlib.pyx && \
python3.10 -m pip install . && \
cd - && \
rm -rf /tmp/gpyfft
# python flint (FLINT2 + ARB + python-flint)
RUN cd /tmp && \
wget https://github.com/wbhart/flint2/archive/v2.8.4.tar.gz && \
tar -xvzf v*.tar.gz && \
rm -f v*.tar.gz && \
cd flint2-* && \
./configure && \
make && \
make install && \
cd - && \
rm -rf flint2-*
RUN cd /tmp && \
wget https://github.com/fredrik-johansson/arb/archive/2.22.1.tar.gz && \
tar -xvzf *.tar.gz && \
rm -f *.tar.gz && \
cd arb-* && \
./configure && \
make && \
make install && \
cd - && \
rm -rf arb-*
RUN python3.10 -m pip install --upgrade python-flint -vvv
# static fftw + pyfftw (with R2R transforms)
# Weird pyfftw bug : not passing -O2 explicitely during build causes a segfault on import...
# See https://bugs.gentoo.org/548776
ENV FFTW_ROOT="/usr/local"
RUN cd /tmp && \
wget http://www.fftw.org/fftw-3.3.10.tar.gz && \
tar -xvzf fftw-*.tar.gz && \
rm -f fftw-*.tar.gz && \
cd fftw-* && \
./configure --enable-openmp --enable-threads --enable-mpi --enable-static --with-pic --prefix="${FFTW_ROOT}" --enable-single && \
make && make install && make clean && \
./configure --enable-openmp --enable-threads --enable-mpi --enable-static --with-pic --prefix="${FFTW_ROOT}" && \
make && make install && make clean && \
./configure --enable-openmp --enable-threads --enable-mpi --enable-static --with-pic --prefix="${FFTW_ROOT}" --enable-long-double && \
make && make install && make clean && \
rm -rf /tmp/fftw-*
RUN cd /tmp && \
git clone https://github.com/pyFFTW/pyFFTW && \
cd pyFFTW && \
STATIC_FFTW_DIR="${FFTW_ROOT}/lib" CFLAGS="-Wl,-Bsymbolic -fopenmp -I${FFTW_ROOT}/include -O2" python3.10 setup.py build_ext --inplace && \
python3.10 -m pip install --upgrade . && \
rm -rf /tmp/pyFFTW
RUN python3.10 -m pip install ansicolors --ignore-installed
RUN python3.10 -m pip install numpy==1.21.5
# ensure all libraries are known by the runtime linker
RUN ldconfig
# clean cached packages
RUN rm -rf /var/lib/apt/lists/*
RUN rm -rf $HOME/.cache/pip/*
RUN rm -rf /tmp/*
CMD ["/bin/bash"]
Loading