Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add limited PR testing #101

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/github-pr-linux-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Hosted Runners (linux, CUDA)

on:
push:
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
container: nvidia/cuda:12.6.2-devel-ubuntu22.04
steps:
- name: Install cmake
run: >
apt-get update && apt-get install
-y --no-install-suggests --no-install-recommends
cmake

- name: Checkout Kokkos Tutorials
uses: actions/checkout@v4
with:
path: kokkos-tutorials

- name: Checkout Kokkos
uses: actions/checkout@v4
with:
repository: 'kokkos/kokkos'
ref: master
path: kokkos

- name: Configure Kokkos
run: >
cmake -S "${GITHUB_WORKSPACE}"/kokkos -B "${GITHUB_WORKSPACE}"/build-kokkos
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}"/install-kokkos
-DCMAKE_CXX_COMPILER="${GITHUB_WORKSPACE}"/kokkos/bin/nvcc_wrapper
-DCMAKE_BUILD_TYPE=RelWithDebInfo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine but noting that it is the default hence unnecessary

-DKokkos_ENABLE_CUDA=ON
-DKokkos_ARCH_AMPERE80=ON
-DKokkos_ENABLE_COMPILER_WARNINGS=ON
cwpearson marked this conversation as resolved.
Show resolved Hide resolved

- name: Build & Install Kokkos
run: cmake --build "${GITHUB_WORKSPACE}"/build-kokkos --config RelWithDebInfo --parallel 2 --target install

- name: Configure and Build Exercises
run: |
bash "${GITHUB_WORKSPACE}"/kokkos-tutorials/Scripts/ci-configure-build-test.sh \
"${GITHUB_WORKSPACE}"/install-kokkos/lib/cmake/Kokkos \
"${GITHUB_WORKSPACE}"/kokkos-tutorials \
"${GITHUB_WORKSPACE}"/kokkos/bin/nvcc_wrapper \
RelWithDebInfo \
CUDA
57 changes: 57 additions & 0 deletions .github/workflows/github-pr-unix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Hosted Runners (unix)

on:
push:
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cpp_compiler: g++
build_type: RelWithDebInfo
backend: OPENMP
- os: macos-latest
cpp_compiler: clang++
build_type: Debug
backend: THREADS

steps:
- name: Checkout Kokkos Tutorials
uses: actions/checkout@v4
with:
path: kokkos-tutorials

- name: Checkout Kokkos
uses: actions/checkout@v4
with:
repository: 'kokkos/kokkos'
ref: master
path: kokkos

- name: Configure Kokkos
run: >
cmake -S ${{ github.workspace}}/kokkos -B ${{ github.workspace}}/build-kokkos
-DCMAKE_INSTALL_PREFIX=${{ github.workspace}}/install-kokkos
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DKokkos_ENABLE_COMPILER_WARNINGS=ON

- name: Build & Install Kokkos
run: cmake --build ${{ github.workspace}}/build-kokkos --config ${{ matrix.build_type }} --parallel 2 --target install

- name: Configure and Build Exercises
run: |
bash ${{ github.workspace}}/kokkos-tutorials/Scripts/ci-configure-build-test.sh \
${{ github.workspace}}/install-kokkos/lib/cmake/Kokkos \
${{ github.workspace}}/kokkos-tutorials \
${{ matrix.cpp_compiler}} \
${{ matrix.build_type}} \
${{ matrix.backend }}
54 changes: 54 additions & 0 deletions .github/workflows/github-pr-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Hosted Runners (windows)

on:
push:
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
cpp_compiler: cl
build_type: Release
backend: SERIAL

steps:
- name: Checkout Kokkos Tutorials
uses: actions/checkout@v4
with:
path: kokkos-tutorials

- name: Checkout Kokkos
uses: actions/checkout@v4
with:
repository: 'kokkos/kokkos'
ref: master
path: kokkos

- name: Configure Kokkos
run: >
cmake -S ${{ github.workspace}}\kokkos -B ${{ github.workspace}}\build-kokkos
dalg24 marked this conversation as resolved.
Show resolved Hide resolved
-DCMAKE_INSTALL_PREFIX=${{ github.workspace}}\install-kokkos
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: Build & Install Kokkos
run: cmake --build ${{ github.workspace}}\build-kokkos --config ${{ matrix.build_type }} --parallel 2 --target install

- name: Configure and Build Exercises
run: |
${{ github.workspace}}\kokkos-tutorials\Scripts\ci-configure-build-test.bat ^
${{ github.workspace}}\install-kokkos\lib\cmake\Kokkos ^
${{ github.workspace}}\kokkos-tutorials ^
${{ matrix.cpp_compiler}} ^
${{ matrix.build_type}} ^
${{ matrix.backend }}
shell: cmd

32 changes: 32 additions & 0 deletions Scripts/ci-configure-build-test.bat
cwpearson marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@echo off
setlocal EnableDelayedExpansion

if "%~5"=="" (
echo Usage: build.bat kokkos_root tutorials_src cpp_compiler build_type backend
exit /b 1
)

set kokkos_root=%~1
set tutorials_src=%~2
set cpp_compiler=%~3
set build_type=%~4
set backend=%~5

set "EXERCISES=01 02 03"
if "%backend%"=="CUDA" set "EXERCISES=%EXERCISES% 04"

set Kokkos_ROOT=%kokkos_root%
mkdir build 2>nul

for %%e in (%EXERCISES%) do (
for %%k in (Begin Solution) do (
set "source_dir=%tutorials_src%\Exercises\%%e\%%k"
set "build_dir=build\Exercises\%%e\%%k"
echo building !source_dir!
cmake -S "!source_dir!" -B "!build_dir!" ^
-DCMAKE_CXX_COMPILER="%cpp_compiler%" ^
-DCMAKE_BUILD_TYPE="%build_type%"

cmake --build "!build_dir!" --config "%build_type%"
)
)
36 changes: 36 additions & 0 deletions Scripts/ci-configure-build-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#! /bin/bash

set -eou pipefail

kokkos_root="$1"
tutorials_src="$2"
cpp_compiler="$3"
build_type="$4"
backend="$5"

EXERCISES=(
01
02
03
)

# Add CUDA exercise when backend is CUDA
if [ "$backend" == CUDA ]; then
EXERCISES+=(04)
fi

export Kokkos_ROOT="$kokkos_root"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we handle Kokkos and KokkosKernels differently and why don't we just set these environment variable externally?

mkdir -p build
for e in "${EXERCISES[@]}"; do
for k in Begin Solution; do
source_dir="$tutorials_src"/Exercises/"$e"/"$k"
build_dir=build/Exercises/"$e"/"$k"
echo building "$source_dir"
cmake -S "$source_dir" -B "$build_dir" \
-DCMAKE_CXX_COMPILER="$cpp_compiler" \
-DCMAKE_BUILD_TYPE="$build_type"

# --config needed for windows
cmake --build "$build_dir" --config "$build_type"
done
done