1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! dynamic linking of CUDA

#![cfg_attr(
    feature = "backtrace",
    feature(error_generic_member_access)
)]

pub mod api;
mod error;
mod ffi;
pub mod load;

pub use api::{CudaContext, CudaDevice};
pub use error::*;

#[cfg(test)]
mod tests {
    use crate::*;

    #[test]
    fn test_version() {
        let shlib = load::load().expect("load");
        let libcuda = api::init(&shlib).expect("cuda init");
        libcuda.init(0).expect("init");

        let version = libcuda.driver_get_version().expect("driver get version");
        println!("CUDA version {}", version);
    }
}