MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / new

Method new

crates/cudnn/src/context.rs:59–68  ·  view source on GitHub ↗

Creates a new cuDNN context, allocating the required memory on both host and device. # Examples ``` # use std::error::Error; # # fn main() -> Result<(), Box > { use cudnn::CudnnContext; let ctx = CudnnContext::new()?; # Ok(()) # } ```

()

Source from the content-addressed store, hash-verified

57 /// # }
58 /// ```
59 pub fn new() -> Result<Self, CudnnError> {
60 let mut raw = MaybeUninit::uninit();
61
62 unsafe {
63 sys::cudnnCreate(raw.as_mut_ptr()).into_result()?;
64 let raw = raw.assume_init();
65
66 Ok(Self { raw })
67 }
68 }
69
70 /// Returns the version number of the underlying cuDNN library.
71 pub fn version(&self) -> (u32, u32, u32) {

Callers

nothing calls this directly

Calls 2

into_resultMethod · 0.45
as_mut_ptrMethod · 0.45

Tested by

no test coverage detected