Exception objects for errors from the GPU runtime API. More...
Classes | |
class | sp::CudaException |
Base class for exception types that wrap CUDA error codes. More... | |
class | sp::CudaMissingConfigurationException |
Exception corresponding to cudaErrorMissingConfiguration of cudaError . More... | |
class | sp::CudaMemoryAllocationException |
Exception corresponding to cudaErrorMemoryAllocation of cudaError . More... | |
class | sp::CudaInitializationErrorException |
Exception corresponding to cudaErrorInitializationError of cudaError . More... | |
class | sp::CudaLaunchFailureException |
Exception corresponding to cudaErrorLaunchFailure of cudaError . More... | |
class | sp::CudaPriorLaunchFailureException |
Exception corresponding to cudaErrorPriorLaunchFailure of cudaError . More... | |
class | sp::CudaLaunchTimeoutException |
Exception corresponding to cudaErrorLaunchTimeout of cudaError . More... | |
class | sp::CudaLaunchOutOfResourcesException |
Exception corresponding to cudaErrorLaunchOutOfResources of cudaError . More... | |
class | sp::CudaInvalidDeviceFunctionException |
Exception corresponding to cudaErrorInvalidDeviceFunction of cudaError . More... | |
class | sp::CudaInvalidConfigurationException |
Exception corresponding to cudaErrorInvalidConfiguration of cudaError . More... | |
class | sp::CudaInvalidDeviceException |
Exception corresponding to cudaErrorInvalidDevice of cudaError . More... | |
class | sp::CudaInvalidValueException |
Exception corresponding to cudaErrorInvalidValue of cudaError . More... | |
class | sp::CudaInvalidPitchValueException |
Exception corresponding to cudaErrorInvalidPitchValue of cudaError . More... | |
class | sp::CudaInvalidSymbolException |
Exception corresponding to cudaErrorInvalidSymbol of cudaError . More... | |
class | sp::CudaMapBufferObjectFailedException |
Exception corresponding to cudaErrorMapBufferObjectFailed of cudaError . More... | |
class | sp::CudaUnmapBufferObjectFailedException |
Exception corresponding to cudaErrorUnmapBufferObjectFailed of cudaError . More... | |
class | sp::CudaInvalidHostPointerException |
Exception corresponding to cudaErrorInvalidHostPointer of cudaError . More... | |
class | sp::CudaInvalidDevicePointerException |
Exception corresponding to cudaErrorInvalidDevicePointer of cudaError . More... | |
class | sp::CudaInvalidTextureException |
Exception corresponding to cudaErrorInvalidTexture of cudaError . More... | |
class | sp::CudaInvalidTextureBindingException |
Exception corresponding to cudaErrorInvalidTextureBinding of cudaError . More... | |
class | sp::CudaInvalidChannelDescriptorException |
Exception corresponding to cudaErrorInvalidChannelDescriptor of cudaError . More... | |
class | sp::CudaInvalidMemcpyDirectionException |
Exception corresponding to cudaErrorInvalidMemcpyDirection of cudaError . More... | |
class | sp::CudaAddressOfConstantException |
Exception corresponding to cudaErrorAddressOfConstant of cudaError . More... | |
class | sp::CudaTextureFetchFailedException |
Exception corresponding to cudaErrorTextureFetchFailed of cudaError . More... | |
class | sp::CudaTextureNotBoundException |
Exception corresponding to cudaErrorTextureNotBound of cudaError . More... | |
class | sp::CudaSynchronizationErrorException |
Exception corresponding to cudaErrorSynchronizationError of cudaError . More... | |
class | sp::CudaInvalidFilterSettingException |
Exception corresponding to cudaErrorInvalidFilterSetting of cudaError . More... | |
class | sp::CudaInvalidNormSettingException |
Exception corresponding to cudaErrorInvalidNormSetting of cudaError . More... | |
class | sp::CudaMixedDeviceExecutionException |
Exception corresponding to cudaErrorMixedDeviceExecution of cudaError . More... | |
class | sp::CudaUnknownException |
Exception corresponding to cudaErrorUnknown of cudaError . More... | |
class | sp::CudaNotYetImplementedException |
Exception corresponding to cudaErrorNotYetImplemented of cudaError . More... | |
class | sp::CudaMemoryValueTooLargeException |
Exception corresponding to cudaErrorMemoryValueTooLarge of cudaError . More... | |
class | sp::CudaInvalidResourceHandleException |
Exception corresponding to cudaErrorInvalidResourceHandle of cudaError . More... | |
class | sp::CudaNotReadyException |
Exception corresponding to cudaErrorNotReady of cudaError . More... | |
class | sp::CudaInsufficientDriverException |
Exception corresponding to cudaErrorInsufficientDriver of cudaError . More... | |
class | sp::CudaSetOnActiveProcessException |
Exception corresponding to cudaErrorSetOnActiveProcess of cudaError . More... | |
class | sp::CudaInvalidSurfaceException |
Exception corresponding to cudaErrorInvalidSurface of cudaError . More... | |
class | sp::CudaNoDeviceException |
Exception corresponding to cudaErrorNoDevice of cudaError . More... | |
class | sp::CudaECCUncorrectableException |
Exception corresponding to cudaErrorECCUncorrectable of cudaError . More... | |
class | sp::CudaSharedObjectSymbolNotFoundException |
Exception corresponding to cudaErrorSharedObjectSymbolNotFound of cudaError . More... | |
class | sp::CudaSharedObjectInitFailedException |
Exception corresponding to cudaErrorSharedObjectInitFailed of cudaError . More... | |
class | sp::CudaUnsupportedLimitException |
Exception corresponding to cudaErrorUnsupportedLimit of cudaError . More... | |
class | sp::CudaDuplicateVariableNameException |
Exception corresponding to cudaErrorDuplicateVariableName of cudaError . More... | |
class | sp::CudaDuplicateTextureNameException |
Exception corresponding to cudaErrorDuplicateTextureName of cudaError . More... | |
class | sp::CudaDuplicateSurfaceNameException |
Exception corresponding to cudaErrorDuplicateSurfaceName of cudaError . More... | |
class | sp::CudaDevicesUnavailableException |
Exception corresponding to cudaErrorDevicesUnavailable of cudaError . More... | |
class | sp::CudaInvalidKernelImageException |
Exception corresponding to cudaErrorInvalidKernelImage of cudaError . More... | |
class | sp::CudaNoKernelImageForDeviceException |
Exception corresponding to cudaErrorNoKernelImageForDevice of cudaError . More... | |
class | sp::CudaIncompatibleDriverContextException |
Exception corresponding to cudaErrorIncompatibleDriverContext of cudaError . More... | |
class | sp::CudaPeerAccessAlreadyEnabledException |
Exception corresponding to cudaErrorPeerAccessAlreadyEnabled of cudaError . More... | |
class | sp::CudaPeerAccessNotEnabledException |
Exception corresponding to cudaErrorPeerAccessNotEnabled of cudaError . More... | |
class | sp::CudaDeviceAlreadyInUseException |
Exception corresponding to cudaErrorDeviceAlreadyInUse of cudaError . More... | |
class | sp::CudaProfilerDisabledException |
Exception corresponding to cudaErrorProfilerDisabled of cudaError . More... | |
class | sp::CudaProfilerNotInitializedException |
Exception corresponding to cudaErrorProfilerNotInitialized of cudaError . More... | |
class | sp::CudaProfilerAlreadyStartedException |
Exception corresponding to cudaErrorProfilerAlreadyStarted of cudaError . More... | |
class | sp::CudaProfilerAlreadyStoppedException |
Exception corresponding to cudaErrorProfilerAlreadyStopped of cudaError . More... | |
class | sp::CudaAssertException |
Exception corresponding to cudaErrorAssert of cudaError . More... | |
class | sp::CudaTooManyPeersException |
Exception corresponding to cudaErrorTooManyPeers of cudaError . More... | |
class | sp::CudaHostMemoryAlreadyRegisteredException |
Exception corresponding to cudaErrorHostMemoryAlreadyRegistered of cudaError . More... | |
class | sp::CudaHostMemoryNotRegisteredException |
Exception corresponding to cudaErrorHostMemoryNotRegistered of cudaError . More... | |
class | sp::CudaOperatingSystemException |
Exception corresponding to cudaErrorOperatingSystem of cudaError . More... | |
class | sp::CudaPeerAccessUnsupportedException |
Exception corresponding to cudaErrorPeerAccessUnsupported of cudaError . More... | |
class | sp::CudaLaunchMaxDepthExceededException |
Exception corresponding to cudaErrorLaunchMaxDepthExceeded of cudaError . More... | |
class | sp::CudaLaunchFileScopedTexException |
Exception corresponding to cudaErrorLaunchFileScopedTex of cudaError . More... | |
class | sp::CudaLaunchFileScopedSurfException |
Exception corresponding to cudaErrorLaunchFileScopedSurf of cudaError . More... | |
class | sp::CudaSyncDepthExceededException |
Exception corresponding to cudaErrorSyncDepthExceeded of cudaError . More... | |
class | sp::CudaLaunchPendingCountExceededException |
Exception corresponding to cudaErrorLaunchPendingCountExceeded of cudaError . More... | |
class | sp::CudaNotPermittedException |
Exception corresponding to cudaErrorNotPermitted of cudaError . More... | |
class | sp::CudaNotSupportedException |
Exception corresponding to cudaErrorNotSupported of cudaError . More... | |
class | sp::CudaHardwareStackErrorException |
Exception corresponding to cudaErrorHardwareStackError of cudaError . More... | |
class | sp::CudaInstructionFailureException |
Exception corresponding to cudaErrorIllegalInstruction of cudaError . More... | |
class | sp::CudaMisalignedAddressException |
Exception corresponding to cudaErrorMisalignedAddress of cudaError . More... | |
class | sp::CudaInvalidAddressSpaceException |
Exception corresponding to cudaErrorInvalidAddressSpace of cudaError . More... | |
class | sp::CudaInvalidPcException |
Exception corresponding to cudaErrorInvalidPc of cudaError . More... | |
class | sp::CudaIllegalAddressException |
Exception corresponding to cudaErrorIllegalAddress of cudaError . More... | |
class | sp::CudaInvalidPtxException |
Exception corresponding to cudaErrorInvalidPtx of cudaError . More... | |
class | sp::CudaInvalidGraphicsContextException |
Exception corresponding to cudaErrorInvalidGraphicsContext of cudaError . More... | |
class | sp::CudaNvlinkUncorrectableException |
Exception corresponding to cudaErrorNvlinkUncorrectable of cudaError . More... | |
class | sp::CudaStartupFailureException |
Exception corresponding to cudaErrorStartupFailure of cudaError . More... | |
class | sp::CudaJitCompilerNotFoundException |
Exception corresponding to cudaErrorJitCompilerNotFound of cudaError . More... | |
class | sp::CudaCooperativeLaunchTooLargeException |
Exception corresponding to cudaErrorCooperativeLaunchTooLarge of cudaError . More... | |
class | sp::CudaSystemNotReadyException |
Exception corresponding to cudaErrorSystemNotReady of cudaError . More... | |
class | sp::CudaIllegalStateException |
Exception corresponding to cudaErrorIllegalState of cudaError . More... | |
class | sp::CudaStreamCaptureUnsupportedException |
Exception corresponding to cudaErrorStreamCaptureUnsupported of cudaError . More... | |
class | sp::CudaStreamCaptureInvalidatedException |
Exception corresponding to cudaErrorStreamCaptureInvalidated of cudaError . More... | |
class | sp::CudaStreamCaptureMergeException |
Exception corresponding to cudaErrorStreamCaptureMerge of cudaError . More... | |
class | sp::CudaStreamCaptureUnmatchedException |
Exception corresponding to cudaErrorStreamCaptureUnmatched of cudaError . More... | |
class | sp::CudaStreamCaptureUnjoinedException |
Exception corresponding to cudaErrorStreamCaptureUnjoined of cudaError . More... | |
class | sp::CudaStreamCaptureIsolationException |
Exception corresponding to cudaErrorStreamCaptureIsolation of cudaError . More... | |
class | sp::CudaStreamCaptureImplicitException |
Exception corresponding to cudaErrorStreamCaptureImplicit of cudaError . More... | |
class | sp::CudaCapturedEventException |
Exception corresponding to cudaErrorCapturedEvent of cudaError . More... | |
class | sp::CudaAlreadyAcquiredException |
Exception corresponding to cudaErrorAlreadyAcquired of cudaError . More... | |
class | sp::CudaAlreadyMappedException |
Exception corresponding to cudaErrorAlreadyMapped of cudaError . More... | |
class | sp::CudaArrayIsMappedException |
Exception corresponding to cudaErrorArrayIsMapped of cudaError . More... | |
class | sp::CudaCompatNotSupportedOnDeviceException |
Exception corresponding to cudaErrorCompatNotSupportedOnDevice of cudaError . More... | |
class | sp::CudaContextIsDestroyedException |
Exception corresponding to cudaErrorContextIsDestroyed of cudaError . More... | |
class | sp::CudaTimeoutException |
Exception corresponding to cudaErrorTimeout of cudaError . More... | |
class | sp::CudaGraphExecUpdateFailureException |
Exception corresponding to cudaErrorGraphExecUpdateFailure of cudaError . More... | |
class | sp::CudaDeviceUninitializedException |
Exception corresponding to cudaErrorDeviceUninitialized of cudaError . More... | |
class | sp::CudaFileNotFoundException |
Exception corresponding to cudaErrorFileNotFound of cudaError . More... | |
class | sp::CudaInvalidSourceException |
Exception corresponding to cudaErrorInvalidSource of cudaError . More... | |
class | sp::CudaLaunchIncompatibleTexturingException |
Exception corresponding to cudaErrorLaunchIncompatibleTexturing of cudaError . More... | |
class | sp::CudaNotMappedException |
Exception corresponding to cudaErrorNotMapped of cudaError . More... | |
class | sp::CudaNotMappedAsArrayException |
Exception corresponding to cudaErrorNotMappedAsArray of cudaError . More... | |
class | sp::CudaNotMappedAsPointerException |
Exception corresponding to cudaErrorNotMappedAsPointer of cudaError . More... | |
class | sp::CudaStreamCaptureWrongThreadException |
Exception corresponding to cudaErrorStreamCaptureWrongThread of cudaError . More... | |
class | sp::CudaSymbolNotFoundException |
Exception corresponding to cudaErrorSymbolNotFound of cudaError . More... | |
class | sp::CudaSystemDriverMismatchException |
Exception corresponding to cudaErrorSystemDriverMismatch of cudaError . More... | |
class | sp::CudaErrorStubLibraryException |
Exception corresponding to cudaErrorStubLibrary of cudaError . More... | |
class | sp::CudaErrorCallRequiresNewerDriverException |
Exception corresponding to cudaErrorCallRequiresNewerDriver of cudaError . More... | |
class | sp::CudaErrorDeviceNotLicensedException |
Exception corresponding to cudaErrorDeviceNotLicensed of cudaError . More... | |
class | sp::CudaErrorUnsupportedPtxVersionException |
Exception corresponding to cudaErrorUnsupportedPtxVersion of cudaError . More... | |
class | sp::CudaErrorSoftwareValidityNotEstablishedException |
Exception corresponding to cudaErrorSoftwareValidityNotEstablished of cudaError . More... | |
class | sp::CudaErrorJitCompilationDisabledException |
Exception corresponding to cudaErrorJitCompilationDisabled of cudaError . More... | |
class | sp::CudaErrorUnsupportedExecAffinityException |
Exception corresponding to cudaErrorUnsupportedExecAffinity of cudaError . More... | |
class | sp::CudaErrorMpsConnectionFailedException |
Exception corresponding to cudaErrorMpsConnectionFailed of cudaError . More... | |
class | sp::CudaErrorMpsRpcFailureException |
Exception corresponding to cudaErrorMpsRpcFailure of cudaError . More... | |
class | sp::CudaErrorMpsServerNotReadyException |
Exception corresponding to cudaErrorMpsServerNotReady of cudaError . More... | |
class | sp::CudaErrorMpsMaxClientsReachedException |
Exception corresponding to cudaErrorMpsMaxClientsReached of cudaError . More... | |
class | sp::CudaErrorMpsMaxConnectionsReachedException |
Exception corresponding to cudaErrorMpsMaxConnectionsReached of cudaError . More... | |
class | sp::CudaErrorExternalDeviceException |
Exception corresponding to cudaErrorExternalDevice of cudaError . More... | |
Typedefs | |
template<cudaError_t Code> | |
using | sp::CudaExceptionFor = typename CudaExceptionForImpl< Code >::type |
Type alias that gets you the exception type corresponding to a specific CUDA error code. More... | |
Functions | |
void | sp::throwCudaException (cudaError_t c, std::string desc="") |
Throw a cudaError_t as an exception, unless it's cudaSuccess . More... | |
Exception objects for errors from the GPU runtime API.
The NVIDIA® CUDA® runtme API, the AMD HIP runtime API, and other similar APIs for controlling GPUs all use a C-style return code system for error handling. This has some issues:
LibSCALE's APIs provide a platform-agnostic wrapper around GPU runtime APIs that use C++ exceptions. This can significantly simplify application code, slightly improve performance, and reduce the scope for programmer error.
By using exceptions, such accidents are impossible. On most 64-bit host platforms, there isn't any additional overhead introduced by C++ exceptions unless they are thrown. Since throws are by definition very rare, this isn't a concern.
Because the exceptional code path is cold, and there is no overhead to having the try-block, libSCALE is able to do quite elaborate analysis after an exception occurs to figure out what went wrong. As a result, your program - when it eventually crashes - might emit an error something like this:
Thus saving you an irritating few minutes fiddling with the debugger to find your silly mistake.
using sp::CudaExceptionFor = typedef typename CudaExceptionForImpl<Code>::type |
Type alias that gets you the exception type corresponding to a specific CUDA error code.
CudaExceptionFor<cudaErrorInvalidValue>
is CudaInvalidValueException
, for example.
Useful for throwing a specific CUDA exception, like throw sp::CudaExceptionFor<cudaErrorInvalidPointer>();
.
void sp::throwCudaException | ( | cudaError_t | c, |
std::string | desc = "" |
||
) |
Throw a cudaError_t
as an exception, unless it's cudaSuccess
.
If you are using a CUDA API directly (instead of through libSCALE), or a non-Spectral CUDA library that returns cudaError_t
, you can wrap calls to it in this to convert its error codes into exceptions and keep things tidy.