Skip to content

Commit

Permalink
Merge pull request #188 from uliegecsm/build-kokkos
Browse files Browse the repository at this point in the history
ci: build kokkos tools with kokkos
  • Loading branch information
dalg24 authored Jul 3, 2023
2 parents 4bae71c + 86d59a4 commit 4c444bc
Show file tree
Hide file tree
Showing 10 changed files with 199 additions and 10 deletions.
File renamed without changes.
56 changes: 56 additions & 0 deletions .github/workflows/build-with-kokkos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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
- image: nvidia/cuda:12.1.0-devel-ubuntu22.04
preset: Cuda
- image: rocm/dev-ubuntu-22.04:5.4
preset: ROCm
container:
image: ${{ matrix.image }}
env:
Kokkos_ROOT: /opt/kokkos
steps:
- name: Checkout Kokkos Tools
uses: actions/checkout@v3
- name: Checkout Kokkos repository at latest develop
uses: actions/checkout@v3
with:
repository: kokkos/kokkos
path: kokkos
ref: develop
- name: Install CMake, compilers, OpenMPI and dtrace
run: |
apt update
apt --yes --no-install-recommends install \
cmake make \
gcc g++ \
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 }}
2 changes: 1 addition & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ add_subdirectory(debugging/kernel-logger)
if(NOT WIN32)
add_subdirectory(profiling/simple-kernel-timer)
add_subdirectory(profiling/memory-hwm)
if(KOKKOSTOOLS_USE_MPI)
if(KokkosTools_ENABLE_MPI)
add_subdirectory(profiling/memory-hwm-mpi)
else()
message(STATUS "Skipping memory-hwm-mpi (MPI disabled)")
Expand Down
78 changes: 78 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"version" : 3,
"configurePresets" : [
{
"name" : "default",
"binaryDir" : "${sourceDir}/build-with-${presetName}",
"cacheVariables" : {
"CMAKE_BUILD_TYPE" : "Release",
"CMAKE_CXX_STANDARD" : "17",
"KokkosTools_ENABLE_EXAMPLES" : "ON",
"KokkosTools_ENABLE_SINGLE" : "ON",
"KokkosTools_ENABLE_MPI" : "ON"
}
},
{
"name" : "OpenMP",
"inherits" : "default"
},
{
"name" : "Cuda",
"inherits" : "default",
"cacheVariables" : {
"CMAKE_CXX_COMPILER" : "$env{Kokkos_ROOT}/bin/nvcc_wrapper"
}
},
{
"name" : "ROCm",
"inherits" : "default",
"environment" : {
"ROCM_PATH" : "/opt/rocm"
},
"cacheVariables" : {
"CMAKE_CXX_COMPILER" : "hipcc"
}
}
],
"buildPresets" : [
{
"name" : "OpenMP",
"configurePreset" : "OpenMP",
"inheritConfigureEnvironment" : true
},
{
"name" : "Cuda",
"configurePreset" : "Cuda",
"inheritConfigureEnvironment" : true
},
{
"name" : "ROCm",
"configurePreset" : "ROCm",
"inheritConfigureEnvironment" : true
}
],
"testPresets" : [
{
"name" : "default",
"configurePreset" : "default",
"inheritConfigureEnvironment" : true,
"output" : {"outputOnFailure": true},
"execution" : {"noTestsAction": "error", "stopOnFailure": false}
},
{
"name" : "OpenMP",
"configurePreset" : "OpenMP",
"inherits" : "default"
},
{
"name" : "Cuda",
"configurePreset" : "Cuda",
"inherits" : "default"
},
{
"name" : "ROCm",
"configurePreset" : "ROCm",
"inherits" : "default"
}
]
}
2 changes: 1 addition & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ message(STATUS "Found installed Kokkos at ${Kokkos_DIR}")
set(TEST_APP kp_example)
add_executable(${TEST_APP} main.cpp)
set(LIBS "Kokkos::kokkos;kokkostools")
if(USE_MPI)
if(KokkosTools_ENABLE_MPI)
list(APPEND LIBS MPI::MPI_CXX)
endif()
target_link_libraries(${TEST_APP} PRIVATE ${LIBS})
Expand Down
54 changes: 54 additions & 0 deletions kokkos.presets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"version" : 3,
"configurePresets" : [
{
"name" : "default",
"binaryDir" : "${sourceDir}/build-with-${presetName}",
"cacheVariables" : {
"CMAKE_BUILD_TYPE" : "Release",
"CMAKE_CXX_STANDARD" : "17",
"CMAKE_CXX_EXTENSIONS" : "OFF",
"BUILD_SHARED_LIBS" : "ON"
}
},
{
"name" : "OpenMP",
"inherits" : "default",
"cacheVariables" : {
"Kokkos_ENABLE_OPENMP" : "ON"
}
},
{
"name" : "Cuda",
"inherits" : "default",
"cacheVariables" : {
"Kokkos_ENABLE_CUDA" : "ON",
"Kokkos_ARCH_VOLTA70" : "ON",
"CMAKE_CXX_COMPILER" : "${sourceDir}/bin/nvcc_wrapper"
}
},
{
"name" : "ROCm",
"inherits" : "default",
"cacheVariables" : {
"Kokkos_ENABLE_HIP" : "ON",
"Kokkos_ARCH_VEGA906" : "ON",
"CMAKE_CXX_COMPILER" : "hipcc"
}
}
],
"buildPresets" : [
{
"name" : "OpenMP",
"configurePreset" : "OpenMP"
},
{
"name" : "Cuda",
"configurePreset" : "Cuda"
},
{
"name" : "ROCm",
"configurePreset" : "ROCm"
}
]
}
4 changes: 2 additions & 2 deletions profiling/chrome-tracing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kp_add_library(kp_chrome_tracing kp_chrome_tracing.cpp)

if(USE_MPI)
if(KokkosTools_ENABLE_MPI)
target_link_libraries(kp_chrome_tracing PRIVATE MPI::MPI_CXX)
endif()
endif()
7 changes: 4 additions & 3 deletions profiling/roctx-connector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
find_library(ROCM_ROCTX_LIB roctx64 HINTS $ENV{ROCM_PATH}/lib)
find_path(ROCM_ROCTX_INCLUDE roctx.h HINTS $ENV{ROCM_PATH}/include/roctracer)
find_library(ROCM_ROCTX_LIB roctx64 REQUIRED HINTS $ENV{ROCM_PATH}/lib)
find_path(ROCM_ROCTX_INCLUDE roctx.h REQUIRED HINTS $ENV{ROCM_PATH}/include/roctracer)

kp_add_library(kp_roctx_connector kp_roctx_connector.cpp)

target_include_directories(kp_roctx_connector PRIVATE ${ROCM_ROCTX_INCLUDE})
target_link_libraries(kp_roctx_connector ${ROCM_ROCTX_LIB})
target_link_libraries(kp_roctx_connector PRIVATE ${ROCM_ROCTX_LIB})
4 changes: 2 additions & 2 deletions profiling/space-time-stack/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kp_add_library(kp_space_time_stack kp_space_time_stack.cpp)

if(USE_MPI)
if(KokkosTools_ENABLE_MPI)
target_link_libraries(kp_space_time_stack PRIVATE MPI::MPI_CXX)
endif()
endif()

0 comments on commit 4c444bc

Please sign in to comment.