use crate::compat::*;
#[derive(Debug, Clone)]
pub enum CudaKernelError {
InvalidKernel(String),
InvalidInput(String),
LaunchError(String),
MemoryError(String),
Message(String),
}
impl fmt::Display for CudaKernelError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CudaKernelError::InvalidKernel(msg) => write!(f, "invalid kernel: {}", msg),
CudaKernelError::InvalidInput(msg) => write!(f, "invalid input: {}", msg),
CudaKernelError::LaunchError(msg) => write!(f, "launch error: {}", msg),
CudaKernelError::MemoryError(msg) => write!(f, "memory error: {}", msg),
CudaKernelError::Message(msg) => write!(f, "message: {}", msg),
}
}
}
#[cfg(feature = "std")]
impl std::error::Error for CudaKernelError {}
pub type Result<T> = core::result::Result<T, CudaKernelError>;