From 632bcecc40a8e22044354818fbb303a255b36542 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 6 Jan 2024 15:47:39 +0530 Subject: [PATCH] #3646 Use `os.cpu_count` rather than processor affinity --- .github/workflows/publish_pypi.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 556ffd1a1f..8a8126b0e4 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -41,8 +41,8 @@ jobs: id: get_num_cores shell: python run: | - from os import environ, sched_getaffinity - num_cpus = len(sched_getaffinity(0)) + from os import environ, cpu_count + num_cpus = cpu_count() output_file = environ['GITHUB_OUTPUT'] with open(output_file, "a", encoding="utf-8") as output_stream: output_stream.write(f"count={num_cpus}\n") @@ -80,9 +80,9 @@ jobs: VCPKG_DEFAULT_TRIPLET=x64-windows-static-md VCPKG_FEATURE_FLAGS=manifests,registries CMAKE_GENERATOR="Visual Studio 17 2022" - CMAKE_GENERATOR_PLATFORM=x64' - CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.get_num_cores.outputs.num_cpus }} - CIBW_ARCHS: "AMD64" + CMAKE_GENERATOR_PLATFORM=x64 + CMAKE_BUILD_PARALLEL_LEVEL=${{ steps.get_num_cores.outputs.count }} + CIBW_ARCHS: AMD64 CIBW_BEFORE_BUILD: python -m pip install setuptools wheel # skip CasADi and CMake CIBW_TEST_COMMAND: python -c "import pybamm; pybamm.IDAKLUSolver()"