Skip to content

Commit

Permalink
#3646 set CMake parallelism for Windows wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Jan 6, 2024
1 parent 0218ac4 commit 9017c21
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ jobs:
with:
python-version: 3.8

- name: Get number of cores on Windows
id: get_num_cores
shell: python
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(f"count={num_cpus}\n")
- name: Clone pybind11 repo (no history)
run: git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git

Expand Down Expand Up @@ -64,7 +74,14 @@ jobs:
- name: Build 64-bit wheels on Windows
run: pipx run cibuildwheel --output-dir wheelhouse
env:
CIBW_ENVIRONMENT: 'PYBAMM_USE_VCPKG=ON VCPKG_ROOT_DIR=C:\vcpkg VCPKG_DEFAULT_TRIPLET=x64-windows-static-md VCPKG_FEATURE_FLAGS=manifests,registries CMAKE_GENERATOR="Visual Studio 17 2022" CMAKE_GENERATOR_PLATFORM=x64'
CIBW_ENVIRONMENT: >
PYBAMM_USE_VCPKG=ON
VCPKG_ROOT_DIR=C:\vcpkg
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"
CIBW_BEFORE_BUILD: python -m pip install setuptools wheel # skip CasADi and CMake
CIBW_TEST_COMMAND: python -c "import pybamm; pybamm.IDAKLUSolver()"
Expand Down

0 comments on commit 9017c21

Please sign in to comment.