Skip to main content

CudaError

Enum CudaError 

Source
pub enum CudaError {
Show 96 variants InvalidValue, OutOfMemory, NotInitialized, Deinitialized, ProfilerDisabled, ProfilerNotInitialized, ProfilerAlreadyStarted, ProfilerAlreadyStopped, StubLibrary, DeviceUnavailable, NoDevice, InvalidDevice, DeviceNotLicensed, InvalidImage, InvalidContext, ContextAlreadyCurrent, MapFailed, UnmapFailed, ArrayIsMapped, AlreadyMapped, NoBinaryForGpu, AlreadyAcquired, NotMapped, NotMappedAsArray, NotMappedAsPointer, EccUncorrectable, UnsupportedLimit, ContextAlreadyInUse, PeerAccessUnsupported, InvalidPtx, InvalidGraphicsContext, NvlinkUncorrectable, JitCompilerNotFound, UnsupportedPtxVersion, JitCompilationDisabled, UnsupportedExecAffinity, UnsupportedDevsideSync, InvalidSource, FileNotFound, SharedObjectSymbolNotFound, SharedObjectInitFailed, OperatingSystem, InvalidHandle, IllegalState, LossyQuery, NotFound, NotReady, IllegalAddress, LaunchOutOfResources, LaunchTimeout, LaunchIncompatibleTexturing, PeerAccessAlreadyEnabled, PeerAccessNotEnabled, PrimaryContextActive, ContextIsDestroyed, Assert, TooManyPeers, HostMemoryAlreadyRegistered, HostMemoryNotRegistered, HardwareStackError, IllegalInstruction, MisalignedAddress, InvalidAddressSpace, InvalidPc, LaunchFailed, CooperativeLaunchTooLarge, NotPermitted, NotSupported, SystemNotReady, SystemDriverMismatch, CompatNotSupportedOnDevice, MpsConnectionFailed, MpsRpcFailure, MpsServerNotReady, MpsMaxClientsReached, MpsMaxConnectionsReached, MpsClientTerminated, CdpNotSupported, CdpVersionMismatch, StreamCaptureUnsupported, StreamCaptureInvalidated, StreamCaptureMerge, StreamCaptureUnmatched, StreamCaptureUnjoined, StreamCaptureIsolation, StreamCaptureImplicit, CapturedEvent, StreamCaptureWrongThread, Timeout, GraphExecUpdateFailure, ExternalDevice, InvalidClusterSize, FunctionNotLoaded, InvalidResourceType, InvalidResourceConfiguration, Unknown(u32),
}
Expand description

Primary error type for CUDA driver API calls.

Each variant maps to a specific CUresult code from the CUDA Driver API. The Unknown variant is the catch-all for codes not explicitly listed.

Variants§

§

InvalidValue

CUDA_ERROR_INVALID_VALUE (1)

§

OutOfMemory

CUDA_ERROR_OUT_OF_MEMORY (2)

§

NotInitialized

CUDA_ERROR_NOT_INITIALIZED (3)

§

Deinitialized

CUDA_ERROR_DEINITIALIZED (4)

§

ProfilerDisabled

CUDA_ERROR_PROFILER_DISABLED (5)

§

ProfilerNotInitialized

CUDA_ERROR_PROFILER_NOT_INITIALIZED (6)

§

ProfilerAlreadyStarted

CUDA_ERROR_PROFILER_ALREADY_STARTED (7)

§

ProfilerAlreadyStopped

CUDA_ERROR_PROFILER_ALREADY_STOPPED (8)

§

StubLibrary

CUDA_ERROR_STUB_LIBRARY (34)

§

DeviceUnavailable

CUDA_ERROR_DEVICE_UNAVAILABLE (46)

§

NoDevice

CUDA_ERROR_NO_DEVICE (100)

§

InvalidDevice

CUDA_ERROR_INVALID_DEVICE (101)

§

DeviceNotLicensed

CUDA_ERROR_DEVICE_NOT_LICENSED (102)

§

InvalidImage

CUDA_ERROR_INVALID_IMAGE (200)

§

InvalidContext

CUDA_ERROR_INVALID_CONTEXT (201)

§

ContextAlreadyCurrent

CUDA_ERROR_CONTEXT_ALREADY_CURRENT (202)

§

MapFailed

CUDA_ERROR_MAP_FAILED (205)

§

UnmapFailed

CUDA_ERROR_UNMAP_FAILED (206)

§

ArrayIsMapped

CUDA_ERROR_ARRAY_IS_MAPPED (207)

§

