6 releases (3 breaking)

0.4.0-pre.2 Jun 18, 2019
0.4.0-pre.1 Mar 4, 2019
0.4.0-pre.0 Feb 14, 2019
0.3.0 Aug 31, 2018
0.1.0 Nov 8, 2016

#1518 in Hardware support


Used in 2 crates

MIT/Apache

1MB
27K SLoC

guppybot.org docs.rs

These are Rust bindings to the CUDA toolkit APIs.

The FFI bindings are done via bindgen and are substantially whitelisted; see build.rs for the whitelisted APIs. High-level wrappers are located in top-level modules (driver, runtime, blas, and rand).


lib.rs:

Cargo features

CUDA version features

There are often multiple versions of CUDA installed, and different programs may require different CUDA versions. Therefore it is important to ensure that the FFI bindings are for the desired version of CUDA.

There are several features that pin the API bindings to specific CUDA versions:

  • cuda_6_5, cuda_7_0, cuda_7_5, cuda_8_0, cuda_9_0, cuda_9_1, cuda_9_2, cuda_10_0, cuda_10_1

One and only one of these features must be set somewhere in the cargo dependency graph in order for the cuda crate to be used, otherwise the crate will force a compile-time error.

For further details on CUDA version compatibility, please see: https://docs.nvidia.com/deploy/cuda-compatibility/index.html.

Recommendations

It is recommended that binary crates specify one and only one of these version features, whereas library crates should specify no features.

Other Cargo features

  • cuda_sys: This features substitutes the FFI bindings auto-generated by bindgen with the bindings provided by the cuda_sys crate. As of cuda_sys v0.2.0, these bindings are specific to CUDA 8.0 only.

  • fresh: For maintainers of the crate itself. This feature generates fresh FFI bindings using bindgen from the build script.

Dependencies

~46–320KB