Skip to content

Commit

Permalink
alternative per-platform methods for obtaining the processor count
Browse files Browse the repository at this point in the history
  • Loading branch information
Razish committed Sep 28, 2023
1 parent 92b2823 commit db114cf
Showing 1 changed file with 4 additions and 48 deletions.
52 changes: 4 additions & 48 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ jobs:
platform: x64

steps:
- name: Get the number of CPUs that the current process has access to.
id: cpus
run: |
from os import environ, sched_getaffinity
num_cpus = len(sched_getaffinity(0))
output_file = environ["GITHUB_OUTPUT"]
with open(output_file, "a", encoding="utf-8") as output_stream:
output_stream.write("count={}\n".format(num_cpus))
shell: python

- uses: actions/checkout@v3

- name: Add msbuild to PATH
Expand All @@ -73,7 +62,7 @@ jobs:
- name: Build
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }} -j ${{ steps.cpus.outputs.count }}
run: cmake --build . --config ${{ matrix.build_type }} -j $NUMBER_OF_PROCESSORS

- name: Install
if: ${{ matrix.build_type == 'Release' }}
Expand Down Expand Up @@ -110,17 +99,6 @@ jobs:
platform: x64

steps:
- name: Get the number of CPUs that the current process has access to.
id: cpus
run: |
from os import environ, sched_getaffinity
num_cpus = len(sched_getaffinity(0))
output_file = environ["GITHUB_OUTPUT"]
with open(output_file, "a", encoding="utf-8") as output_stream:
output_stream.write("count={}\n".format(num_cpus))
shell: python

- uses: actions/checkout@v3

- name: Install v141_xp Toolchain
Expand Down Expand Up @@ -159,7 +137,7 @@ jobs:
- name: Build
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }} -j ${{ steps.cpus.outputs.count }}
run: cmake --build . --config ${{ matrix.build_type }} -j $NUMBER_OF_PROCESSORS

- name: Install
if: ${{ matrix.build_type == 'Release' }}
Expand Down Expand Up @@ -192,17 +170,6 @@ jobs:
portable: [Non-Portable]

steps:
- name: Get the number of CPUs that the current process has access to.
id: cpus
run: |
from os import environ, sched_getaffinity
num_cpus = len(sched_getaffinity(0))
output_file = environ["GITHUB_OUTPUT"]
with open(output_file, "a", encoding="utf-8") as output_stream:
output_stream.write("count={}\n".format(num_cpus))
shell: python

- uses: actions/checkout@v3

- name: Create Build Environment
Expand Down Expand Up @@ -239,7 +206,7 @@ jobs:
- name: Build
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --build . -j ${{ steps.cpus.outputs.count }}
run: cmake --build . -j $(nproc)

- name: Install
if: ${{ matrix.build_type == 'Release' }}
Expand Down Expand Up @@ -284,17 +251,6 @@ jobs:
portable: [Non-Portable]

steps:
- name: Get the number of CPUs that the current process has access to.
id: cpus
run: |
from os import environ, sched_getaffinity
num_cpus = len(sched_getaffinity(0))
output_file = environ["GITHUB_OUTPUT"]
with open(output_file, "a", encoding="utf-8") as output_stream:
output_stream.write("count={}\n".format(num_cpus))
shell: python

- uses: actions/checkout@v3

- name: Create Build Environment
Expand All @@ -318,7 +274,7 @@ jobs:
- name: Build
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --build . -j ${{ steps.cpus.outputs.count }}
run: cmake --build . -j $(getconf _NPROCESSORS_ONLN)

- name: Install
if: ${{ matrix.build_type == 'Release' }}
Expand Down

0 comments on commit db114cf

Please sign in to comment.