GPU prefetching
A minimal package for GPU prefetching from disk.
Installation 🚀
pip install --upgrade pip uv
uv pip install gpuprefetch
Usage 🔥
The snippet below show how to easily instantiate our prefetching.
from gpuprefetch import Prefetcher
# By default, we do not install jax,
# you need to install it separately if you want to use our converter.
from gpuprefetch.converter import cupy_to_jax
def my_loader():
# Replace with your real disk I/O
return np.random.rand(64, 64, 3).astype(np.float32)
with Prefetcher(
loader=my_loader, # The callable loading the data
# (e.g., from disk)
dtype=cp.float32, # Type of data.
shape=(64,64,3), # Shape of the data for pre-allocation.
capacity=100, # Buffer size.
# The larger, the higher the memory
# consumption but the lower the latency.
device="cuda:0", # Where you want your data to be loaded.
# We currently support only cuda devices.
post=cupy_to_jax, # By default, we return a cupy array.
# You can use one of our efficient converters
# on the returned value, pass it as `post`
# argument, or pass a custom callable.
# We use it as: return post(data)
nworkers=32, # We spawn nworkers processes to concurrently
# fill the queue.
) as loader_with_prefetching:
# Inside this block, the workers are active and they are safely
# killed on exit.
# You can access the pre-fetched data with:
prefetched_data = next(loader_with_prefetching)
Citation ☕️
If this was useful in your research software, you can cite this work as:
@software{terpin2025gpuprefetching,
author = {Terpin, Antonio},
title = {A minimal GPU prefetching package.},
year = {2025},
version = {1.0.0},
url = {https://github.com/antonioterpin/gpu-prefetch},
}
Metadata
Release files for gpuprefetch 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 | Provenance | Actions |
|---|---|---|---|---|
| gpuprefetch-0.1.0.tar.gz | 5.6 kB | Without provenance | Details for gpuprefetch-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gpuprefetch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for gpuprefetch-0.1.0-py3-none-any.whl |
Total release size: 11.9 kB
Release files / gpuprefetch-0.1.0.tar.gz
| Download URL | gpuprefetch-0.1.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
415add77fee3ebbdd8463e7c16e93ac2fc7cdb7676bfdb1eabedf32ac1383932
|
|
BLAKE2b-256 checksum How to use checksums |
cda317327080180ae8191f23f304676e799bebd8d5e4980d23b551d9104a80f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Release files / gpuprefetch-0.1.0-py3-none-any.whl
| Download URL | gpuprefetch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
238c93a93654b6dee27f57672cd60041dcb0f632e336278ec6858b272f890e49
|
|
BLAKE2b-256 checksum How to use checksums |
0eb22a0b2349014ee15ea81076406271d0c84b778c5ce42a15ad8d2ecc0d9e93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Security for gpuprefetch 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.