Skip to content

Commit

Permalink
Merge pull request #206 from bluescarni/pr/numpy2
Browse files Browse the repository at this point in the history
Support for numpy 2
  • Loading branch information
bluescarni authored Dec 17, 2024
2 parents e6d7588 + 2e2609a commit 56dff33
Show file tree
Hide file tree
Showing 26 changed files with 323 additions and 398 deletions.
42 changes: 12 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,34 @@
version: 2.1

jobs:
conda_heyoka_head_39:
conda_x86_64_heyoka_head_312:
docker:
- image: cimg/base:current
resource_class: large
steps:
- checkout
- run:
name: Build and test
command: bash ./tools/circleci_conda_heyoka_head_39.sh
- store_artifacts:
path: doc/_build/html
conda_heyoka_head_310:
docker:
- image: cimg/base:current
resource_class: large
steps:
- checkout
- run:
name: Build and test
command: bash ./tools/circleci_conda_heyoka_head_310.sh
- store_artifacts:
path: doc/_build/html
conda_heyoka_head_312:
docker:
- image: cimg/base:current
resource_class: large
steps:
- checkout
- run:
name: Build and test
command: bash ./tools/circleci_conda_heyoka_head_312.sh
ubuntu_arm64:
command: bash ./tools/conda_docs.sh
environment:
HEYOKA_PY_PY_VERSION: "3.12"
HEYOKA_PY_CONDA_ARCH: "Linux-x86_64"
conda_arm64_heyoka_head_312:
machine:
image: ubuntu-2204:current
resource_class: arm.large
steps:
- checkout
- run:
name: Build and test
command: bash ./tools/circleci_ubuntu_arm64.sh
command: bash ./tools/conda_docs.sh
environment:
HEYOKA_PY_PY_VERSION: "3.12"
HEYOKA_PY_CONDA_ARCH: "Linux-aarch64"

