Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 3.12 #424

Merged
merged 25 commits into from
Aug 16, 2024
Merged

Support Python 3.12 #424

merged 25 commits into from
Aug 16, 2024

Conversation

yguclu
Copy link
Member

@yguclu yguclu commented Aug 5, 2024

We make Psydac support Python 3.12 by using NumPy >= 2.0 together with Petsc4py >= 3.21 and the master branch of Igakit (updated on 6 Aug 2024). We also increase the required SymPDE version to 0.19.0. For simplicity, the same requirements are made for older versions of Python.

This closes #406.

Rationale

Python 3.12 does not have a distutils module. Therefore, NumPy 2.0 was released on 16 Jun 2024 with a new meson backend for the f2py tool which is part of the library. As of 6 Aug 2024, Igakit also moved from distutils to the meson-python build system in combination with NumPy 2.0.

The first version of petsc4py which is compatible with Python 3.12 is shipped with PETSc 3.21, hence we use this now instead of PETSc 3.20. Such a version of petsc4py also requires NumPy >= 2.0.

The move to NumPy 2.0 also means that some numeric datatypes behave differently. For this we need SymPDE >= 0.19.0.

Summary of changes

  • In pyproject.toml, set maximum Python version to 3.12, and require SymPDE 0.19.0 instead of 0.18.3;
  • In README.md, increase PETSc version to 3.21.4;
  • In method integral of TensorFemSpace, convert any NumPy result to the native Python type to avoid errors with SymPy's sympify (after the upgrade to NumPy 2.0);
  • Apply some bug fixes to the unit tests after the upgrade of NumPy and SymPDE;
  • In continuous-integration.yml, add tests with Python 3.12, increase PETSc version to 3.21.4, and add check of parallel h5py.

@yguclu yguclu changed the title Use 'meson' branch of Igakit Use latest version of NumPy, Igakit, SymPDE Aug 8, 2024
@yguclu yguclu changed the title Use latest version of NumPy, Igakit, SymPDE Support Python 3.12 Aug 8, 2024
@yguclu yguclu marked this pull request as ready for review August 14, 2024 13:10
@yguclu yguclu requested a review from kvrigor August 14, 2024 13:11
@yguclu yguclu requested a review from a team August 14, 2024 13:26
@kvrigor
Copy link
Member

kvrigor commented Aug 16, 2024

Summary of what I understood in this PR:

  • Python3.12 support enabled in continuous-integration.yml and new sympde 0.19.0 reflected in pyproject.toml
  • Diffs in tests are due to bugfixes by @campospinto and @yguclu
  • Running maxwell_2d_multi_patch.py gives a passing result:
$ python3.12 examples/maxwell_2d_multi_patch.py
> Grid          :: [4,4]
> Degree        :: [2,2]
> CG info       ::  {'niter': 829, 'success': np.True_, 'res_norm': 9.976906608695098e-09}
> L2 error      :: 1.59e+00

> Solution time :: 2.72e+01
> Evaluat. time :: 3.61e-02

image

@yguclu yguclu merged commit ba0f47a into devel Aug 16, 2024
7 checks passed
@yguclu yguclu deleted the meson-igakit branch August 16, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove dependency on distutils
3 participants