1 unstable release
new 0.1.0 | Jan 27, 2025 |
---|
#1031 in Hardware support
76 downloads per month
5KB
Code to make working with CUDA, via the CUDARC lib, easier.
This library abstracts over some of the boilerplate needed to use the Cudarc library, for using CUDA GPU compute in the rust language.
To use, create a build.rs
file like this:
//! We use this to automatically compile CUDA C++ code when building.
use cuda_setup::{build, GpuArchitecture};
fn main() {
// The second parameter is a list of paths to all kernels to compile.
build(GpuArchitecture::Rtx4, &vec!["src/cuda/cuda.cu", "src/cuda/util.cu"]);
}
Or if your application has CUDA feature-gated:
//! We use this to automatically compile CUDA C++ code when building.
#[cfg(feature = "cuda")]
use cuda_setup::{build, GpuArchitecture};
fn main() {
#[cfg(feature = "cuda")]
build(GpuArchitecture::Rtx4, &vec!["src/cuda/cuda.cu", "src/cuda/util.cu"]);
}
Include this in Cargo.toml
:
[dependencies]
cudarc = { version = "^0.13.3",features=["cuda-12060"] }
[build-dependencies]
cuda_setup = "^0.1.0"