Skip to main content

Python pybind11 wrapper for Intel oneMKL PARDISO sparse direct solver

Project description

py-mkl-pardiso

Test

Python pybind11 wrapper for the Intel oneMKL PARDISO sparse direct solver.

pymklpardiso exposes the real-valued subset of Intel's PARDISO sparse direct solver to Python via pybind11. It works with SciPy sparse matrices in CSR format and NumPy arrays.

Supported platforms: Linux (x86_64), Windows (AMD64).

Installation

pip install py-mkl-pardiso

Or install from source (requires MKL):

git clone https://github.com/bodono/py-mkl-pardiso.git
cd py-mkl-pardiso
pip install -e ".[test]"

Building from source requires:

  • Intel oneMKL (set MKLROOT if not auto-detected)
  • A C++17 compiler
  • Python >= 3.10
  • pybind11 >= 2.12

Quick start

import numpy as np
import scipy.sparse as sp
from pymklpardiso import PardisoSolver, MTYPE_REAL_SYM_POSDEF

# Build a symmetric positive-definite matrix (upper triangle, CSR)
A_full = np.array([
    [4.0, 1.0],
    [1.0, 3.0],
])
A_upper = sp.csr_matrix(np.triu(A_full))
A_upper.sort_indices()

# Create solver — analyzes, factors, and is ready to solve
solver = PardisoSolver(A_upper, MTYPE_REAL_SYM_POSDEF)

b = np.array([1.0, 2.0])
x = solver.solve(b)
print(x)  # [0.09090909 0.63636364]

Refactoring workflow

When the sparsity pattern stays the same but values change (e.g., in an iterative algorithm), use refactor() to skip symbolic analysis:

solver = PardisoSolver(A_upper, MTYPE_REAL_SYM_POSDEF)
for new_values in value_generator:
    solver.refactor(new_values)
    x = solver.solve(b)

API reference

PardisoSolver(A, mtype, iparms=None, msglvl=0)

Create a PARDISO solver instance. The constructor extracts the CSR sparsity pattern from A, applies any iparms overrides, and runs symbolic analysis

  • numeric factorization so the solver is ready to call solve().
Parameter Type Default Description
A sparse CSR (required) Square sparse matrix (any object with indptr, indices, data, shape). For symmetric types, pass only the upper triangle in CSR format.
mtype int (required) Matrix type (see constants below).
iparms dict None Optional {index: value} iparm overrides.
msglvl int 0 Message level (0 = silent, 1 = print statistics).

Matrix type constants

Constant Value Description
MTYPE_REAL_STRUCT_SYM 1 Real structurally symmetric
MTYPE_REAL_SYM_POSDEF 2 Real symmetric positive definite
MTYPE_REAL_SYM_INDEF -2 Real symmetric indefinite
MTYPE_REAL_NONSYM 11 Real nonsymmetric

Core methods

solver.solve(b) Solve Ax = b. Accepts 1D (n,) or 2D (n, nrhs) arrays. Returns the solution as a new NumPy array (Fortran-contiguous for 2D).

solver.solve_into(b, x) Solve Ax = b writing into pre-allocated x. For 2D arrays, both b and x must be Fortran-contiguous.

solver.refactor(values) Re-factorize with new nonzero values (phase 22 only). Does not re-run symbolic analysis. Raises if symbolic analysis is invalid; use factor() to re-analyze from scratch. values must match the stored sparsity pattern exactly.

solver.factor(values) Re-analyze and re-factorize with new values (phases 11 + 22). This always runs fresh symbolic analysis. Use this for error recovery or when iparm changes require fresh symbolic analysis. values must match the stored sparsity pattern exactly.

Analysis invalidation: symbolic analysis (phase 11) becomes invalid when an iparm value changes via set_iparm() or set_iparm_all(), or after release() / reset(). Changing numeric values alone does not invalidate analysis. After a successful factor(), subsequent refactor() calls continue to work, including with value-dependent analysis settings such as iparm[10] = 1. When analysis is invalid, refactor() raises; call factor() to re-analyze and recover.

Other methods

Method Description
solver.release() Free PARDISO internal memory.
solver.n Matrix dimension (property).
solver.nnz Number of nonzeros (property).
solver.mtype Matrix type (property).
solver.set_perm(perm) Set fill-reducing permutation.
solver.clear_perm() Clear permutation.
solver.has_perm() Whether a permutation is set.
solver.set_iparm(idx, value) Set a single iparm entry.
solver.get_iparm() Get all 64 iparm values.
solver.get_iparm_value(idx) Get a single iparm value.
solver.set_iparm_all(iparm) Set all 64 iparm values.
solver.set_msglvl(msglvl) Change message level.
solver.run_phase(phase) Run an arbitrary PARDISO phase.
solver.run_phase_into(phase, b, x) Run a phase with RHS/output arrays.

iparm notes

  • iparm[0] is locked to 1 (user-supplied parameters).
  • iparm[34] is locked to 1 (zero-based indexing).
  • See the MKL PARDISO iparm documentation for all parameters.

License

MIT

Project details


Download files

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

Source Distribution

py_mkl_pardiso-0.0.5.tar.gz (24.4 kB view details)

Uploaded Source

Built Distributions

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

py_mkl_pardiso-0.0.5-cp314-cp314t-win_amd64.whl (14.8 MB view details)

Uploaded CPython 3.14tWindows x86-64

py_mkl_pardiso-0.0.5-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.0 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

