Skip to content

Commit b338a70

Browse files
max-modelsyguclue-moral-sanchezcampospintoFrederikSchnack
authored
Update devel tiny 20250901 (#41)
* Support Python 3.13 (pyccel#475) Closes pyccel#476: * Do not restrict the maximum Python version to 3.12 in `pyproject.toml` * Require `Cython >= 3` to avoid `h5py` installation crash w/ Python 3.13 * Require `sympde == 0.19.2` which supports Python 3.13 * Run unit tests with Python 3.13 too * Fix PSYDAC_BACKEND_GPYCCEL flags on latest Apple silicon (pyccel#480) Currently, Psydac can not be used on Apple M4 computers since the `PSYDAC_BACKEND_GPYCCEL['flags']` is not set correctly. This change sets the flag for `Apple MX (etc.)` to `apple-mX`, which should work so long as the naming scheme stays unchanged. In addition, the regular expression used to find the GFortran version is now defined in a raw string instead of a standard Python UTF8 string. This avoids a `SyntaxWarning: invalid escape sequence`. --------- Co-authored-by: Yaman Güçlü <[email protected]> * Resolve warnings in sequential unit tests (pyccel#481) * Use raw strings for docstrings with LaTeX to avoid UTF8 syntax warnings on escape sequences; * Use CSC matrices to avoid SciPy sparse solver warning. We do not address the NumPy warnings which arise in our MPI unit tests (see pyccel#353). * Pass `out` parameter to `petsc_to_psydac` (pyccel#483) * Rename `dot` as `inner` in `Vector`, `VectorSpace`, and subclasses (pyccel#484) Main changes -------------- * Rename the method `dot` of the base class `VectorSpace` as `inner`, and make it an abstract method (which must be implemented by the subclasses). * Rename the method `dot` of the base class `Vector` as `inner`. This is a concrete method which calls `self.space.inner` and does not need to be overridden by the subclasses. * Add `inner` methods to the classes `StencilVector`, `BlockVectorSpace`, and `DenseVectorSpace`. These methods override the abstract method of the base class as required, and are derived from the former functions `Stencil.dot`, `BlockVector.dot`, and `DenseVector.dot`, which have been removed (see next point). * Remove the property `dtype` and the method `dot` (now `inner`) from the classes `StencilVector`, `BlockVector`, and `DenseVector`, because the default methods of the base class already provide a sufficient implementation. This fixes pyccel#330. Necessary additional changes ------------------------------ * Update all linear solvers in `linalg.solvers` with the new method calls; * Update all unit tests with the new method calls, in files: - `api/tests/test_assembly.py` - `feec/tests/test_commuting_projections.py` - `feec/tests/test_global_projectors.py` - `linalg/tests/test_block.py` - `linalg/tests/test_linalg.py` - `linalg/tests/test_stencil_interface_matrix.py` - `linalg/tests/test_stencil_vector.py` Unrelated additional changes ----------------------------- * Rename the class `VectorDot` as `VectorInner` in module `api.ast.linalg`, although never used in Psydac. * Speed up 3D unit tests in: - `feec/tests/test_commuting_projectors.py` - `feec/tests/test_global_projectors.py` * Update docstring for inner product in polar/dense.py (pyccel#488) --------- Co-authored-by: Yaman Güçlü <[email protected]> * Add a `dot_inner` concrete method to the base class `LinearOperator` (pyccel#493) Implement `M.dot(u).inner(v)`, or `(M @ u).inner(v)`, without creating a temporary vector. The result of the dot product is written to a local work vector stored in the `LinearOperator` object. This work vector is then used to compute the inner product with the vector `v`. The subclasses do not need to override this method, unless a more efficient implementation which avoids writing to the work vector altogether (reducing memory pressure) is needed. A unit test is added: function `test_dot_inner` in file psydac/linalg/tests/test_linalg.py. Additionally, the helper function `get_StencilVectorSpace` defined in psydac/linalg/tests/test_linalg.py (only used in the same file and in test_matrix_free.py) has a new signature and now works in any number of dimensions. Fixes pyccel#491. * Install PETSc-3.23.2 (latest version) (pyccel#499) * Update authors (pyccel#500) * Fix the code generation of unnecessary derivatives (pyccel#490) This PR changes the code generation involved in the `discretize` function to avoid calculating unnecessary derivatives. This allows for using constant spline (degree 0) discretizations, for which we have to make a special case in the calculation of ghost regions in `psydac/linalg/stencil.py`. Additionally, we add basic unit tests checking discretizations using zero-degree splines. This fixes pyccel#489 and fixes pyccel#307. On this occasion, we also do small changes in the `.github/workflows/testing.yml` script as some tests had complications without them. --------- Co-authored-by: Yaman Güçlü <[email protected]> * Fix bug in `allocate_matrices` in `DiscreteBilinearForm` (pyccel#507) Always use the maximum padding between test and trial spaces in `allocate_matrices` in `DiscreteBilinearForm`. (Earlier this was not done in the case of scalar spaces.) Fixes pyccel#504. * Enable Pyccel 2.0 (pyccel#503) Pyccel 2.0 was just released, which means some of the kernels in Psydac need to be updated: - Remove the `template` decorator (see pyccel/pyccel#2331) * Add `T` as `TypeVar` * Specify `T`, `T[:]`, `T[:,:]`, ... in function arguments. - Replace `@types` decorators (see pyccel/pyccel#2329) - Replace `const` with `Final` (see pyccel/pyccel#2340) Further changes: - Update import path for `epyccel` (fixes pyccel#426) - Update arguments to `epyccel` (see pyccel/pyccel#2348): * Rename `fflags` to `flags` * Replace `accelerators` list with `openmp` bool - Require Pyccel >= 2.0.1 (fixes pyccel#471) --------- Co-authored-by: Yaman Güçlü <[email protected]> Co-authored-by: Elena Moral Sánchez <[email protected]> Co-authored-by: Emily Bourne <[email protected]> * New installation procedure and README (pyccel#510) Recently the installation of `h5py` in parallel mode (i.e. with MPI support through `mpi4py`) seems to have been simplified. This may be due to the recent move of `mpi4py` to wheels, or other factors. Therefore we can now simplify our installation procedure as follows: ```sh pip install h5py --no-cache-dir --no-binary h5py pip install .[test] ``` We update here the CI workflows and completely rewrite our README file. **Commit summary** - Completely rewrite `README.md`: * Expand initial description * Add Citing and Contributing sections * Shorten Installation section * Reorganize documentation sections * Move detailed installation instructions to separate file `docs/installation.md` * Move mesh generation to separate file `docs/psydac-mesh.md` - Add BibTeX file `CITING.bib` with citation of 2022 ECCOMAS proceedings - Remove obsolete files `requirements.txt` and `requirements_extra.txt` - Rename (and move) `docs_requirements.txt` as `docs/requirements.txt` - Update installation procedure in `testing` CI workflow - Change name in `testing` workflow from "Run tests" to "Unit tests" - Modify `testing` and `documentation` workflows so that they only run when needed - Allow running workflows manually - Fix broken CI badge in `README.md` * Removed python -m pip install -r requirements.txt * Removed duplicated requirements from pyproject.toml * Removed duplicated requirements from pyproject.toml --------- Co-authored-by: Yaman Güçlü <[email protected]> Co-authored-by: Elena Moral Sánchez <[email protected]> Co-authored-by: Martin Campos Pinto <[email protected]> Co-authored-by: Frederik Schnack <[email protected]> Co-authored-by: Elena Moral Sánchez <[email protected]> Co-authored-by: Emily Bourne <[email protected]>
1 parent b62433c commit b338a70

File tree

10 files changed

+238
-31
lines changed

10 files changed

+238
-31
lines changed

.github/workflows/documentation.yml.disabled

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
name: documentation
1+
name: Documentation
22

33
on:
44
push:
55
branches: [ devel ]
6+
paths:
7+
- 'docs/**'
8+
- 'psydac/**.py'
9+
610
pull_request:
711
branches: [ devel ]
12+
paths:
13+
- 'docs/**'
14+
- 'psydac/**.py'
15+
16+
workflow_dispatch:
817

918
permissions:
1019
contents: read
@@ -29,7 +38,7 @@ jobs:
2938
sudo apt install graphviz
3039
- name: Install Python dependencies
3140
run: |
32-
python -m pip install -r docs_requirements.txt
41+
python -m pip install -r docs/requirements.txt
3342
- name: Make the sphinx doc
3443
run: |
3544
rm -rf docs/source/modules/STUBDIR
@@ -44,7 +53,7 @@ jobs:
4453
path: 'docs/build/html'
4554

4655
deploy_docs:
47-
if: github.event_name != 'pull_request'
56+
if: github.event_name == 'push' && github.ref == 'refs/heads/devel'
4857
needs: build_docs
4958
runs-on: ubuntu-latest
5059
environment:

.github/workflows/testing.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ jobs:
146146
python -m pip install wheel Cython numpy
147147
python -m pip install src/binding/petsc4py
148148
149-
- name: Install Python dependencies
150-
run: |
151-
python -m pip install -r requirements.txt --no-cache-dir
152-
python -m pip list
153149
# - name: Check parallel h5py installation
154150
# run: |
155151
# python -c "
@@ -323,11 +319,6 @@ jobs:
323319
python -m pip install wheel Cython numpy
324320
python -m pip install src/binding/petsc4py
325321
326-
- name: Install Python dependencies
327-
run: |
328-
python -m pip install -r requirements.txt --no-cache-dir
329-
python -m pip list
330-
331322
# - name: Check parallel h5py installation
332323
# run: |
333324
# python -c "

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ __test__/
3535
env/
3636
env*/
3737
*env/
38+
# Visual Studio Code workspace files
39+
*.code-workspace

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ before_install:
2424
- python -m pip uninstall -y sympde
2525
- python -m pip uninstall -y pyccel
2626
- python -m pip uninstall -y gelato
27-
- python -m pip install -r requirements.txt
2827

2928
# command to install project
3029
install:

CITATION.bib

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@inproceedings{Guclu2022,
2+
title = {{{PSYDAC}}: A High-Performance {{IGA}} Library in {{Python}}},
3+
booktitle = {8th {{European Congress}} on {{Computational Methods}} in {{Applied Sciences}} and {{Engineering}}},
4+
author = {Güçlü, Y. and Hadjout, S. and Ratnani, A.},
5+
year = {2022},
6+
publisher = {CIMNE},
7+
doi = {10.23967/eccomas.2022.227},
8+
url = {https://www.scipedia.com/public/Guclu_et_al_2022a},
9+
eventtitle = {8th {{European Congress}} on {{Computational Methods}} in {{Applied Sciences}} and {{Engineering}}},
10+
}

docs/installation.md

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
# Installation
2+
3+
- [Requirements](#requirements)
4+
- [Python setup and project download](#python-setup-and-project-download)
5+
- [Installing the library](#installing-the-library)
6+
- [Optional PETSc installation](#optional-petsc-installation)
7+
- [Uninstall](#uninstall)
8+
9+
## Requirements
10+
11+
Psydac requires a certain number of components to be installed on the machine:
12+
13+
- Fortran and C compilers with OpenMP support
14+
- OpenMP library
15+
- BLAS and LAPACK libraries
16+
- MPI library
17+
- HDF5 library with MPI support
18+
19+
The installation instructions depend on the operating system and on the packaging manager used.
20+
21+
### Linux Debian-Ubuntu-Mint
22+
23+
To install all requirements on a Linux Ubuntu operating system, just use APT, the Advanced Packaging Tool:
24+
```sh
25+
sudo apt update
26+
sudo apt install python3 python3-dev python3-pip
27+
sudo apt install gcc gfortran
28+
sudo apt install libblas-dev liblapack-dev
29+
sudo apt install libopenmpi-dev openmpi-bin
30+
sudo apt install libomp-dev libomp5
31+
sudo apt install libhdf5-openmpi-dev
32+
```
33+
34+
### macOS
35+
36+
To install all the requirements on a macOS operating system we recommend using [Homebrew](https://brew.sh/):
37+
38+
```eh
39+
brew update
40+
brew install gcc
41+
brew install openblas
42+
brew install lapack
43+
brew install open-mpi
44+
brew install libomp
45+
brew install hdf5-mpi
46+
```
47+
48+
### Other operating systems
49+
50+
Please see the [instructions for the pyccel library](https://github.com/pyccel/pyccel#Requirements) for further details.
51+
52+
### High-performance computers using Environment Modules
53+
54+
Many high-performance computers use [Environment Modules](https://modules.sourceforge.net/).
55+
On those systems one typically needs to load the correct versions (i.e. compatible with each other) of the modules `gcc`, `openmpi`, and `hdf5-mpi`, e.g.
56+
57+
```sh
58+
module load gcc/15
59+
module load openmpi/5.0
60+
module load hdf5-mpi/1.14.1
61+
```
62+
OpenMP instructions should work out of the box.
63+
For access to BLAS and LAPACK routines there are usually different options, we refer therefore to any documentation provided by the supercomputer's maintainers.
64+
65+
## Python setup and project download
66+
67+
We recommend creating a clean Python virtual environment using [venv](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment):
68+
```sh
69+
python3 -m venv <ENV-PATH>
70+
```
71+
where `<ENV-PATH>` is the location to create the virtual environment.
72+
(A new directory will be created at the required location.)
73+
In order to activate the environment just run the command
74+
```sh
75+
source <ENV-PATH>/bin/activate
76+
```
77+
At this point the commands `python` and [`pip`](https://pip.pypa.io/en/stable/) will refer to the Python 3 interpreter and package manager of the virtual environment, respectively.
78+
Additionally, the command `deactivate` closes the environment.
79+
It is good practice to keep `pip` up to date with
80+
```sh
81+
pip install --upgrade pip
82+
```
83+
84+
One can clone the Psydac repository at any location `<ROOT-PATH>` in the filesystem which does not require administrator privileges, using either
85+
```sh
86+
git clone https://github.com/pyccel/psydac.git
87+
```
88+
or
89+
```sh
90+
git clone [email protected]:pyccel/psydac.git
91+
```
92+
The latter command requires a GitHub account.
93+
94+
## Installing the library
95+
96+
Psydac depends on several Python packages, which should be installed in the newly created virtual environment.
97+
Almost all of these dependencies will be automatically installed by `pip` at the time of installing the `psydac` package later on.
98+
99+
The single exception is the `h5py` package, which needs to be installed in parallel mode.
100+
This means that a wheel will be built from sources and linked to the local parallel HDF5 library.
101+
102+
To this end, we first set the environment variable `HDF5_DIR` s.t. the path `$HDF5_DIR/lib/` will correspond to the folder containing the dynamic library `libhdf5.so` (on Ubuntu/Debian) or `libhdf5.dylib` (on macOS).
103+
This path can be obtained with a command which depends on your system.
104+
105+
- **Ubuntu/Debian**:
106+
```sh
107+
export HDF5_DIR=$(dpkg -L libhdf5-openmpi-dev | grep "libhdf5.so" | xargs dirname)
108+
```
109+
110+
- **macOS**:
111+
```sh
112+
export HDF5_DIR=$(brew list hdf5-mpi | grep "libhdf5.dylib" | xargs dirname | xargs dirname)
113+
```
114+
115+
- **High-performance computers using [Environment Modules](https://modules.sourceforge.net/)**:
116+
117+
The correct location of the HDF5 library can be found using the `module show` command, which reveals any environment variables after the `setenv` keyword.
118+
For example, on this system both `HDF5_HOME` and `HDF5_ROOT` contain the information we need:
119+
120+
```sh
121+
> module show hdf5-mpi/1.14.1
122+
123+
-------------------------------------------------------------------
124+
/mpcdf/soft/SLE_15/sub/gcc_15/sub/openmpi_5_0/modules/libs/hdf5-mpi/1.14.1:
125+
126+
module-whatis {HDF5 library 1.14.1 with MPI support, built for openmpi_5_0_7_gcc_15_1}
127+
conflict hdf5-serial
128+
conflict hdf5-mpi
129+
setenv HDF5_HOME /mpcdf/soft/SLE_15/packages/skylake/hdf5/gcc_15-15.1.0-openmpi_5.0-5.0.7/1.14.1
130+
setenv HDF5_ROOT /mpcdf/soft/SLE_15/packages/skylake/hdf5/gcc_15-15.1.0-openmpi_5.0-5.0.7/1.14.1
131+
prepend-path PATH /mpcdf/soft/SLE_15/packages/skylake/hdf5/gcc_15-15.1.0-openmpi_5.0-5.0.7/1.14.1/bin
132+
-------------------------------------------------------------------
133+
```
134+
135+
Therefore it is sufficient to set
136+
137+
```sh
138+
export HDF5_DIR=$HDF5_HOME
139+
```
140+
141+
Next, install `h5py` in parallel mode using `pip`:
142+
```sh
143+
export CC="mpicc"
144+
export HDF5_MPI="ON"
145+
146+
pip install h5py --no-cache-dir --no-binary h5py
147+
```
148+
149+
At this point the Psydac library may be installed from the cloned directory `<ROOT-PATH>/psydac` in **standard mode**, which copies the relevant files to the correct locations of the virtual environment, or in **development mode**, which only installs symbolic links to the Psydac directory. The latter mode allows one to affect the behavior of Psydac by modifying the source files.
150+
151+
- **Standard mode**:
152+
```bash
153+
pip install .
154+
```
155+
156+
- **Development mode**:
157+
```bash
158+
pip install --editable .
159+
```
160+
161+
## Optional PETSc installation
162+
163+
Although Psydac provides several iterative linear solvers which work with our native matrices and vectors, it is often useful to access a dedicated library like [PETSc](https://petsc.org). To this end, our matrices and vectors have the method `topetsc()`, which converts them to the corresponding `petsc4py` objects.
164+
(`petsc4py` is a Python package which provides Python bindings to PETSc.) After solving the linear system with a PETSc solver, the function `petsc_to_psydac` allows converting the solution vector back to the Psydac format.
165+
166+
In order to use these additional feature, PETSc and petsc4py must be installed as follows.
167+
First, we download the latest release of PETSc from its [official Git repository](https://gitlab.com/petsc/petsc):
168+
```sh
169+
git clone --depth 1 --branch v3.21.4 https://gitlab.com/petsc/petsc.git
170+
```
171+
Next, we specify a configuration for complex numbers, and install PETSc in a local directory:
172+
```sh
173+
cd petsc
174+
175+
export PETSC_DIR=$(pwd)
176+
export PETSC_ARCH=petsc-cmplx
177+
178+
./configure --with-scalar-type=complex --with-fortran-bindings=0 --have-numpy=1
179+
180+
make all check
181+
182+
cd -
183+
```
184+
Finally, we install the Python package `petsc4py` which is included in the `PETSc` source distribution:
185+
```sh
186+
pip install wheel Cython numpy
187+
pip install petsc/src/binding/petsc4py
188+
```
189+
190+
## Uninstall
191+
192+
- **Whichever the install mode**:
193+
```bash
194+
pip uninstall psydac
195+
```
196+
- **If PETSc was installed**:
197+
```bash
198+
pip uninstall petsc4py
199+
```
200+
201+
The non-Python dependencies can be uninstalled manually using the package manager.
202+
In the case of PETSc, it is sufficient to remove the cloned source directory given that the installation has been performed locally.

docs/psydac-mesh.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Mesh Generation
2+
3+
After installation, the command `psydac-mesh` will be available.
4+
5+
## Example of usage
6+
7+
```bash
8+
psydac-mesh -n='16,16' -d='3,3' square mesh.h5
9+
```
File renamed without changes.

pyproject.toml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools >= 64.0", "wheel", "numpy", "pyccel >= 1.11.2"]
2+
requires = ["setuptools >= 64.0, != 67.2.0", "wheel", "numpy", "pyccel >= 2.0.1"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -8,7 +8,7 @@ version = "2.4.5.dev0"
88
description = "Python package for isogeometric analysis (IGA)"
99
readme = "README.md"
1010
requires-python = ">= 3.10"
11-
license = "MIT"
11+
license = {file = "LICENSE"}
1212
authors = [
1313
{name = "Psydac development team", email = "[email protected]"}
1414
]
@@ -30,13 +30,7 @@ dependencies = [
3030
'pyevtk',
3131

3232
# Our packages from PyPi
33-
'pyccel >= 2.0',
34-
35-
# In addition, we depend on mpi4py and h5py (MPI version).
36-
# Since h5py must be built from source, we run the commands
37-
#
38-
# python3 -m pip install requirements.txt
39-
# python3 -m pip install .
33+
'pyccel >= 2.0.1',
4034
'mpi4py >= 4',
4135
'h5py',
4236

requirements.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)