cuda_setup

Crates.iocuda_setup
lib.rscuda_setup
version
sourcesrc
created_at2025-01-27 19:56:35.491471+00
updated_at2025-03-08 19:07:39.37293+00
descriptionAssists with CUDA setup when using the CUDARC lib.
homepage
repositoryhttps://github.com/David-OConnor/cuda_setup
max_upload_size
id1532805
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`
size0
David O'Connor (David-OConnor)

documentation

https://docs.rs/cuda_setup

README

Code to make working with CUDA, via the CUDARC lib, easier.

Crate Docs

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"
Commit count: 3

cargo fmt