AlreadyMapped

CUDA_ERROR_ALREADY_MAPPED (208)

§

NoBinaryForGpu

CUDA_ERROR_NO_BINARY_FOR_GPU (209)

§

AlreadyAcquired

CUDA_ERROR_ALREADY_ACQUIRED (210)

§

NotMapped

CUDA_ERROR_NOT_MAPPED (211)

§

NotMappedAsArray

CUDA_ERROR_NOT_MAPPED_AS_ARRAY (212)

§

NotMappedAsPointer

CUDA_ERROR_NOT_MAPPED_AS_POINTER (213)

§

EccUncorrectable

CUDA_ERROR_ECC_UNCORRECTABLE (214)

§

UnsupportedLimit

CUDA_ERROR_UNSUPPORTED_LIMIT (215)

§

ContextAlreadyInUse

CUDA_ERROR_CONTEXT_ALREADY_IN_USE (216)

§

PeerAccessUnsupported

CUDA_ERROR_PEER_ACCESS_UNSUPPORTED (217)

§

InvalidPtx

CUDA_ERROR_INVALID_PTX (218)

§

InvalidGraphicsContext

CUDA_ERROR_INVALID_GRAPHICS_CONTEXT (219)

§

NvlinkUncorrectable

CUDA_ERROR_NVLINK_UNCORRECTABLE (220)

§

JitCompilerNotFound

CUDA_ERROR_JIT_COMPILER_NOT_FOUND (221)

§

UnsupportedPtxVersion

CUDA_ERROR_UNSUPPORTED_PTX_VERSION (222)

§

JitCompilationDisabled

CUDA_ERROR_JIT_COMPILATION_DISABLED (223)

§

UnsupportedExecAffinity

CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY (224)

§

UnsupportedDevsideSync

CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC (225)

§

InvalidSource

CUDA_ERROR_INVALID_SOURCE (300)

§

FileNotFound

CUDA_ERROR_FILE_NOT_FOUND (301)

§

SharedObjectSymbolNotFound

CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND (302)

§

SharedObjectInitFailed

CUDA_ERROR_SHARED_OBJECT_INIT_FAILED (303)

§

OperatingSystem

CUDA_ERROR_OPERATING_SYSTEM (304)

§

InvalidHandle

CUDA_ERROR_INVALID_HANDLE (400)

§

IllegalState

CUDA_ERROR_ILLEGAL_STATE (401)

§

LossyQuery

CUDA_ERROR_LOSSY_QUERY (402)

§

NotFound

CUDA_ERROR_NOT_FOUND (500)

§

NotReady

CUDA_ERROR_NOT_READY (600)

§

IllegalAddress

CUDA_ERROR_ILLEGAL_ADDRESS (700)

§

LaunchOutOfResources

CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES (701)

§

LaunchTimeout

CUDA_ERROR_LAUNCH_TIMEOUT (702)

§

LaunchIncompatibleTexturing

CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING (703)

§

PeerAccessAlreadyEnabled

CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED (704)

§

PeerAccessNotEnabled

CUDA_ERROR_PEER_ACCESS_NOT_ENABLED (705)

§

PrimaryContextActive

CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE (708)

§

ContextIsDestroyed

CUDA_ERROR_CONTEXT_IS_DESTROYED (709)

§

Assert

CUDA_ERROR_ASSERT (710)

§

TooManyPeers

CUDA_ERROR_TOO_MANY_PEERS (711)

§

HostMemoryAlreadyRegistered

CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED (712)

§

HostMemoryNotRegistered

CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED (713)

§

HardwareStackError

CUDA_ERROR_HARDWARE_STACK_ERROR (714)

§

IllegalInstruction

CUDA_ERROR_ILLEGAL_INSTRUCTION (715)

§

MisalignedAddress

CUDA_ERROR_MISALIGNED_ADDRESS (716)

§

InvalidAddressSpace

CUDA_ERROR_INVALID_ADDRESS_SPACE (717)

§

InvalidPc

CUDA_ERROR_INVALID_PC (718)

§

LaunchFailed

CUDA_ERROR_LAUNCH_FAILED (719)

§

CooperativeLaunchTooLarge

CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE (720)

§

NotPermitted

CUDA_ERROR_NOT_PERMITTED (800)

§

NotSupported

CUDA_ERROR_NOT_SUPPORTED (801)

§

SystemNotReady

CUDA_ERROR_SYSTEM_NOT_READY (802)

§

SystemDriverMismatch

CUDA_ERROR_SYSTEM_DRIVER_MISMATCH (803)

