CUDA Batch Integration Engine.
Project description
CuBIE
CUDA batch integration engine for python
A batch integration system for numerically integarating many systems of ODEs in parallel, for when elegant solutions fail and you would like to simulate 1,000,000 systems, fast. Cubie is a tool that performs the equivalent of MATLABs ODE functions (ode45 and the like), Scipy's solve_ivp function, or some of the functions in Julia's SciML/OrdinaryDiffEq. This package was designed to simulate a large electrophysiological model as part of a likelihood-free inference method (eventually, package [cubism]), but the machinery is domain-agnostic.
This library uses Numba to JIT-compile CUDA kernels, allowing you the speed of compiled CUDA code without the headache of writing CUDA code. It is designed to have a reasonably MATLAB- or SciPy-like interface, so that you can get up and running without having to figure out the intricacies of the internal mechanics.
The batch solving interface is not yet completely stable, and some parameters/arguments are likely to change further through to v1.0. The core (per-parameter-set) machinery is reasonably stable. As of v0.0.6, you can:
- Set up and solve large parameter/initial condition sweeps of a system defined by a set of ODEs, entered either as:
- A string or list of strings containing the equations of the system
- A python function (not well tested yet)
- A CellML model (tested on a subset of models in the CellML library so far)
- Use any of a large set of explicit or implicit runge-kutta or rosenbrock methods to integrate the problem.
- Extract the solution for any variable or
observableat any time point, or extract summary statistics only to speed things up. - Provide
forcing termsby including a function of t in your equations, or by providing an array of values for the system to interpolate. - Select from a handful of step-size control algorithms when using an adaptive-step algorithm like RK45 or RadauIIA5.
v0.0.6 also includes a few major milestones, the most significant of which is numerical validation of the methods against results from the OrdinaryDiffEq suite of solvers. All algorithms are now validated and have been partially optimized to compete with the really fast solvers in Julia DiffEqGPU.jl and some other GPU-accelerated packages that are either written in a tricky language or use some pretty rigid interfaces. Other changes are largely internal, but all contribute to a more cohesive and abuse-tolerant package. I intend to publish some comparisons moving forward, watch this space.
Roadmap:
- v0.0.7: API improvements. This version should be stable enough for use in research - I will be using it in mine.
- Remove the distinction between 'observables' and 'state' from the user-facing arguments requesting variable saving.
- Separate summary variable timing from save timing.
- Add time-logging for user visibility of codegen-compile-run times.
- v0.1.0: Documentation to match the API, organised in the sane way that a robot does not.
- User guide brought up-to-date with API, tracing an example through a few integration scenarios.
Documentation:
https://ccam80.github.io/cubie/
Installation:
We recommend that you use a python virtual environment to install Cubie - some dependencies are pinned to a specific version, so installing it in it's own environment will avoid downgrading your system-wide packages and interfering with other projects.
python -m venv cubie_env
./cubie_env/Scripts/activate # Windows
# source cubie_env/bin/activate # Linux/Mac
pip install cubie
Then, when you fire up your Cubie project, run
source cubie_env/bin/activate
Or set up your IDE to use the python.exe in cubie_env/Scripts/activate (Windows) or cubie_env/bin/activate (Linux/Mac)
as the project's interpreter so you don't have to worry about it.
System Requirements:
- Python 3.10 or later
- CUDA Toolkit 12.9 or later
- NVIDIA GPU with compute capability 6.0 or higher (i.e. GTX10-series or newer)
Python Requirements
- Python >= 3.10
- NumPy==1.26.4
- Numba
- Numba-CUDA
- attrs
- SymPy >= 1.13.0
Optional Dependencies
Install these using pip install cubie[optional]
- Cupy-cu12x: For pool-based memory management (if you're doing a lot of consecutive batches of different sizes)
- Pandas: For DataFrame output support
- Matplotlib: For plotting support. Only used to plot an interpolated driver function for sanity-checks (see
:doc:
Drivers <user_guide/drivers>), but generally useful for visualizing results.
Contributing:
Pull requests are very, very welcome! Please open an issue if you would like to discuss a feature or bug before doing a bunch of work on it, as I may have already partially implemented it or at least figured out where it might fit. For v0.1.0 I will get some more descriptive documentation of the architecture in place.
Project Goals:
- Make an engine and interface for batch integration that is close enough to MATLAB or SciPy that a Python beginner can get integrating with the documentation alone in an hour or two. This also means staying Windows-compatible.
- Perform integrations of 10 or more parallel systems faster than MATLAB or SciPy can
- Enable extraction of summary variables only (rather than saving time-domain outputs) to facilitate use in algorithms like likelihood-free inference.
- Be extensible enough that users can add their own systems and algorithms without needing to go near the core machinery.
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 cubie-0.0.6.tar.gz.
File metadata
- Download URL: cubie-0.0.6.tar.gz
- Upload date:
- Size: 275.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7e90410e3b876c600fdb82c4545a4b021889a5fa96ef0450324a913ab73aaed
|
|
| MD5 |
ba485b9f73e7f424fc07477689a7be2c
|
|
| BLAKE2b-256 |
b5237d12d27f66000bbc7e419ec5f0965b1b0e53276c3054766288e799feba16
|
Provenance
The following attestation bundles were made for cubie-0.0.6.tar.gz:
Publisher:
pypi.yml on ccam80/cubie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cubie-0.0.6.tar.gz -
Subject digest:
d7e90410e3b876c600fdb82c4545a4b021889a5fa96ef0450324a913ab73aaed - Sigstore transparency entry: 780069134
- Sigstore integration time:
-
Permalink:
ccam80/cubie@e67da0cc5438829dbadd828697b22eaff1cecfc2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ccam80
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@e67da0cc5438829dbadd828697b22eaff1cecfc2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file cubie-0.0.6-py3-none-any.whl.
File metadata
- Download URL: cubie-0.0.6-py3-none-any.whl
- Upload date:
- Size: 337.2 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 |
768c020dcad7f4e178655f951f9916ec3e2495ad5b4dacc9bafb09ac3fb91ca9
|
|
| MD5 |
6af87580127bec07801c272da03469b2
|
|
| BLAKE2b-256 |
da414a064f99f64e25d087596a006e0ae55021668b8d20f71c6ac3bc2e663628
|
Provenance
The following attestation bundles were made for cubie-0.0.6-py3-none-any.whl:
Publisher:
pypi.yml on ccam80/cubie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cubie-0.0.6-py3-none-any.whl -
Subject digest:
768c020dcad7f4e178655f951f9916ec3e2495ad5b4dacc9bafb09ac3fb91ca9 - Sigstore transparency entry: 780069136
- Sigstore integration time:
-
Permalink:
ccam80/cubie@e67da0cc5438829dbadd828697b22eaff1cecfc2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ccam80
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@e67da0cc5438829dbadd828697b22eaff1cecfc2 -
Trigger Event:
workflow_dispatch
-
Statement type: