Skip to main content

What is this repo?

This is a minimalistic, self-contained sparse Cholesky solver, supporting solving both on the CPU and on the GPU, easily integrable in your tensor pipeline.

When we were working on our "Large Steps in Inverse Rendering of Geometry" paper [1], we found it quite challenging to hook up an existing sparse linear solver to our pipeline, and we managed to do so by adding dependencies on large projects (i.e. cusparse and scikit-sparse), only to use a small part of its functionality. Therefore, we decided to implement our own library, that serves one purpose: efficiently solving sparse linear systems on the GPU or CPU, using a Cholesky factorization.

Under the hood, it relies on CHOLMOD for sparse matrix factorization. For the solving phase, it uses CHOLMOD for the CPU version, and uses the result of an analysis step run once when building the solver for fast solving on the GPU [2].

It achieves comparable performance as other frameworks, with the dependencies nicely shipped along.


Benchmark

Benchmark run on a Linux Ryzen 3990X workstation with a TITAN RTX.


The Python bindings are generated with nanobind, which makes it easily interoperable with most tensor frameworks (Numpy, PyTorch, JAX...)

Installing

With PyPI (recommended)

pip install cholespy

From source

git clone --recursive https://github.com/rgl-epfl/cholespy
pip install ./cholespy

Documentation

There is only one class in the module, with two variants: CholeskySolverF, CholeskySolverD. The only difference is that CholeskySolverF solves the system in single precision while CholeskySolverD uses double precision. This is mostly useful for solving on the GPU, as the CPU version relies on CHOLMOD, which only supports double precision anyway.

The most common tensor frameworks (PyTorch, NumPy, TensorFlow...) are supported out of the box. You can pass them directly to the module without any need for manual conversion.

Since both variants have the same signature, we only detail CholeskySolverF below:

cholespy.CholeskySolverF(n_rows, ii, jj, x, type)

Parameters:

  • n_rows - The number of rows in the (sparse) matrix.
  • ii - The first array of indices in the sparse matrix representation. If type is COO, then this is the array of row indices. If it is CSC (resp. CSR), then it is the array of column (resp. row) indices, such that row (resp. column) indices for column (resp. row) k are stored in jj[ii[k]:ii[k+1]] and the corresponding entries are in x[ii[k]:ii[k+1]].
  • jj - The second array of indices in the sparse matrix representation. If type is COO, then this is the array of column indices. If it is CSC (resp. CSR), then it is the array of row (resp. column) indices.
  • x - The array of nonzero entries.
  • type - The matrix representation type, of type MatrixType. Available types are MatrixType.COO, MatrixType.CSC and MatrixType.CSR.

cholespy.CholeskySolverF.solve(b, x)

Parameters

  • b - Right-hand side of the equation to solve. Can be a vector or a matrix. If it is a matrix, it must be of shape (n_rows, n_rhs). It must be on the same device as the tensors passed to the solver constructor. If using CUDA arrays, then the maximum supported value for n_rhs is 128.
  • x - Placeholder for the solution. It must be on the same device and have the same shape as b.

x and b must have the same dtype as the solver used, i.e. float32 for CholeskySolverF or float64 for CholeskySolverD. Since x is modified in place, implicit type conversion is not supported.

Example usage

from cholespy import CholeskySolverF, MatrixType
import torch

# Identity matrix
n_rows = 20
rows = torch.arange(n_rows, device='cuda')
cols = torch.arange(n_rows, device='cuda')
data = torch.ones(n_rows, device='cuda')

solver = CholeskySolverF(n_rows, rows, cols, data, MatrixType.COO)

b = torch.ones(n_rows, device='cuda')
x = torch.zeros_like(b)

solver.solve(b, x)
# b = [1, ..., 1]

References

[1] Nicolet, B., Jacobson, A., & Jakob, W. (2021). Large steps in inverse rendering of geometry. ACM Transactions on Graphics (TOG), 40(6), 1-13.

[2] Naumov, M. (2011). Parallel solution of sparse triangular linear systems in the preconditioned iterative methods on the GPU. NVIDIA Corp., Westford, MA, USA, Tech. Rep. NVR-2011, 1.

Release files for cholespy 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cholespy 2.2.0
File Size Uploaded
cholespy-2.2.0.tar.gz 59.0 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for cholespy 2.2.0
File
cholespy-2.2.0-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
cholespy-2.2.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
cholespy-2.2.0-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
cholespy-2.2.0-cp314-cp314t-macosx_10_15_x86_64.whl CPython 3.14 CPython 3.14 free-threading macOS 10.15+ x86-64 Details
cholespy-2.2.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
cholespy-2.2.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
cholespy-2.2.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details
cholespy-2.2.0-cp312-abi3-macosx_10_14_x86_64.whl CPython 3.12 abi3 macOS 10.14+ x86-64 Details
cholespy-2.2.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
cholespy-2.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
cholespy-2.2.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
cholespy-2.2.0-cp311-cp311-macosx_10_14_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.14+ x86-64 Details
cholespy-2.2.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
cholespy-2.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
cholespy-2.2.0-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
cholespy-2.2.0-cp310-cp310-macosx_10_14_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.14+ x86-64 Details
cholespy-2.2.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
cholespy-2.2.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
cholespy-2.2.0-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details
cholespy-2.2.0-cp39-cp39-macosx_10_14_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.14+ x86-64 Details

