Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor initialize() #13

Closed
smedegaard opened this issue Nov 4, 2024 · 0 comments · Fixed by #15 or #126
Closed

refactor initialize() #13

smedegaard opened this issue Nov 4, 2024 · 0 comments · Fixed by #15 or #126

Comments

@smedegaard
Copy link
Owner

pub fn initialize() -> Result<()> {
    std::panic::catch_unwind(|| unsafe {
        let code = sys::hipInit(0);
        ((), code).to_result()
    })
    .unwrap_or_else(|_| Err(HipError::from_kind(HipErrorKind::InvalidValue))) // Map panic to InvalidValue error
}

This function does not panic when called twice. take it back to it's original form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant