GPU-accelerated, parallel implementation of Akima Splines
Project description
CudAkima: Parallel Akima Splines on GPUs
CudAkima is a Python package that offers a parallel, GPU-accelerated implementation of Akima Splines. The code also provides CPU support. The documentation is available here, while the code is hosted on GitHub.
Getting started:
Akima Splines are spline interpolants that tend to show smoother behaviors with respect to the widely used Cubic Splines. On the other hand, Akima Splines have a discontinuous second derivative.
Both scipy and cupy already offer implementations of Akima Splines. However, in these versions, the $x$ array along which the interpolation is performed can only be 1D. The main point behind the whole package is the fast, parallel interpolation of batches of arrays of different lengths. This is achieved by padding the1D arrays with NaN values and stacking them into multidimensional arrays.
In this implementation, the coefficients of the polynomials used for the interpolation are not stored in memory. For this reason, the package is particularly suited for applications where the arrays to perform the interpolation on keep changing (e.g., when doing parameter estimation on the location and amplitude of the spline knots). In this specific case, where $x$ and $y$ are matrices of different arrays, CudAkima results faster than a naive loop over the matrices using scipy (cupy) by a factor of $\sim 3$ ($\sim 20$) on CPUs (GPUs). This comparison can be found in the examples directory.
The interpolation scheme needs at least 4 finite points to work successfully. This caveat is due to the current boundary conditions. If this condition is not met (ie, the interpolation grid is made of less than 4 points), linear interpolation is used instead.
Here is a quick example of how to get started with the package:
from cudakima import AkimaInterpolant1D
interpolant = AkimaInterpolant1D()
Check out the examples directory for more info and comparisons.
Prerequisites:
CudAkima depends only on numba and numpy. It also requires cupy to be used on GPUs.
Installation
This project is managed by uv. uv can be installed with:
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# or with Homebrew
brew install uv
# or with pipx
pipx install uv
To set up the development environment, first clone the repository:
git clone https://github.com/asantini29/CudAkima.git
cd CudAkima
uv sync
This will create a virtual environment and install all necessary dependencies. Run your commands within this environment using
uv run <YOUR-COMMAND>
Versioning
We use SemVer for versioning.
Current Version: 0.2.2
Authors
- Alesandro Santini
Contributors
Get in touch if you would like to contribute!
Code TODO:
- extend documentation.
- look at different boundary conditions.
- work on a possible 2D interpolation.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Citing
If you use CudAkima in your research, you can cite it in the following way:
@software{cudakima_2024_13919394,
author = {Alessandro Santini},
title = {asantini29/CudAkima: First official release},
month = oct,
year = 2024,
publisher = {Zenodo},
version = {v0.2.2},
doi = {10.5281/zenodo.13919394},
url = {https://doi.org/10.5281/zenodo.13919394}
}
Aknowledgments
We thank Nikolaos Karnesis for discussions.
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 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 cudakima-0.2.3.tar.gz.
File metadata
- Download URL: cudakima-0.2.3.tar.gz
- Upload date:
- Size: 662.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9bc21532777d686e0c99fa0467c88e1796cb60875f12d8e7b552e49e07ab2d7
|
|
| MD5 |
a2925a277b3c5d611e31250c042f71ce
|
|
| BLAKE2b-256 |
2f74e7844bd452041fd679fd185f02cda793477783a9379d4e46406dc1f6d08a
|
Provenance
The following attestation bundles were made for cudakima-0.2.3.tar.gz:
Publisher:
publish.yml on asantini29/CudAkima
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cudakima-0.2.3.tar.gz -
Subject digest:
c9bc21532777d686e0c99fa0467c88e1796cb60875f12d8e7b552e49e07ab2d7 - Sigstore transparency entry: 995334608
- Sigstore integration time:
-
Permalink:
asantini29/CudAkima@31d63d4469135cb1f48244c7cd222d7415d641dc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/asantini29
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@31d63d4469135cb1f48244c7cd222d7415d641dc -
Trigger Event:
push
-
Statement type:
File details
Details for the file cudakima-0.2.3-py3-none-any.whl.
File metadata
- Download URL: cudakima-0.2.3-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cb7e3e593bcc9d1f26ec53a23c7db3e8c92c7cdea7f12c7929727fce96e66ea
|
|
| MD5 |
fcbb72005869a2f6b4d8de89ec194dfe
|
|
| BLAKE2b-256 |
c7427cd62bda7091e8ac140a4d7379d852a38c8e364c74a07066e81db50ed31e
|
Provenance
The following attestation bundles were made for cudakima-0.2.3-py3-none-any.whl:
Publisher:
publish.yml on asantini29/CudAkima
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cudakima-0.2.3-py3-none-any.whl -
Subject digest:
5cb7e3e593bcc9d1f26ec53a23c7db3e8c92c7cdea7f12c7929727fce96e66ea - Sigstore transparency entry: 995334655
- Sigstore integration time:
-
Permalink:
asantini29/CudAkima@31d63d4469135cb1f48244c7cd222d7415d641dc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/asantini29
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@31d63d4469135cb1f48244c7cd222d7415d641dc -
Trigger Event:
push
-
Statement type: