Skip to content

Commit

Permalink
#217 Replace unwrap with ? in CudaDevice::new() (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
coreylowman authored May 1, 2024
1 parent 64ddbc7 commit d565d8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/driver/safe/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ unsafe impl Sync for CudaDevice {}
impl CudaDevice {
/// Creates a new [CudaDevice] on device index `ordinal`.
pub fn new(ordinal: usize) -> Result<Arc<Self>, result::DriverError> {
result::init().unwrap();
result::init()?;

let cu_device = result::device::get(ordinal as i32).unwrap();
let cu_device = result::device::get(ordinal as i32)?;

// primary context initialization, can fail with OOM
let cu_primary_ctx = unsafe { result::primary_ctx::retain(cu_device) }?;
Expand Down

0 comments on commit d565d8c

Please sign in to comment.