|
| 1 | +FROM ubuntu:22.04 as builder |
| 2 | + |
| 3 | +ARG CUDA_ARCH=60 |
| 4 | + |
| 5 | +ENV DEBIAN_FRONTEND noninteractive |
| 6 | + |
| 7 | +ENV FORCE_UNSAFE_CONFIGURE 1 |
| 8 | + |
| 9 | +ENV PATH="/spack/bin:${PATH}" |
| 10 | + |
| 11 | +ENV MPICH_VERSION=3.4.3 |
| 12 | + |
| 13 | +ENV CMAKE_VERSION=3.27.9 |
| 14 | + |
| 15 | +RUN apt-get -y update |
| 16 | + |
| 17 | +RUN apt-get install -y apt-utils |
| 18 | + |
| 19 | +# install basic tools |
| 20 | +RUN apt-get install -y --no-install-recommends gcc g++ gfortran clang libomp-14-dev git make unzip file \ |
| 21 | + vim wget pkg-config python3-pip python3-dev cython3 python3-pythran curl tcl m4 cpio automake meson \ |
| 22 | + xz-utils patch patchelf apt-transport-https ca-certificates gnupg software-properties-common perl tar bzip2 \ |
| 23 | + liblzma-dev libbz2-dev |
| 24 | + |
| 25 | +# install CMake |
| 26 | +RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz -O cmake.tar.gz && \ |
| 27 | + tar zxvf cmake.tar.gz --strip-components=1 -C /usr |
| 28 | + |
| 29 | +# get latest version of spack |
| 30 | +RUN git clone -b v0.21.0 https://github.com/spack/spack.git |
| 31 | + |
| 32 | +# set the location of packages built by spack |
| 33 | +RUN spack config add config:install_tree:root:/opt/local |
| 34 | +# set cuda_arch for all packages |
| 35 | +RUN spack config add packages:all:variants:cuda_arch=${CUDA_ARCH} |
| 36 | + |
| 37 | +# find all external packages |
| 38 | +RUN spack external find --all --exclude python |
| 39 | + |
| 40 | +# find compilers |
| 41 | +RUN spack compiler find |
| 42 | + |
| 43 | +# install yq (utility to manipulate the yaml files) |
| 44 | +RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_386 && chmod a+x /usr/local/bin/yq |
| 45 | + |
| 46 | +# change the fortran compilers: for gcc the gfortran is already properly set and the change has no effect; add it for clang |
| 47 | +RUN yq -i '.compilers[0].compiler.paths.f77 = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml && \ |
| 48 | + yq -i '.compilers[0].compiler.paths.fc = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml && \ |
| 49 | + yq -i '.compilers[1].compiler.paths.f77 = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml && \ |
| 50 | + yq -i '.compilers[1].compiler.paths.fc = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml |
| 51 | + |
| 52 | +# install MPICH |
| 53 | +RUN spack install mpich@${MPICH_VERSION} %gcc |
| 54 | + |
| 55 | +# for the MPI hook |
| 56 | +RUN echo $(spack find --format='{prefix.lib}' mpich) > /etc/ld.so.conf.d/mpich.conf |
| 57 | +RUN ldconfig |
| 58 | + |
| 59 | +# create environments for several configurations and install dependencies |
| 60 | +RUN spack env create -d /tiledmm-env-cuda && \ |
| 61 | + spack -e /tiledmm-env-cuda add "tiled-mm@master %gcc +cuda +tests +shared " && \ |
| 62 | + spack -e /tiledmm-env-cuda develop -p /src tiled-mm@master && \ |
| 63 | + spack -e /tiledmm-env-cuda install --only=dependencies --fail-fast |
0 commit comments