workflows:
version: 2.1
all_builds:
jobs:
- conda_heyoka_head_39
- conda_heyoka_head_310
- conda_heyoka_head_312
- ubuntu_arm64
- conda_x86_64_heyoka_head_312
- conda_arm64_heyoka_head_312
49 changes: 29 additions & 20 deletions .github/workflows/gh_actions_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,38 @@ jobs:
- uses: actions/checkout@v4
- name: Build
run: bash tools/gha_conda_static.sh
osx_heyoka_head:
runs-on: macos-latest
osx_heyoka_head_x86_64:
runs-on: macos-13
env:
HEYOKA_PY_PY_VERSION: "3.12"
HEYOKA_PY_CONDA_ARCH: "MacOSX-x86_64"
steps:
- uses: actions/checkout@v4
- name: Build
run: bash tools/gha_osx_heyoka_head.sh
osx_heyoka_head_static:
runs-on: macos-latest
osx_heyoka_head_x86_64_static:
runs-on: macos-13
env:
HEYOKA_PY_PY_VERSION: "3.12"
HEYOKA_PY_CONDA_ARCH: "MacOSX-x86_64"
steps:
- uses: actions/checkout@v4
- name: Build
run: bash tools/gha_osx_heyoka_head_static.sh
osx_heyoka_head_arm64:
runs-on: macos-14
env:
HEYOKA_PY_PY_VERSION: "3.12"
HEYOKA_PY_CONDA_ARCH: "MacOSX-arm64"
steps:
- uses: actions/checkout@v4
- name: Build
run: bash tools/gha_osx_heyoka_head.sh
osx_heyoka_head_arm64_static:
runs-on: macos-14
env:
HEYOKA_PY_PY_VERSION: "3.12"
HEYOKA_PY_CONDA_ARCH: "MacOSX-arm64"
steps:
- uses: actions/checkout@v4
- name: Build
Expand Down Expand Up @@ -124,21 +148,6 @@ jobs:
with:
name: wheel_39
path: repaired_wheel/*.whl
manylinux228_x86_64-py38:
runs-on: ubuntu-latest
container:
image: pagmo2/manylinux228_x86_64_with_deps:latest
env:
HEYOKA_PY_BUILD_TYPE: "Python38"
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
steps:
- uses: actions/checkout@v4
- name: Build
run: bash tools/gha_manylinux.sh
- uses: actions/upload-artifact@v4
with:
name: wheel_38
path: repaired_wheel/*.whl
windows_2022_heyoka_head:
runs-on: windows-2022
steps:
Expand All @@ -153,7 +162,7 @@ jobs:
- name: Build
shell: pwsh
run: |
conda install -y python=3.12 git pybind11 numpy<2 cmake llvmdev tbb-devel tbb astroquery libboost-devel fmt skyfield spdlog sleef sympy cloudpickle zlib libzlib 'mppp=1.*' numba
conda install -y python=3.12 git pybind11 numpy>=2 cmake llvmdev tbb-devel tbb astroquery libboost-devel fmt skyfield spdlog sleef sympy cloudpickle zlib libzlib 'mppp=2.*' numba
git clone --depth 1 https://github.com/bluescarni/heyoka.git heyoka_cpp
cd heyoka_cpp
mkdir build
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
env:
HEYOKA_PY_PY_VERSION: "3.12"
HEYOKA_PY_CONDA_ARCH: "Linux-x86_64"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build docs
run: bash tools/gha_conda_docs.sh
run: bash tools/conda_docs.sh
- name: Upload docs
uses: actions/upload-pages-artifact@v3
with:
Expand Down
26 changes: 14 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# required by heyoka.
cmake_minimum_required(VERSION 3.18.0)

if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.31.0)
# NOTE: adopt the new behaviour for this policy:
# https://cmake.org/cmake/help/latest/policy/CMP0177.html
cmake_policy(SET CMP0177 NEW)
endif()

# Set default build type to "Release".
# NOTE: this should be done before the project command since the latter can set
# CMAKE_BUILD_TYPE itself (it does so for nmake).
Expand All @@ -11,7 +17,7 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()

project(heyoka.py VERSION 6.1.3 LANGUAGES CXX C)
project(heyoka.py VERSION 7.0.0 LANGUAGES CXX C)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/yacma")

Expand Down Expand Up @@ -118,7 +124,7 @@ find_package(fmt REQUIRED CONFIG)
message(STATUS "fmt version: ${fmt_VERSION}")

# heyoka.
find_package(heyoka 6.1.0 REQUIRED CONFIG)
find_package(heyoka 7.0.0 REQUIRED CONFIG)

# Python.

Expand All @@ -144,17 +150,13 @@ find_package(Python3 QUIET REQUIRED COMPONENTS ${_HEYOKA_PY_PYTHON3_COMPONENTS})

message(STATUS "Python3 interpreter: ${Python3_EXECUTABLE}")
message(STATUS "Python3 installation directory: ${Python3_SITEARCH}")
if(${Python3_VERSION_MINOR} LESS 5)
message(FATAL_ERROR "The minimum supported version of Python is 3.5, but version 3.${Python3_VERSION_MINOR} was found instead")
endif()
# NOTE: mppp::real support requires NumPy 1.22 at least.
if(heyoka_WITH_REAL AND ${Python3_NumPy_VERSION} LESS 1.22)
message(FATAL_ERROR "The minimum version of NumPy required for supporting arbitrary-precision computations is 1.22, but version ${Python3_NumPy_VERSION} was found instead")
# NOTE: Python 3.9 seems like the absolute minimum for NumPy 2.
if(${Python3_VERSION_MINOR} LESS 9)
message(FATAL_ERROR "The minimum supported version of Python is 3.9, but version 3.${Python3_VERSION_MINOR} was found instead")
endif()
# NOTE: NumPy 2 not supported yet if we are building with support
# for mppp::real or mppp::real128.
if((heyoka_WITH_REAL OR heyoka_WITH_REAL128) AND ${Python3_NumPy_VERSION} VERSION_GREATER_EQUAL 2)
message(FATAL_ERROR "NumPy 2 is not supported when building with support for quadruple-precision or arbitrary-precision computations")
# We support only NumPy>=2.
if((heyoka_WITH_REAL OR heyoka_WITH_REAL128) AND ${Python3_NumPy_VERSION} VERSION_LESS 2)
message(FATAL_ERROR "NumPy>=2 is required when building with support for quadruple-precision or arbitrary-precision computations")
endif()
message(STATUS "NumPy version: ${Python3_NumPy_VERSION}")
unset(_HEYOKA_PY_PYTHON3_COMPONENTS)
Expand Down
14 changes: 13 additions & 1 deletion doc/breaking_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ Breaking changes

.. currentmodule:: heyoka

.. _bchanges_7_0_0:

7.0.0
-----

Updated Python dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~

heyoka.py now depends on NumPy>=2. This is due to changes introduced by NumPy 2 in the DType API,
which make it unfeasible to support both NumPy 1 and 2 at the same time.
As a further consequence, support for Python<3.9 has also been dropped.

.. _bchanges_6_0_0:

6.0.0
Expand Down Expand Up @@ -206,7 +218,7 @@ before invoking ``propagate_grid()``.
the ``propagate_until()`` method, but an integral value was passed instead.
The solution is to use ``propagate_until(10.)`` instead.
In a similar fashion, if your code
is raising :py:exc:`TypeError` exceptions with heyoka.py >=0.19,
is raising :py:exc:`TypeError` exceptions with heyoka.py>=0.19,
the solution is to ensure that values of the correct
type are passed to the heyoka.py API (especially whenever floating-point arguments
are expected).
Expand Down
15 changes: 14 additions & 1 deletion doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Changelog
=========

6.1.3 (unreleased)
7.0.0 (unreleased)
------------------

New
Expand All @@ -12,6 +12,19 @@ New
- Upload the source distribution to PyPI
(`#203 <https://github.com/bluescarni/heyoka.py/pull/203>`__).

Changes
~~~~~~~

- heyoka.py now requires version 7.0.0 of the
heyoka C++ library
(`#206 <https://github.com/bluescarni/heyoka.py/pull/206>`__).
- **BREAKING**: heyoka.py now requires Python >= 3.9
(`#206 <https://github.com/bluescarni/heyoka.py/pull/206>`__).
This is a :ref:`breaking change <bchanges_7_0_0>`.
- **BREAKING**: heyoka.py now requires NumPy >= 2
(`#206 <https://github.com/bluescarni/heyoka.py/pull/206>`__).
This is a :ref:`breaking change <bchanges_7_0_0>`.

6.1.2 (2024-10-10)
------------------

Expand Down
6 changes: 3 additions & 3 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Dependencies
heyoka.py has several Python and C++ dependencies. On the C++ side, heyoka.py depends on:

* the `heyoka C++ library <https://github.com/bluescarni/heyoka>`__,
version 6.1.x (**mandatory**),
version 7.0.x (**mandatory**),
* the `Boost <https://www.boost.org/>`__ C++ libraries (**mandatory**),
* the `{fmt} <https://fmt.dev/latest/index.html>`__ library (**mandatory**),
* the `TBB <https://github.com/oneapi-src/oneTBB>`__ library (**mandatory**),
Expand All @@ -21,9 +21,9 @@ heyoka.py has several Python and C++ dependencies. On the C++ side, heyoka.py de
:ref:`heyoka <hy:installation>` and :ref:`mp++ <mppp:installation>` installation
instructions).

On the Python side, heyoka.py requires at least Python 3.5 and depends on:
On the Python side, heyoka.py requires at least Python 3.9 and depends on:

* `NumPy <https://numpy.org/>`__ (version <2, **mandatory**),
* `NumPy <https://numpy.org/>`__ (version >=2, **mandatory**),
* `cloudpickle <https://github.com/cloudpipe/cloudpickle>`__ (**mandatory**),
* `SymPy <https://www.sympy.org/en/index.html>`__ (version >=1.13.0) and `mpmath <https://mpmath.org/>`__
(*optional*, for converting heyoka.py expressions to/from SymPy expressions),
Expand Down
10 changes: 5 additions & 5 deletions doc/notebooks/arbitrary_precision.ipynb

Large diffs are not rendered by default.

18 changes: 7 additions & 11 deletions doc/notebooks/ext_precision.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 56dff33

Please sign in to comment.