Skip to content

cicd: test Cuda version supported by Kokkos (11.0.3) #159

cicd: test Cuda version supported by Kokkos (11.0.3)

cicd: test Cuda version supported by Kokkos (11.0.3) #159

name: Build Kokkos alongside with Kokkos Tools for various configurations
on: [push, pull_request]
jobs:
build-kokkos:
name: Build Kokkos Tools alongside Kokkos
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: ubuntu:22.04
preset: OpenMP
compiler: default
- image: nvidia/cuda:11.0.3-devel-ubuntu20.04
preset: Cuda
compiler: default
- image: nvidia/cuda:12.2.0-devel-ubuntu22.04
preset: Cuda
compiler: {cpp: g++-12, c: gcc-12}
- image: rocm/dev-ubuntu-22.04:5.4
preset: ROCm
compiler: default
- image: rocm/dev-ubuntu-22.04:5.7
preset: ROCm
compiler: default
container:
image: ${{ matrix.image }}
env:
Kokkos_ROOT: /opt/kokkos
steps:
- name: Checkout Kokkos Tools
uses: actions/checkout@v4
- name: Checkout Kokkos repository at latest develop
uses: actions/checkout@v4
with:
repository: kokkos/kokkos
path: kokkos
ref: develop
- name: Ensure non-interactive frontend.
run : |
echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV
- name: Install compilers
run : |
apt update
if [ ${{ matrix.compiler }} != 'default' ];then
apt --yes --no-install-recommends install ${{ matrix.compiler.c }} ${{ matrix.compiler.cpp }}
export CC=${{ matrix.compiler.c }}
export CXX=${{ matrix.compiler.cpp }}
else
apt --yes --no-install-recommends install gcc g++
export CC=gcc
export CXX=g++
fi
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
case ${{ matrix.preset }} in
*OpenMP* )
echo "Preset is OpenMP, nothing to do."
;;
*Cuda* )
echo "Preset is Cuda. Setting 'NVCC_WRAPPER_DEFAULT_COMPILER' to '$CXX'."
echo "NVCC_WRAPPER_DEFAULT_COMPILER=$CXX" >> $GITHUB_ENV
;;
*ROCm* )
echo "Preset is ROCm, nothing to do."
;;
* )
echo "Unsupported preset '${{ matrix.preset }}'."
exit -1
esac
# Add Kitware's APT source to get the latest CMake version (or at least newer than 3.19 to support JSON presets).
# See also https://apt.kitware.com/.
- name: Add Kitware's APT source to get the latest CMake version.
run : |
apt --yes --no-install-recommends install wget lsb-release
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null
apt update
rm /usr/share/keyrings/kitware-archive-keyring.gpg
apt --no-install-recommends --yes install kitware-archive-keyring
- name: Install CMake, OpenMPI and dtrace
run: |
apt --yes --no-install-recommends install \
cmake make \
libopenmpi-dev \
systemtap-sdt-dev
- name: Compile and install Kokkos
working-directory: kokkos
run: |
cp ${GITHUB_WORKSPACE}/kokkos.presets.json CMakePresets.json
cmake -S . --preset=${{ matrix.preset }}
cmake --build --preset=${{ matrix.preset }}
cmake --install build-with-${{ matrix.preset }} --prefix=${Kokkos_ROOT}
- name: Build Kokkos Tools, enabling examples
run: |
cmake -S . --preset=${{ matrix.preset }}
cmake --build --preset=${{ matrix.preset }}
cmake --install build-with-${{ matrix.preset }} --prefix=/opt/kokkos-tools
# For now, GitHub runners are used. These runner don't have GPUs. Therefore, testing can only be done for OpenMP.
- name: Run tests
if: ${{ matrix.preset == 'OpenMP' }}
run: |
ctest --preset=${{ matrix.preset }}