Skip to main content

Physics Informed Preconditioners and Solvers

Project description

Physics Informed Preconditioners

Introduction

Pipre, short for Physics Informed Preconditioners, is a large-scale linear equation solver package. It supports distributed heterogeneous parallel computing (MPI+CPU/GPU/DCU/...) and provides physics-informed preconditioners for solvers, especially physics-informed AMG preconditioners. It is dedicated to stably and efficiently solving large-scale linear algebraic equations derived from the discretization of mathematical and physical models.

Install

$ pip install pypipre

Usage

use the following command to get the help message:

$ python -m pypipre help

copy the example out

$ cp -r path_to_pypipre/examples .

then run the example:

$ python solver.py thermal1.mtx thermal1_b.mtx solver.json

The following python script shows the above solver.py. read matrix A and vector b from MatrixMarket files, using CUDA to solve Ax=b.

# solver.py
import pypipre as pipre
import sys, re, os
#import json
import commentjson as json

fnA = sys.argv[1]
fnb = sys.argv[2]
config = sys.argv[3]

params = json.load(open(config))

A = pipre.ParCSRMatrix()
A.loadFromFile(fnA)
b = pipre.ParMatrix()
b.loadFromFile(fnb)
if b.getSize() == 0:
    b.resize(A.getRows(), 1)
    b.fill(1)

# transfer the matrix and vector to gpu 0.
dev = pipre.Device("cuda:0")
A = A.toDevice(dev)
b = b.toDevice(dev)

# use gpu 0 to finish the computation.
precond = pipre.createPrecond(params["preconditioner"])
precond.setup(A)
solver = pipre.createSolver(params["solver"])
solver.setup(A)

out = solver.solve(precond, A, b)

Solvers and Preconditioners

use

$ python -m pipre info

to show the builtin solvers, preconditioners, smoothers, level_transfers.

Compatibility

  • OS version

Now support Linux, Ubuntu/Federa/... will be OK. Windows version will be available later.

  • PYTHON version

the python version is >=3.8.

  • GPU/CUDA version

If you want to use CUDA, ensure that CUDA Version >= 12.4.

  • DCU version

please contact us to compile the specified version.

  • DISTRIBUTED version

MPI support is on going.

License

This software is free software distributed under the Lesser General Public License or LGPL, version 3.0 or any later versions. This software distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with PIPRE. If not, see http://www.gnu.org/licenses/.

This software depends on GLOG, AMGCL, their license files are located in the package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypipre-1.0.3-py3-none-any.whl (15.2 MB view details)

Uploaded Python 3

File details

Details for the file pypipre-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: pypipre-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 15.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for pypipre-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 deb7c3974eb3f98ffb0523a0ac6c5c73e24affc4509a75b43bf86d0e8e70e7a1
MD5 b3c329400df7e50f45240fe8f3b3ef1f
BLAKE2b-256 f02edf9fa00a09bca01b41bc3ed7b8d33992794882710751d3859ce5132c82da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page