Skip to content

Commit

Permalink
Merge pull request #42 from esa/python-313-fix
Browse files Browse the repository at this point in the history
Python 3.13 Wheels/ Release 3.2.1
  • Loading branch information
schuhmaj authored Sep 12, 2024
2 parents 0065a7e + 32d1211 commit 149515d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 38 deletions.
38 changes: 15 additions & 23 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,36 @@ jobs:
- uses: actions/checkout@v3
############################# LINUX WHEELS #############################
# In case of Linux we need to install compiler and build tools before building the wheels
# We only build the manylinux wheels, but not the musllinux wheels (due to some compile problems)
# We set-up QEMU to enable aarch64 builds in the GitHub Runner (which is x86_64 based)
# We build wheels for manylinux and musllinux for aarch64 and x86_64
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
if: matrix.os == 'ubuntu-latest'
- name: Build wheels (Linux)
uses: pypa/cibuildwheel@v2.17.0
uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_BEFORE_BUILD: yum makecache && yum install -y gcc-c++ cmake && pip install ninja
CIBW_BUILD: "*manylinux*"
CIBW_BEFORE_BUILD: pipx install ninja cmake
CIBW_FREE_THREADED_SUPPORT: 1
CIBW_ARCHS_LINUX: "x86_64 aarch64"
CIBW_TEST_COMMAND: 'python -c "import polyhedral_gravity"'
with:
package-dir: .
output-dir: dist
if: matrix.os == 'ubuntu-latest'
############################# MACOS WHEELS #############################
# We use Apple Clang, the macOS GitHub Runner is nowadays arm64 based
# The GCC compiler installable via brew does not support cross-compiling for x86_64. Hence, also Apple Claang
# We use Apple Clang as it is the only compiler offering cross-compiling for x86_64
# The macOS GitHub Runner is nowadays arm64 based
# For the x86_64, we set the MACOSX_DEPLOYMENT_TARGET='10.13' (released 2017) in order to have support for C++17
# We don't need this for the arm64 stuff since it works (and macOS on arm64 cam after C++17)
- name: Build wheels (macOS ARM)
uses: pypa/cibuildwheel@v2.17.0
# We don't need this for arm64 since macOS arm64 initially supported C++17/ came years later than macOS 10.13
- name: Build wheels (macOS)
uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_BEFORE_BUILD: brew install ninja
CIBW_ARCHS_MACOS: "arm64"
CIBW_TEST_COMMAND: 'python -c "import polyhedral_gravity"'
with:
package-dir: .
output-dir: dist
if: matrix.os == 'macos-latest'
- name: Build wheels (macOS x86_64)
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_BEFORE_BUILD: brew install ninja
CIBW_BEFORE_BUILD: pipx install ninja cmake
CIBW_FREE_THREADED_SUPPORT: 1
CIBW_ENVIRONMENT: 'MACOSX_DEPLOYMENT_TARGET="10.13"'
CIBW_ARCHS_MACOS: "x86_64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_TEST_COMMAND: 'python -c "import polyhedral_gravity"'
with:
package-dir: .
Expand All @@ -70,12 +61,13 @@ jobs:
############################# WINDOWS WHEELS #############################
# Set up the Visual Studio environment on Windows (required, so that CMake finds the compiler)
# We use the Microsoft Visual Studio Compiler to compile the wheel
# As of 09.09.2024, it is not yet possible to build free-threaded wheel on Windows
- uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- name: Build wheels (Windows)
uses: pypa/cibuildwheel@v2.17.0
uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_BEFORE_BUILD: choco install -y ninja cmake
CIBW_BEFORE_BUILD: pipx install ninja cmake
CIBW_ARCHS_WINDOWS: "auto64"
CIBW_TEST_COMMAND: 'python -c "import polyhedral_gravity"'
with:
Expand Down
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@ option(USE_LOCAL_TBB "Uses the local tbb installation rather than on using the a
GitHub via CMake (Default: OFF)" OFF)

# Set the Logging Level
set(LOGGING_LEVEL "2" CACHE STRING "Set the Logging level, default (INFO=2), available options:
TRACE=0, DEBUG=1, INFO=2, WARN=3, ERROR=4, CRITICAL=5, OFF=6")
set_property(CACHE LOGGING_LEVEL PROPERTY STRINGS 0, 1, 2, 3, 4, 5, 6)
add_compile_definitions(SPDLOG_ACTIVE_LEVEL=${LOGGING_LEVEL})
set(LOGGING_LEVEL_LIST "TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF")
set(LOGGING_LEVEL "INFO" CACHE STRING "Set the Logging level, default (INFO), available options: TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL, OFF")
set_property(CACHE LOGGING_LEVEL PROPERTY STRINGS ${LOGGING_LEVEL_LIST})
# Convert the logging level string to its corresponding number
list(FIND LOGGING_LEVEL_LIST ${LOGGING_LEVEL} LOGGING_LEVEL_INDEX)
if (${LOGGING_LEVEL_INDEX} EQUAL -1)
message(FATAL_ERROR "Invalid logging level: ${LOGGING_LEVEL}")
endif ()
add_compile_definitions(SPDLOG_ACTIVE_LEVEL=${LOGGING_LEVEL_INDEX})
message(STATUS "Logging level set to ${LOGGING_LEVEL} (=${LOGGING_LEVEL_INDEX})")

###################################
# What actually to build? - Options
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,14 @@ cmake --build .

The following options are available:

| Name (Default) | Options |
|-------------------------------------------:|:-------------------------------------------------------------------------------------------|
| POLYHEDRAL_GRAVITY_PARALLELIZATION (`CPP`) | `CPP` = Serial Execution / `OMP` or `TBB` = Parallel Execution with OpenMP or Intel\'s TBB |
| LOGGING_LEVEL (`2`) | `0` = TRACE/ `1` = DEBUG/ `2` = INFO / `3` = WARN/ `4` = ERROR/ `5` = CRITICAL/ `6` = OFF |
| USE_LOCAL_TBB (`OFF`) | Use a local installation of `TBB` instead of setting it up via `CMake` |
| BUILD_POLYHEDRAL_GRAVITY_DOCS (`OFF`) | Build this documentation |
| BUILD_POLYHEDRAL_GRAVITY_TESTS (`ON`) | Build the Tests |
| BUILD_POLYHEDRAL_PYTHON_INTERFACE (`ON`) | Build the Python interface |
| Name (Default) | Options |
|-------------------------------------------:|:--------------------------------------------------------------------------------------------|
| POLYHEDRAL_GRAVITY_PARALLELIZATION (`CPP`) | `CPP` = Serial Execution / `OMP` or `TBB` = Parallel Execution with OpenMP or Intel\'s TBB |
| LOGGING_LEVEL (`INFO`) | `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `CRITICAL`, `OFF` |
| USE_LOCAL_TBB (`OFF`) | Use a local installation of `TBB` instead of setting it up via `CMake` |
| BUILD_POLYHEDRAL_GRAVITY_DOCS (`OFF`) | Build this documentation |
| BUILD_POLYHEDRAL_GRAVITY_TESTS (`ON`) | Build the Tests |
| BUILD_POLYHEDRAL_PYTHON_INTERFACE (`ON`) | Build the Python interface |

During testing POLYHEDRAL_GRAVITY_PARALLELIZATION=`TBB` has been the most performant.
It is further not recommend to change the LOGGING_LEVEL to something else than `INFO=2`.
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The available options are the following:
Name (Default) Options
================================================ ===================================================================================================================================
POLYHEDRAL_GRAVITY_PARALLELIZATION (:code:`CPP`) :code:`CPP` = Serial Execution / :code:`OMP` or :code:`TBB` = Parallel Execution with OpenMP or Intel's TBB
LOGGING_LEVEL (:code:`2`) :code:`0` = TRACE/ :code:`1` = DEBUG/ :code:`2` = INFO / :code:`3` = WARN/ :code:`4` = ERROR/ :code:`5` = CRITICAL/ :code:`6` = OFF
LOGGING_LEVEL (:code:`INFO`) :code:`TRACE`, :code:`DEBUG`, :code:`INFO`, :code:`WARN`, :code:`ERROR`, :code:`CRITICAL`, :code:`OFF`
USE_LOCAL_TBB (:code:`OFF`) Use a local installation of :code:`TBB` instead of setting it up via :code:`CMake`
BUILD_POLYHEDRAL_GRAVITY_DOCS (:code:`OFF`) Build this documentation
BUILD_POLYHEDRAL_GRAVITY_TESTS (:code:`ON`) Build the Tests
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Modify to change the parallelization (Default value: TBB)
"POLYHEDRAL_GRAVITY_PARALLELIZATION": "TBB",
# Default value (INFO=2)
"LOGGING_LEVEL": 2,
"LOGGING_LEVEL": "INFO",
# Default value (OFF)
"USE_LOCAL_TBB": "OFF",
# Not required for the python interface (--> OFF)
Expand Down Expand Up @@ -175,7 +175,7 @@ def build_extension(self, ext):
# --------------------------------------------------------------------------------
setup(
name="polyhedral_gravity",
version="3.2",
version="3.2.1",
author="Jonas Schuhmacher",
author_email="jonas.schuhmacher@tum.de",
description="Package to compute full gravity tensor of a given constant density polyhedron for arbitrary points "
Expand Down

0 comments on commit 149515d

Please sign in to comment.