Skip to content

Commit

Permalink
Add Cargo features for selecting installed CUDA version.
Browse files Browse the repository at this point in the history
Use the features to gate on the API version and a (currently empty)
binding to the FP16 API.

Fix for stable rustc.
  • Loading branch information
peterhj committed Dec 10, 2018
1 parent 127043c commit d22d725
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,24 @@ keywords = ["GPGPU", "CUDA", "ffi"]
license = "MIT"
readme = "README.md"
categories = []

[features]
default = ["cuda_8_0"]
cuda_6_5 = []
cuda_7_0 = ["gte_cuda_7_0"]
cuda_7_5 = ["gte_cuda_7_0", "gte_cuda_7_5"]
cuda_8_0 = ["gte_cuda_7_0", "gte_cuda_7_5", "gte_cuda_8_0"]
cuda_9_0 = ["gte_cuda_7_0", "gte_cuda_7_5", "gte_cuda_8_0", "gte_cuda_9_0"]
cuda_9_1 = ["gte_cuda_7_0", "gte_cuda_7_5", "gte_cuda_8_0", "gte_cuda_9_0", "gte_cuda_9_1"]
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"]
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"]
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 = []

[dependencies]
static_assertions = "0.3.1"
Empty file added src/cuda_fp16.rs
Empty file.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#[macro_use] extern crate static_assertions;

pub mod cublas;
pub mod cuda;
pub mod cudart;
#[cfg(feature = "gte_cuda_8_0")]
pub mod cuda_fp16;
pub mod vector_types;

#[cfg(feature = "cuda_8_0")]
const_assert_eq!(cuda_8_0_api_version; cuda::__CUDA_API_VERSION, 8000);
#[cfg(feature = "cuda_8_0")]
const_assert_eq!(cuda_8_0_version; cuda::CUDA_VERSION, 8000);

#[test]
fn cuda_version() {
let mut d_ver = 0;
Expand Down

0 comments on commit d22d725

Please sign in to comment.