py_mkl_pardiso-0.0.5-cp314-cp314-win_amd64.whl (14.8 MB view details)

Uploaded CPython 3.14Windows x86-64

py_mkl_pardiso-0.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

py_mkl_pardiso-0.0.5-cp313-cp313-win_amd64.whl (14.5 MB view details)

Uploaded CPython 3.13Windows x86-64

py_mkl_pardiso-0.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

py_mkl_pardiso-0.0.5-cp312-cp312-win_amd64.whl (14.5 MB view details)

Uploaded CPython 3.12Windows x86-64

py_mkl_pardiso-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

py_mkl_pardiso-0.0.5-cp311-cp311-win_amd64.whl (14.5 MB view details)

Uploaded CPython 3.11Windows x86-64

py_mkl_pardiso-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

py_mkl_pardiso-0.0.5-cp310-cp310-win_amd64.whl (14.5 MB view details)

Uploaded CPython 3.10Windows x86-64

py_mkl_pardiso-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file py_mkl_pardiso-0.0.5.tar.gz.

File metadata

  • Download URL: py_mkl_pardiso-0.0.5.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_mkl_pardiso-0.0.5.tar.gz
Algorithm Hash digest
SHA256 de8a37648f5793229b90f6639e8825ccfb45368cf3e88026108fc7dd9b004993
MD5 592ba846872ee62d758df6a3ee15b1a7
BLAKE2b-256 68c44f35925a97bd6dffcf04fe495577ed3ec808f4a885b30c67302854ee103b

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5.tar.gz:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 a8c2a2bd85e7191bfa3ce2af43eb114fa4df3974c3b99b2d8bd377a32debaf62
MD5 59da21cd3254d4319f6939e859bf9654
BLAKE2b-256 b7f23085baf71c39df6bd90f3dbca9be9cf03c5214fdabad6101c9c5c377d6bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp314-cp314t-win_amd64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d93f28fb2edb8fc991317376a6f31f2536c215c2fe9cf95228f52d3d2d7b0f42
MD5 c6dab90c7d2f0f28a21d4641a3d578f6
BLAKE2b-256 1dc9519a0c805ea8fb852736092b4eeb4c98ba7635b0fd1bd08b4a8589a40074

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 8ea5771fcaa8b845b81909ac6208371e76b59394ea5a747f752b45fd5918ce53
MD5 2ee6587884154906873f234409ce61b0
BLAKE2b-256 a1888d4e2b432e8ca2e51e69a5169f0d978befeed6aec4e290124cffc457c54a

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp314-cp314-win_amd64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9e3d48ab50d9feb5d0f4af00c20cca3b77bc9627bf903016d2fd393d4683ed62
MD5 a45136c277e5ccca6ed67918f201d267
BLAKE2b-256 486afc5de49b3d9b85795b9ff6ac698ac3893a56839b121fa7d8f923e82651d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 db123636c5f42882ef0ad6792917f6b22af12ad8e6d35a4b3c8c453655532623
MD5 cc56413aec9757a06cbbeea73dcb4cb4
BLAKE2b-256 e0137e5d648990dc48ec9b3c7ad13fa3259bfc9e0f3dd33b6b53cb4422dbef08

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp313-cp313-win_amd64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6439b4a28caca748a614e08013d35bf691fe310eae0160618a0375a79be3f8dd
MD5 6baa6386bb90cf14834b27c4c0ad5fe7
BLAKE2b-256 7bec64d64edc72f14827e9b0bfb313c5024ec8be9f165af6e2f4ac24239701c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 63d3c63805033e169544ba8442cb920be8408737e873eb6f48efe8f7b6aa7667
MD5 206c4247c9c621e8f31f1c3250220a92
BLAKE2b-256 d421708fbbe3843aa901059582af3656a69563804cb15a705451afce757defa5

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f1fe359206cfb26777be4ab2927a84abe337ce932097d3ffeb09a6b1c6884f1a
MD5 5973c6f52fc1aa551943ebb201d21fd3
BLAKE2b-256 e147b7a2b99a08b418993e7c09fab22faa9f89468d53d7382e1f1d17507fdc73

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8f156023f096ebe395cc7e5d8a97857240798c6649a7e5fec575fcb9188c51f4
MD5 3a683ad87e048112726215223d666d69
BLAKE2b-256 f8af283e9c43582d35b6016d8fa67add21e03d9aa30d3c0623b4e4bf02acf7a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 986c55d9e12bd112b525fd4dabd1637c5d54ca95bb48dbfd5b2ed29e71625e17
MD5 d4ead12ccac60540784c4f6263742108
BLAKE2b-256 bda1b7fd5cdd97614c34bbc877832833a911d25bd6da69d3d2def0305c1fc48c

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 673f15eabeda66924ecd265a30fcef1ec4b1706edc4674006b586b61acb4e084
MD5 334738083899c069b57da455a5ff9c2a
BLAKE2b-256 7c962df55b9ba6a5e71f9a200719d4bcbaa45ff28a58e17c8dcaab316e4faad5

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp310-cp310-win_amd64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_mkl_pardiso-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_mkl_pardiso-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8dbe70b5452696750c85d527f6f35dcb6242026844f611c7ee6e024ca481c2cf
MD5 602e0f7982c2159ae7036b086fea3914
BLAKE2b-256 aa1e540b35cde744dc9b0e3258f10ad734528ee65b581ef4603b88820b9e86d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_mkl_pardiso-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on bodono/py-mkl-pardiso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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