cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
|
Facilities for exception-based handling of Runtime and Driver API errors, including a basic exception class wrapping ::std::runtime_error
.
More...
#include "types.hpp"
#include "region.hpp"
#include <cuda_runtime_api.h>
#include <type_traits>
#include <string>
#include <stdexcept>
Go to the source code of this file.
Classes | |
class | cuda::runtime_error |
A (base?) class for exceptions raised by CUDA code; these errors are thrown by essentially all CUDA Runtime API wrappers upon failure. More... | |
Namespaces | |
cuda | |
All definitions and functionality wrapping the CUDA Runtime API. | |
cuda::outstanding_error | |
Unlike the Runtime API, where every error is outstanding until cleared, the Driver API, which we use mostly, only remembers "sticky" errors - severe errors which corrupt contexts. | |
cuda::device | |
Definitions and functionality related to CUDA devices (not including the device wrapper type device_t itself) | |
cuda::stream | |
Definitions and functionality related to CUDA streams (not including the device wrapper type stream_t itself) | |
cuda::event | |
Definitions and functionality related to CUDA events (not including the event wrapper type event_t itself) | |
Macros | |
#define | CUDA_API_WRAPPERS_ERROR_HPP_ |
#define | throw_if_error_lazy(status__, ...) |
Enumerations | |
enum | cuda::status::named_t : ::std::underlying_type< status_t >::type { success = CUDA_SUCCESS, memory_allocation_failure = CUDA_ERROR_OUT_OF_MEMORY, not_yet_initialized = CUDA_ERROR_NOT_INITIALIZED, already_deinitialized = CUDA_ERROR_DEINITIALIZED, profiler_disabled = CUDA_ERROR_PROFILER_DISABLED, profiler_already_started = CUDA_ERROR_PROFILER_ALREADY_STARTED, profiler_already_stopped = CUDA_ERROR_PROFILER_ALREADY_STOPPED, prior_launch_failure = cudaErrorPriorLaunchFailure, launch_timeout = CUDA_ERROR_LAUNCH_TIMEOUT, launch_out_of_resources = CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, kernel_launch_incompatible_texturing_mode = CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, invalid_kernel_function = cudaErrorInvalidDeviceFunction, invalid_configuration = cudaErrorInvalidConfiguration, invalid_device = CUDA_ERROR_INVALID_DEVICE, invalid_value = CUDA_ERROR_INVALID_VALUE, invalid_pitch_value = cudaErrorInvalidPitchValue, invalid_symbol = cudaErrorInvalidSymbol, map_buffer_object_failed = CUDA_ERROR_MAP_FAILED, unmap_buffer_object_failed = CUDA_ERROR_UNMAP_FAILED, array_still_mapped = CUDA_ERROR_ARRAY_IS_MAPPED, resource_already_mapped = CUDA_ERROR_ALREADY_MAPPED, resource_already_acquired = CUDA_ERROR_ALREADY_ACQUIRED, resource_not_mapped = CUDA_ERROR_NOT_MAPPED, not_mapped_as_pointer = CUDA_ERROR_NOT_MAPPED_AS_POINTER, not_mapped_as_array = CUDA_ERROR_NOT_MAPPED_AS_ARRAY, invalid_host_pointer = cudaErrorInvalidHostPointer, invalid_device_pointer = cudaErrorInvalidDevicePointer, invalid_texture = cudaErrorInvalidTexture, invalid_texture_binding = cudaErrorInvalidTextureBinding, invalid_channel_descriptor = cudaErrorInvalidChannelDescriptor, invalid_memcpy_direction = cudaErrorInvalidMemcpyDirection, address_of_constant = cudaErrorAddressOfConstant, texture_fetch_failed = cudaErrorTextureFetchFailed, texture_not_bound = cudaErrorTextureNotBound, synchronization_error = cudaErrorSynchronizationError, invalid_filter_setting = cudaErrorInvalidFilterSetting, invalid_norm_setting = cudaErrorInvalidNormSetting, mixed_device_execution = cudaErrorMixedDeviceExecution, unknown = CUDA_ERROR_UNKNOWN, not_yet_implemented = cudaErrorNotYetImplemented, memory_value_too_large = cudaErrorMemoryValueTooLarge, invalid_resource_handle = CUDA_ERROR_INVALID_HANDLE, async_operations_not_yet_completed = CUDA_ERROR_NOT_READY, insufficient_driver = cudaErrorInsufficientDriver, set_on_active_process = cudaErrorSetOnActiveProcess, invalid_surface = cudaErrorInvalidSurface, symbol_not_found = CUDA_ERROR_NOT_FOUND, no_device = CUDA_ERROR_NO_DEVICE, ecc_uncorrectable = CUDA_ERROR_ECC_UNCORRECTABLE, shared_object_symbol_not_found = CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND, invalid_source = CUDA_ERROR_INVALID_SOURCE, file_not_found = CUDA_ERROR_FILE_NOT_FOUND, shared_object_init_failed = CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, jit_compiler_not_found = CUDA_ERROR_JIT_COMPILER_NOT_FOUND, unsupported_limit = CUDA_ERROR_UNSUPPORTED_LIMIT, duplicate_variable_name = cudaErrorDuplicateVariableName, duplicate_texture_name = cudaErrorDuplicateTextureName, duplicate_surface_name = cudaErrorDuplicateSurfaceName, devices_unavailable = cudaErrorDevicesUnavailable, invalid_kernel_image = CUDA_ERROR_INVALID_IMAGE, no_kernel_image_for_device = CUDA_ERROR_NO_BINARY_FOR_GPU, incompatible_driver_context = cudaErrorIncompatibleDriverContext, missing_configuration = cudaErrorMissingConfiguration, invalid_context = CUDA_ERROR_INVALID_CONTEXT, context_already_current = CUDA_ERROR_CONTEXT_ALREADY_CURRENT, context_already_in_use = CUDA_ERROR_CONTEXT_ALREADY_IN_USE, peer_access_already_enabled = CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED, peer_access_not_enabled = CUDA_ERROR_PEER_ACCESS_NOT_ENABLED, device_already_in_use = cudaErrorDeviceAlreadyInUse, primary_context_already_active = CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE, context_is_destroyed = CUDA_ERROR_CONTEXT_IS_DESTROYED, primary_context_is_uninitialized = CUDA_ERROR_CONTEXT_IS_DESTROYED, assert = CUDA_ERROR_ASSERT, too_many_peers = CUDA_ERROR_TOO_MANY_PEERS, host_memory_already_registered = CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED, host_memory_not_registered = CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED, operating_system = CUDA_ERROR_OPERATING_SYSTEM, peer_access_unsupported = CUDA_ERROR_PEER_ACCESS_UNSUPPORTED, launch_max_depth_exceeded = cudaErrorLaunchMaxDepthExceeded, launch_file_scoped_tex = cudaErrorLaunchFileScopedTex, launch_file_scoped_surf = cudaErrorLaunchFileScopedSurf, sync_depth_exceeded = cudaErrorSyncDepthExceeded, launch_pending_count_exceeded = cudaErrorLaunchPendingCountExceeded, invalid_device_function = cudaErrorInvalidDeviceFunction, not_permitted = CUDA_ERROR_NOT_PERMITTED, not_supported = CUDA_ERROR_NOT_SUPPORTED, hardware_stack_error = CUDA_ERROR_HARDWARE_STACK_ERROR, illegal_instruction = CUDA_ERROR_ILLEGAL_INSTRUCTION, misaligned_address = CUDA_ERROR_MISALIGNED_ADDRESS, exception_during_kernel_execution = CUDA_ERROR_LAUNCH_FAILED, cooperative_launch_too_large = CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE, invalid_address_space = CUDA_ERROR_INVALID_ADDRESS_SPACE, invalid_pc = CUDA_ERROR_INVALID_PC, illegal_address = CUDA_ERROR_ILLEGAL_ADDRESS, invalid_ptx = CUDA_ERROR_INVALID_PTX, invalid_graphics_context = CUDA_ERROR_INVALID_GRAPHICS_CONTEXT, nvlink_uncorrectable = CUDA_ERROR_NVLINK_UNCORRECTABLE, startup_failure = cudaErrorStartupFailure, api_failure_base = cudaErrorApiFailureBase } |
Aliases for CUDA status codes. More... | |
enum | : bool { dont_clear_errors = false, do_clear_errors = true } |
Functions | |
void | cuda::throw_if_error (status_t status, const ::std::string &message) noexcept(false) |
Do nothing... More... | |
void | cuda::throw_if_error (cudaError_t status, const ::std::string &message) noexcept(false) |
void | cuda::throw_if_error (status_t status, ::std::string &&message) noexcept(false) |
void | cuda::throw_if_error (cudaError_t status, ::std::string &&message) noexcept(false) |
void | cuda::throw_if_error (status_t status) noexcept(false) |
Does nothing - unless the status indicates an error, in which case a cuda::runtime_error exception is thrown. More... | |
void | cuda::throw_if_error (cudaError_t status) noexcept(false) |
status_t | cuda::outstanding_error::get (bool try_clearing=false) noexcept(true) |
void | cuda::outstanding_error::ensure_none (const ::std::string &message) noexcept(false) |
Does nothing (unless throwing an exception) More... | |
void | cuda::outstanding_error::ensure_none (const char *message) noexcept(false) |
A variant of ensure_none() which takes a C-style string. More... | |
void | cuda::outstanding_error::ensure_none () noexcept(false) |
Does nothing (unless throwing an exception) More... | |
constexpr bool | cuda::is_success (status_t status) |
Determine whether the API call returning the specified status had succeeded. | |
constexpr bool | cuda::is_success (cudaError_t status) |
constexpr bool | cuda::is_failure (status_t status) |
Determine whether the API call returning the specified status had failed. | |
constexpr bool | cuda::is_failure (cudaError_t status) |
inline ::std::string | cuda::describe (status_t status) |
Obtain a brief textual explanation for a specified kind of CUDA Runtime API status or error code. | |
inline ::std::string | cuda::describe (cudaError_t status) |
Facilities for exception-based handling of Runtime and Driver API errors, including a basic exception class wrapping ::std::runtime_error
.
#define throw_if_error_lazy | ( | status__, | |
... | |||
) |
enum cuda::status::named_t : ::std::underlying_type< status_t >::type |
Aliases for CUDA status codes.