Generate PyTorch Custom Operators from Numba-CUDA kernels
Project description
Pytorch-Numba Extension JIT
Writing custom CUDA operators in C and CPP can make certain operations significantly
more efficient, but requires setting up a full C++ project and involves a great deal of
boilerplate.
Writing CUDA kernels using numba-cuda is significantly easier, but incurs overhead on
every call, and still requires some boilerplate to integrate with the tracing systems
that underlie torch.compile.
However, many of the CUDA kernels that would be used for deep learning are relatively similar (read from a set of input arrays, write to output arrays). As such, most of the boilerplate and binding code for C++ extensions could be generated automatically.
This project aims to do exactly that: pnex.jit takes a Python function in the form of a Numba CUDA
kernel, along with some type annotations, and compiles a user-friendly and
highly-performant PyTorch C++ extension.
Additionally, if a convenient wrapper for PyTorch Custom Operators is all that is desired, this library also allows skipping the C++ compilation phase and only generating the boilerplate for a Custom Operator definition.
For an example usage of this package, see my other package pytorch-nd-semiconv
This package is listed on PyPi; it can be installed with
pip install pytorch-numba-extension-jit
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
Built Distribution
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 pytorch_numba_extension_jit-0.1.5.tar.gz.
File metadata
- Download URL: pytorch_numba_extension_jit-0.1.5.tar.gz
- Upload date:
- Size: 57.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.26
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
408624c0244f54f4b754dfcbf1ae1ff5fccd012e3ed9eed39223b7273e3e9992
|
|
| MD5 |
0815f97d02f50e3d26360a3e7fa3a348
|
|
| BLAKE2b-256 |
bde1b8fb8f9b69900380d17f21daa9a0f174443a75016ad68e477679f4fa7de8
|
File details
Details for the file pytorch_numba_extension_jit-0.1.5-py3-none-any.whl.
File metadata
- Download URL: pytorch_numba_extension_jit-0.1.5-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.26
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60dbe51d03ad66910762c5100f2625a48f190e2d2c4e84da7db61e75eaa20528
|
|
| MD5 |
f2d9d948b7bfdfbac38ad7120b05c45c
|
|
| BLAKE2b-256 |
2619fa6f310b63d55528e2d9345020db2c76f9e9ac6f378e852c346f2c43bb1a
|