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 16 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
71 changes: 71 additions & 0 deletions .github/workflows/github-pr-linux-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
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 Packages
run: >
apt-get update && apt-get install
-y --no-install-suggests --no-install-recommends
cmake openmpi-bin libopenmpi-dev

- 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: Checkout Kokkos Kernels
uses: actions/checkout@v4
with:
repository: 'kokkos/kokkos-kernels'
ref: master
path: kokkos-kernels

- 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 Kokkos Kernels
run: >
cmake -S "${GITHUB_WORKSPACE}"/kokkos-kernels -B "${GITHUB_WORKSPACE}"/build-kokkos-kernels
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}"/install-kokkos-kernels
-DCMAKE_CXX_COMPILER="${GITHUB_WORKSPACE}"/kokkos/bin/nvcc_wrapper
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DKokkos_ROOT="${GITHUB_WORKSPACE}"/install-kokkos

- name: Build & Install Kokkos Kernels
run: cmake --build "${GITHUB_WORKSPACE}"/build-kokkos-kernels --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}"/install-kokkos-kernels \
"${GITHUB_WORKSPACE}"/kokkos-tutorials \
"${GITHUB_WORKSPACE}"/kokkos/bin/nvcc_wrapper \
RelWithDebInfo \
CUDA
86 changes: 86 additions & 0 deletions .github/workflows/github-pr-unix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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: Install Packages
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update
sudo apt-get install -y --no-install-suggests --no-install-recommends openmpi-bin libopenmpi-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install open-mpi
fi
shell: bash

- 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: Checkout Kokkos Kernels
uses: actions/checkout@v4
with:
repository: 'kokkos/kokkos-kernels'
ref: master
path: kokkos-kernels

- 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 Kokkos Kernels
run: >
cmake -S "${GITHUB_WORKSPACE}"/kokkos-kernels -B "${GITHUB_WORKSPACE}"/build-kokkos-kernels
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}"/install-kokkos-kernels
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DKokkos_ROOT="${GITHUB_WORKSPACE}"/install-kokkos

- name: Build & Install Kokkos Kernels
run: cmake --build "${GITHUB_WORKSPACE}"/build-kokkos-kernels --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}"/install-kokkos-kernels \
"${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

1 change: 1 addition & 0 deletions Exercises/mpi_exch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ find_package(MPI REQUIRED)

add_executable(mpi_exch mpi_exch.cpp)
target_link_libraries(mpi_exch Kokkos::kokkos)
target_link_libraries(mpi_exch MPI::MPI_CXX)
1 change: 1 addition & 0 deletions Exercises/mpi_heat_conduction/Solution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ find_package(MPI REQUIRED)

add_executable(heat3d mpi_heat_conduction_solution.cpp)
target_link_libraries(heat3d Kokkos::kokkos)
target_link_libraries(heat3d MPI::MPI_CXX)
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%"
)
)
95 changes: 95 additions & 0 deletions Scripts/ci-configure-build-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#! /bin/bash

set -eou pipefail

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

# These are exercises with CMakeLists.txt in Begin and Solution subdirectories
# TODO: advanced_reductions seems broken
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, Begin doesn't compile.

# TODO: hpcbind does not use cmake
# TODO: instances does not use cmake
# TODO: parallel_scan seems broken
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate?

Copy link
Author

Choose a reason for hiding this comment

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

It just means there were compilation errors when I tried to compile it in this framework. I didn't spend more than 30s looking at any of them. I figured fixing them up could be follow-on work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, see #104.

# TODO: simd_warp seems broken
# TODO: subview seems broken
# TODO: vectorshift needs Kokkos Remote Spaces
# TODO: kokkoskernels/CGSolve_SpILUKprecond needs to know where Kokkos Kernels source directory is
# TODO: kokkoskernels/SpILUK needs to know where Kokkos Kernels source directory is
# TODO: kokkoskernels/TeamGemm seems broken
# TODO: mpi_heat_conduction/no-mpi does not use cmake
BEGIN_SOLUTION_EXERCISES=(
01
02
03
dualview
kokkoskernels/BlockJacobi
kokkoskernels/GaussSeidel
kokkoskernels/GraphColoring
kokkoskernels/InnerProduct
mdrange
mpi_pack_unpack
random_number
scatter_view
simd
team_policy
team_scratch_memory
team_vector_loop
unordered_map
)

if [ "$backend" == CUDA ]; then
BEGIN_SOLUTION_EXERCISES+=(04)
BEGIN_SOLUTION_EXERCISES+=(multi_gpu_cuda)
fi


if [ ! "$backend" == CUDA ]; then
BEGIN_SOLUTION_EXERCISES+=(tasking) # tasking doesn't seem to work on CUDA
BEGIN_SOLUTION_EXERCISES+=(virtualfunction) # TODO: virtualfunction needs Kokkos with CUDA RDC
fi

if [ "$backend" == OPENMP ]; then
BEGIN_SOLUTIONS_EXERCISES+=(unique_token)
fi

# no fortran on macOs
if [[ ! "$OSTYPE" == "darwin"* ]]; then
BEGIN_SOLUTIONS_EXERCISES+=(fortran-kokkosinterface)
fi

# These are exercises with CMakeLists.txt in the root directory
EXERCISES=(
kokkoskernels/CGSolve/Solution # Begin does not include the proper headers (on purpose) so it can't be compiled
kokkoskernels/SpGEMM/Solution # Begin does not include the proper headers (on purpose) so it can't be compiled
mpi_exch
tools_minimd
)

# TODO: explicitly specifies CUDA
if [ "$backend" == CUDA ]; then
EXERCISES+=(mpi_heat_conduction/Solution) # TODO: mpi_heat_conduction/Begin does not use cmake
fi

# Add Begin and Solution subdirectory from BEGIN_SOLUTION_EXCERCISES to EXERCISES
for e in "${BEGIN_SOLUTION_EXERCISES[@]}"; do
EXERCISES+=("$e"/Begin)
EXERCISES+=("$e"/Solution)
done

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
source_dir="$tutorials_src"/Exercises/"$e"
build_dir=build/Exercises/"$e"
echo building "$source_dir"
cmake -S "$source_dir" -B "$build_dir" \
-DCMAKE_CXX_COMPILER="$cpp_compiler" \
-DCMAKE_BUILD_TYPE="$build_type" \
-DKokkosKernels_ROOT="$kernels_root"

cmake --build "$build_dir"
done