Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Tests

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
pytest:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
OMP_NUM_THREADS: "1"
MKL_NUM_THREADS: "1"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
steps:
- name: Check out repository
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: "pip"

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install numpy scipy matplotlib pytest
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
python -m pip install -e .

- name: Run tests
run: python -m pytest -q test
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ The Hierarchical Poincaré-Steklov (HPS) Solver is a high-performance computing
- [SciPy](https://scipy.org/): For sparse matrix operations and linear algebra.
- [petsc4py](https://petsc.org/release/petsc4py/) (Optional): To use PETSc for sparse matrix operations. The solver can fall back to SciPy if petsc4py is not available. However, PETSc (particularly using the MUMPS direct solver) makes the code much faster.

## Installation:
1. Download the repository to your machine.
2. (Recommended) create a clean Conda environment. Alternatively switch to the environment you wish to incorporate `hpsmultidomain` into.
3. Navigate to the repository directory and run `pip install .`. This will download hpsmultidomain itself as well as its dependencies.
4. (Optional but recommended) Install `mpi4py` and `petsc4py` through either Conda or pip, since they generally give better performance than SuperLU.

### (Optional but recommended) MUMPS via petsc4py:

1. Install fortran into your environment if it's not there already: `conda install -c conda-forge gfortran`
2. Set the proper petsc configure options:
```export PETSC_CONFIGURE_OPTIONS="--with-64-bit-indices --download-mumps --with-debugging=0 --with-mpi=0 --with-mumps-serial --with-fortran-bindings=0 --download-metis --download-scotch --download-bison --download-flex"```
This downloads `MUMPS` as well as `metis` for improved pivoting. This configuration does not provide MPI support (but still offers OpenMP, which is adequate for many workstations). It removes debugging and fortran bindings (but not compiled fortran) for performance.
3. Install PETSc: `python -m pip install -v --no-binary=:all: --no-cache-dir petsc`
4. Install petsc4py: `python -m pip install -v --no-build-isolation --no-binary=:all: --no-cache-dir petsc4py`

YMMV depending on your machine. You may need to restrict the versions of pip and setuptools:
`pip install -U "pip<26" "setuptools<75" wheel`
and/or update cython:
`python -m pip install --upgrade cython`

## Example usage
For a 2D problem:
```
Expand All @@ -54,6 +74,8 @@ And for a 3D problem:
python hpsmultidomain/argparse_driver.py --pde poisson --domain square --bc log_dist --n 50 --p 12 --d 3 --solver MUMPS
```

You can also test on preconfigured basic problems by calling `python test/test_multidomain.py` and `python test/test_multidomain_curved.py`

## Notes
A series of command line arguments can be seen in `argparse_driver.py`. These include:
- `pde` to specify the partial differential equation to solve, such as `poisson` or `bfield_constant` (i.e. constant-coefficient Helmholtz equation)
Expand Down
Loading