Skip to content

Commit

Permalink
Merge pull request #708 from Pressio/707-create-a-kokkos-only-pipeline
Browse files Browse the repository at this point in the history
#707: create a kokkos-only pipeline
  • Loading branch information
fnrizzi authored Jan 7, 2025
2 parents b88d750 + d435fd0 commit 49094d5
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 16 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/ci-kokkos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: github-Linux-kokkos

on:
pull_request:
types: [ opened, reopened, synchronize ]
branches: [main, develop]
paths-ignore:
- 'logos/**'
- 'helper_scripts/**'
- 'docker_scripts/**'
- 'docs/**'
- '**/*.md'
push: # for direct quick fixes
branches:
- 'main'
- 'develop'
paths-ignore:
- 'logos/**'
- 'helper_scripts/**'
- 'docker_scripts/**'
- 'docs/**'
- '**/*.md'

concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{github.event_name == 'pull_request'}}

jobs:
CI-kokkos:
name: Kokkos
continue-on-error: false
strategy:
fail-fast: false
matrix:
image:
- ubuntu-gnu-kokkos-cpu-serial-11
- ubuntu-gnu-kokkos-cpu-openmp-11
build_type:
- Release
- Debug

runs-on: ubuntu-latest
container:
image: ghcr.io/pressio/${{ matrix.image }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
env:
num_cpus: 4
PRESSIO_INSTALL_DIR: ${{ github.workspace }}/pressio_install

steps:
- uses: actions/checkout@v4

- name: Checkout pressio examples
uses: actions/checkout@v4
with:
repository: Pressio/pressio-templates-usage-as-library
path: examples
ref: add-compatibility-with-pressio-ops

- name: Checkout pressio-ops
uses: actions/checkout@v4
with:
repository: Pressio/pressio-ops
path: pressio-ops
ref: develop

- name: Configure
run: |
cmake -B builddir \
-D CMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} \
-D CMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-D CMAKE_C_COMPILER:FILEPATH=$CC \
-D CMAKE_CXX_COMPILER:FILEPATH=$CXX \
-D PRESSIO_ENABLE_TESTS:BOOL=ON \
-D PRESSIO_ENABLE_TPL_EIGEN:BOOL=OFF \
-D PRESSIO_ENABLE_TPL_MPI:BOOL=OFF \
-D PRESSIO_ENABLE_TPL_KOKKOS:BOOL=ON \
-D Kokkos_ROOT=/kokkos/install \
-D KokkosKernels_ROOT=/kokkos-kernels/install \
-D PRESSIO_ENABLE_DEBUG_PRINT=ON \
-D CMAKE_INSTALL_PREFIX:PATH=${PRESSIO_INSTALL_DIR} \
-D CMAKE_CXX_FLAGS='-Wall -Werror'
- name: Build
run: cmake --build builddir -j $num_cpus --target install

- name: Example - include only
working-directory: examples
run: |
$CXX \
--std=c++17 \
-DPRESSIO_ENABLE_TPL_KOKKOS \
-I/kokkos/install/include \
-I/kokkos-kernels/install/include \
-I${GITHUB_WORKSPACE}/pressio-ops/include \
-I${PRESSIO_INSTALL_DIR}/include \
-c main.cpp
- name: Example - include only with embedded definitions
working-directory: examples
run: |
$CXX \
--std=c++17 \
-DPRESSIO_ENABLE_TPL_KOKKOS \
-I/kokkos/install/include \
-I/kokkos-kernels/install/include \
-I${GITHUB_WORKSPACE}/pressio-ops/include \
-I${PRESSIO_INSTALL_DIR}/include \
-c main_with_defines.cpp
- name: Test
working-directory: builddir
run: |
export LD_LIBRARY_PATH=/kokkos/install/lib:/kokkos-kernels/install/include
ctest -j $num_cpus --output-on-failure
26 changes: 11 additions & 15 deletions tests/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,18 @@ if(PRESSIO_ENABLE_TPL_KOKKOS)
# when trilinos is enabled it links kokkos too
if(NOT PRESSIO_ENABLE_TPL_TRILINOS)
# if kokkos is used as standalone lib, then we are more specific
# user needs to define: KOKKOS_ROOT_DIR and KOKKOS_KERNELS_ROOT_DIR
if (NOT KOKKOS_ROOT OR NOT KOKKOS_KERNELS_ROOT)
message(FATAL_ERROR "Missing KOKKOS_ROOT. KOKKOS needs:
-D KOKKOS_ROOT=<full-path-to-kokkos-installation>
-D KOKKOS_KERNELS_ROOT=<full-path-to-kokkos-kernels-installation>
")
# user needs to define: Kokkos_ROOT and KokkosKernels_ROOT
if (NOT Kokkos_ROOT OR NOT KokkosKernels_ROOT)
message(
FATAL_ERROR
"Missing Kokkos_ROOT. Kokkos needs:
-D Kokkos_ROOT=<full-path-to-kokkos-installation>
-D KokkosKernels_ROOT=<full-path-to-kokkos-kernels-installation>"
)
endif()

set(KOKKOS_LIB_NAMES kokkoscontainers kokkoscore kokkoskernels)

include_directories(SYSTEM ${KOKKOS_ROOT}/include ${KOKKOS_KERNELS_ROOT}/include)

link_directories(${KOKKOS_ROOT}/lib ${KOKKOS_ROOT}/lib64
${KOKKOS_KERNELS_ROOT}/lib ${KOKKOS_KERNELS_ROOT}/lib64)

link_libraries(${KOKKOS_LIB_NAMES})
find_package(Kokkos REQUIRED)
find_package(KokkosKernels REQUIRED)
link_libraries(Kokkos::kokkos Kokkos::kokkoskernels)
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion tests/functional_small/solvers_linear/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if(PRESSIO_ENABLE_TPL_EIGEN)
add_serial_utest(${TESTING_LEVEL}_eigen_matrix_free_sparse ${SRC1})
endif()

if(PRESSIO_ENABLE_TPL_KOKKOS)
if(PRESSIO_ENABLE_TPL_TRILINOS)
set(SRC1 ${CMAKE_CURRENT_SOURCE_DIR}/solvers_linear_kokkos.cc)
add_serial_utest_kokkos(${TESTING_LEVEL}_solvers_linear_kokkos ${SRC1})
endif()

0 comments on commit 49094d5

Please sign in to comment.