From f0de7f9b2d351b702922860b99155f27a99febf6 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 5 Nov 2024 22:25:42 -0500 Subject: [PATCH 1/3] core-number #comment update the number of cores that can be used --- .github/workflows/build_and_test.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4cec954..3593ac3 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -47,6 +47,23 @@ jobs: pluginval-binary: ./pluginval.exe steps: + # Figure out how many cores we have to work with + - name: Set number of cores + run: | + echo "Determining number of cores..." + if [[ "$RUNNER_OS" == "Linux" ]]; then + CORES=$(nproc) + elif [[ "$RUNNER_OS" == "macOS" ]]; then + CORES=$(sysctl -n hw.ncpu) + elif [[ "$RUNNER_OS" == "Windows" ]]; then + CORES=$NUMBER_OF_PROCESSORS + else + echo "Unknown OS. Defaulting to 2 cores." + CORES=2 + fi + echo "NUMBER_OF_CORES=$CORES" >> $GITHUB_ENV + echo "Detected $CORES cores" + # Setup MSVC toolchain and developer command prompt (Windows) - uses: ilammy/msvc-dev-cmd@v1 @@ -119,7 +136,7 @@ jobs: run: cmake -B ${{ env.BUILD_DIR }} -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ${{ matrix.extra-flags }} . - name: Build - run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel 4 + run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel ${{ env.NUMBER_OF_CORES }} - name: Test working-directory: ${{ env.BUILD_DIR }} From fe7b9a63732bfbb53c839e16ee114703e9928764 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 5 Nov 2024 22:52:39 -0500 Subject: [PATCH 2/3] Let cmake use as many as possible --- .github/workflows/build_and_test.yml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 3593ac3..d30098b 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -47,23 +47,6 @@ jobs: pluginval-binary: ./pluginval.exe steps: - # Figure out how many cores we have to work with - - name: Set number of cores - run: | - echo "Determining number of cores..." - if [[ "$RUNNER_OS" == "Linux" ]]; then - CORES=$(nproc) - elif [[ "$RUNNER_OS" == "macOS" ]]; then - CORES=$(sysctl -n hw.ncpu) - elif [[ "$RUNNER_OS" == "Windows" ]]; then - CORES=$NUMBER_OF_PROCESSORS - else - echo "Unknown OS. Defaulting to 2 cores." - CORES=2 - fi - echo "NUMBER_OF_CORES=$CORES" >> $GITHUB_ENV - echo "Detected $CORES cores" - # Setup MSVC toolchain and developer command prompt (Windows) - uses: ilammy/msvc-dev-cmd@v1 @@ -136,7 +119,7 @@ jobs: run: cmake -B ${{ env.BUILD_DIR }} -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ${{ matrix.extra-flags }} . - name: Build - run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel ${{ env.NUMBER_OF_CORES }} + run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel - name: Test working-directory: ${{ env.BUILD_DIR }} From 68f9553b732c54800407019033339023a83a993f Mon Sep 17 00:00:00 2001 From: = Date: Tue, 5 Nov 2024 23:09:56 -0500 Subject: [PATCH 3/3] core-number #comment although ninja will choose the best, MSVC will not --- .github/workflows/build_and_test.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index d30098b..3593ac3 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -47,6 +47,23 @@ jobs: pluginval-binary: ./pluginval.exe steps: + # Figure out how many cores we have to work with + - name: Set number of cores + run: | + echo "Determining number of cores..." + if [[ "$RUNNER_OS" == "Linux" ]]; then + CORES=$(nproc) + elif [[ "$RUNNER_OS" == "macOS" ]]; then + CORES=$(sysctl -n hw.ncpu) + elif [[ "$RUNNER_OS" == "Windows" ]]; then + CORES=$NUMBER_OF_PROCESSORS + else + echo "Unknown OS. Defaulting to 2 cores." + CORES=2 + fi + echo "NUMBER_OF_CORES=$CORES" >> $GITHUB_ENV + echo "Detected $CORES cores" + # Setup MSVC toolchain and developer command prompt (Windows) - uses: ilammy/msvc-dev-cmd@v1 @@ -119,7 +136,7 @@ jobs: run: cmake -B ${{ env.BUILD_DIR }} -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ${{ matrix.extra-flags }} . - name: Build - run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel + run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel ${{ env.NUMBER_OF_CORES }} - name: Test working-directory: ${{ env.BUILD_DIR }}