From 435d176effc5f69db1d9d6082b704d822d4a1068 Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Wed, 5 Jun 2024 22:17:04 +0200 Subject: [PATCH] #2296: Conditionally build kokkos inside build_cpp.sh and enable it on gcc-12 workflow --- ci/azure/azure-gcc-12-ubuntu-mpich.yml | 1 + ci/build_cpp.sh | 33 ++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/ci/azure/azure-gcc-12-ubuntu-mpich.yml b/ci/azure/azure-gcc-12-ubuntu-mpich.yml index 1378cd6736..4c2e38038f 100644 --- a/ci/azure/azure-gcc-12-ubuntu-mpich.yml +++ b/ci/azure/azure-gcc-12-ubuntu-mpich.yml @@ -146,6 +146,7 @@ stages: dockerComposeCommand: 'run ubuntu-cpp-clean' env: CODECOV_TOKEN: $(codecov_token) + VT_KOKKOS_ENABLED: 1 - task: Bash@3 displayName: Put compilation's and tests' logs in PR comment continueOnError: true diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index db4ef0469a..bfcc4ab013 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -15,7 +15,7 @@ else target=${3:-install} fi -if [ -z ${4} ]; then +if [ -z "${4}" ]; then dashj="" else dashj="-j ${4}" @@ -44,6 +44,28 @@ case $CXX in && export NVCC_WRAPPER_DEFAULT_COMPILER;; esac +if test "${VT_KOKKOS_ENABLED:-0}" -eq 1 +then + echo "The variable VT_KOKKOS_ENABLED is set." + + if test -d "kokkos" + then + rm -Rf kokkos + fi + + git clone -b master https://github.com/kokkos/kokkos.git + export KOKKOS_DIR=$PWD/kokkos + export KOKKOS_BUILD=${build_dir}/kokkos/build + export KOKKOS_INSTALL="$KOKKOS_BUILD/install" + mkdir -p "$KOKKOS_BUILD" + cd "$KOKKOS_BUILD" + cmake -G "${CMAKE_GENERATOR:-Ninja}" \ + -DCMAKE_INSTALL_PREFIX="$KOKKOS_INSTALL" \ + "$KOKKOS_DIR" + cmake --build . "${dashj}" --target install + cd "${build_dir}" +fi + if test -d "checkpoint" then rm -Rf checkpoint @@ -68,8 +90,9 @@ else cd build cmake -G "${CMAKE_GENERATOR:-Ninja}" \ -DCMAKE_INSTALL_PREFIX="$CHECKPOINT_BUILD/install" \ + -Dkokkos_DIR="$KOKKOS_INSTALL" \ "$CHECKPOINT" - cmake --build . ${dashj} --target install + cmake --build . "${dashj}" --target install fi fi @@ -172,7 +195,7 @@ then # To easily tell if compilation of given file succeeded special progress bar is used # (controlled by variable NINJA_STATUS) export NINJA_STATUS="[ninja][%f/%t] " - time cmake --build . ${dashj} --target "${target}" | tee "$OUTPUT_TMP" + time cmake --build . "${dashj}" --target "${target}" | tee "$OUTPUT_TMP" compilation_ret=${PIPESTATUS[0]} sed -i '/ninja: build stopped:/d' "$OUTPUT_TMP" @@ -181,7 +204,7 @@ then elif test "$GENERATOR" = "Unix Makefiles" then # Gcc outputs warnings and errors to stderr, so there's not much to do - time cmake --build . ${dashj} --target "${target}" 2> >(tee "$OUTPUT_TMP") + time cmake --build . "${dashj}" --target "${target}" 2> >(tee "$OUTPUT_TMP") compilation_ret=$? WARNS_ERRS=$(cat "$OUTPUT_TMP") fi @@ -190,7 +213,7 @@ then WARNS_ERRS=${WARNS_ERRS//$'\n'/$DELIMITER} echo "$WARNS_ERRS" > "$OUTPUT" else - time cmake --build . ${dashj} --target "${target}" + time cmake --build . "${dashj}" --target "${target}" compilation_ret=$? fi