From dc7dfeb0371d8d4cc2892b7c94f57760656bd0e6 Mon Sep 17 00:00:00 2001 From: Randolph Settgast Date: Thu, 23 May 2024 23:10:18 -0700 Subject: [PATCH] add nproc flag to builds --- .github/workflows/continuousIntegration.yml | 7 +++++++ scripts/ci_build_and_test.sh | 5 +++++ scripts/ci_build_and_test_in_container.sh | 9 ++------- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continuousIntegration.yml b/.github/workflows/continuousIntegration.yml index 8adc89d..db8f71a 100644 --- a/.github/workflows/continuousIntegration.yml +++ b/.github/workflows/continuousIntegration.yml @@ -137,6 +137,7 @@ jobs: CMAKE_BUILD_TYPE: Release ENABLE_CUDA: ON CMAKE_CUDA_ARCHITECTURES: "86" + NPROC: 4 DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all" - name: ubuntu22-gcc11-cuda11-dbg (ubuntu-22, gcc 11.4.0, cuda-11.8.0, Debug) @@ -147,6 +148,7 @@ jobs: CMAKE_BUILD_TYPE: Debug ENABLE_CUDA: ON CMAKE_CUDA_ARCHITECTURES: "86" + NPROC: 4 DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all" - name: ubuntu22-clang14-cuda11-rel (ubuntu-22, clang-14.0.0, cuda-11.8.0, Release) @@ -157,6 +159,7 @@ jobs: CMAKE_BUILD_TYPE: Release ENABLE_CUDA: ON CMAKE_CUDA_ARCHITECTURES: "86" + NPROC: 4 DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all" - name: ubuntu22-clang14-cuda11-dbg (ubuntu-22, clang-14.0.0, cuda-11.8.0, Debug) @@ -167,6 +170,7 @@ jobs: CMAKE_BUILD_TYPE: Debug ENABLE_CUDA: ON CMAKE_CUDA_ARCHITECTURES: "86" + NPROC: 4 DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all" - name: RHEL8.9-clang17-cuda12-rel (ubi8.9, clang-17.0.6, cuda-12.4.1, Release) @@ -177,6 +181,7 @@ jobs: CMAKE_BUILD_TYPE: Release ENABLE_CUDA: ON CMAKE_CUDA_ARCHITECTURES: "86" + NPROC: 4 DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all" - name: RHEL8.9-gcc13-cuda12-rel (ubi8.8, gcc 13.2.1, cuda-12.4.1, Release) @@ -187,6 +192,7 @@ jobs: CMAKE_BUILD_TYPE: Release ENABLE_CUDA: ON CMAKE_CUDA_ARCHITECTURES: "86" + NPROC: 4 DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all" steps: @@ -207,6 +213,7 @@ jobs: CMAKE_BUILD_TYPE: ${{ matrix.CMAKE_BUILD_TYPE }} ENABLE_CUDA: ${{ matrix.ENABLE_CUDA }} CMAKE_CUDA_ARCHITECTURES: ${{ matrix.CMAKE_CUDA_ARCHITECTURES }} + NPROC: ${{ matrix.NPROC }} BUILD_AND_TEST_ARGS: ${{ matrix.BUILD_AND_TEST_ARGS }} --build-exe DOCKER_RUN_ARGS: ${{ matrix.DOCKER_RUN_ARGS }} HOST_CONFIG: hostconfigs/environment.cmake diff --git a/scripts/ci_build_and_test.sh b/scripts/ci_build_and_test.sh index 2e476a2..a02fb61 100755 --- a/scripts/ci_build_and_test.sh +++ b/scripts/ci_build_and_test.sh @@ -5,6 +5,10 @@ BUILD_DIR=${GITHUB_WORKSPACE} BUILD_DIR_MOUNT_POINT=/tmp/Shiva +if [[ -z "${NPROC}" ]]; then + NPROC=$(nproc) +fi + # We need to keep track of the building container (hence the `CONTAINER_NAME`) # so we can extract the data from it later (if needed). Another solution would have been to use a mount point, # but that would not have solved the problem for the TPLs (we would require extra action to copy them to the mount point). @@ -23,5 +27,6 @@ docker run \ -e ENABLE_CUDA=${ENABLE_CUDA} \ -e CMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES} \ -e CMAKE_BUILD_TYPE \ + -e NPROC \ ${DOCKER_REPOSITORY} \ ${BUILD_DIR_MOUNT_POINT}/scripts/ci_build_and_test_in_container.sh ${BUILD_AND_TEST_ARGS}; \ No newline at end of file diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index dfa0d32..da41aaa 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -1,11 +1,6 @@ #!/bin/bash env -echo "running nproc" -nproc - -echo "running free -m" -free -m # The or_die function run the passed command line and # exits the program in case of non zero error code @@ -70,14 +65,14 @@ fi if [[ "$*" == *--code-coverage* ]]; then - or_die make -j $(nproc) VERBOSE=1 + or_die make -j ${NPROC} VERBOSE=1 or_die make shiva_coverage cp -r ${SHIVA_BUILD_DIR}/shiva_coverage.info.cleaned /tmp/Shiva/shiva_coverage.info.cleaned fi if [[ "$*" == *--build-exe* ]]; then - or_die make -j $(nproc) + or_die make -j ${NPROC} if [[ "$*" != *--disable-unit-tests* ]]; then or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck|testCppCheck|testClangTidy"