Total release size: 122.3 MB

Release files / cholespy-2.2.0.tar.gz

Download URL cholespy-2.2.0.tar.gz
Size 59.0 MB
Tags Source
SHA-256 checksum
How to use checksums
4f12da345d318013f386b0a1e6e0f5e63893ab30ff9ecf8ca50e121b85a58125
BLAKE2b-256 checksum
How to use checksums
9d786900f46f4a8627dcbb0406cde5a4e00159f034a6c6a8811770145a36a2db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp314-cp314t-win_amd64.whl

Download URL cholespy-2.2.0-cp314-cp314t-win_amd64.whl
Size 5.0 MB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
d2a1acdf8165d75009216eed18b36d361b9933ff2f24b38935e24244ec34e85c
BLAKE2b-256 checksum
How to use checksums
07dddea75e2c94707a90aa1cc48485c5c3ea1336ffc778a181313e7603ba8373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cholespy-2.2.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.6 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1db1e21db352fe116cd318a135f823a0e63c1c83f38104c3567dd03f92edad0e
BLAKE2b-256 checksum
How to use checksums
983f70f37fd6141ec7c836834556f1fb7a7f549f284d18638fb6425499723deb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp314-cp314t-macosx_11_0_arm64.whl

Download URL cholespy-2.2.0-cp314-cp314t-macosx_11_0_arm64.whl
Size 971.2 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
960950b4cc8dfdf0dab580452240f6d98d3f27b95aa0e2f638360d12b9c9ea10
BLAKE2b-256 checksum
How to use checksums
96a0a1ea4db30ff9545a5a922110ec95d945501c8029ecfaa78fd08b8a11e1d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp314-cp314t-macosx_10_15_x86_64.whl

Download URL cholespy-2.2.0-cp314-cp314t-macosx_10_15_x86_64.whl
Size 1.1 MB
Tags CPython 3.14 CPython 3.14 free-threading macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
18bf86cb04533901b114d407aed2e44a517f21429ee5c9b47746b5fd0f624e0a
BLAKE2b-256 checksum
How to use checksums
26b80c78ce56976c46b23ac7e65d6f0186ba70b391cb538561bf642133da9998
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp312-abi3-win_amd64.whl

Download URL cholespy-2.2.0-cp312-abi3-win_amd64.whl
Size 4.9 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
deecc02df678e51e7741667b1b47158663496ca893cf2f75daa34b2520ebbe65
BLAKE2b-256 checksum
How to use checksums
5b466e073f0247841e62f2d4643ba7eec61365295e4ff632ebc283c5946f3063
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cholespy-2.2.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.6 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
3e32e9760380a3804ac6da150ac4eb7e5b4554cfd3b36d437fd819c17e1e9317
BLAKE2b-256 checksum
How to use checksums
8494b2a491bbd74386b2301ff8c3a33957261404f866846645e699b7611c65d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL cholespy-2.2.0-cp312-abi3-macosx_11_0_arm64.whl
Size 967.7 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7d32daeb91a40025c92a8ce51c12044fa616749ed37b177935b62e761c8fbe53
BLAKE2b-256 checksum
How to use checksums
d340a300878fcf6cccb667228f1b45dd4ecd1d04d1ee01daa76f2c9ab79ce2ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp312-abi3-macosx_10_14_x86_64.whl

Download URL cholespy-2.2.0-cp312-abi3-macosx_10_14_x86_64.whl
Size 1.1 MB
Tags CPython 3.12 abi3 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
90af005b75147b0119838c24e7c36b70af7a9643644a3f3e62780b0b50b55978
BLAKE2b-256 checksum
How to use checksums
bdb3f573bcd0a7d8cb8413d988c60d2dba754bcf47915cbeae0971c54966e9f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp311-cp311-win_amd64.whl

