Skip to content
This repository was archived by the owner on Mar 29, 2025. It is now read-only.

Commit d22d725

Browse files
committed
Add Cargo features for selecting installed CUDA version.
Use the features to gate on the API version and a (currently empty) binding to the FP16 API. Fix for stable rustc.
1 parent 127043c commit d22d725

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

Cargo.toml

+21
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,24 @@ keywords = ["GPGPU", "CUDA", "ffi"]
1313
license = "MIT"
1414
readme = "README.md"
1515
categories = []
16+
17+
[features]
18+
default = ["cuda_8_0"]
19+
cuda_6_5 = []
20+
cuda_7_0 = ["gte_cuda_7_0"]
21+
cuda_7_5 = ["gte_cuda_7_0", "gte_cuda_7_5"]
22+
cuda_8_0 = ["gte_cuda_7_0", "gte_cuda_7_5", "gte_cuda_8_0"]
23+
cuda_9_0 = ["gte_cuda_7_0", "gte_cuda_7_5", "gte_cuda_8_0", "gte_cuda_9_0"]
24+
cuda_9_1 = ["gte_cuda_7_0", "gte_cuda_7_5", "gte_cuda_8_0", "gte_cuda_9_0", "gte_cuda_9_1"]
25+
cuda_9_2 = ["gte_cuda_7_0", "gte_cuda_7_5", "gte_cuda_8_0", "gte_cuda_9_0", "gte_cuda_9_1", "gte_cuda_9_2"]
26+
cuda_10_0 = ["gte_cuda_7_0", "gte_cuda_7_5", "gte_cuda_8_0", "gte_cuda_9_0", "gte_cuda_9_1", "gte_cuda_9_2", "gte_cuda_10_0"]
27+
gte_cuda_7_0 = []
28+
gte_cuda_7_5 = []
29+
gte_cuda_8_0 = []
30+
gte_cuda_9_0 = []
31+
gte_cuda_9_1 = []
32+
gte_cuda_9_2 = []
33+
gte_cuda_10_0 = []
34+
35+
[dependencies]
36+
static_assertions = "0.3.1"

src/cuda_fp16.rs

Whitespace-only changes.

src/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
#[macro_use] extern crate static_assertions;
2+
13
pub mod cublas;
24
pub mod cuda;
35
pub mod cudart;
6+
#[cfg(feature = "gte_cuda_8_0")]
7+
pub mod cuda_fp16;
48
pub mod vector_types;
59

10+
#[cfg(feature = "cuda_8_0")]
11+
const_assert_eq!(cuda_8_0_api_version; cuda::__CUDA_API_VERSION, 8000);
12+
#[cfg(feature = "cuda_8_0")]
13+
const_assert_eq!(cuda_8_0_version; cuda::CUDA_VERSION, 8000);
14+
615
#[test]
716
fn cuda_version() {
817
let mut d_ver = 0;

0 commit comments

Comments
 (0)