§

CompatNotSupportedOnDevice

CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE (804)

§

MpsConnectionFailed

CUDA_ERROR_MPS_CONNECTION_FAILED (805)

§

MpsRpcFailure

CUDA_ERROR_MPS_RPC_FAILURE (806)

§

MpsServerNotReady

CUDA_ERROR_MPS_SERVER_NOT_READY (807)

§

MpsMaxClientsReached

CUDA_ERROR_MPS_MAX_CLIENTS_REACHED (808)

§

MpsMaxConnectionsReached

CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED (809)

§

MpsClientTerminated

CUDA_ERROR_MPS_CLIENT_TERMINATED (810)

§

CdpNotSupported

CUDA_ERROR_CDP_NOT_SUPPORTED (811)

§

CdpVersionMismatch

CUDA_ERROR_CDP_VERSION_MISMATCH (812)

§

StreamCaptureUnsupported

CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED (900)

§

StreamCaptureInvalidated

CUDA_ERROR_STREAM_CAPTURE_INVALIDATED (901)

§

StreamCaptureMerge

CUDA_ERROR_STREAM_CAPTURE_MERGE (902)

§

StreamCaptureUnmatched

CUDA_ERROR_STREAM_CAPTURE_UNMATCHED (903)

§

StreamCaptureUnjoined

CUDA_ERROR_STREAM_CAPTURE_UNJOINED (904)

§

StreamCaptureIsolation

CUDA_ERROR_STREAM_CAPTURE_ISOLATION (905)

§

StreamCaptureImplicit

CUDA_ERROR_STREAM_CAPTURE_IMPLICIT (906)

§

CapturedEvent

CUDA_ERROR_CAPTURED_EVENT (907)

§

StreamCaptureWrongThread

CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD (908)

§

Timeout

CUDA_ERROR_TIMEOUT (909)

§

GraphExecUpdateFailure

CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE (910)

§

ExternalDevice

CUDA_ERROR_EXTERNAL_DEVICE (911)

§

InvalidClusterSize

CUDA_ERROR_INVALID_CLUSTER_SIZE (912)

§

FunctionNotLoaded

CUDA_ERROR_FUNCTION_NOT_LOADED (913)

§

InvalidResourceType

CUDA_ERROR_INVALID_RESOURCE_TYPE (914)

§

InvalidResourceConfiguration

CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION (915)

§

Unknown(u32)

Unknown error code not covered by any other variant.

Implementations§

Source§

impl CudaError

Source

pub fn from_raw(code: u32) -> Self

Convert a raw CUresult code into the corresponding CudaError variant.

This should not be called with CUDA_SUCCESS (0); prefer using check which returns Ok(()) for success.

Source

pub fn is_fatal(&self) -> bool

Returns true for errors that indicate a fatal, non-recoverable GPU state — meaning the current CUDA context is likely corrupted and should be destroyed before attempting further GPU work.

§Rationale

Most CUDA errors are caused by incorrect API usage (e.g. bad argument, unsupported feature) and do not invalidate the GPU context. A small subset — hardware faults, illegal instructions, or illegal memory accesses — leave the device in an indeterminate state.

§Examples
use oxicuda_driver::CudaError;

// Hardware fault — fatal
assert!(CudaError::IllegalAddress.is_fatal());
assert!(CudaError::LaunchFailed.is_fatal());
assert!(CudaError::HardwareStackError.is_fatal());

// Bad argument — recoverable
assert!(!CudaError::InvalidValue.is_fatal());
assert!(!CudaError::OutOfMemory.is_fatal());
assert!(!CudaError::NotReady.is_fatal());
Source

pub fn is_usage_error(&self) -> bool

Returns true for errors that are clearly caused by incorrect API usage rather than hardware faults or resource exhaustion.

These errors indicate the caller passed bad arguments and the GPU state is intact.

use oxicuda_driver::CudaError;

assert!(CudaError::InvalidValue.is_usage_error());
assert!(CudaError::InvalidDevice.is_usage_error());
assert!(!CudaError::OutOfMemory.is_usage_error());
Source

pub fn as_raw(&self) -> u32

Convert this error back to its raw CUresult code.

Trait Implementations§

Source§

impl Clone for CudaError

Source§

fn clone(&self) -> CudaError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CudaError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CudaError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for CudaError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl Hash for CudaError

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CudaError

Source§

fn eq(&self, other: &CudaError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for CudaError

Source§

impl Eq for CudaError

Source§

impl StructuralPartialEq for CudaError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more