72#ifdef __DRIVER_TYPES_H__
73static const char *_cudaGetErrorEnum(cudaError_t error)
80 case cudaErrorMissingConfiguration:
81 return "cudaErrorMissingConfiguration";
83 case cudaErrorMemoryAllocation:
84 return "cudaErrorMemoryAllocation";
86 case cudaErrorInitializationError:
87 return "cudaErrorInitializationError";
89 case cudaErrorLaunchFailure:
90 return "cudaErrorLaunchFailure";
92 case cudaErrorPriorLaunchFailure:
93 return "cudaErrorPriorLaunchFailure";
95 case cudaErrorLaunchTimeout:
96 return "cudaErrorLaunchTimeout";
98 case cudaErrorLaunchOutOfResources:
99 return "cudaErrorLaunchOutOfResources";
101 case cudaErrorInvalidDeviceFunction:
102 return "cudaErrorInvalidDeviceFunction";
104 case cudaErrorInvalidConfiguration:
105 return "cudaErrorInvalidConfiguration";
107 case cudaErrorInvalidDevice:
108 return "cudaErrorInvalidDevice";
110 case cudaErrorInvalidValue:
111 return "cudaErrorInvalidValue";
113 case cudaErrorInvalidPitchValue:
114 return "cudaErrorInvalidPitchValue";
116 case cudaErrorInvalidSymbol:
117 return "cudaErrorInvalidSymbol";
119 case cudaErrorMapBufferObjectFailed:
120 return "cudaErrorMapBufferObjectFailed";
122 case cudaErrorUnmapBufferObjectFailed:
123 return "cudaErrorUnmapBufferObjectFailed";
125 case cudaErrorInvalidHostPointer:
126 return "cudaErrorInvalidHostPointer";
128 case cudaErrorInvalidDevicePointer:
129 return "cudaErrorInvalidDevicePointer";
131 case cudaErrorInvalidTexture:
132 return "cudaErrorInvalidTexture";
134 case cudaErrorInvalidTextureBinding:
135 return "cudaErrorInvalidTextureBinding";
137 case cudaErrorInvalidChannelDescriptor:
138 return "cudaErrorInvalidChannelDescriptor";
140 case cudaErrorInvalidMemcpyDirection:
141 return "cudaErrorInvalidMemcpyDirection";
143 case cudaErrorAddressOfConstant:
144 return "cudaErrorAddressOfConstant";
146 case cudaErrorTextureFetchFailed:
147 return "cudaErrorTextureFetchFailed";
149 case cudaErrorTextureNotBound:
150 return "cudaErrorTextureNotBound";
152 case cudaErrorSynchronizationError:
153 return "cudaErrorSynchronizationError";
155 case cudaErrorInvalidFilterSetting:
156 return "cudaErrorInvalidFilterSetting";
158 case cudaErrorInvalidNormSetting:
159 return "cudaErrorInvalidNormSetting";
161 case cudaErrorMixedDeviceExecution:
162 return "cudaErrorMixedDeviceExecution";
164 case cudaErrorCudartUnloading:
165 return "cudaErrorCudartUnloading";
167 case cudaErrorUnknown:
168 return "cudaErrorUnknown";
170 case cudaErrorNotYetImplemented:
171 return "cudaErrorNotYetImplemented";
173 case cudaErrorMemoryValueTooLarge:
174 return "cudaErrorMemoryValueTooLarge";
176 case cudaErrorInvalidResourceHandle:
177 return "cudaErrorInvalidResourceHandle";
179 case cudaErrorNotReady:
180 return "cudaErrorNotReady";
182 case cudaErrorInsufficientDriver:
183 return "cudaErrorInsufficientDriver";
185 case cudaErrorSetOnActiveProcess:
186 return "cudaErrorSetOnActiveProcess";
188 case cudaErrorInvalidSurface:
189 return "cudaErrorInvalidSurface";
191 case cudaErrorNoDevice:
192 return "cudaErrorNoDevice";
194 case cudaErrorECCUncorrectable:
195 return "cudaErrorECCUncorrectable";
197 case cudaErrorSharedObjectSymbolNotFound:
198 return "cudaErrorSharedObjectSymbolNotFound";
200 case cudaErrorSharedObjectInitFailed:
201 return "cudaErrorSharedObjectInitFailed";
203 case cudaErrorUnsupportedLimit:
204 return "cudaErrorUnsupportedLimit";
206 case cudaErrorDuplicateVariableName:
207 return "cudaErrorDuplicateVariableName";
209 case cudaErrorDuplicateTextureName:
210 return "cudaErrorDuplicateTextureName";
212 case cudaErrorDuplicateSurfaceName:
213 return "cudaErrorDuplicateSurfaceName";
215 case cudaErrorDevicesUnavailable:
216 return "cudaErrorDevicesUnavailable";
218 case cudaErrorInvalidKernelImage:
219 return "cudaErrorInvalidKernelImage";
221 case cudaErrorNoKernelImageForDevice:
222 return "cudaErrorNoKernelImageForDevice";
224 case cudaErrorIncompatibleDriverContext:
225 return "cudaErrorIncompatibleDriverContext";
227 case cudaErrorPeerAccessAlreadyEnabled:
228 return "cudaErrorPeerAccessAlreadyEnabled";
230 case cudaErrorPeerAccessNotEnabled:
231 return "cudaErrorPeerAccessNotEnabled";
233 case cudaErrorDeviceAlreadyInUse:
234 return "cudaErrorDeviceAlreadyInUse";
236 case cudaErrorProfilerDisabled:
237 return "cudaErrorProfilerDisabled";
239 case cudaErrorProfilerNotInitialized:
240 return "cudaErrorProfilerNotInitialized";
242 case cudaErrorProfilerAlreadyStarted:
243 return "cudaErrorProfilerAlreadyStarted";
245 case cudaErrorProfilerAlreadyStopped:
246 return "cudaErrorProfilerAlreadyStopped";
248#if __CUDA_API_VERSION >= 0x4000
250 case cudaErrorAssert:
251 return "cudaErrorAssert";
253 case cudaErrorTooManyPeers:
254 return "cudaErrorTooManyPeers";
256 case cudaErrorHostMemoryAlreadyRegistered:
257 return "cudaErrorHostMemoryAlreadyRegistered";
259 case cudaErrorHostMemoryNotRegistered:
260 return "cudaErrorHostMemoryNotRegistered";
263 case cudaErrorStartupFailure:
264 return "cudaErrorStartupFailure";
266 case cudaErrorApiFailureBase:
267 return "cudaErrorApiFailureBase";
277#ifdef __cuda_cuda_h__
279static const char *_cudaGetErrorEnum(CUresult error)
284 return "CUDA_SUCCESS";
286 case CUDA_ERROR_INVALID_VALUE:
287 return "CUDA_ERROR_INVALID_VALUE";
289 case CUDA_ERROR_OUT_OF_MEMORY:
290 return "CUDA_ERROR_OUT_OF_MEMORY";
292 case CUDA_ERROR_NOT_INITIALIZED:
293 return "CUDA_ERROR_NOT_INITIALIZED";
295 case CUDA_ERROR_DEINITIALIZED:
296 return "CUDA_ERROR_DEINITIALIZED";
298 case CUDA_ERROR_PROFILER_DISABLED:
299 return "CUDA_ERROR_PROFILER_DISABLED";
301 case CUDA_ERROR_PROFILER_NOT_INITIALIZED:
302 return "CUDA_ERROR_PROFILER_NOT_INITIALIZED";
304 case CUDA_ERROR_PROFILER_ALREADY_STARTED:
305 return "CUDA_ERROR_PROFILER_ALREADY_STARTED";
307 case CUDA_ERROR_PROFILER_ALREADY_STOPPED:
308 return "CUDA_ERROR_PROFILER_ALREADY_STOPPED";
310 case CUDA_ERROR_NO_DEVICE:
311 return "CUDA_ERROR_NO_DEVICE";
313 case CUDA_ERROR_INVALID_DEVICE:
314 return "CUDA_ERROR_INVALID_DEVICE";
316 case CUDA_ERROR_INVALID_IMAGE:
317 return "CUDA_ERROR_INVALID_IMAGE";
319 case CUDA_ERROR_INVALID_CONTEXT:
320 return "CUDA_ERROR_INVALID_CONTEXT";
322 case CUDA_ERROR_CONTEXT_ALREADY_CURRENT:
323 return "CUDA_ERROR_CONTEXT_ALREADY_CURRENT";
325 case CUDA_ERROR_MAP_FAILED:
326 return "CUDA_ERROR_MAP_FAILED";
328 case CUDA_ERROR_UNMAP_FAILED:
329 return "CUDA_ERROR_UNMAP_FAILED";
331 case CUDA_ERROR_ARRAY_IS_MAPPED:
332 return "CUDA_ERROR_ARRAY_IS_MAPPED";
334 case CUDA_ERROR_ALREADY_MAPPED:
335 return "CUDA_ERROR_ALREADY_MAPPED";
337 case CUDA_ERROR_NO_BINARY_FOR_GPU:
338 return "CUDA_ERROR_NO_BINARY_FOR_GPU";
340 case CUDA_ERROR_ALREADY_ACQUIRED:
341 return "CUDA_ERROR_ALREADY_ACQUIRED";
343 case CUDA_ERROR_NOT_MAPPED:
344 return "CUDA_ERROR_NOT_MAPPED";
346 case CUDA_ERROR_NOT_MAPPED_AS_ARRAY:
347 return "CUDA_ERROR_NOT_MAPPED_AS_ARRAY";
349 case CUDA_ERROR_NOT_MAPPED_AS_POINTER:
350 return "CUDA_ERROR_NOT_MAPPED_AS_POINTER";
352 case CUDA_ERROR_ECC_UNCORRECTABLE:
353 return "CUDA_ERROR_ECC_UNCORRECTABLE";
355 case CUDA_ERROR_UNSUPPORTED_LIMIT:
356 return "CUDA_ERROR_UNSUPPORTED_LIMIT";
358 case CUDA_ERROR_CONTEXT_ALREADY_IN_USE:
359 return "CUDA_ERROR_CONTEXT_ALREADY_IN_USE";
361 case CUDA_ERROR_INVALID_SOURCE:
362 return "CUDA_ERROR_INVALID_SOURCE";
364 case CUDA_ERROR_FILE_NOT_FOUND:
365 return "CUDA_ERROR_FILE_NOT_FOUND";
367 case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND:
368 return "CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND";
370 case CUDA_ERROR_SHARED_OBJECT_INIT_FAILED:
371 return "CUDA_ERROR_SHARED_OBJECT_INIT_FAILED";
373 case CUDA_ERROR_OPERATING_SYSTEM:
374 return "CUDA_ERROR_OPERATING_SYSTEM";
376 case CUDA_ERROR_INVALID_HANDLE:
377 return "CUDA_ERROR_INVALID_HANDLE";
379 case CUDA_ERROR_NOT_FOUND:
380 return "CUDA_ERROR_NOT_FOUND";
382 case CUDA_ERROR_NOT_READY:
383 return "CUDA_ERROR_NOT_READY";
385 case CUDA_ERROR_LAUNCH_FAILED:
386 return "CUDA_ERROR_LAUNCH_FAILED";
388 case CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES:
389 return "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES";
391 case CUDA_ERROR_LAUNCH_TIMEOUT:
392 return "CUDA_ERROR_LAUNCH_TIMEOUT";
394 case CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING:
395 return "CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING";
397 case CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED:
398 return "CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED";
400 case CUDA_ERROR_PEER_ACCESS_NOT_ENABLED:
401 return "CUDA_ERROR_PEER_ACCESS_NOT_ENABLED";
403 case CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE:
404 return "CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE";
406 case CUDA_ERROR_CONTEXT_IS_DESTROYED:
407 return "CUDA_ERROR_CONTEXT_IS_DESTROYED";
409 case CUDA_ERROR_ASSERT:
410 return "CUDA_ERROR_ASSERT";
412 case CUDA_ERROR_TOO_MANY_PEERS:
413 return "CUDA_ERROR_TOO_MANY_PEERS";
415 case CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED:
416 return "CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED";
418 case CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED:
419 return "CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED";
421 case CUDA_ERROR_UNKNOWN:
422 return "CUDA_ERROR_UNKNOWN";
424 case CUDA_ERROR_PEER_ACCESS_UNSUPPORTED:
425 return "CUDA_ERROR_PEER_ACCESS_UNSUPPORTED";
427 case CUDA_ERROR_INVALID_PTX:
428 return "CUDA_ERROR_INVALID_PTX";
430#if __CUDA_API_VERSION >= 6500
431 case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT:
432 return "CUDA_ERROR_INVALID_GRAPHICS_CONTEXT";
435 case CUDA_ERROR_ILLEGAL_ADDRESS:
436 return "CUDA_ERROR_ILLEGAL_ADDRESS";
438 case CUDA_ERROR_HARDWARE_STACK_ERROR:
439 return "CUDA_ERROR_HARDWARE_STACK_ERROR";
441 case CUDA_ERROR_ILLEGAL_INSTRUCTION:
442 return "CUDA_ERROR_ILLEGAL_INSTRUCTION";
444 case CUDA_ERROR_MISALIGNED_ADDRESS:
445 return "CUDA_ERROR_MISALIGNED_ADDRESS";
447 case CUDA_ERROR_INVALID_ADDRESS_SPACE:
448 return "CUDA_ERROR_INVALID_ADDRESS_SPACE";
450 case CUDA_ERROR_INVALID_PC:
451 return "CUDA_ERROR_INVALID_PC";
453 case CUDA_ERROR_NOT_PERMITTED:
454 return "CUDA_ERROR_NOT_PERMITTED";
456 case CUDA_ERROR_NOT_SUPPORTED:
457 return "CUDA_ERROR_NOT_SUPPORTED";
466static const char *_cudaGetErrorEnum(cublasStatus_t error)
470 case CUBLAS_STATUS_SUCCESS:
471 return "CUBLAS_STATUS_SUCCESS";
473 case CUBLAS_STATUS_NOT_INITIALIZED:
474 return "CUBLAS_STATUS_NOT_INITIALIZED";
476 case CUBLAS_STATUS_ALLOC_FAILED:
477 return "CUBLAS_STATUS_ALLOC_FAILED";
479 case CUBLAS_STATUS_INVALID_VALUE:
480 return "CUBLAS_STATUS_INVALID_VALUE";
482 case CUBLAS_STATUS_ARCH_MISMATCH:
483 return "CUBLAS_STATUS_ARCH_MISMATCH";
485 case CUBLAS_STATUS_MAPPING_ERROR:
486 return "CUBLAS_STATUS_MAPPING_ERROR";
488 case CUBLAS_STATUS_EXECUTION_FAILED:
489 return "CUBLAS_STATUS_EXECUTION_FAILED";
491 case CUBLAS_STATUS_INTERNAL_ERROR:
492 return "CUBLAS_STATUS_INTERNAL_ERROR";
501static const char *_cudaGetErrorEnum(cufftResult error)
506 return "CUFFT_SUCCESS";
508 case CUFFT_INVALID_PLAN:
509 return "CUFFT_INVALID_PLAN";
511 case CUFFT_ALLOC_FAILED:
512 return "CUFFT_ALLOC_FAILED";
514 case CUFFT_INVALID_TYPE:
515 return "CUFFT_INVALID_TYPE";
517 case CUFFT_INVALID_VALUE:
518 return "CUFFT_INVALID_VALUE";
520 case CUFFT_INTERNAL_ERROR:
521 return "CUFFT_INTERNAL_ERROR";
523 case CUFFT_EXEC_FAILED:
524 return "CUFFT_EXEC_FAILED";
526 case CUFFT_SETUP_FAILED:
527 return "CUFFT_SETUP_FAILED";
529 case CUFFT_INVALID_SIZE:
530 return "CUFFT_INVALID_SIZE";
532 case CUFFT_UNALIGNED_DATA:
533 return "CUFFT_UNALIGNED_DATA";
542static const char *_cudaGetErrorEnum(cusparseStatus_t error)
546 case CUSPARSE_STATUS_SUCCESS:
547 return "CUSPARSE_STATUS_SUCCESS";
549 case CUSPARSE_STATUS_NOT_INITIALIZED:
550 return "CUSPARSE_STATUS_NOT_INITIALIZED";
552 case CUSPARSE_STATUS_ALLOC_FAILED:
553 return "CUSPARSE_STATUS_ALLOC_FAILED";
555 case CUSPARSE_STATUS_INVALID_VALUE:
556 return "CUSPARSE_STATUS_INVALID_VALUE";
558 case CUSPARSE_STATUS_ARCH_MISMATCH:
559 return "CUSPARSE_STATUS_ARCH_MISMATCH";
561 case CUSPARSE_STATUS_MAPPING_ERROR:
562 return "CUSPARSE_STATUS_MAPPING_ERROR";
564 case CUSPARSE_STATUS_EXECUTION_FAILED:
565 return "CUSPARSE_STATUS_EXECUTION_FAILED";
567 case CUSPARSE_STATUS_INTERNAL_ERROR:
568 return "CUSPARSE_STATUS_INTERNAL_ERROR";
570 case CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED:
571 return "CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED";
580static const char *_cudaGetErrorEnum(curandStatus_t error)
584 case CURAND_STATUS_SUCCESS:
585 return "CURAND_STATUS_SUCCESS";
587 case CURAND_STATUS_VERSION_MISMATCH:
588 return "CURAND_STATUS_VERSION_MISMATCH";
590 case CURAND_STATUS_NOT_INITIALIZED:
591 return "CURAND_STATUS_NOT_INITIALIZED";
593 case CURAND_STATUS_ALLOCATION_FAILED:
594 return "CURAND_STATUS_ALLOCATION_FAILED";
596 case CURAND_STATUS_TYPE_ERROR:
597 return "CURAND_STATUS_TYPE_ERROR";
599 case CURAND_STATUS_OUT_OF_RANGE:
600 return "CURAND_STATUS_OUT_OF_RANGE";
602 case CURAND_STATUS_LENGTH_NOT_MULTIPLE:
603 return "CURAND_STATUS_LENGTH_NOT_MULTIPLE";
605 case CURAND_STATUS_DOUBLE_PRECISION_REQUIRED:
606 return "CURAND_STATUS_DOUBLE_PRECISION_REQUIRED";
608 case CURAND_STATUS_LAUNCH_FAILURE:
609 return "CURAND_STATUS_LAUNCH_FAILURE";
611 case CURAND_STATUS_PREEXISTING_FAILURE:
612 return "CURAND_STATUS_PREEXISTING_FAILURE";
614 case CURAND_STATUS_INITIALIZATION_FAILED:
615 return "CURAND_STATUS_INITIALIZATION_FAILED";
617 case CURAND_STATUS_ARCH_MISMATCH:
618 return "CURAND_STATUS_ARCH_MISMATCH";
620 case CURAND_STATUS_INTERNAL_ERROR:
621 return "CURAND_STATUS_INTERNAL_ERROR";
630static const char *_cudaGetErrorEnum(NppStatus error)
634 case NPP_NOT_SUPPORTED_MODE_ERROR:
635 return "NPP_NOT_SUPPORTED_MODE_ERROR";
637 case NPP_ROUND_MODE_NOT_SUPPORTED_ERROR:
638 return "NPP_ROUND_MODE_NOT_SUPPORTED_ERROR";
640 case NPP_RESIZE_NO_OPERATION_ERROR:
641 return "NPP_RESIZE_NO_OPERATION_ERROR";
643 case NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY:
644 return "NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY";
646#if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) <= 0x5000
648 case NPP_BAD_ARG_ERROR:
649 return "NPP_BAD_ARGUMENT_ERROR";
651 case NPP_COEFF_ERROR:
652 return "NPP_COEFFICIENT_ERROR";
655 return "NPP_RECTANGLE_ERROR";
658 return "NPP_QUADRANGLE_ERROR";
660 case NPP_MEM_ALLOC_ERR:
661 return "NPP_MEMORY_ALLOCATION_ERROR";
663 case NPP_HISTO_NUMBER_OF_LEVELS_ERROR:
664 return "NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR";
666 case NPP_INVALID_INPUT:
667 return "NPP_INVALID_INPUT";
669 case NPP_POINTER_ERROR:
670 return "NPP_POINTER_ERROR";
673 return "NPP_WARNING";
675 case NPP_ODD_ROI_WARNING:
676 return "NPP_ODD_ROI_WARNING";
680 case NPP_BAD_ARGUMENT_ERROR:
681 return "NPP_BAD_ARGUMENT_ERROR";
683 case NPP_COEFFICIENT_ERROR:
684 return "NPP_COEFFICIENT_ERROR";
686 case NPP_RECTANGLE_ERROR:
687 return "NPP_RECTANGLE_ERROR";
689 case NPP_QUADRANGLE_ERROR:
690 return "NPP_QUADRANGLE_ERROR";
692 case NPP_MEMORY_ALLOCATION_ERR:
693 return "NPP_MEMORY_ALLOCATION_ERROR";
695 case NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR:
696 return "NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR";
698 case NPP_INVALID_HOST_POINTER_ERROR:
699 return "NPP_INVALID_HOST_POINTER_ERROR";
701 case NPP_INVALID_DEVICE_POINTER_ERROR:
702 return "NPP_INVALID_DEVICE_POINTER_ERROR";
705 case NPP_LUT_NUMBER_OF_LEVELS_ERROR:
706 return "NPP_LUT_NUMBER_OF_LEVELS_ERROR";
708 case NPP_TEXTURE_BIND_ERROR:
709 return "NPP_TEXTURE_BIND_ERROR";
711 case NPP_WRONG_INTERSECTION_ROI_ERROR:
712 return "NPP_WRONG_INTERSECTION_ROI_ERROR";
714 case NPP_NOT_EVEN_STEP_ERROR:
715 return "NPP_NOT_EVEN_STEP_ERROR";
717 case NPP_INTERPOLATION_ERROR:
718 return "NPP_INTERPOLATION_ERROR";
720 case NPP_RESIZE_FACTOR_ERROR:
721 return "NPP_RESIZE_FACTOR_ERROR";
723 case NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR:
724 return "NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR";
726#if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) <= 0x5000
728 case NPP_MEMFREE_ERR:
729 return "NPP_MEMFREE_ERR";
732 return "NPP_MEMSET_ERR";
735 return "NPP_MEMCPY_ERROR";
737 case NPP_MIRROR_FLIP_ERR:
738 return "NPP_MIRROR_FLIP_ERR";
741 case NPP_MEMFREE_ERROR:
742 return "NPP_MEMFREE_ERROR";
744 case NPP_MEMSET_ERROR:
745 return "NPP_MEMSET_ERROR";
747 case NPP_MEMCPY_ERROR:
748 return "NPP_MEMCPY_ERROR";
750 case NPP_MIRROR_FLIP_ERROR:
751 return "NPP_MIRROR_FLIP_ERROR";
754 case NPP_ALIGNMENT_ERROR:
755 return "NPP_ALIGNMENT_ERROR";
758 return "NPP_STEP_ERROR";
761 return "NPP_SIZE_ERROR";
763 case NPP_NULL_POINTER_ERROR:
764 return "NPP_NULL_POINTER_ERROR";
766 case NPP_CUDA_KERNEL_EXECUTION_ERROR:
767 return "NPP_CUDA_KERNEL_EXECUTION_ERROR";
769 case NPP_NOT_IMPLEMENTED_ERROR:
770 return "NPP_NOT_IMPLEMENTED_ERROR";
776 return "NPP_SUCCESS";
778 case NPP_WRONG_INTERSECTION_QUAD_WARNING:
779 return "NPP_WRONG_INTERSECTION_QUAD_WARNING";
781 case NPP_MISALIGNED_DST_ROI_WARNING:
782 return "NPP_MISALIGNED_DST_ROI_WARNING";
784 case NPP_AFFINE_QUAD_INCORRECT_WARNING:
785 return "NPP_AFFINE_QUAD_INCORRECT_WARNING";
787 case NPP_DOUBLE_SIZE_WARNING:
788 return "NPP_DOUBLE_SIZE_WARNING";
790 case NPP_WRONG_INTERSECTION_ROI_WARNING:
791 return "NPP_WRONG_INTERSECTION_ROI_WARNING";
798#ifdef __DRIVER_TYPES_H__
800#define DEVICE_RESET cudaDeviceReset();
813 fprintf(stderr,
"CUDA error at %s:%d code=%d(%s) \"%s\" \n",
814 file, line,
static_cast<unsigned int>(
result), _cudaGetErrorEnum(
result),
func);
821#ifdef __DRIVER_TYPES_H__
823#define checkCudaErrors(val) check((val), #val, __FILE__, __LINE__)
826#define getLastCudaError(msg) __getLastCudaError(msg, __FILE__, __LINE__)
828inline void __getLastCudaError(
const char *errorMessage,
const char *file,
const int line)
830 cudaError_t err = cudaGetLastError();
832 if (cudaSuccess != err)
834 fprintf(stderr,
"%s(%i) : getLastCudaError() CUDA error : %s : (%d) %s.\n",
835 file, line, errorMessage, (
int)err, cudaGetErrorString(err));
843#define MAX(a, b) (a > b ? a : b)
856 sSMtoCores nGpuArchCoresPerSM[] = {
872 while (nGpuArchCoresPerSM[
index].SM != -1)
874 if (nGpuArchCoresPerSM[
index].SM == ((major << 4) + minor))
876 return nGpuArchCoresPerSM[
index].Cores;
883 printf(
"MapSMtoCores for SM %d.%d is undefined. Default to use %d Cores/SM\n", major, minor, nGpuArchCoresPerSM[7].Cores);
884 return nGpuArchCoresPerSM[7].Cores;
888#ifdef __CUDA_RUNTIME_H__
890inline int gpuDeviceInit(
int devID)
893 checkCudaErrors(cudaGetDeviceCount(&device_count));
895 if (device_count == 0)
897 fprintf(stderr,
"gpuDeviceInit() CUDA error: no devices supporting CUDA.\n");
906 if (devID > device_count - 1)
908 fprintf(stderr,
"\n");
909 fprintf(stderr,
">> %d CUDA capable GPU device(s) detected. <<\n", device_count);
910 fprintf(stderr,
">> gpuDeviceInit (-device=%d) is not a valid GPU device. <<\n", devID);
911 fprintf(stderr,
"\n");
915 cudaDeviceProp deviceProp;
916 checkCudaErrors(cudaGetDeviceProperties(&deviceProp, devID));
918 if (deviceProp.computeMode == cudaComputeModeProhibited)
920 fprintf(stderr,
"Error: device is running in <Compute Mode Prohibited>, no threads can use ::cudaSetDevice().\n");
924 if (deviceProp.major < 1)
926 fprintf(stderr,
"gpuDeviceInit(): GPU device does not support CUDA.\n");
930 checkCudaErrors(cudaSetDevice(devID));
931 printf(
"gpuDeviceInit() CUDA Device [%d]: \"%s\n", devID, deviceProp.name);
937inline int gpuGetMaxGflopsDeviceId()
939 int current_device = 0, sm_per_multiproc = 0;
940 int max_perf_device = 0;
941 int device_count = 0, best_SM_arch = 0;
943 unsigned long long max_compute_perf = 0;
944 cudaDeviceProp deviceProp;
945 cudaGetDeviceCount(&device_count);
947 checkCudaErrors(cudaGetDeviceCount(&device_count));
949 if (device_count == 0)
951 fprintf(stderr,
"gpuGetMaxGflopsDeviceId() CUDA error: no devices supporting CUDA.\n");
956 while (current_device < device_count)
958 cudaGetDeviceProperties(&deviceProp, current_device);
961 if (deviceProp.computeMode != cudaComputeModeProhibited)
963 if (deviceProp.major > 0 && deviceProp.major < 9999)
965 best_SM_arch =
MAX(best_SM_arch, deviceProp.major);
975 while (current_device < device_count)
977 cudaGetDeviceProperties(&deviceProp, current_device);
980 if (deviceProp.computeMode != cudaComputeModeProhibited)
982 if (deviceProp.major == 9999 && deviceProp.minor == 9999)
984 sm_per_multiproc = 1;
991 unsigned long long compute_perf = (
unsigned long long)deviceProp.multiProcessorCount * sm_per_multiproc * deviceProp.clockRate;
993 if (compute_perf > max_compute_perf)
996 if (best_SM_arch > 2)
999 if (deviceProp.major == best_SM_arch)
1001 max_compute_perf = compute_perf;
1002 max_perf_device = current_device;
1007 max_compute_perf = compute_perf;
1008 max_perf_device = current_device;
1016 return max_perf_device;
1020inline int findCudaDevice(
int argc,
const char **argv)
1022 cudaDeviceProp deviceProp;
1032 printf(
"Invalid command line parameter\n ");
1037 devID = gpuDeviceInit(devID);
1041 printf(
"exiting...\n");
1049 devID = gpuGetMaxGflopsDeviceId();
1050 checkCudaErrors(cudaSetDevice(devID));
1051 checkCudaErrors(cudaGetDeviceProperties(&deviceProp, devID));
1052 printf(
"GPU Device %d: \"%s\" with compute capability %d.%d\n\n", devID, deviceProp.name, deviceProp.major, deviceProp.minor);
1059inline bool checkCudaCapabilities(
int major_version,
int minor_version)
1061 cudaDeviceProp deviceProp;
1062 deviceProp.major = 0;
1063 deviceProp.minor = 0;
1066 checkCudaErrors(cudaGetDevice(&dev));
1067 checkCudaErrors(cudaGetDeviceProperties(&deviceProp, dev));
1069 if ((deviceProp.major > major_version) || (deviceProp.major == major_version && deviceProp.minor >= minor_version))
1071 printf(
" GPU Device %d: <%16s >, Compute SM %d.%d detected\n", dev, deviceProp.name, deviceProp.major, deviceProp.minor);
1076 printf(
" No GPU device was found that can support CUDA compute capability %d.%d.\n", major_version, minor_version);
GLenum func
Definition: khronos-glext.h:6719
GLuint64EXT * result
Definition: khronos-glext.h:12573
GLuint index
Definition: khronos-glext.h:6722
int _ConvertSMVer2Cores(int major, int minor)
Definition: helper_cuda.h:847
void check(T result, char const *const func, const char *const file, int const line)
Definition: helper_cuda.h:809
#define DEVICE_RESET
Definition: helper_cuda.h:804
#define MAX(a, b)
Definition: helper_cuda.h:843
bool checkCmdLineFlag(const int argc, const char **argv, const char *string_ref)
Definition: helper_string.h:125
int getCmdLineArgumentInt(const int argc, const char **argv, const char *string_ref)
Definition: helper_string.h:183