Homa

Homa is a fast sparse matrix permutation library with Python and C++ APIs. It targets end-to-end acceleration of sparse Cholesky solvers by reducing the cost of computing fill-reducing permutations. Homa is particularly effective when matrix sparsity patterns change frequently and each factorization is used only a small number of times.
The benchmarks below compare cuDSS using its default ordering with cuDSS using Homa on Laplacian systems from the Thingi10K dataset (left) and the TetWild dataset (right).
Benchmark setup: Total time includes permutation, symbolic analysis, numerical factorization, and triangular solve. All experiments use floating-point arithmetic and were run on an NVIDIA RTX PRO 6000 GPU with an AMD EPYC 9555 64-core, 3.2 GHz CPU. cuDSS Defaults uses cuDSS's default METIS-based nested-dissection ordering, while cuDSS + Homa replaces only the permutation with Homa's ordering.
This repo has two complementary purposes:
-
Fast Sparse Matrix Permutation: Given the sparsity pattern of a sparse matrix, Homa computes a fill-reducing permutation and, when requested, an elimination tree. The result can be passed to any sparse Cholesky solver that accepts user orderings.
-
Solvers front end: Homa exposes one
ordering -> analyze -> factorize -> solveworkflow from Python and C++. The current supported backends are NVIDIA cuDSS, SuiteSparse CHOLMOD, and Intel MKL PARDISO.
The Python package is named homapy.
Installation
For Python usage, install the Python bindings:
python -m pip install homapy
The GPU/cuDSS path requires a CUDA 12.x-compatible NVIDIA driver and CUDA 12.x runtime libraries. For Python examples, install scipy for CPU sparse matrices and a CUDA-12-compatible CuPy build for GPU-resident matrices:
python -m pip install scipy
# Install the CuPy package that matches your CUDA 12.x environment.
For C++ usage, using Homa in your CMake project (FetchContent):
When using Homa from another CMake project, call homa_configure_runtime() for targets that link Homa so enabled solver runtimes are configured correctly.
include(FetchContent)
FetchContent_Declare(homa
GIT_REPOSITORY https://github.com/BehroozZare/fast-permute.git
GIT_TAG v0.1.0
)
FetchContent_MakeAvailable(homa)
target_link_libraries(my_target PRIVATE Homa::homa)
homa_configure_runtime(my_target)
Quick Start
Python
For cuDSS on the GPU, use cupyx.scipy.sparse CSR matrix to keep the matrix on the GPU. Homa passes the CSR device pointers to cuDSS, so repeated solves and refactorizations do not lead to host-device memcpy.
import cupy as cp
import cupyx.scipy.sparse as csp
import numpy as np
import scipy.sparse as sp
import homapy
n = 10
A_cpu = sp.diags(
[-np.ones(n - 1), 4.0 * np.ones(n), -np.ones(n - 1)],
[-1, 0, 1],
format="csr",
)
b_cpu = np.ones(n)
A_gpu = csp.csr_matrix(A_cpu)
b_gpu = cp.asarray(b_cpu)
solver = homapy.Solver(backend="cudss", dtype="float64")
solver.set_matrix(A_gpu)
solver.ordering(patch_size=512, local_method="amd", patch_method="greedy")
solver.analyze_pattern()
solver.factorize()
x_gpu = solver.solve(b_gpu)
Mutate the values and refactorize without repeating ordering or analysis:
A_gpu.setdiag(A_gpu.diagonal() + 0.5)
solver.refactorize(A_gpu)
x2_gpu = solver.solve(A_gpu @ cp.ones(n))
CHOLMOD and MKL/PARDISO on the CPU use the same Python front-end on host CSR matrices:
x_mkl = homapy.spsolve(A_cpu, b_cpu, backend="mkl", dtype="float64")
x_cholmod = homapy.spsolve(A_cpu, b_cpu, backend="cholmod", dtype="float64")
You can also use Homa only for ordering:
perm, etree = homapy.compute_ordering(
A_cpu,
patch_size=512,
local_method="amd",
patch_method="greedy",
compute_etree=True,
)
C++
The standalone ordering API takes the sparsity pattern of a square symmetric matrix:
#include "homa/homa.h"
homa::Options opts;
opts.patch_size = 512;
opts.compute_etree = true;
homa::OrderingResult ord = homa::compute_ordering(A, opts);
// ord.perm is a permutation of [0, n)
// ord.etree is filled when compute_etree is true
For cuDSS, Homa can consume device CSR pointers through SparseMatrixView:
#include "homa/solvers/LinSysSolver.h"
std::unique_ptr<homa::LinSysSolverD> solver(
homa::LinSysSolverD::create(homa::LinSysSolverType::GPU_CUDSS));
homa::SparseMatrixView<double> Adev{
n,
n,
nnz,
d_rowptr,
d_colind,
d_values,
homa::SparseFormat::CSR,
homa::MemoryLocation::Device,
};
solver->setMatrix(Adev);
solver->ordering(opts);
solver->analyze_pattern();
solver->factorize();
solver->solve(rhs, result);
The same solver interface also supports CPU backends:
auto backend = homa::LinSysSolverType::CPU_CHOLMOD;
// or homa::LinSysSolverType::CPU_MKL
std::unique_ptr<homa::LinSysSolverD> cpu_solver(homa::LinSysSolverD::create(backend));
MKL/PARDISO expects lower-triangular storage:
Eigen::SparseMatrix<double> A_lower = A.triangularView<Eigen::Lower>();
A_lower.makeCompressed();
cpu_solver->setMatrix(A_lower);
When to use Homa
Computing a fill-reducing permutation can account for a substantial portion of the end-to-end runtime of a sparse direct solve. For the large Laplacian systems from Thingi10K (below), permutation takes up to 96% of the end-to-end solve time.
Homa is most effective when the matrix sparsity pattern changes frequently, requiring a new permutation and symbolic analysis, and each resulting factorization is used to solve only one or a few right-hand sides. In this setting, reducing permutation time can substantially reduce the end-to-end runtime.
This reduction in ordering time comes with a tradeoff. Homa may produce more fill than slower ordering methods, e.g., METIS. This can increase numerical factorization time, triangular-solve time, and memory consumption. If the same sparsity pattern is refactorized many times, the cost of a slower but higher-quality ordering can be amortized and may provide better overall performance.
Development
For local Python builds and wheel development, see python/README.md. For C++ examples and benchmark drivers, see examples/README.md.
Citation
If you use Homa's ordering in academic work, please cite:
@inproceedings{Zarebavani:2026:FSM,
title = {Fast Sparse Matrix Permutation for Mesh-Based Direct Solvers},
author = {Zarebavani, Behrooz and Mahmoud, Ahmed H. and Dodik, Ana and Yuan, Changcheng and Porumbescu, Serban D. and Owens, John D. and Mehri Dehnavi, Maryam and Solomon, Justin},
year = {2026},
isbn = {9798400725548},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
month = jul,
series = {SIGGRAPH Conference Papers '26},
booktitle = {Proceedings of the Special Interest Group on Computer Graphics and Interactive Techniques Conference Conference Papers},
articleno = {136},
numpages = {11},
doi = {10.1145/3799902.3811189}
}
Metadata
Release files for homapy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| homapy-0.1.0.tar.gz | 3.6 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| homapy-0.1.0-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| homapy-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.28+ x86-64 | Details |
| homapy-0.1.0-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| homapy-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.28+ x86-64 | Details |
| homapy-0.1.0-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details |
| homapy-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.28+ x86-64 | Details |
| homapy-0.1.0-cp39-cp39-win_amd64.whl | CPython 3.9 | CPython 3.9 | Windows x86-64 | Details |
| homapy-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.28+ x86-64 | Details |
Total release size: 1.9 GB
Release files / homapy-0.1.0.tar.gz
| Download URL | homapy-0.1.0.tar.gz |
|---|---|
| Size | 3.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e2b7e92c938e8af51f50a9d6690cbeb0f44d06474a7e34f0b9ad3d91cbda594
|
|
BLAKE2b-256 checksum How to use checksums |
d485f30efecfc56337ca2974486312f6290c4b15e7373dffc9e2862638f58070
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / homapy-0.1.0-cp312-cp312-win_amd64.whl
| Download URL | homapy-0.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 254.8 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
84a0f4393cf94dc32b65678b99c8329f8925612df43da25b1e8ac410655d776c
|
|
BLAKE2b-256 checksum How to use checksums |
d346a0458e661470e58dca0d6cf1e5551f13b607f61729094d2cb9199b1322ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / homapy-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | homapy-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 207.3 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
348bc5cc88250adddd0badeb951efa48038fbffb7083bd38dabe23e6b4dadc00
|
|
BLAKE2b-256 checksum How to use checksums |
fe6cf8e61c4179745e29bddbf2a1c4183273e7cbe38bfe1cef9f570857cf772a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / homapy-0.1.0-cp311-cp311-win_amd64.whl
| Download URL | homapy-0.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 254.8 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8510518c4f9e4913958aaab99168c348167144b9e87df2e756f047d8b4df6c8d
|
|
BLAKE2b-256 checksum How to use checksums |
77b1453a9a2f50590afe302f2f020c11a6cfc541f747b6948f2bc7fd9d8e5740
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / homapy-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | homapy-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 207.3 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
718dc207a51f76f344813263ff781ef2831ec5f15e6a47c1f3a31f2402e27891
|
|
BLAKE2b-256 checksum How to use checksums |
ef2f3594a8ec6a6b3e195ffdea5eb0ed7f9006756c8f31faa385178f6aa6bb9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / homapy-0.1.0-cp310-cp310-win_amd64.whl
| Download URL | homapy-0.1.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 254.8 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
579acb27e22ce3b28c59b2f7134e959368bd32864008f47b07c01353f814ace5
|
|
BLAKE2b-256 checksum How to use checksums |
2fee7c5ced353080cabbcd4a3044da6de2a287040646c6a88eba58dd1cb20cab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / homapy-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | homapy-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 207.3 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
6808c1a3832b8c49ee5b53aaf1274ba568ddca2b354dfc4d0575c799058dfed4
|
|
BLAKE2b-256 checksum How to use checksums |
59723c89876641e439ff0e9a14215eeee3e510c7546d2d85c760c5bc1579f18e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / homapy-0.1.0-cp39-cp39-win_amd64.whl
| Download URL | homapy-0.1.0-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 254.8 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1c6c0e6f44f9d2ecebdf624017ce6ad94e013b4e518d63de1b185c51a2ded017
|
|
BLAKE2b-256 checksum How to use checksums |
46f213b3a3e1cbc2dfdb73aeb4685f7d25536f837568cb1723360f7bb1b9e3b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / homapy-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl
| Download URL | homapy-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 207.3 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e2b2ff89aeb2228d02ccad01145b1392695f973ca8be58755d2b61086dc3d5d8
|
|
BLAKE2b-256 checksum How to use checksums |
51b406315e37ec90796102d257d2a01ccadb7a09982992e82fda3c5d6ad2cbb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency log