2 * Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
4 * Please refer to the NVIDIA end user license agreement (EULA) associated
5 * with this source code for terms and conditions that govern your use of
6 * this software. Any use, reproduction, disclosure, or distribution of
7 * this software and related documentation outside the terms of the EULA
8 * is strictly prohibited.
12 #ifndef _DRVAPI_ERROR_STRING_H_
13 #define _DRVAPI_ERROR_STRING_H_
19 #ifdef __cuda_cuda_h__ // check to see if CUDA_H is included above
21 // Error Code string definitions here
24 char const *error_string;
31 static s_CudaErrorStr sCudaDrvErrorString[] =
34 * The API call returned with no errors. In the case of query calls, this
35 * can also mean that the operation being queried is complete (see
36 * ::cuEventQuery() and ::cuStreamQuery()).
38 { "CUDA_SUCCESS", 0 },
41 * This indicates that one or more of the parameters passed to the API call
42 * is not within an acceptable range of values.
44 { "CUDA_ERROR_INVALID_VALUE", 1 },
47 * The API call failed because it was unable to allocate enough memory to
48 * perform the requested operation.
50 { "CUDA_ERROR_OUT_OF_MEMORY", 2 },
53 * This indicates that the CUDA driver has not been initialized with
54 * ::cuInit() or that initialization has failed.
56 { "CUDA_ERROR_NOT_INITIALIZED", 3 },
59 * This indicates that the CUDA driver is in the process of shutting down.
61 { "CUDA_ERROR_DEINITIALIZED", 4 },
64 * This indicates profiling APIs are called while application is running
65 * in visual profiler mode.
67 { "CUDA_ERROR_PROFILER_DISABLED", 5 },
69 * This indicates profiling has not been initialized for this context.
70 * Call cuProfilerInitialize() to resolve this.
72 { "CUDA_ERROR_PROFILER_NOT_INITIALIZED", 6 },
74 * This indicates profiler has already been started and probably
75 * cuProfilerStart() is incorrectly called.
77 { "CUDA_ERROR_PROFILER_ALREADY_STARTED", 7 },
79 * This indicates profiler has already been stopped and probably
80 * cuProfilerStop() is incorrectly called.
82 { "CUDA_ERROR_PROFILER_ALREADY_STOPPED", 8 },
84 * This indicates that no CUDA-capable devices were detected by the installed
87 { "CUDA_ERROR_NO_DEVICE (no CUDA-capable devices were detected)", 100 },
90 * This indicates that the device ordinal supplied by the user does not
91 * correspond to a valid CUDA device.
93 { "CUDA_ERROR_INVALID_DEVICE (device specified is not a valid CUDA device)", 101 },
97 * This indicates that the device kernel image is invalid. This can also
98 * indicate an invalid CUDA module.
100 { "CUDA_ERROR_INVALID_IMAGE", 200 },
103 * This most frequently indicates that there is no context bound to the
104 * current thread. This can also be returned if the context passed to an
105 * API call is not a valid handle (such as a context that has had
106 * ::cuCtxDestroy() invoked on it). This can also be returned if a user
107 * mixes different API versions (i.e. 3010 context with 3020 API calls).
108 * See ::cuCtxGetApiVersion() for more details.
110 { "CUDA_ERROR_INVALID_CONTEXT", 201 },
113 * This indicated that the context being supplied as a parameter to the
114 * API call was already the active context.
116 * This error return is deprecated as of CUDA 3.2. It is no longer an
117 * error to attempt to push the active context via ::cuCtxPushCurrent().
119 { "CUDA_ERROR_CONTEXT_ALREADY_CURRENT", 202 },
122 * This indicates that a map or register operation has failed.
124 { "CUDA_ERROR_MAP_FAILED", 205 },
127 * This indicates that an unmap or unregister operation has failed.
129 { "CUDA_ERROR_UNMAP_FAILED", 206 },
132 * This indicates that the specified array is currently mapped and thus
133 * cannot be destroyed.
135 { "CUDA_ERROR_ARRAY_IS_MAPPED", 207 },
138 * This indicates that the resource is already mapped.
140 { "CUDA_ERROR_ALREADY_MAPPED", 208 },
143 * This indicates that there is no kernel image available that is suitable
144 * for the device. This can occur when a user specifies code generation
145 * options for a particular CUDA source file that do not include the
146 * corresponding device configuration.
148 { "CUDA_ERROR_NO_BINARY_FOR_GPU", 209 },
151 * This indicates that a resource has already been acquired.
153 { "CUDA_ERROR_ALREADY_ACQUIRED", 210 },
156 * This indicates that a resource is not mapped.
158 { "CUDA_ERROR_NOT_MAPPED", 211 },
161 * This indicates that a mapped resource is not available for access as an
164 { "CUDA_ERROR_NOT_MAPPED_AS_ARRAY", 212 },
167 * This indicates that a mapped resource is not available for access as a
170 { "CUDA_ERROR_NOT_MAPPED_AS_POINTER", 213 },
173 * This indicates that an uncorrectable ECC error was detected during
176 { "CUDA_ERROR_ECC_UNCORRECTABLE", 214 },
179 * This indicates that the ::CUlimit passed to the API call is not
180 * supported by the active device.
182 { "CUDA_ERROR_UNSUPPORTED_LIMIT", 215 },
185 * This indicates that the ::CUcontext passed to the API call can
186 * only be bound to a single CPU thread at a time but is already
187 * bound to a CPU thread.
189 { "CUDA_ERROR_CONTEXT_ALREADY_IN_USE", 216 },
192 * This indicates that the device kernel source is invalid.
194 { "CUDA_ERROR_INVALID_SOURCE", 300 },
197 * This indicates that the file specified was not found.
199 { "CUDA_ERROR_FILE_NOT_FOUND", 301 },
202 * This indicates that a link to a shared object failed to resolve.
204 { "CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND", 302 },
207 * This indicates that initialization of a shared object failed.
209 { "CUDA_ERROR_SHARED_OBJECT_INIT_FAILED", 303 },
212 * This indicates that an OS call failed.
214 { "CUDA_ERROR_OPERATING_SYSTEM", 304 },
218 * This indicates that a resource handle passed to the API call was not
219 * valid. Resource handles are opaque types like ::CUstream and ::CUevent.
221 { "CUDA_ERROR_INVALID_HANDLE", 400 },
225 * This indicates that a named symbol was not found. Examples of symbols
226 * are global/constant variable names, texture names }, and surface names.
228 { "CUDA_ERROR_NOT_FOUND", 500 },
232 * This indicates that asynchronous operations issued previously have not
233 * completed yet. This result is not actually an error, but must be indicated
234 * differently than ::CUDA_SUCCESS (which indicates completion). Calls that
235 * may return this value include ::cuEventQuery() and ::cuStreamQuery().
237 { "CUDA_ERROR_NOT_READY", 600 },
241 * An exception occurred on the device while executing a kernel. Common
242 * causes include dereferencing an invalid device pointer and accessing
243 * out of bounds shared memory. The context cannot be used }, so it must
244 * be destroyed (and a new one should be created). All existing device
245 * memory allocations from this context are invalid and must be
246 * reconstructed if the program is to continue using CUDA.
248 { "CUDA_ERROR_LAUNCH_FAILED", 700 },
251 * This indicates that a launch did not occur because it did not have
252 * appropriate resources. This error usually indicates that the user has
253 * attempted to pass too many arguments to the device kernel, or the
254 * kernel launch specifies too many threads for the kernel's register
255 * count. Passing arguments of the wrong size (i.e. a 64-bit pointer
256 * when a 32-bit int is expected) is equivalent to passing too many
257 * arguments and can also result in this error.
259 { "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES", 701 },
262 * This indicates that the device kernel took too long to execute. This can
263 * only occur if timeouts are enabled - see the device attribute
264 * ::CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT for more information. The
265 * context cannot be used (and must be destroyed similar to
266 * ::CUDA_ERROR_LAUNCH_FAILED). All existing device memory allocations from
267 * this context are invalid and must be reconstructed if the program is to
268 * continue using CUDA.
270 { "CUDA_ERROR_LAUNCH_TIMEOUT", 702 },
273 * This error indicates a kernel launch that uses an incompatible texturing
276 { "CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING", 703 },
279 * This error indicates that a call to ::cuCtxEnablePeerAccess() is
280 * trying to re-enable peer access to a context which has already
281 * had peer access to it enabled.
283 { "CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED", 704 },
286 * This error indicates that ::cuCtxDisablePeerAccess() is
287 * trying to disable peer access which has not been enabled yet
288 * via ::cuCtxEnablePeerAccess().
290 { "CUDA_ERROR_PEER_ACCESS_NOT_ENABLED", 705 },
293 * This error indicates that the primary context for the specified device
294 * has already been initialized.
296 { "CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE", 708 },
299 * This error indicates that the context current to the calling thread
300 * has been destroyed using ::cuCtxDestroy }, or is a primary context which
301 * has not yet been initialized.
303 { "CUDA_ERROR_CONTEXT_IS_DESTROYED", 709 },
306 * A device-side assert triggered during kernel execution. The context
307 * cannot be used anymore, and must be destroyed. All existing device
308 * memory allocations from this context are invalid and must be
309 * reconstructed if the program is to continue using CUDA.
311 { "CUDA_ERROR_ASSERT", 710 },
314 * This indicates that an unknown internal error has occurred.
316 { "CUDA_ERROR_UNKNOWN", 999 },
320 // This is just a linear search through the array, since the error_id's are not
321 // always ocurring consecutively
322 inline const char *getCudaDrvErrorString(CUresult error_id)
326 while (sCudaDrvErrorString[index].error_id != error_id &&
327 sCudaDrvErrorString[index].error_id != -1)
332 if (sCudaDrvErrorString[index].error_id == error_id)
333 return (const char *)sCudaDrvErrorString[index].error_string;
335 return (const char *)"CUDA_ERROR not found!";
338 #endif // __cuda_cuda_h__