Python bindings for RXMesh, a CUDA/C++ library for mesh processing on the GPU.
Project description
PyRXMesh
Python bindings for RXMesh, a CUDA/C++ library for GPU mesh processing.
PyRXMesh allows you to keep mesh workflows in Python while using RXMesh data structures and GPU kernels underneath. It supports exchanging arrays and attributes with NumPy and PyTorch, building sparse matrices, and solving linear systems. We use a Python plugin to allow CUDA kernels to be written, compiled, and used directly in Python. Check out CUSTOM_CUDA_PLUGINS.md for more details.
Installation
Install PyRXMesh with:
python -m pip install PyRXMesh
PyRXMesh is a CUDA package. You need an NVIDIA driver compatible with the CUDA version used by the wheel. For source builds and development setup, see DEVELOPING.md.
Simple Example
import pyrxmesh as rx
#Use GPU 0
rx.init(0)
mesh = rx.RXMeshStatic("mesh.obj")
print(mesh.num_vertices, mesh.num_edges, mesh.num_faces)
rx.show()
The repository includes a small viewer example:
python examples/load_and_show.py --input mesh.obj
Mesh Attributes
Attributes are data attached to vertices, edges, or faces
import pyrxmesh as rx
mesh = rx.RXMeshStatic("mesh.obj")
coords = mesh.input_vertex_coordinates()
velocity = mesh.add_vertex_attribute("velocity", dtype="float32",
dim=3, location=rx.Location.ALL)
velocity.reset(0.0, rx.Location.DEVICE)
host_coords = coords.to_numpy_copy(source=rx.Location.HOST)
print(host_coords.shape)
NumPy And Torch Interop
Unsuffixed to_* methods return zero-copy views when possible. Methods ending
in _copy make an explicit copy.
import pyrxmesh as rx
mesh = rx.RXMeshStatic("mesh.obj")
attr = mesh.add_vertex_attribute("temperature", dtype="float32",
dim=1, location=rx.Location.ALL)
attr.reset(1.0, rx.Location.ALL)
view = attr.to_numpy(rx.Location.HOST)
view[0, 0] = 42.0
owned = attr.to_numpy_copy(source=rx.Location.HOST)
print(owned[0, 0])
Torch views use DLPack:
tensor = attr.to_torch(rx.Location.DEVICE)
tensor += 2.0
Dense And Sparse Matrices
PyRXMesh exposes RXMesh dense matrices and CSR sparse matrices.
import numpy as np
import pyrxmesh as rx
matrix = rx.DenseMatrix(4, 3, dtype="float32", location=rx.Location.ALL)
values = np.arange(12, dtype=np.float32).reshape(4, 3)
matrix.from_numpy_copy(values, target=rx.Location.ALL)
print(matrix.norm2())
Sparse matrices are CSR-only:
mesh = rx.RXMeshStatic("mesh.obj")
laplace_like = mesh.sparse_matrix(rx.Op.VV, dtype="float32")
row_ptr, col_idx, values = laplace_like.to_numpy_copy()
print(laplace_like.shape, laplace_like.nnz)
You can multiply sparse matrices by dense vectors:
x = np.ones((laplace_like.cols, 1), dtype=np.float32)
y = laplace_like.multiply_vector(x)
print(y.to_numpy_copy(source=rx.Location.HOST))
Solvers
RXMesh solver bindings work with SparseMatrix and DenseMatrix objects:
import numpy as np
import pyrxmesh as rx
row_ptr = np.array([0, 2, 5, 7], dtype=np.int32)
col_idx = np.array([0, 1, 0, 1, 2, 1, 2], dtype=np.int32)
values = np.array([4, 1, 1, 3, 1, 1, 2], dtype=np.float32)
A = rx.SparseMatrix.from_numpy_copy(row_ptr, col_idx, values,
shape=(3, 3), dtype="float32")
b = rx.DenseMatrix(3, 1, dtype="float32", location=rx.Location.ALL)
b.from_numpy_copy(np.array([[1], [2], [3]], dtype=np.float32))
solver = rx.CGSolver(A, unknown_dim=1)
x = solver.solve(b)
print(x.to_numpy_copy(source=rx.Location.HOST))
Documentation
- RXMeshDocs: RXMesh CUDA/C++ documentation website
- DEVELOPING.md: build PyRXMesh from source and work against RXMesh forks, tags, or local checkouts.
- CUSTOM_CUDA_PLUGINS.md: write small compiled CUDA plugins that operate on PyRXMesh meshes and attributes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrxmesh-0.2.1rc0.tar.gz.
File metadata
- Download URL: pyrxmesh-0.2.1rc0.tar.gz
- Upload date:
- Size: 84.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e2a185b3c5da837f9b25883aa822a600eaa539d73fcc4a386632ac7b7b42fab
|
|
| MD5 |
e4c1f7426c390c7a87f4ee91b3cdd08d
|
|
| BLAKE2b-256 |
71c630463ae404d0767be086cb81aaa75fb9101524cba58463261f1709a0aef4
|
Provenance
The following attestation bundles were made for pyrxmesh-0.2.1rc0.tar.gz:
Publisher:
wheels.yml on Ahdhn/PyRXMesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrxmesh-0.2.1rc0.tar.gz -
Subject digest:
1e2a185b3c5da837f9b25883aa822a600eaa539d73fcc4a386632ac7b7b42fab - Sigstore transparency entry: 1830583985
- Sigstore integration time:
-
Permalink:
Ahdhn/PyRXMesh@afd02143bf3c8d304353100e06508ff796b476e4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ahdhn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@afd02143bf3c8d304353100e06508ff796b476e4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyrxmesh-0.2.1rc0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: pyrxmesh-0.2.1rc0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 45.6 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f19dd91325c888406310d233975fac15b32d040b845fad63e5667e0707005cc3
|
|
| MD5 |
47d37c5a265b75acfea0a667a457eee1
|
|
| BLAKE2b-256 |
ebc3e772eb65a6bb51fa8a4fb4f1522d1ec0106f55e40687e71bfc784ee7149c
|
Provenance
The following attestation bundles were made for pyrxmesh-0.2.1rc0-cp312-cp312-win_amd64.whl:
Publisher:
wheels.yml on Ahdhn/PyRXMesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrxmesh-0.2.1rc0-cp312-cp312-win_amd64.whl -
Subject digest:
f19dd91325c888406310d233975fac15b32d040b845fad63e5667e0707005cc3 - Sigstore transparency entry: 1830584296
- Sigstore integration time:
-
Permalink:
Ahdhn/PyRXMesh@afd02143bf3c8d304353100e06508ff796b476e4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ahdhn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@afd02143bf3c8d304353100e06508ff796b476e4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyrxmesh-0.2.1rc0-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyrxmesh-0.2.1rc0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 46.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a17ea3d87df1d493c82c8be6933db582ca938deaf6c7f81dc033c3ff2477280
|
|
| MD5 |
bbc3a9612004abe12818d35ebf79535c
|
|
| BLAKE2b-256 |
f43de4978e6275c898157dc739ecb2fae08fa98f15723cc960a8153cbf532615
|
Provenance
The following attestation bundles were made for pyrxmesh-0.2.1rc0-cp312-cp312-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on Ahdhn/PyRXMesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrxmesh-0.2.1rc0-cp312-cp312-manylinux_2_28_x86_64.whl -
Subject digest:
7a17ea3d87df1d493c82c8be6933db582ca938deaf6c7f81dc033c3ff2477280 - Sigstore transparency entry: 1830584755
- Sigstore integration time:
-
Permalink:
Ahdhn/PyRXMesh@afd02143bf3c8d304353100e06508ff796b476e4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ahdhn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@afd02143bf3c8d304353100e06508ff796b476e4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyrxmesh-0.2.1rc0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: pyrxmesh-0.2.1rc0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 45.6 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dea1f28105706911c8374973c02e63f141c24a9c9aab69cdf6660d4595c793a2
|
|
| MD5 |
742cec07f79e7ffd26fcda098af08894
|
|
| BLAKE2b-256 |
257be6528ac2208d8dbbd305a3cd0fa9ba92c38cf948394803b6dde012bc5b92
|
Provenance
The following attestation bundles were made for pyrxmesh-0.2.1rc0-cp311-cp311-win_amd64.whl:
Publisher:
wheels.yml on Ahdhn/PyRXMesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrxmesh-0.2.1rc0-cp311-cp311-win_amd64.whl -
Subject digest:
dea1f28105706911c8374973c02e63f141c24a9c9aab69cdf6660d4595c793a2 - Sigstore transparency entry: 1830584501
- Sigstore integration time:
-
Permalink:
Ahdhn/PyRXMesh@afd02143bf3c8d304353100e06508ff796b476e4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ahdhn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@afd02143bf3c8d304353100e06508ff796b476e4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyrxmesh-0.2.1rc0-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyrxmesh-0.2.1rc0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 46.1 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6321f5508ab4ced9827a7d52f57a4b893609442049de6c1d05b2884774f208d7
|
|
| MD5 |
9cad03ad4b54c24034f8894bf3fe08bd
|
|
| BLAKE2b-256 |
b3a5fd01483839ba2c6009c24e5081af42bbd0c5bed62e857dc5904e9ae57a42
|
Provenance
The following attestation bundles were made for pyrxmesh-0.2.1rc0-cp311-cp311-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on Ahdhn/PyRXMesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrxmesh-0.2.1rc0-cp311-cp311-manylinux_2_28_x86_64.whl -
Subject digest:
6321f5508ab4ced9827a7d52f57a4b893609442049de6c1d05b2884774f208d7 - Sigstore transparency entry: 1830585363
- Sigstore integration time:
-
Permalink:
Ahdhn/PyRXMesh@afd02143bf3c8d304353100e06508ff796b476e4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ahdhn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@afd02143bf3c8d304353100e06508ff796b476e4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyrxmesh-0.2.1rc0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: pyrxmesh-0.2.1rc0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 45.6 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c5cc6595e80afc0d4929d31aede54760223617185e1139aa1c32404276b2496
|
|
| MD5 |
fb9c3aee639f2da677cad7bf5be00829
|
|
| BLAKE2b-256 |
ecdfca577532e6fa6742a29fb29dab1ef641a49f86096a55bebb9997885baa42
|
Provenance
The following attestation bundles were made for pyrxmesh-0.2.1rc0-cp310-cp310-win_amd64.whl:
Publisher:
wheels.yml on Ahdhn/PyRXMesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrxmesh-0.2.1rc0-cp310-cp310-win_amd64.whl -
Subject digest:
0c5cc6595e80afc0d4929d31aede54760223617185e1139aa1c32404276b2496 - Sigstore transparency entry: 1830585742
- Sigstore integration time:
-
Permalink:
Ahdhn/PyRXMesh@afd02143bf3c8d304353100e06508ff796b476e4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ahdhn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@afd02143bf3c8d304353100e06508ff796b476e4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyrxmesh-0.2.1rc0-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyrxmesh-0.2.1rc0-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 46.1 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed42959172d7c145e28098bf19d5239e5c6f42745a0a2a75a42a049f126701fc
|
|
| MD5 |
50c0bf0a7ac81fe34015bcb1e36c1001
|
|
| BLAKE2b-256 |
b0836b0e1b7dd1b471db92d96e94fd2d797316a6d21ef1a0e8f7c04e8892088c
|
Provenance
The following attestation bundles were made for pyrxmesh-0.2.1rc0-cp310-cp310-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on Ahdhn/PyRXMesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrxmesh-0.2.1rc0-cp310-cp310-manylinux_2_28_x86_64.whl -
Subject digest:
ed42959172d7c145e28098bf19d5239e5c6f42745a0a2a75a42a049f126701fc - Sigstore transparency entry: 1830584163
- Sigstore integration time:
-
Permalink:
Ahdhn/PyRXMesh@afd02143bf3c8d304353100e06508ff796b476e4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ahdhn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@afd02143bf3c8d304353100e06508ff796b476e4 -
Trigger Event:
workflow_dispatch
-
Statement type: