pub mod context;

pub use context::{
    GPU_STATE, GpuContext, GpuState, gpu_init, gpu_state, gpu_state_or_panic, gpu_thread_init,
};

pub mod wavefront;

use thiserror::Error;

#[derive(Error, Debug)]
pub enum GpuError {
    #[error("CUDA driver error: {0}")]
    Driver(#[from] cudarc::driver::DriverError),
    #[error("No GPU context initialized")]
    NoContext,
}

pub fn gpu_unwrap() -> &'static GpuContext {
    context::GPU_STATE.get().expect("GPU not initialized")
}
