35 #ifdef __DRIVER_TYPES_H__
36 static const char *_cudaGetErrorEnum(cudaError_t error)
43 case cudaErrorMissingConfiguration:
44 return "cudaErrorMissingConfiguration";
46 case cudaErrorMemoryAllocation:
47 return "cudaErrorMemoryAllocation";
49 case cudaErrorInitializationError:
50 return "cudaErrorInitializationError";
52 case cudaErrorLaunchFailure:
53 return "cudaErrorLaunchFailure";
55 case cudaErrorPriorLaunchFailure:
56 return "cudaErrorPriorLaunchFailure";
58 case cudaErrorLaunchTimeout:
59 return "cudaErrorLaunchTimeout";
61 case cudaErrorLaunchOutOfResources:
62 return "cudaErrorLaunchOutOfResources";
64 case cudaErrorInvalidDeviceFunction:
65 return "cudaErrorInvalidDeviceFunction";
67 case cudaErrorInvalidConfiguration:
68 return "cudaErrorInvalidConfiguration";
70 case cudaErrorInvalidDevice:
71 return "cudaErrorInvalidDevice";
73 case cudaErrorInvalidValue:
74 return "cudaErrorInvalidValue";
76 case cudaErrorInvalidPitchValue:
77 return "cudaErrorInvalidPitchValue";
79 case cudaErrorInvalidSymbol:
80 return "cudaErrorInvalidSymbol";
82 case cudaErrorMapBufferObjectFailed:
83 return "cudaErrorMapBufferObjectFailed";
85 case cudaErrorUnmapBufferObjectFailed:
86 return "cudaErrorUnmapBufferObjectFailed";
88 case cudaErrorInvalidHostPointer:
89 return "cudaErrorInvalidHostPointer";
91 case cudaErrorInvalidDevicePointer:
92 return "cudaErrorInvalidDevicePointer";
94 case cudaErrorInvalidTexture:
95 return "cudaErrorInvalidTexture";
97 case cudaErrorInvalidTextureBinding:
98 return "cudaErrorInvalidTextureBinding";
100 case cudaErrorInvalidChannelDescriptor:
101 return "cudaErrorInvalidChannelDescriptor";
103 case cudaErrorInvalidMemcpyDirection:
104 return "cudaErrorInvalidMemcpyDirection";
106 case cudaErrorAddressOfConstant:
107 return "cudaErrorAddressOfConstant";
109 case cudaErrorTextureFetchFailed:
110 return "cudaErrorTextureFetchFailed";
112 case cudaErrorTextureNotBound:
113 return "cudaErrorTextureNotBound";
115 case cudaErrorSynchronizationError:
116 return "cudaErrorSynchronizationError";
118 case cudaErrorInvalidFilterSetting:
119 return "cudaErrorInvalidFilterSetting";
121 case cudaErrorInvalidNormSetting:
122 return "cudaErrorInvalidNormSetting";
124 case cudaErrorMixedDeviceExecution:
125 return "cudaErrorMixedDeviceExecution";
127 case cudaErrorCudartUnloading:
128 return "cudaErrorCudartUnloading";
130 case cudaErrorUnknown:
131 return "cudaErrorUnknown";
133 case cudaErrorNotYetImplemented:
134 return "cudaErrorNotYetImplemented";
136 case cudaErrorMemoryValueTooLarge:
137 return "cudaErrorMemoryValueTooLarge";
139 case cudaErrorInvalidResourceHandle:
140 return "cudaErrorInvalidResourceHandle";
142 case cudaErrorNotReady:
143 return "cudaErrorNotReady";
145 case cudaErrorInsufficientDriver:
146 return "cudaErrorInsufficientDriver";
148 case cudaErrorSetOnActiveProcess:
149 return "cudaErrorSetOnActiveProcess";
151 case cudaErrorInvalidSurface:
152 return "cudaErrorInvalidSurface";
154 case cudaErrorNoDevice:
155 return "cudaErrorNoDevice";
157 case cudaErrorECCUncorrectable:
158 return "cudaErrorECCUncorrectable";
160 case cudaErrorSharedObjectSymbolNotFound:
161 return "cudaErrorSharedObjectSymbolNotFound";
163 case cudaErrorSharedObjectInitFailed:
164 return "cudaErrorSharedObjectInitFailed";
166 case cudaErrorUnsupportedLimit:
167 return "cudaErrorUnsupportedLimit";
169 case cudaErrorDuplicateVariableName:
170 return "cudaErrorDuplicateVariableName";
172 case cudaErrorDuplicateTextureName:
173 return "cudaErrorDuplicateTextureName";
175 case cudaErrorDuplicateSurfaceName:
176 return "cudaErrorDuplicateSurfaceName";
178 case cudaErrorDevicesUnavailable:
179 return "cudaErrorDevicesUnavailable";
181 case cudaErrorInvalidKernelImage:
182 return "cudaErrorInvalidKernelImage";
184 case cudaErrorNoKernelImageForDevice:
185 return "cudaErrorNoKernelImageForDevice";
187 case cudaErrorIncompatibleDriverContext:
188 return "cudaErrorIncompatibleDriverContext";
190 case cudaErrorPeerAccessAlreadyEnabled:
191 return "cudaErrorPeerAccessAlreadyEnabled";
193 case cudaErrorPeerAccessNotEnabled:
194 return "cudaErrorPeerAccessNotEnabled";
196 case cudaErrorDeviceAlreadyInUse:
197 return "cudaErrorDeviceAlreadyInUse";
199 case cudaErrorProfilerDisabled:
200 return "cudaErrorProfilerDisabled";
202 case cudaErrorProfilerNotInitialized:
203 return "cudaErrorProfilerNotInitialized";
205 case cudaErrorProfilerAlreadyStarted:
206 return "cudaErrorProfilerAlreadyStarted";
208 case cudaErrorProfilerAlreadyStopped:
209 return "cudaErrorProfilerAlreadyStopped";
212 case cudaErrorAssert:
213 return "cudaErrorAssert";
215 case cudaErrorTooManyPeers:
216 return "cudaErrorTooManyPeers";
218 case cudaErrorHostMemoryAlreadyRegistered:
219 return "cudaErrorHostMemoryAlreadyRegistered";
221 case cudaErrorHostMemoryNotRegistered:
222 return "cudaErrorHostMemoryNotRegistered";
225 case cudaErrorOperatingSystem:
226 return "cudaErrorOperatingSystem";
228 case cudaErrorPeerAccessUnsupported:
229 return "cudaErrorPeerAccessUnsupported";
231 case cudaErrorLaunchMaxDepthExceeded:
232 return "cudaErrorLaunchMaxDepthExceeded";
234 case cudaErrorLaunchFileScopedTex:
235 return "cudaErrorLaunchFileScopedTex";
237 case cudaErrorLaunchFileScopedSurf:
238 return "cudaErrorLaunchFileScopedSurf";
240 case cudaErrorSyncDepthExceeded:
241 return "cudaErrorSyncDepthExceeded";
243 case cudaErrorLaunchPendingCountExceeded:
244 return "cudaErrorLaunchPendingCountExceeded";
246 case cudaErrorNotPermitted:
247 return "cudaErrorNotPermitted";
249 case cudaErrorNotSupported:
250 return "cudaErrorNotSupported";
253 case cudaErrorHardwareStackError:
254 return "cudaErrorHardwareStackError";
256 case cudaErrorIllegalInstruction:
257 return "cudaErrorIllegalInstruction";
259 case cudaErrorMisalignedAddress:
260 return "cudaErrorMisalignedAddress";
262 case cudaErrorInvalidAddressSpace:
263 return "cudaErrorInvalidAddressSpace";
265 case cudaErrorInvalidPc:
266 return "cudaErrorInvalidPc";
268 case cudaErrorIllegalAddress:
269 return "cudaErrorIllegalAddress";
272 case cudaErrorInvalidPtx:
273 return "cudaErrorInvalidPtx";
275 case cudaErrorInvalidGraphicsContext:
276 return "cudaErrorInvalidGraphicsContext";
278 case cudaErrorStartupFailure:
279 return "cudaErrorStartupFailure";
281 case cudaErrorApiFailureBase:
282 return "cudaErrorApiFailureBase";
289 #ifdef __cuda_cuda_h__
291 static const char *_cudaGetErrorEnum(CUresult error)
296 return "CUDA_SUCCESS";
298 case CUDA_ERROR_INVALID_VALUE:
299 return "CUDA_ERROR_INVALID_VALUE";
301 case CUDA_ERROR_OUT_OF_MEMORY:
302 return "CUDA_ERROR_OUT_OF_MEMORY";
304 case CUDA_ERROR_NOT_INITIALIZED:
305 return "CUDA_ERROR_NOT_INITIALIZED";
307 case CUDA_ERROR_DEINITIALIZED:
308 return "CUDA_ERROR_DEINITIALIZED";
310 case CUDA_ERROR_PROFILER_DISABLED:
311 return "CUDA_ERROR_PROFILER_DISABLED";
313 case CUDA_ERROR_PROFILER_NOT_INITIALIZED:
314 return "CUDA_ERROR_PROFILER_NOT_INITIALIZED";
316 case CUDA_ERROR_PROFILER_ALREADY_STARTED:
317 return "CUDA_ERROR_PROFILER_ALREADY_STARTED";
319 case CUDA_ERROR_PROFILER_ALREADY_STOPPED:
320 return "CUDA_ERROR_PROFILER_ALREADY_STOPPED";
322 case CUDA_ERROR_NO_DEVICE:
323 return "CUDA_ERROR_NO_DEVICE";
325 case CUDA_ERROR_INVALID_DEVICE:
326 return "CUDA_ERROR_INVALID_DEVICE";
328 case CUDA_ERROR_INVALID_IMAGE:
329 return "CUDA_ERROR_INVALID_IMAGE";
331 case CUDA_ERROR_INVALID_CONTEXT:
332 return "CUDA_ERROR_INVALID_CONTEXT";
334 case CUDA_ERROR_CONTEXT_ALREADY_CURRENT:
335 return "CUDA_ERROR_CONTEXT_ALREADY_CURRENT";
337 case CUDA_ERROR_MAP_FAILED:
338 return "CUDA_ERROR_MAP_FAILED";
340 case CUDA_ERROR_UNMAP_FAILED:
341 return "CUDA_ERROR_UNMAP_FAILED";
343 case CUDA_ERROR_ARRAY_IS_MAPPED:
344 return "CUDA_ERROR_ARRAY_IS_MAPPED";
346 case CUDA_ERROR_ALREADY_MAPPED:
347 return "CUDA_ERROR_ALREADY_MAPPED";
349 case CUDA_ERROR_NO_BINARY_FOR_GPU:
350 return "CUDA_ERROR_NO_BINARY_FOR_GPU";
352 case CUDA_ERROR_ALREADY_ACQUIRED:
353 return "CUDA_ERROR_ALREADY_ACQUIRED";
355 case CUDA_ERROR_NOT_MAPPED:
356 return "CUDA_ERROR_NOT_MAPPED";
358 case CUDA_ERROR_NOT_MAPPED_AS_ARRAY:
359 return "CUDA_ERROR_NOT_MAPPED_AS_ARRAY";
361 case CUDA_ERROR_NOT_MAPPED_AS_POINTER:
362 return "CUDA_ERROR_NOT_MAPPED_AS_POINTER";
364 case CUDA_ERROR_ECC_UNCORRECTABLE:
365 return "CUDA_ERROR_ECC_UNCORRECTABLE";
367 case CUDA_ERROR_UNSUPPORTED_LIMIT:
368 return "CUDA_ERROR_UNSUPPORTED_LIMIT";
370 case CUDA_ERROR_CONTEXT_ALREADY_IN_USE:
371 return "CUDA_ERROR_CONTEXT_ALREADY_IN_USE";
373 case CUDA_ERROR_INVALID_SOURCE:
374 return "CUDA_ERROR_INVALID_SOURCE";
376 case CUDA_ERROR_FILE_NOT_FOUND:
377 return "CUDA_ERROR_FILE_NOT_FOUND";
379 case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND:
380 return "CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND";
382 case CUDA_ERROR_SHARED_OBJECT_INIT_FAILED:
383 return "CUDA_ERROR_SHARED_OBJECT_INIT_FAILED";
385 case CUDA_ERROR_OPERATING_SYSTEM:
386 return "CUDA_ERROR_OPERATING_SYSTEM";
388 case CUDA_ERROR_INVALID_HANDLE:
389 return "CUDA_ERROR_INVALID_HANDLE";
391 case CUDA_ERROR_NOT_FOUND:
392 return "CUDA_ERROR_NOT_FOUND";
394 case CUDA_ERROR_NOT_READY:
395 return "CUDA_ERROR_NOT_READY";
397 case CUDA_ERROR_LAUNCH_FAILED:
398 return "CUDA_ERROR_LAUNCH_FAILED";
400 case CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES:
401 return "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES";
403 case CUDA_ERROR_LAUNCH_TIMEOUT:
404 return "CUDA_ERROR_LAUNCH_TIMEOUT";
406 case CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING:
407 return "CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING";
409 case CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED:
410 return "CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED";
412 case CUDA_ERROR_PEER_ACCESS_NOT_ENABLED:
413 return "CUDA_ERROR_PEER_ACCESS_NOT_ENABLED";
415 case CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE:
416 return "CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE";
418 case CUDA_ERROR_CONTEXT_IS_DESTROYED:
419 return "CUDA_ERROR_CONTEXT_IS_DESTROYED";
421 case CUDA_ERROR_ASSERT:
422 return "CUDA_ERROR_ASSERT";
424 case CUDA_ERROR_TOO_MANY_PEERS:
425 return "CUDA_ERROR_TOO_MANY_PEERS";
427 case CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED:
428 return "CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED";
430 case CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED:
431 return "CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED";
433 case CUDA_ERROR_UNKNOWN:
434 return "CUDA_ERROR_UNKNOWN";
443 static const char *_cudaGetErrorEnum(cublasStatus_t error)
447 case CUBLAS_STATUS_SUCCESS:
448 return "CUBLAS_STATUS_SUCCESS";
450 case CUBLAS_STATUS_NOT_INITIALIZED:
451 return "CUBLAS_STATUS_NOT_INITIALIZED";
453 case CUBLAS_STATUS_ALLOC_FAILED:
454 return "CUBLAS_STATUS_ALLOC_FAILED";
456 case CUBLAS_STATUS_INVALID_VALUE:
457 return "CUBLAS_STATUS_INVALID_VALUE";
459 case CUBLAS_STATUS_ARCH_MISMATCH:
460 return "CUBLAS_STATUS_ARCH_MISMATCH";
462 case CUBLAS_STATUS_MAPPING_ERROR:
463 return "CUBLAS_STATUS_MAPPING_ERROR";
465 case CUBLAS_STATUS_EXECUTION_FAILED:
466 return "CUBLAS_STATUS_EXECUTION_FAILED";
468 case CUBLAS_STATUS_INTERNAL_ERROR:
469 return "CUBLAS_STATUS_INTERNAL_ERROR";
478 static const char *_cudaGetErrorEnum(cufftResult error)
483 return "CUFFT_SUCCESS";
485 case CUFFT_INVALID_PLAN:
486 return "CUFFT_INVALID_PLAN";
488 case CUFFT_ALLOC_FAILED:
489 return "CUFFT_ALLOC_FAILED";
491 case CUFFT_INVALID_TYPE:
492 return "CUFFT_INVALID_TYPE";
494 case CUFFT_INVALID_VALUE:
495 return "CUFFT_INVALID_VALUE";
497 case CUFFT_INTERNAL_ERROR:
498 return "CUFFT_INTERNAL_ERROR";
500 case CUFFT_EXEC_FAILED:
501 return "CUFFT_EXEC_FAILED";
503 case CUFFT_SETUP_FAILED:
504 return "CUFFT_SETUP_FAILED";
506 case CUFFT_INVALID_SIZE:
507 return "CUFFT_INVALID_SIZE";
509 case CUFFT_UNALIGNED_DATA:
510 return "CUFFT_UNALIGNED_DATA";
512 case CUFFT_INCOMPLETE_PARAMETER_LIST:
513 return "CUFFT_INCOMPLETE_PARAMETER_LIST";
515 case CUFFT_INVALID_DEVICE:
516 return "CUFFT_INVALID_DEVICE";
518 case CUFFT_PARSE_ERROR:
519 return "CUFFT_PARSE_ERROR";
521 case CUFFT_NO_WORKSPACE:
522 return "CUFFT_NO_WORKSPACE";
524 case CUFFT_NOT_IMPLEMENTED:
525 return "CUFFT_NOT_IMPLEMENTED";
527 case CUFFT_LICENSE_ERROR:
528 return "CUFFT_LICENSE_ERROR";
538 static const char *_cudaGetErrorEnum(cusparseStatus_t error)
542 case CUSPARSE_STATUS_SUCCESS:
543 return "CUSPARSE_STATUS_SUCCESS";
545 case CUSPARSE_STATUS_NOT_INITIALIZED:
546 return "CUSPARSE_STATUS_NOT_INITIALIZED";
548 case CUSPARSE_STATUS_ALLOC_FAILED:
549 return "CUSPARSE_STATUS_ALLOC_FAILED";
551 case CUSPARSE_STATUS_INVALID_VALUE:
552 return "CUSPARSE_STATUS_INVALID_VALUE";
554 case CUSPARSE_STATUS_ARCH_MISMATCH:
555 return "CUSPARSE_STATUS_ARCH_MISMATCH";
557 case CUSPARSE_STATUS_MAPPING_ERROR:
558 return "CUSPARSE_STATUS_MAPPING_ERROR";
560 case CUSPARSE_STATUS_EXECUTION_FAILED:
561 return "CUSPARSE_STATUS_EXECUTION_FAILED";
563 case CUSPARSE_STATUS_INTERNAL_ERROR:
564 return "CUSPARSE_STATUS_INTERNAL_ERROR";
566 case CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED:
567 return "CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED";
576 static const char *_cudaGetErrorEnum(curandStatus_t error)
580 case CURAND_STATUS_SUCCESS:
581 return "CURAND_STATUS_SUCCESS";
583 case CURAND_STATUS_VERSION_MISMATCH:
584 return "CURAND_STATUS_VERSION_MISMATCH";
586 case CURAND_STATUS_NOT_INITIALIZED:
587 return "CURAND_STATUS_NOT_INITIALIZED";
589 case CURAND_STATUS_ALLOCATION_FAILED:
590 return "CURAND_STATUS_ALLOCATION_FAILED";
592 case CURAND_STATUS_TYPE_ERROR:
593 return "CURAND_STATUS_TYPE_ERROR";
595 case CURAND_STATUS_OUT_OF_RANGE:
596 return "CURAND_STATUS_OUT_OF_RANGE";
598 case CURAND_STATUS_LENGTH_NOT_MULTIPLE:
599 return "CURAND_STATUS_LENGTH_NOT_MULTIPLE";
601 case CURAND_STATUS_DOUBLE_PRECISION_REQUIRED:
602 return "CURAND_STATUS_DOUBLE_PRECISION_REQUIRED";
604 case CURAND_STATUS_LAUNCH_FAILURE:
605 return "CURAND_STATUS_LAUNCH_FAILURE";
607 case CURAND_STATUS_PREEXISTING_FAILURE:
608 return "CURAND_STATUS_PREEXISTING_FAILURE";
610 case CURAND_STATUS_INITIALIZATION_FAILED:
611 return "CURAND_STATUS_INITIALIZATION_FAILED";
613 case CURAND_STATUS_ARCH_MISMATCH:
614 return "CURAND_STATUS_ARCH_MISMATCH";
616 case CURAND_STATUS_INTERNAL_ERROR:
617 return "CURAND_STATUS_INTERNAL_ERROR";
626 static const char *_cudaGetErrorEnum(NppStatus error)
630 case NPP_NOT_SUPPORTED_MODE_ERROR:
631 return "NPP_NOT_SUPPORTED_MODE_ERROR";
633 case NPP_ROUND_MODE_NOT_SUPPORTED_ERROR:
634 return "NPP_ROUND_MODE_NOT_SUPPORTED_ERROR";
636 case NPP_RESIZE_NO_OPERATION_ERROR:
637 return "NPP_RESIZE_NO_OPERATION_ERROR";
639 case NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY:
640 return "NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY";
642 #if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) <= 0x5000
644 case NPP_BAD_ARG_ERROR:
645 return "NPP_BAD_ARGUMENT_ERROR";
647 case NPP_COEFF_ERROR:
648 return "NPP_COEFFICIENT_ERROR";
651 return "NPP_RECTANGLE_ERROR";
654 return "NPP_QUADRANGLE_ERROR";
656 case NPP_MEM_ALLOC_ERR:
657 return "NPP_MEMORY_ALLOCATION_ERROR";
659 case NPP_HISTO_NUMBER_OF_LEVELS_ERROR:
660 return "NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR";
662 case NPP_INVALID_INPUT:
663 return "NPP_INVALID_INPUT";
665 case NPP_POINTER_ERROR:
666 return "NPP_POINTER_ERROR";
669 return "NPP_WARNING";
671 case NPP_ODD_ROI_WARNING:
672 return "NPP_ODD_ROI_WARNING";
676 case NPP_BAD_ARGUMENT_ERROR:
677 return "NPP_BAD_ARGUMENT_ERROR";
679 case NPP_COEFFICIENT_ERROR:
680 return "NPP_COEFFICIENT_ERROR";
682 case NPP_RECTANGLE_ERROR:
683 return "NPP_RECTANGLE_ERROR";
685 case NPP_QUADRANGLE_ERROR:
686 return "NPP_QUADRANGLE_ERROR";
688 case NPP_MEMORY_ALLOCATION_ERR:
689 return "NPP_MEMORY_ALLOCATION_ERROR";
691 case NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR:
692 return "NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR";
694 case NPP_INVALID_HOST_POINTER_ERROR:
695 return "NPP_INVALID_HOST_POINTER_ERROR";
697 case NPP_INVALID_DEVICE_POINTER_ERROR:
698 return "NPP_INVALID_DEVICE_POINTER_ERROR";
701 case NPP_LUT_NUMBER_OF_LEVELS_ERROR:
702 return "NPP_LUT_NUMBER_OF_LEVELS_ERROR";
704 case NPP_TEXTURE_BIND_ERROR:
705 return "NPP_TEXTURE_BIND_ERROR";
707 case NPP_WRONG_INTERSECTION_ROI_ERROR:
708 return "NPP_WRONG_INTERSECTION_ROI_ERROR";
710 case NPP_NOT_EVEN_STEP_ERROR:
711 return "NPP_NOT_EVEN_STEP_ERROR";
713 case NPP_INTERPOLATION_ERROR:
714 return "NPP_INTERPOLATION_ERROR";
716 case NPP_RESIZE_FACTOR_ERROR:
717 return "NPP_RESIZE_FACTOR_ERROR";
719 case NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR:
720 return "NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR";
723 #if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) <= 0x5000
725 case NPP_MEMFREE_ERR:
726 return "NPP_MEMFREE_ERR";
729 return "NPP_MEMSET_ERR";
732 return "NPP_MEMCPY_ERROR";
734 case NPP_MIRROR_FLIP_ERR:
735 return "NPP_MIRROR_FLIP_ERR";
738 case NPP_MEMFREE_ERROR:
739 return "NPP_MEMFREE_ERROR";
741 case NPP_MEMSET_ERROR:
742 return "NPP_MEMSET_ERROR";
744 case NPP_MEMCPY_ERROR:
745 return "NPP_MEMCPY_ERROR";
747 case NPP_MIRROR_FLIP_ERROR:
748 return "NPP_MIRROR_FLIP_ERROR";
751 case NPP_ALIGNMENT_ERROR:
752 return "NPP_ALIGNMENT_ERROR";
755 return "NPP_STEP_ERROR";
758 return "NPP_SIZE_ERROR";
760 case NPP_NULL_POINTER_ERROR:
761 return "NPP_NULL_POINTER_ERROR";
763 case NPP_CUDA_KERNEL_EXECUTION_ERROR:
764 return "NPP_CUDA_KERNEL_EXECUTION_ERROR";
766 case NPP_NOT_IMPLEMENTED_ERROR:
767 return "NPP_NOT_IMPLEMENTED_ERROR";
773 return "NPP_SUCCESS";
775 case NPP_WRONG_INTERSECTION_QUAD_WARNING:
776 return "NPP_WRONG_INTERSECTION_QUAD_WARNING";
778 case NPP_MISALIGNED_DST_ROI_WARNING:
779 return "NPP_MISALIGNED_DST_ROI_WARNING";
781 case NPP_AFFINE_QUAD_INCORRECT_WARNING:
782 return "NPP_AFFINE_QUAD_INCORRECT_WARNING";
784 case NPP_DOUBLE_SIZE_WARNING:
785 return "NPP_DOUBLE_SIZE_WARNING";
787 case NPP_WRONG_INTERSECTION_ROI_WARNING:
788 return "NPP_WRONG_INTERSECTION_ROI_WARNING";
790 #if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) >= 0x6000
792 case NPP_LUT_PALETTE_BITSIZE_ERROR:
793 return "NPP_LUT_PALETTE_BITSIZE_ERROR";
795 case NPP_ZC_MODE_NOT_SUPPORTED_ERROR:
796 return "NPP_ZC_MODE_NOT_SUPPORTED_ERROR";
798 case NPP_QUALITY_INDEX_ERROR:
799 return "NPP_QUALITY_INDEX_ERROR";
801 case NPP_CHANNEL_ORDER_ERROR:
802 return "NPP_CHANNEL_ORDER_ERROR";
804 case NPP_ZERO_MASK_VALUE_ERROR:
805 return "NPP_ZERO_MASK_VALUE_ERROR";
807 case NPP_NUMBER_OF_CHANNELS_ERROR:
808 return "NPP_NUMBER_OF_CHANNELS_ERROR";
811 return "NPP_COI_ERROR";
813 case NPP_DIVISOR_ERROR:
814 return "NPP_DIVISOR_ERROR";
816 case NPP_CHANNEL_ERROR:
817 return "NPP_CHANNEL_ERROR";
819 case NPP_STRIDE_ERROR:
820 return "NPP_STRIDE_ERROR";
822 case NPP_ANCHOR_ERROR:
823 return "NPP_ANCHOR_ERROR";
825 case NPP_MASK_SIZE_ERROR:
826 return "NPP_MASK_SIZE_ERROR";
828 case NPP_MOMENT_00_ZERO_ERROR:
829 return "NPP_MOMENT_00_ZERO_ERROR";
831 case NPP_THRESHOLD_NEGATIVE_LEVEL_ERROR:
832 return "NPP_THRESHOLD_NEGATIVE_LEVEL_ERROR";
834 case NPP_THRESHOLD_ERROR:
835 return "NPP_THRESHOLD_ERROR";
837 case NPP_CONTEXT_MATCH_ERROR:
838 return "NPP_CONTEXT_MATCH_ERROR";
840 case NPP_FFT_FLAG_ERROR:
841 return "NPP_FFT_FLAG_ERROR";
843 case NPP_FFT_ORDER_ERROR:
844 return "NPP_FFT_ORDER_ERROR";
846 case NPP_SCALE_RANGE_ERROR:
847 return "NPP_SCALE_RANGE_ERROR";
849 case NPP_DATA_TYPE_ERROR:
850 return "NPP_DATA_TYPE_ERROR";
852 case NPP_OUT_OFF_RANGE_ERROR:
853 return "NPP_OUT_OFF_RANGE_ERROR";
855 case NPP_DIVIDE_BY_ZERO_ERROR:
856 return "NPP_DIVIDE_BY_ZERO_ERROR";
858 case NPP_RANGE_ERROR:
859 return "NPP_RANGE_ERROR";
861 case NPP_NO_MEMORY_ERROR:
862 return "NPP_NO_MEMORY_ERROR";
864 case NPP_ERROR_RESERVED:
865 return "NPP_ERROR_RESERVED";
867 case NPP_NO_OPERATION_WARNING:
868 return "NPP_NO_OPERATION_WARNING";
870 case NPP_DIVIDE_BY_ZERO_WARNING:
871 return "NPP_DIVIDE_BY_ZERO_WARNING";
880 #ifdef __DRIVER_TYPES_H__
882 #define DEVICE_RESET cudaDeviceReset();
890 template<
typename T >
891 void check(T result,
char const *
const func,
const char *
const file,
int const line)
895 fprintf(stderr,
"CUDA error at %s:%d code=%d(%s) \"%s\" \n",
896 file, line, static_cast<unsigned int>(result), _cudaGetErrorEnum(result), func);
903 #ifdef __DRIVER_TYPES_H__
905 #define checkCudaErrors(val) check ( (val), #val, __FILE__, __LINE__ )
908 #define getLastCudaError(msg) __getLastCudaError (msg, __FILE__, __LINE__)
910 inline void __getLastCudaError(
const char *errorMessage,
const char *file,
const int line)
912 cudaError_t err = cudaGetLastError();
914 if (cudaSuccess != err)
916 fprintf(stderr,
"%s(%i) : getLastCudaError() CUDA error : %s : (%d) %s.\n",
917 file, line, errorMessage, (
int)err, cudaGetErrorString(err));
925 #define MAX(a,b) (a > b ? a : b)
931 return (value >= 0 ? (
int)(value + 0.5) : (
int)(value - 0.5));
944 sSMtoCores nGpuArchCoresPerSM[] =
959 while (nGpuArchCoresPerSM[index].SM != -1)
961 if (nGpuArchCoresPerSM[index].SM == ((major << 4) + minor))
963 return nGpuArchCoresPerSM[index].Cores;
970 printf(
"MapSMtoCores for SM %d.%d is undefined. Default to use %d Cores/SM\n", major, minor, nGpuArchCoresPerSM[index-1].Cores);
971 return nGpuArchCoresPerSM[index-1].Cores;
975 #ifdef __CUDA_RUNTIME_H__
977 inline int gpuDeviceInit(
int devID)
980 checkCudaErrors(cudaGetDeviceCount(&device_count));
982 if (device_count == 0)
984 fprintf(stderr,
"gpuDeviceInit() CUDA error: no devices supporting CUDA.\n");
993 if (devID > device_count-1)
995 fprintf(stderr,
"\n");
996 fprintf(stderr,
">> %d CUDA capable GPU device(s) detected. <<\n", device_count);
997 fprintf(stderr,
">> gpuDeviceInit (-device=%d) is not a valid GPU device. <<\n", devID);
998 fprintf(stderr,
"\n");
1002 cudaDeviceProp deviceProp;
1003 checkCudaErrors(cudaGetDeviceProperties(&deviceProp, devID));
1005 if (deviceProp.computeMode == cudaComputeModeProhibited)
1007 fprintf(stderr,
"Error: device is running in <Compute Mode Prohibited>, no threads can use ::cudaSetDevice().\n");
1011 if (deviceProp.major < 1)
1013 fprintf(stderr,
"gpuDeviceInit(): GPU device does not support CUDA.\n");
1017 checkCudaErrors(cudaSetDevice(devID));
1018 printf(
"gpuDeviceInit() CUDA Device [%d]: \"%s\n", devID, deviceProp.name);
1024 inline int gpuGetMaxGflopsDeviceId()
1026 int current_device = 0, sm_per_multiproc = 0;
1027 int max_perf_device = 0;
1028 int device_count = 0, best_SM_arch = 0;
1029 int devices_prohibited = 0;
1031 unsigned long long max_compute_perf = 0;
1032 cudaDeviceProp deviceProp;
1033 cudaGetDeviceCount(&device_count);
1035 checkCudaErrors(cudaGetDeviceCount(&device_count));
1037 if (device_count == 0)
1039 fprintf(stderr,
"gpuGetMaxGflopsDeviceId() CUDA error: no devices supporting CUDA.\n");
1044 while (current_device < device_count)
1046 cudaGetDeviceProperties(&deviceProp, current_device);
1049 if (deviceProp.computeMode != cudaComputeModeProhibited)
1051 if (deviceProp.major > 0 && deviceProp.major < 9999)
1053 best_SM_arch =
MAX(best_SM_arch, deviceProp.major);
1058 devices_prohibited++;
1064 if (devices_prohibited == device_count)
1066 fprintf(stderr,
"gpuGetMaxGflopsDeviceId() CUDA error: all devices have compute mode prohibited.\n");
1073 while (current_device < device_count)
1075 cudaGetDeviceProperties(&deviceProp, current_device);
1078 if (deviceProp.computeMode != cudaComputeModeProhibited)
1080 if (deviceProp.major == 9999 && deviceProp.minor == 9999)
1082 sm_per_multiproc = 1;
1089 unsigned long long compute_perf = (
unsigned long long) deviceProp.multiProcessorCount * sm_per_multiproc * deviceProp.clockRate;
1091 if (compute_perf > max_compute_perf)
1094 if (best_SM_arch > 2)
1097 if (deviceProp.major == best_SM_arch)
1099 max_compute_perf = compute_perf;
1100 max_perf_device = current_device;
1105 max_compute_perf = compute_perf;
1106 max_perf_device = current_device;
1114 return max_perf_device;
1119 inline int findCudaDevice(
int argc,
const char **argv)
1121 cudaDeviceProp deviceProp;
1131 printf(
"Invalid command line parameter\n ");
1136 devID = gpuDeviceInit(devID);
1140 printf(
"exiting...\n");
1148 devID = gpuGetMaxGflopsDeviceId();
1149 checkCudaErrors(cudaSetDevice(devID));
1150 checkCudaErrors(cudaGetDeviceProperties(&deviceProp, devID));
1151 printf(
"GPU Device %d: \"%s\" with compute capability %d.%d\n\n", devID, deviceProp.name, deviceProp.major, deviceProp.minor);
1158 inline bool checkCudaCapabilities(
int major_version,
int minor_version)
1160 cudaDeviceProp deviceProp;
1161 deviceProp.major = 0;
1162 deviceProp.minor = 0;
1165 checkCudaErrors(cudaGetDevice(&dev));
1166 checkCudaErrors(cudaGetDeviceProperties(&deviceProp, dev));
1168 if ((deviceProp.major > major_version) ||
1169 (deviceProp.major == major_version && deviceProp.minor >= minor_version))
1171 printf(
" Device %d: <%16s >, Compute SM %d.%d detected\n", dev, deviceProp.name, deviceProp.major, deviceProp.minor);
1176 printf(
" No GPU device was found that can support CUDA compute capability %d.%d.\n", major_version, minor_version);
bool checkCmdLineFlag(const int argc, const char **argv, const char *string_ref)
int _ConvertSMVer2Cores(int major, int minor)
void check(T result, char const *const func, const char *const file, int const line)
int getCmdLineArgumentInt(const int argc, const char **argv, const char *string_ref)