Skip to content

Commit

Permalink
Use a base nvcc Docker image from Kokkos
Browse files Browse the repository at this point in the history
  • Loading branch information
pzehner committed Jan 24, 2024
1 parent f5dfaad commit 312009e
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 36 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ jobs:
# TODO check if current build has a different Dockerfile

- name: Build image
# TODO improve with caching https://docs.docker.com/engine/reference/commandline/image_build/#cache-from
run: |
docker build \
-t ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend }} \
--cache-from ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend }} \
--build-arg BUIDKIT_INLINE_CACHE=1 \
--progress=plain \
docker/${{ matrix.backend }}
docker/base/${{ matrix.backend }}
- name: Login in GitHub Containers Repository
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
Expand Down Expand Up @@ -100,9 +99,6 @@ jobs:
with:
submodules: recursive

- name: Login in GitHub Containers Repository
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Pull image
run: docker pull ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}

Expand All @@ -122,15 +118,25 @@ jobs:
docker run -v ${{github.workspace}}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }} \
cmake --build build -j 2
- name: Save image
run: docker commit ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }} ghcr.io/cexa-project/kokkos-fft/kokkos_fft_${{ matrix.backend.name }}
- name: Build image
run: |
docker build \
-t ghcr.io/cexa-project/kokkos-fft/tests_${{ matrix.backend.name }} \
--cache-from ghcr.io/cexa-project/kokkos-fft/tests_${{ matrix.backend.name }} \
--build-arg BUIDKIT_INLINE_CACHE=1 \
--progress=plain \
-f docker/tests/${{ matrix.backend.name }}/Dockerfile \
.
if: ${{ matrix.target.name }} == "native"

- name: Install
run: |
docker run -v ${{github.workspace}}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }} \
./install_test/bin/install_${{ matrix.backend.name }}.sh /tmp ${{ matrix.backend.name }}
- name: Login in GitHub Containers Repository
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: docker push ghcr.io/cexa-project/kokkos-fft/kokkos_fft_${{ matrix.backend.name }}
run: docker push ghcr.io/cexa-project/kokkos-fft/tests_${{ matrix.backend.name }}
if: ${{ matrix.target.name }} == "native"
43 changes: 43 additions & 0 deletions docker/base/cuda/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ARG BASE=nvidia/cuda:12.3.1-devel-ubuntu20.04
FROM $BASE

ARG ADDITIONAL_PACKAGES

RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub

RUN apt-get update && apt-get install -y \
bc \
wget \
ccache \
libfftw3-dev \
$ADDITIONAL_PACKAGES \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN KEYDUMP_URL=https://cloud.cees.ornl.gov/download && \
KEYDUMP_FILE=keydump && \
wget --quiet ${KEYDUMP_URL}/${KEYDUMP_FILE} && \
wget --quiet ${KEYDUMP_URL}/${KEYDUMP_FILE}.sig && \
gpg --import ${KEYDUMP_FILE} && \
gpg --verify ${KEYDUMP_FILE}.sig ${KEYDUMP_FILE} && \
rm ${KEYDUMP_FILE}*

ARG CMAKE_VERSION=3.23.2
ENV CMAKE_DIR=/opt/cmake
RUN CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION} && \
CMAKE_SCRIPT=cmake-${CMAKE_VERSION}-Linux-x86_64.sh && \
CMAKE_SHA256=cmake-${CMAKE_VERSION}-SHA-256.txt && \
wget --quiet ${CMAKE_URL}/${CMAKE_SHA256} && \
wget --quiet ${CMAKE_URL}/${CMAKE_SHA256}.asc && \
wget --quiet ${CMAKE_URL}/${CMAKE_SCRIPT} && \
gpg --verify ${CMAKE_SHA256}.asc ${CMAKE_SHA256} && \
grep -i ${CMAKE_SCRIPT} ${CMAKE_SHA256} | sed -e s/linux/Linux/ | sha256sum --check && \
mkdir -p ${CMAKE_DIR} && \
sh ${CMAKE_SCRIPT} --skip-license --prefix=${CMAKE_DIR} && \
rm cmake*
ENV PATH=${CMAKE_DIR}/bin:$PATH

WORKDIR /work
ENV FFTWDIR "/usr"
CMD ["bash"]
File renamed without changes.
28 changes: 0 additions & 28 deletions docker/cuda/Dockerfile

This file was deleted.

7 changes: 7 additions & 0 deletions docker/tests/cuda/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG BASE=ghcr.io/cexa-project/kokkos-fft/base_cuda
FROM $BASE

ARG BUILD_DIR=./build
COPY $BUILD_DIR /work/build

WORKDIR /work/build

0 comments on commit 312009e

Please sign in to comment.