From d5197656274ef274de9bbd2704a42368a8bcb053 Mon Sep 17 00:00:00 2001 From: Vicente Adolfo Bolea Sanchez Date: Tue, 30 Aug 2022 13:42:12 -0400 Subject: [PATCH] CMAKE: avoid CUDA the false negative err --- .github/workflows/everything.yml | 4 ++- scripts/ci/cmake-v2/ci-common.cmake | 2 +- scripts/ci/cmake-v2/ci-el8-cuda-serial.cmake | 4 +-- scripts/ci/gh-actions/config/ninja.cmake | 34 ++++++++++++++++++++ scripts/ci/gh-actions/linux-setup.sh | 11 +++++-- 5 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 scripts/ci/gh-actions/config/ninja.cmake diff --git a/.github/workflows/everything.yml b/.github/workflows/everything.yml index 89c304de60..1a1bc635e4 100644 --- a/.github/workflows/everything.yml +++ b/.github/workflows/everything.yml @@ -127,7 +127,9 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} path: source - name: Setup - run: gha/scripts/ci/gh-actions/linux-setup.sh + run: | + echo "${GITHUB_WORKSPACE}/../.local/bin" >> $GITHUB_PATH + gha/scripts/ci/gh-actions/linux-setup.sh - name: Update run: gha/scripts/ci/gh-actions/run.sh update - name: Configure diff --git a/scripts/ci/cmake-v2/ci-common.cmake b/scripts/ci/cmake-v2/ci-common.cmake index dc03b2febc..033692ad98 100644 --- a/scripts/ci/cmake-v2/ci-common.cmake +++ b/scripts/ci/cmake-v2/ci-common.cmake @@ -15,7 +15,7 @@ if(NOT CTEST_BUILD_FLAGS) if(CTEST_CMAKE_GENERATOR STREQUAL "Unix Makefiles") set(CTEST_BUILD_FLAGS "-k -j${N2CPUS}") elseif(CTEST_CMAKE_GENERATOR STREQUAL "Ninja") - set(CTEST_BUILD_FLAGS "-k0 -j${N2CPUS}") + set(CTEST_BUILD_FLAGS "-j${N2CPUS}") endif() endif() if(NOT PARALLEL_LEVEL IN_LIST CTEST_TEST_ARGS) diff --git a/scripts/ci/cmake-v2/ci-el8-cuda-serial.cmake b/scripts/ci/cmake-v2/ci-el8-cuda-serial.cmake index 5855d0794e..daa497380f 100644 --- a/scripts/ci/cmake-v2/ci-el8-cuda-serial.cmake +++ b/scripts/ci/cmake-v2/ci-el8-cuda-serial.cmake @@ -2,7 +2,7 @@ include(ProcessorCount) ProcessorCount(NCPUS) -math(EXPR N2CPUS "${NCPUS}*2") +math(EXPR N2CPUS "${NCPUS}*4") set(ENV{CC} gcc) set(ENV{CXX} g++) @@ -25,6 +25,6 @@ CMAKE_Fortran_FLAGS:STRING=-Wall ") set(CTEST_TEST_ARGS PARALLEL_LEVEL ${NCPUS}) -set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +set(CTEST_CMAKE_GENERATOR "Ninja") list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") include(${CMAKE_CURRENT_LIST_DIR}/ci-common.cmake) diff --git a/scripts/ci/gh-actions/config/ninja.cmake b/scripts/ci/gh-actions/config/ninja.cmake new file mode 100644 index 0000000000..6f20c4cd86 --- /dev/null +++ b/scripts/ci/gh-actions/config/ninja.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.0 FATAL_ERROR) + +set(version 1.11.0) + +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") + set(sha256sum 9726e730d5b8599f82654dc80265e64a10a8a817552c34153361ed0c017f9f02) + set(platform linux) +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + set(sha256sum 21915277db59756bfc61f6f281c1f5e3897760b63776fd3d360f77dd7364137f) + set(platform mac) +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + set(sha256sum d0ee3da143211aa447e750085876c9b9d7bcdd637ab5b2c5b41349c617f22f3b) + set(platform win) +else() + message(FATAL_ERROR "Unrecognized platform ${CMAKE_HOST_SYSTEM_NAME}") +endif() + +set(tarball "ninja-${platform}.zip") + +file(DOWNLOAD + "https://github.com/ninja-build/ninja/releases/download/v${version}/${tarball}" $ENV{CI_ROOT_DIR}/.local/bin/${tarball} + EXPECTED_HASH SHA256=${sha256sum} + SHOW_PROGRESS + ) + +execute_process( + COMMAND ${CMAKE_COMMAND} -E tar xf ${tarball} + WORKING_DIRECTORY $ENV{CI_ROOT_DIR}/.local/bin + RESULT_VARIABLE extract_results + ) + +if(extract_results) + message(FATAL_ERROR "Extracting `${tarball}` failed: ${extract_results}.") +endif() diff --git a/scripts/ci/gh-actions/linux-setup.sh b/scripts/ci/gh-actions/linux-setup.sh index ee5ac3d537..53a25c7c8d 100755 --- a/scripts/ci/gh-actions/linux-setup.sh +++ b/scripts/ci/gh-actions/linux-setup.sh @@ -1,10 +1,17 @@ -#!/bin/bash +#!/bin/bash --login -set -e +set -ex export CI_ROOT_DIR="${GITHUB_WORKSPACE}/.." export CI_SOURCE_DIR="${GITHUB_WORKSPACE}" +echo "**********Install dependencies Begin**********" +[ -d ${CI_ROOT_DIR}/.local/bin ] || mkdir -p ${CI_ROOT_DIR}/.local/bin + +find ${CI_SOURCE_DIR}/gha/scripts/ci/gh-actions/config/ -type f -iname '*.sh ' -perm /a=x -exec ./{} \; +find ${CI_SOURCE_DIR}/gha/scripts/ci/gh-actions/config/ -type f -iname '*.cmake' -exec cmake --trace -VV -P {} \; +echo "**********Install dependencies End**********" + SETUP_SCRIPT=${CI_SOURCE_DIR}/scripts/ci/setup/ci-${GH_YML_JOBNAME}.sh if [ -x "${SETUP_SCRIPT}" ]