Crates.io | cuda_setup |
lib.rs | cuda_setup |
version | |
source | src |
created_at | 2025-01-27 19:56:35.491471+00 |
updated_at | 2025-03-08 19:07:39.37293+00 |
description | Assists with CUDA setup when using the CUDARC lib. |
homepage | |
repository | https://github.com/David-OConnor/cuda_setup |
max_upload_size | |
id | 1532805 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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.
// The first kernel passed must be the top-level one. All others are just to watch for changes to trigger
// a new compilation.
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"