PyRXMesh

PyRXMesh brings RXMesh GPU mesh processing to Python. PyRXMesh allows using Python and PyTorch to organize an application, while RXMesh accelerates the mesh processing and automatic differentiation on the GPU.
PyRXMesh provides:
- triangle meshes built from OBJ files or NumPy arrays
- vertex, edge, and face attributes on the host and GPU
- NumPy, SciPy, and PyTorch interoperability
- dense and sparse matrices and linear solvers
- small compiled plugins for custom RXMesh CUDA operations
- differentiable scalar energies that can be interop with PyTorch autograd.
Install
python -m pip install PyRXMesh
PyRXMesh needs an NVIDIA GPU and a driver compatible with the CUDA version in the wheel. PyTorch and SciPy are optional. Install SciPy normally, and choose the CUDA-enabled PyTorch build for your system from the PyTorch installation page.
Visualization is optional and it depends on Polyscope:
python -m pip install "PyRXMesh[viz]"
For a source build, see docs/DEVELOPING.md.
Create a mesh
Initialize RXMesh once, then load a mesh or build one from arrays:
import pyrxmesh as rx
rx.init(0) #0: GPU id
vertices, faces = rx.create_plane(32, 32, dx=0.05)
mesh = rx.RXMeshStatic(vertices, faces)
print(mesh.num_vertices, mesh.num_edges, mesh.num_faces)
velocity = mesh.add_vertex_attribute("velocity", dtype="float32", dim=3)
velocity.reset(0, "device")
RXMeshStatic("mesh.obj") loads an OBJ file. Mesh and attribute arrays use RXMesh linear order by default and maps are available when an application needs input/global order.
See examples/load_and_show.py for mesh inspection and Polyscope visualization, and the tests examples on mesh construction and export and attributes handling.
Automatic differentiation and PyTorch interop
A differentiable plugin defines one or more scalar energy terms as RXMesh CUDA lambdas. We provide a starter plugin/python module which creates an independent project with boilerplate code (pyproject.toml, CMakeLists.txt, etc) needed to compile the CUDA lambda function and build their python bindings:
python -m pyrxmesh.diff_plugin my_energy
The user writes their energy terms in .cu file. Once built, PyRXMesh evaluates its value and gradient on the GPU and exposes the result to PyTorch:
import torch
import my_energy
energy = my_energy.make_energy(mesh, {"weight": 0.5})
x = torch.as_tensor(
mesh.vertices(), dtype=torch.float32, device="cuda"
).requires_grad_()
loss = energy.torch(x)
loss.backward()
The gradient flows through whatever PyTorch computation produced x. For an optimizer that accepts a value and gradient directly, use energy.value_and_grad() instead of creating an autograd node.
The starter contains the CUDA term, Python package, build files, and run script. See Writing Differentiable Energy Plugins for the complete workflow, including query selection, fixed attributes, row order, and zero-copy input.
Exchange data with Python
Attributes are attached to vertices, edges, or faces. They use SoA layout by default and may have host storage, device storage, or both.
coords = mesh.input_vertex_coordinates()
host_view = coords.to_numpy("host") #Zero-copy numpy view
device_tensor = coords.to_torch("device") #Zero-copy pytorch view
owned_array = coords.to_numpy_copy(source="host") #deep copy
Unsuffixed to_* methods return a zero-copy view when supported. Methods ending in _copy return independent storage. Host and device allocations are separate; use attribute.move(source, target) when one side must receive changes from the other.
Mesh ordering maps, face arrays, and the Polyscope edge permutation are available directly from RXMeshStatic. See tests/test_core_mesh.py and tests/test_attributes.py for the supported operations.
Add custom CUDA operations
When an operation cannot be expressed efficiently from Python, generate a small plugin and write only the RXMesh device lambda:
python -m pyrxmesh.plugin my_kernels
The generated package builds against the PyRXMesh installation in the active environment. See Writing Custom CUDA Plugins and examples/custom_kernel_plugin.
Matrices and solvers
PyRXMesh exposes dense matrices, CSR sparse matrices, mesh-derived sparsity patterns, iterative solvers, and optional direct solvers. Dtypes, storage locations, matrix order, and mesh query patterns use short string arguments where they apply.
Documentation
Metadata
Release files for PyRXMesh 0.3.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 | |
|---|---|---|---|
| pyrxmesh-0.3.0.tar.gz | 131.5 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pyrxmesh-0.3.0-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| pyrxmesh-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.28+ x86-64 | Details |
| pyrxmesh-0.3.0-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| pyrxmesh-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.28+ x86-64 | Details |
| pyrxmesh-0.3.0-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details |
| pyrxmesh-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.28+ x86-64 | Details |
Total release size: 680.7 MB
Release files / pyrxmesh-0.3.0.tar.gz
| Download URL | pyrxmesh-0.3.0.tar.gz |
|---|---|
| Size | 131.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb1d85aee172c2495281abc7bae516d281313b036205a2dab22f652bafdf7a6b
|
|
BLAKE2b-256 checksum How to use checksums |
e018b654c083b3852956e0a94a403ea79ea554906f97cd2f7984e071700adc08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 14, 2026.
Transparency logRelease files / pyrxmesh-0.3.0-cp312-cp312-win_amd64.whl
| Download URL | pyrxmesh-0.3.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 130.7 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
22611daf8a7ce19c1d47ce6cf7be0dd4ae92c8f34e8714fdf88201795d0f48c8
|
|
BLAKE2b-256 checksum How to use checksums |
e808ef274f4e30b5aed1091035de121dcb44e95752309464fc90c9bff95fb915
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 14, 2026.
Transparency logRelease files / pyrxmesh-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | pyrxmesh-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 96.1 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
005bbe2cbea0cbb9489e2513957a06ce334ffdff66b52659f6aef5016c6e147d
|
|
BLAKE2b-256 checksum How to use checksums |
ac4399ec07d15b44c17757d488790a3fc670a20ee1b8ae5f8af2a2a59577cb34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 14, 2026.
Transparency logRelease files / pyrxmesh-0.3.0-cp311-cp311-win_amd64.whl
| Download URL | pyrxmesh-0.3.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 130.7 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
6deff8133e96f09ebd2269a4fea0b500b3bbfff5443dbb985c64130d7f2233bb
|
|
BLAKE2b-256 checksum How to use checksums |
1c2da6c303093f057a09f1ce42a7b209d29ad785ab43d6fe8bf2463f942a825d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 14, 2026.
Transparency logRelease files / pyrxmesh-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | pyrxmesh-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 96.1 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c2af6a82f54d11b7228aadb0fbba659066b0b2d8b502bf630a2de5285ec6f618
|
|
BLAKE2b-256 checksum How to use checksums |
829bbad3e73dcbb1270c11a882a4e64f809b2180f2f442b21e6c7200f8be7f59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 14, 2026.
Transparency logRelease files / pyrxmesh-0.3.0-cp310-cp310-win_amd64.whl
| Download URL | pyrxmesh-0.3.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 130.7 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
53d7914d5d2d321e4032b35988acb79f5207815135cb35a701a7f6b05c42685f
|
|
BLAKE2b-256 checksum How to use checksums |
f8b4b8411f76ac8084e313f29fd7d02c817cebe1bdab9208822fdcbde8e0d2e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 14, 2026.
Transparency logRelease files / pyrxmesh-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | pyrxmesh-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 96.1 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
64425a166acd46efdbfa96f9fc4e01ad2c37b15fb15beaf7cb20174060bfe515
|
|
BLAKE2b-256 checksum How to use checksums |
822869459df551b78cf365b736f5161aeff5ba0c25ce6c5074530272d05fea17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 14, 2026.
Transparency log