From 1fc7a0df0064e89df515e9c47dc71e4bcc906f2e Mon Sep 17 00:00:00 2001 From: Jonas Schuhmacher Date: Mon, 9 Sep 2024 10:50:37 +0200 Subject: [PATCH 1/7] wheels for python 3.13 --- .github/workflows/wheels.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index a09274b..db6b3f2 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -31,7 +31,7 @@ jobs: 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*" @@ -47,7 +47,7 @@ jobs: # 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 + uses: pypa/cibuildwheel@v2.20.0 env: CIBW_BEFORE_BUILD: brew install ninja CIBW_ARCHS_MACOS: "arm64" @@ -57,7 +57,7 @@ jobs: output-dir: dist if: matrix.os == 'macos-latest' - name: Build wheels (macOS x86_64) - uses: pypa/cibuildwheel@v2.17.0 + uses: pypa/cibuildwheel@v2.20.0 env: CIBW_BEFORE_BUILD: brew install ninja CIBW_ENVIRONMENT: 'MACOSX_DEPLOYMENT_TARGET="10.13"' @@ -73,7 +73,7 @@ jobs: - 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_ARCHS_WINDOWS: "auto64" From 50d9f9b5ee9c2136e400809702e73b3be31ede91 Mon Sep 17 00:00:00 2001 From: Jonas Schuhmacher Date: Mon, 9 Sep 2024 11:20:41 +0200 Subject: [PATCH 2/7] enable free-threaded build, simplify build, enable musllinux --- .github/workflows/wheels.yml | 92 ++++++++++++++++-------------------- setup.py | 2 +- 2 files changed, 43 insertions(+), 51 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index db6b3f2..b2d2f97 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -33,8 +33,8 @@ jobs: - name: Build wheels (Linux) 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: @@ -46,22 +46,13 @@ jobs: # The GCC compiler installable via brew does not support cross-compiling for x86_64. Hence, also Apple Claang # 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.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.20.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: . @@ -75,7 +66,8 @@ jobs: - name: Build wheels (Windows) uses: pypa/cibuildwheel@v2.20.0 env: - CIBW_BEFORE_BUILD: choco install -y ninja cmake + CIBW_BEFORE_BUILD: pipx install ninja cmake + CIBW_FREE_THREADED_SUPPORT: 1 CIBW_ARCHS_WINDOWS: "auto64" CIBW_TEST_COMMAND: 'python -c "import polyhedral_gravity"' with: @@ -98,38 +90,38 @@ jobs: with: path: dist/*.tar.gz - # 2. Upload the wheels and the source distribution to testpypi - # using trusted publishing - upload_testpypi: - needs: [build_wheels, make_sdist] - environment: - name: testpypi - url: https://test.pypi.org/p/polyhedral-gravity - permissions: - id-token: write - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - - # 3. Upload the wheels to the actually Python Package Index - # using trusted publishing - upload_pypi: - needs: [build_wheels, make_sdist, upload_testpypi] - environment: - name: pypi - url: https://pypi.org/p/polyhedral-gravity - permissions: - id-token: write - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - uses: pypa/gh-action-pypi-publish@release/v1 +# # 2. Upload the wheels and the source distribution to testpypi +# # using trusted publishing +# upload_testpypi: +# needs: [build_wheels, make_sdist] +# environment: +# name: testpypi +# url: https://test.pypi.org/p/polyhedral-gravity +# permissions: +# id-token: write +# runs-on: ubuntu-latest +# steps: +# - uses: actions/download-artifact@v3 +# with: +# name: artifact +# path: dist +# - uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# repository-url: https://test.pypi.org/legacy/ +# +# # 3. Upload the wheels to the actually Python Package Index +# # using trusted publishing +# upload_pypi: +# needs: [build_wheels, make_sdist, upload_testpypi] +# environment: +# name: pypi +# url: https://pypi.org/p/polyhedral-gravity +# permissions: +# id-token: write +# runs-on: ubuntu-latest +# steps: +# - uses: actions/download-artifact@v3 +# with: +# name: artifact +# path: dist +# - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/setup.py b/setup.py index a5139d2..cb6e05e 100644 --- a/setup.py +++ b/setup.py @@ -175,7 +175,7 @@ def build_extension(self, ext): # -------------------------------------------------------------------------------- setup( name="polyhedral_gravity", - version="3.2", + version="3.2.1rc1", 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 " From bd8f7be1800f62047c39ca9041103e5f0c5066d9 Mon Sep 17 00:00:00 2001 From: Jonas Schuhmacher Date: Mon, 9 Sep 2024 12:28:31 +0200 Subject: [PATCH 3/7] no free-threaded support for Windows --- .github/workflows/wheels.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index b2d2f97..d8ee951 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -67,7 +67,6 @@ jobs: uses: pypa/cibuildwheel@v2.20.0 env: CIBW_BEFORE_BUILD: pipx install ninja cmake - CIBW_FREE_THREADED_SUPPORT: 1 CIBW_ARCHS_WINDOWS: "auto64" CIBW_TEST_COMMAND: 'python -c "import polyhedral_gravity"' with: From e8476ea2f9e173ef49aef3de018e6e522862950f Mon Sep 17 00:00:00 2001 From: Jonas Schuhmacher Date: Mon, 9 Sep 2024 12:31:14 +0200 Subject: [PATCH 4/7] rename workflow --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d8ee951..84c118c 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -46,7 +46,7 @@ jobs: # The GCC compiler installable via brew does not support cross-compiling for x86_64. Hence, also Apple Claang # 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 x86_64) + - name: Build wheels (macOS) uses: pypa/cibuildwheel@v2.20.0 env: CIBW_BEFORE_BUILD: pipx install ninja cmake From 7e31148de68711df5b856dbb15e3d52e2cbb8bba Mon Sep 17 00:00:00 2001 From: Jonas Schuhmacher Date: Mon, 9 Sep 2024 16:35:45 +0200 Subject: [PATCH 5/7] fix comments, re-enable publishing --- .github/workflows/wheels.yml | 79 ++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 84c118c..f167f0d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -23,8 +23,8 @@ 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: @@ -42,10 +42,10 @@ jobs: 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) + # 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: @@ -61,6 +61,7 @@ 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) @@ -89,38 +90,38 @@ jobs: with: path: dist/*.tar.gz -# # 2. Upload the wheels and the source distribution to testpypi -# # using trusted publishing -# upload_testpypi: -# needs: [build_wheels, make_sdist] -# environment: -# name: testpypi -# url: https://test.pypi.org/p/polyhedral-gravity -# permissions: -# id-token: write -# runs-on: ubuntu-latest -# steps: -# - uses: actions/download-artifact@v3 -# with: -# name: artifact -# path: dist -# - uses: pypa/gh-action-pypi-publish@release/v1 -# with: -# repository-url: https://test.pypi.org/legacy/ -# -# # 3. Upload the wheels to the actually Python Package Index -# # using trusted publishing -# upload_pypi: -# needs: [build_wheels, make_sdist, upload_testpypi] -# environment: -# name: pypi -# url: https://pypi.org/p/polyhedral-gravity -# permissions: -# id-token: write -# runs-on: ubuntu-latest -# steps: -# - uses: actions/download-artifact@v3 -# with: -# name: artifact -# path: dist -# - uses: pypa/gh-action-pypi-publish@release/v1 + # 2. Upload the wheels and the source distribution to testpypi + # using trusted publishing + upload_testpypi: + needs: [build_wheels, make_sdist] + environment: + name: testpypi + url: https://test.pypi.org/p/polyhedral-gravity + permissions: + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + # 3. Upload the wheels to the actually Python Package Index + # using trusted publishing + upload_pypi: + needs: [build_wheels, make_sdist, upload_testpypi] + environment: + name: pypi + url: https://pypi.org/p/polyhedral-gravity + permissions: + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + - uses: pypa/gh-action-pypi-publish@release/v1 From 456429187ade37d950405dc5f91b18de3a6157a2 Mon Sep 17 00:00:00 2001 From: Jonas Schuhmacher Date: Mon, 9 Sep 2024 16:39:26 +0200 Subject: [PATCH 6/7] increment version remove release-candidate status --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index cb6e05e..50afe6d 100644 --- a/setup.py +++ b/setup.py @@ -175,7 +175,7 @@ def build_extension(self, ext): # -------------------------------------------------------------------------------- setup( name="polyhedral_gravity", - version="3.2.1rc1", + 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 " From 32d1211c04a5123b0d621cff1f5b81da7549aa4b Mon Sep 17 00:00:00 2001 From: Jonas Schuhmacher Date: Wed, 11 Sep 2024 17:17:01 +0200 Subject: [PATCH 7/7] streamline CMake Option LOGGING_LEVEL instead of using descriptive numbers for setting the logging level, one now specifies it using natural language --- CMakeLists.txt | 14 ++++++++++---- README.md | 16 ++++++++-------- docs/quickstart/installation.rst | 2 +- setup.py | 2 +- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06e8a93..380051c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/README.md b/README.md index 4cf097c..217eec0 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/docs/quickstart/installation.rst b/docs/quickstart/installation.rst index af9871c..3ed7545 100644 --- a/docs/quickstart/installation.rst +++ b/docs/quickstart/installation.rst @@ -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 diff --git a/setup.py b/setup.py index 50afe6d..5123228 100644 --- a/setup.py +++ b/setup.py @@ -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)