Download URL cholespy-2.2.0-cp311-cp311-win_amd64.whl
Size 4.9 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
a4f13b70a03cb6e7929496d469ba409bdf672323f097641381a2c4092ad3204b
BLAKE2b-256 checksum
How to use checksums
cdf605508ee258e9650ac650a86c27a94ca411207762054cf220c5be5b4a9fb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cholespy-2.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.6 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5f19dc5fc30b053a4d0749371b161059eacf7a95496eecd33edc494a4d28113c
BLAKE2b-256 checksum
How to use checksums
35b5df31b615d58b75eb1007cff061a9c48f7a2eb37bdd1fdd15354823fcbafe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL cholespy-2.2.0-cp311-cp311-macosx_11_0_arm64.whl
Size 969.0 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9980c19be21a2707e76ffb1a27db20cf6fa3af800115c534d8c3a83ae42afbb1
BLAKE2b-256 checksum
How to use checksums
eb7ee411c09928839d6c755d7bcf53dbb856f18fd966ae12971aa6a4b61aa5e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp311-cp311-macosx_10_14_x86_64.whl

Download URL cholespy-2.2.0-cp311-cp311-macosx_10_14_x86_64.whl
Size 1.1 MB
Tags CPython 3.11 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
74d85d00fb2ba2d7fdb766defcc083071f1f377f9faf91a271a53c0716f0ef74
BLAKE2b-256 checksum
How to use checksums
0c2b2c5f48e0005695aa0b99af8011c2ae035dfd8c14b6a836dd64d505a7f5c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp310-cp310-win_amd64.whl

Download URL cholespy-2.2.0-cp310-cp310-win_amd64.whl
Size 4.9 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
8d0e6c0132bdaf7e20dae81e39ce7b20a1cf84b1f04e66d72974dac30e618a7d
BLAKE2b-256 checksum
How to use checksums
accc543d6bc039dd15278f796b07a1546b31733ef9ce4c6a9c9ba3ca6bf22846
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cholespy-2.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.6 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1c041beedecd276772d13abd2a48f359b60956a5ac171f3beff3abacf9d21a64
BLAKE2b-256 checksum
How to use checksums
bd3caa633135f367a106bef5d86ff697da6c6653ad8b6ae2f2010dbcd20ab84b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp310-cp310-macosx_11_0_arm64.whl

Download URL cholespy-2.2.0-cp310-cp310-macosx_11_0_arm64.whl
Size 968.7 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
df5a3117dea5c027a3322b4337f7f3e76cbc47fd3ab8a5182c15f2290775f97e
BLAKE2b-256 checksum
How to use checksums
647c152b74db45d97ef0645ce783380c31129e8f9d0ea933031b4294677d4a05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp310-cp310-macosx_10_14_x86_64.whl

Download URL cholespy-2.2.0-cp310-cp310-macosx_10_14_x86_64.whl
Size 1.1 MB
Tags CPython 3.10 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
ccc618bca1406671b43a7eff23bea63f69c720edb75f22831a8c4bcacc0f7e45
BLAKE2b-256 checksum
How to use checksums
b9c12c10d184041ae8521bdb7e79e2ef849978bca5c26a0c6a37ca1c421d3035
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp39-cp39-win_amd64.whl

Download URL cholespy-2.2.0-cp39-cp39-win_amd64.whl
Size 4.9 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
c0ea1eb98a19bcffba2d184390c4d6665d0b69910c9de9268a0651332cc29e5c
BLAKE2b-256 checksum
How to use checksums
02e166c3957e816a542f07fa8449b10676f465f1c1f03100cf30d43b1223e849
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cholespy-2.2.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.6 MB
Tags CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
28a2f43973bb8cce12f302dc2a4837b880301fe094fba7e8aa78a771b6a524b2
BLAKE2b-256 checksum
How to use checksums
56f7c17e425a271871248ee25e2de440557db34b78cd7c76ce07c7cc039bb31a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp39-cp39-macosx_11_0_arm64.whl

Download URL cholespy-2.2.0-cp39-cp39-macosx_11_0_arm64.whl
Size 968.9 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0fa9f267a7645f2e31fad87022796a45e10e3cedb494ed1ed3eb8e8156814833
BLAKE2b-256 checksum
How to use checksums
dc02279beaf8fc0c220fd9d34f5c59a5dae90d5c0fe1fcb2ff3de2ff5d7434fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / cholespy-2.2.0-cp39-cp39-macosx_10_14_x86_64.whl

Download URL cholespy-2.2.0-cp39-cp39-macosx_10_14_x86_64.whl
Size 1.1 MB
Tags CPython 3.9 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
0aa579245018c6c9545e738e252e05bad3f750e4b4d71ef721d43c12323e2e4d
BLAKE2b-256 checksum
How to use checksums
a9f5c55169f07ca6246b18cb7511ab1d91d5ad2c40fc069590f45b3e87709ea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

2.2.0 This release

21 release files

1.0.0

12 release files

0.1.6

12 release files

0.1.5

12 release files

0.1.4

12 release files

0.1.2

12 release files

0.1.1

12 release files

0.1.0

12 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page