annotate src/parallel_execution/helper_cuda.h @ 303:1dbaef86593b

CUDAtwice.cbc
author ikkun
date Mon, 13 Feb 2017 18:23:29 +0900
parents src/test/helper_cuda.h@609bf62768b9
children 9755206813cb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
291
87128b876c63 add test
ikkun
parents:
diff changeset
1 /**
87128b876c63 add test
ikkun
parents:
diff changeset
2 * Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
87128b876c63 add test
ikkun
parents:
diff changeset
3 *
87128b876c63 add test
ikkun
parents:
diff changeset
4 * Please refer to the NVIDIA end user license agreement (EULA) associated
87128b876c63 add test
ikkun
parents:
diff changeset
5 * with this source code for terms and conditions that govern your use of
87128b876c63 add test
ikkun
parents:
diff changeset
6 * this software. Any use, reproduction, disclosure, or distribution of
87128b876c63 add test
ikkun
parents:
diff changeset
7 * this software and related documentation outside the terms of the EULA
87128b876c63 add test
ikkun
parents:
diff changeset
8 * is strictly prohibited.
87128b876c63 add test
ikkun
parents:
diff changeset
9 *
87128b876c63 add test
ikkun
parents:
diff changeset
10 */
87128b876c63 add test
ikkun
parents:
diff changeset
11
87128b876c63 add test
ikkun
parents:
diff changeset
12 ////////////////////////////////////////////////////////////////////////////////
87128b876c63 add test
ikkun
parents:
diff changeset
13 // These are CUDA Helper functions for initialization and error checking
87128b876c63 add test
ikkun
parents:
diff changeset
14
87128b876c63 add test
ikkun
parents:
diff changeset
15 #ifndef HELPER_CUDA_H
87128b876c63 add test
ikkun
parents:
diff changeset
16 #define HELPER_CUDA_H
87128b876c63 add test
ikkun
parents:
diff changeset
17
87128b876c63 add test
ikkun
parents:
diff changeset
18 #pragma once
87128b876c63 add test
ikkun
parents:
diff changeset
19
87128b876c63 add test
ikkun
parents:
diff changeset
20 #include <stdlib.h>
87128b876c63 add test
ikkun
parents:
diff changeset
21 #include <stdio.h>
87128b876c63 add test
ikkun
parents:
diff changeset
22 #include <string.h>
87128b876c63 add test
ikkun
parents:
diff changeset
23
87128b876c63 add test
ikkun
parents:
diff changeset
24 #include "helper_string.h"
87128b876c63 add test
ikkun
parents:
diff changeset
25
87128b876c63 add test
ikkun
parents:
diff changeset
26 #ifndef EXIT_WAIVED
87128b876c63 add test
ikkun
parents:
diff changeset
27 #define EXIT_WAIVED 2
87128b876c63 add test
ikkun
parents:
diff changeset
28 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
29
87128b876c63 add test
ikkun
parents:
diff changeset
30 // Note, it is required that your SDK sample to include the proper header files, please
87128b876c63 add test
ikkun
parents:
diff changeset
31 // refer the CUDA examples for examples of the needed CUDA headers, which may change depending
87128b876c63 add test
ikkun
parents:
diff changeset
32 // on which CUDA functions are used.
87128b876c63 add test
ikkun
parents:
diff changeset
33
87128b876c63 add test
ikkun
parents:
diff changeset
34 // CUDA Runtime error messages
87128b876c63 add test
ikkun
parents:
diff changeset
35 #ifdef __DRIVER_TYPES_H__
87128b876c63 add test
ikkun
parents:
diff changeset
36 static const char *_cudaGetErrorEnum(cudaError_t error)
87128b876c63 add test
ikkun
parents:
diff changeset
37 {
87128b876c63 add test
ikkun
parents:
diff changeset
38 switch (error)
87128b876c63 add test
ikkun
parents:
diff changeset
39 {
87128b876c63 add test
ikkun
parents:
diff changeset
40 case cudaSuccess:
87128b876c63 add test
ikkun
parents:
diff changeset
41 return "cudaSuccess";
87128b876c63 add test
ikkun
parents:
diff changeset
42
87128b876c63 add test
ikkun
parents:
diff changeset
43 case cudaErrorMissingConfiguration:
87128b876c63 add test
ikkun
parents:
diff changeset
44 return "cudaErrorMissingConfiguration";
87128b876c63 add test
ikkun
parents:
diff changeset
45
87128b876c63 add test
ikkun
parents:
diff changeset
46 case cudaErrorMemoryAllocation:
87128b876c63 add test
ikkun
parents:
diff changeset
47 return "cudaErrorMemoryAllocation";
87128b876c63 add test
ikkun
parents:
diff changeset
48
87128b876c63 add test
ikkun
parents:
diff changeset
49 case cudaErrorInitializationError:
87128b876c63 add test
ikkun
parents:
diff changeset
50 return "cudaErrorInitializationError";
87128b876c63 add test
ikkun
parents:
diff changeset
51
87128b876c63 add test
ikkun
parents:
diff changeset
52 case cudaErrorLaunchFailure:
87128b876c63 add test
ikkun
parents:
diff changeset
53 return "cudaErrorLaunchFailure";
87128b876c63 add test
ikkun
parents:
diff changeset
54
87128b876c63 add test
ikkun
parents:
diff changeset
55 case cudaErrorPriorLaunchFailure:
87128b876c63 add test
ikkun
parents:
diff changeset
56 return "cudaErrorPriorLaunchFailure";
87128b876c63 add test
ikkun
parents:
diff changeset
57
87128b876c63 add test
ikkun
parents:
diff changeset
58 case cudaErrorLaunchTimeout:
87128b876c63 add test
ikkun
parents:
diff changeset
59 return "cudaErrorLaunchTimeout";
87128b876c63 add test
ikkun
parents:
diff changeset
60
87128b876c63 add test
ikkun
parents:
diff changeset
61 case cudaErrorLaunchOutOfResources:
87128b876c63 add test
ikkun
parents:
diff changeset
62 return "cudaErrorLaunchOutOfResources";
87128b876c63 add test
ikkun
parents:
diff changeset
63
87128b876c63 add test
ikkun
parents:
diff changeset
64 case cudaErrorInvalidDeviceFunction:
87128b876c63 add test
ikkun
parents:
diff changeset
65 return "cudaErrorInvalidDeviceFunction";
87128b876c63 add test
ikkun
parents:
diff changeset
66
87128b876c63 add test
ikkun
parents:
diff changeset
67 case cudaErrorInvalidConfiguration:
87128b876c63 add test
ikkun
parents:
diff changeset
68 return "cudaErrorInvalidConfiguration";
87128b876c63 add test
ikkun
parents:
diff changeset
69
87128b876c63 add test
ikkun
parents:
diff changeset
70 case cudaErrorInvalidDevice:
87128b876c63 add test
ikkun
parents:
diff changeset
71 return "cudaErrorInvalidDevice";
87128b876c63 add test
ikkun
parents:
diff changeset
72
87128b876c63 add test
ikkun
parents:
diff changeset
73 case cudaErrorInvalidValue:
87128b876c63 add test
ikkun
parents:
diff changeset
74 return "cudaErrorInvalidValue";
87128b876c63 add test
ikkun
parents:
diff changeset
75
87128b876c63 add test
ikkun
parents:
diff changeset
76 case cudaErrorInvalidPitchValue:
87128b876c63 add test
ikkun
parents:
diff changeset
77 return "cudaErrorInvalidPitchValue";
87128b876c63 add test
ikkun
parents:
diff changeset
78
87128b876c63 add test
ikkun
parents:
diff changeset
79 case cudaErrorInvalidSymbol:
87128b876c63 add test
ikkun
parents:
diff changeset
80 return "cudaErrorInvalidSymbol";
87128b876c63 add test
ikkun
parents:
diff changeset
81
87128b876c63 add test
ikkun
parents:
diff changeset
82 case cudaErrorMapBufferObjectFailed:
87128b876c63 add test
ikkun
parents:
diff changeset
83 return "cudaErrorMapBufferObjectFailed";
87128b876c63 add test
ikkun
parents:
diff changeset
84
87128b876c63 add test
ikkun
parents:
diff changeset
85 case cudaErrorUnmapBufferObjectFailed:
87128b876c63 add test
ikkun
parents:
diff changeset
86 return "cudaErrorUnmapBufferObjectFailed";
87128b876c63 add test
ikkun
parents:
diff changeset
87
87128b876c63 add test
ikkun
parents:
diff changeset
88 case cudaErrorInvalidHostPointer:
87128b876c63 add test
ikkun
parents:
diff changeset
89 return "cudaErrorInvalidHostPointer";
87128b876c63 add test
ikkun
parents:
diff changeset
90
87128b876c63 add test
ikkun
parents:
diff changeset
91 case cudaErrorInvalidDevicePointer:
87128b876c63 add test
ikkun
parents:
diff changeset
92 return "cudaErrorInvalidDevicePointer";
87128b876c63 add test
ikkun
parents:
diff changeset
93
87128b876c63 add test
ikkun
parents:
diff changeset
94 case cudaErrorInvalidTexture:
87128b876c63 add test
ikkun
parents:
diff changeset
95 return "cudaErrorInvalidTexture";
87128b876c63 add test
ikkun
parents:
diff changeset
96
87128b876c63 add test
ikkun
parents:
diff changeset
97 case cudaErrorInvalidTextureBinding:
87128b876c63 add test
ikkun
parents:
diff changeset
98 return "cudaErrorInvalidTextureBinding";
87128b876c63 add test
ikkun
parents:
diff changeset
99
87128b876c63 add test
ikkun
parents:
diff changeset
100 case cudaErrorInvalidChannelDescriptor:
87128b876c63 add test
ikkun
parents:
diff changeset
101 return "cudaErrorInvalidChannelDescriptor";
87128b876c63 add test
ikkun
parents:
diff changeset
102
87128b876c63 add test
ikkun
parents:
diff changeset
103 case cudaErrorInvalidMemcpyDirection:
87128b876c63 add test
ikkun
parents:
diff changeset
104 return "cudaErrorInvalidMemcpyDirection";
87128b876c63 add test
ikkun
parents:
diff changeset
105
87128b876c63 add test
ikkun
parents:
diff changeset
106 case cudaErrorAddressOfConstant:
87128b876c63 add test
ikkun
parents:
diff changeset
107 return "cudaErrorAddressOfConstant";
87128b876c63 add test
ikkun
parents:
diff changeset
108
87128b876c63 add test
ikkun
parents:
diff changeset
109 case cudaErrorTextureFetchFailed:
87128b876c63 add test
ikkun
parents:
diff changeset
110 return "cudaErrorTextureFetchFailed";
87128b876c63 add test
ikkun
parents:
diff changeset
111
87128b876c63 add test
ikkun
parents:
diff changeset
112 case cudaErrorTextureNotBound:
87128b876c63 add test
ikkun
parents:
diff changeset
113 return "cudaErrorTextureNotBound";
87128b876c63 add test
ikkun
parents:
diff changeset
114
87128b876c63 add test
ikkun
parents:
diff changeset
115 case cudaErrorSynchronizationError:
87128b876c63 add test
ikkun
parents:
diff changeset
116 return "cudaErrorSynchronizationError";
87128b876c63 add test
ikkun
parents:
diff changeset
117
87128b876c63 add test
ikkun
parents:
diff changeset
118 case cudaErrorInvalidFilterSetting:
87128b876c63 add test
ikkun
parents:
diff changeset
119 return "cudaErrorInvalidFilterSetting";
87128b876c63 add test
ikkun
parents:
diff changeset
120
87128b876c63 add test
ikkun
parents:
diff changeset
121 case cudaErrorInvalidNormSetting:
87128b876c63 add test
ikkun
parents:
diff changeset
122 return "cudaErrorInvalidNormSetting";
87128b876c63 add test
ikkun
parents:
diff changeset
123
87128b876c63 add test
ikkun
parents:
diff changeset
124 case cudaErrorMixedDeviceExecution:
87128b876c63 add test
ikkun
parents:
diff changeset
125 return "cudaErrorMixedDeviceExecution";
87128b876c63 add test
ikkun
parents:
diff changeset
126
87128b876c63 add test
ikkun
parents:
diff changeset
127 case cudaErrorCudartUnloading:
87128b876c63 add test
ikkun
parents:
diff changeset
128 return "cudaErrorCudartUnloading";
87128b876c63 add test
ikkun
parents:
diff changeset
129
87128b876c63 add test
ikkun
parents:
diff changeset
130 case cudaErrorUnknown:
87128b876c63 add test
ikkun
parents:
diff changeset
131 return "cudaErrorUnknown";
87128b876c63 add test
ikkun
parents:
diff changeset
132
87128b876c63 add test
ikkun
parents:
diff changeset
133 case cudaErrorNotYetImplemented:
87128b876c63 add test
ikkun
parents:
diff changeset
134 return "cudaErrorNotYetImplemented";
87128b876c63 add test
ikkun
parents:
diff changeset
135
87128b876c63 add test
ikkun
parents:
diff changeset
136 case cudaErrorMemoryValueTooLarge:
87128b876c63 add test
ikkun
parents:
diff changeset
137 return "cudaErrorMemoryValueTooLarge";
87128b876c63 add test
ikkun
parents:
diff changeset
138
87128b876c63 add test
ikkun
parents:
diff changeset
139 case cudaErrorInvalidResourceHandle:
87128b876c63 add test
ikkun
parents:
diff changeset
140 return "cudaErrorInvalidResourceHandle";
87128b876c63 add test
ikkun
parents:
diff changeset
141
87128b876c63 add test
ikkun
parents:
diff changeset
142 case cudaErrorNotReady:
87128b876c63 add test
ikkun
parents:
diff changeset
143 return "cudaErrorNotReady";
87128b876c63 add test
ikkun
parents:
diff changeset
144
87128b876c63 add test
ikkun
parents:
diff changeset
145 case cudaErrorInsufficientDriver:
87128b876c63 add test
ikkun
parents:
diff changeset
146 return "cudaErrorInsufficientDriver";
87128b876c63 add test
ikkun
parents:
diff changeset
147
87128b876c63 add test
ikkun
parents:
diff changeset
148 case cudaErrorSetOnActiveProcess:
87128b876c63 add test
ikkun
parents:
diff changeset
149 return "cudaErrorSetOnActiveProcess";
87128b876c63 add test
ikkun
parents:
diff changeset
150
87128b876c63 add test
ikkun
parents:
diff changeset
151 case cudaErrorInvalidSurface:
87128b876c63 add test
ikkun
parents:
diff changeset
152 return "cudaErrorInvalidSurface";
87128b876c63 add test
ikkun
parents:
diff changeset
153
87128b876c63 add test
ikkun
parents:
diff changeset
154 case cudaErrorNoDevice:
87128b876c63 add test
ikkun
parents:
diff changeset
155 return "cudaErrorNoDevice";
87128b876c63 add test
ikkun
parents:
diff changeset
156
87128b876c63 add test
ikkun
parents:
diff changeset
157 case cudaErrorECCUncorrectable:
87128b876c63 add test
ikkun
parents:
diff changeset
158 return "cudaErrorECCUncorrectable";
87128b876c63 add test
ikkun
parents:
diff changeset
159
87128b876c63 add test
ikkun
parents:
diff changeset
160 case cudaErrorSharedObjectSymbolNotFound:
87128b876c63 add test
ikkun
parents:
diff changeset
161 return "cudaErrorSharedObjectSymbolNotFound";
87128b876c63 add test
ikkun
parents:
diff changeset
162
87128b876c63 add test
ikkun
parents:
diff changeset
163 case cudaErrorSharedObjectInitFailed:
87128b876c63 add test
ikkun
parents:
diff changeset
164 return "cudaErrorSharedObjectInitFailed";
87128b876c63 add test
ikkun
parents:
diff changeset
165
87128b876c63 add test
ikkun
parents:
diff changeset
166 case cudaErrorUnsupportedLimit:
87128b876c63 add test
ikkun
parents:
diff changeset
167 return "cudaErrorUnsupportedLimit";
87128b876c63 add test
ikkun
parents:
diff changeset
168
87128b876c63 add test
ikkun
parents:
diff changeset
169 case cudaErrorDuplicateVariableName:
87128b876c63 add test
ikkun
parents:
diff changeset
170 return "cudaErrorDuplicateVariableName";
87128b876c63 add test
ikkun
parents:
diff changeset
171
87128b876c63 add test
ikkun
parents:
diff changeset
172 case cudaErrorDuplicateTextureName:
87128b876c63 add test
ikkun
parents:
diff changeset
173 return "cudaErrorDuplicateTextureName";
87128b876c63 add test
ikkun
parents:
diff changeset
174
87128b876c63 add test
ikkun
parents:
diff changeset
175 case cudaErrorDuplicateSurfaceName:
87128b876c63 add test
ikkun
parents:
diff changeset
176 return "cudaErrorDuplicateSurfaceName";
87128b876c63 add test
ikkun
parents:
diff changeset
177
87128b876c63 add test
ikkun
parents:
diff changeset
178 case cudaErrorDevicesUnavailable:
87128b876c63 add test
ikkun
parents:
diff changeset
179 return "cudaErrorDevicesUnavailable";
87128b876c63 add test
ikkun
parents:
diff changeset
180
87128b876c63 add test
ikkun
parents:
diff changeset
181 case cudaErrorInvalidKernelImage:
87128b876c63 add test
ikkun
parents:
diff changeset
182 return "cudaErrorInvalidKernelImage";
87128b876c63 add test
ikkun
parents:
diff changeset
183
87128b876c63 add test
ikkun
parents:
diff changeset
184 case cudaErrorNoKernelImageForDevice:
87128b876c63 add test
ikkun
parents:
diff changeset
185 return "cudaErrorNoKernelImageForDevice";
87128b876c63 add test
ikkun
parents:
diff changeset
186
87128b876c63 add test
ikkun
parents:
diff changeset
187 case cudaErrorIncompatibleDriverContext:
87128b876c63 add test
ikkun
parents:
diff changeset
188 return "cudaErrorIncompatibleDriverContext";
87128b876c63 add test
ikkun
parents:
diff changeset
189
87128b876c63 add test
ikkun
parents:
diff changeset
190 case cudaErrorPeerAccessAlreadyEnabled:
87128b876c63 add test
ikkun
parents:
diff changeset
191 return "cudaErrorPeerAccessAlreadyEnabled";
87128b876c63 add test
ikkun
parents:
diff changeset
192
87128b876c63 add test
ikkun
parents:
diff changeset
193 case cudaErrorPeerAccessNotEnabled:
87128b876c63 add test
ikkun
parents:
diff changeset
194 return "cudaErrorPeerAccessNotEnabled";
87128b876c63 add test
ikkun
parents:
diff changeset
195
87128b876c63 add test
ikkun
parents:
diff changeset
196 case cudaErrorDeviceAlreadyInUse:
87128b876c63 add test
ikkun
parents:
diff changeset
197 return "cudaErrorDeviceAlreadyInUse";
87128b876c63 add test
ikkun
parents:
diff changeset
198
87128b876c63 add test
ikkun
parents:
diff changeset
199 case cudaErrorProfilerDisabled:
87128b876c63 add test
ikkun
parents:
diff changeset
200 return "cudaErrorProfilerDisabled";
87128b876c63 add test
ikkun
parents:
diff changeset
201
87128b876c63 add test
ikkun
parents:
diff changeset
202 case cudaErrorProfilerNotInitialized:
87128b876c63 add test
ikkun
parents:
diff changeset
203 return "cudaErrorProfilerNotInitialized";
87128b876c63 add test
ikkun
parents:
diff changeset
204
87128b876c63 add test
ikkun
parents:
diff changeset
205 case cudaErrorProfilerAlreadyStarted:
87128b876c63 add test
ikkun
parents:
diff changeset
206 return "cudaErrorProfilerAlreadyStarted";
87128b876c63 add test
ikkun
parents:
diff changeset
207
87128b876c63 add test
ikkun
parents:
diff changeset
208 case cudaErrorProfilerAlreadyStopped:
87128b876c63 add test
ikkun
parents:
diff changeset
209 return "cudaErrorProfilerAlreadyStopped";
87128b876c63 add test
ikkun
parents:
diff changeset
210
87128b876c63 add test
ikkun
parents:
diff changeset
211 /* Since CUDA 4.0*/
87128b876c63 add test
ikkun
parents:
diff changeset
212 case cudaErrorAssert:
87128b876c63 add test
ikkun
parents:
diff changeset
213 return "cudaErrorAssert";
87128b876c63 add test
ikkun
parents:
diff changeset
214
87128b876c63 add test
ikkun
parents:
diff changeset
215 case cudaErrorTooManyPeers:
87128b876c63 add test
ikkun
parents:
diff changeset
216 return "cudaErrorTooManyPeers";
87128b876c63 add test
ikkun
parents:
diff changeset
217
87128b876c63 add test
ikkun
parents:
diff changeset
218 case cudaErrorHostMemoryAlreadyRegistered:
87128b876c63 add test
ikkun
parents:
diff changeset
219 return "cudaErrorHostMemoryAlreadyRegistered";
87128b876c63 add test
ikkun
parents:
diff changeset
220
87128b876c63 add test
ikkun
parents:
diff changeset
221 case cudaErrorHostMemoryNotRegistered:
87128b876c63 add test
ikkun
parents:
diff changeset
222 return "cudaErrorHostMemoryNotRegistered";
87128b876c63 add test
ikkun
parents:
diff changeset
223
87128b876c63 add test
ikkun
parents:
diff changeset
224 /* Since CUDA 5.0 */
87128b876c63 add test
ikkun
parents:
diff changeset
225 case cudaErrorOperatingSystem:
87128b876c63 add test
ikkun
parents:
diff changeset
226 return "cudaErrorOperatingSystem";
87128b876c63 add test
ikkun
parents:
diff changeset
227
87128b876c63 add test
ikkun
parents:
diff changeset
228 case cudaErrorPeerAccessUnsupported:
87128b876c63 add test
ikkun
parents:
diff changeset
229 return "cudaErrorPeerAccessUnsupported";
87128b876c63 add test
ikkun
parents:
diff changeset
230
87128b876c63 add test
ikkun
parents:
diff changeset
231 case cudaErrorLaunchMaxDepthExceeded:
87128b876c63 add test
ikkun
parents:
diff changeset
232 return "cudaErrorLaunchMaxDepthExceeded";
87128b876c63 add test
ikkun
parents:
diff changeset
233
87128b876c63 add test
ikkun
parents:
diff changeset
234 case cudaErrorLaunchFileScopedTex:
87128b876c63 add test
ikkun
parents:
diff changeset
235 return "cudaErrorLaunchFileScopedTex";
87128b876c63 add test
ikkun
parents:
diff changeset
236
87128b876c63 add test
ikkun
parents:
diff changeset
237 case cudaErrorLaunchFileScopedSurf:
87128b876c63 add test
ikkun
parents:
diff changeset
238 return "cudaErrorLaunchFileScopedSurf";
87128b876c63 add test
ikkun
parents:
diff changeset
239
87128b876c63 add test
ikkun
parents:
diff changeset
240 case cudaErrorSyncDepthExceeded:
87128b876c63 add test
ikkun
parents:
diff changeset
241 return "cudaErrorSyncDepthExceeded";
87128b876c63 add test
ikkun
parents:
diff changeset
242
87128b876c63 add test
ikkun
parents:
diff changeset
243 case cudaErrorLaunchPendingCountExceeded:
87128b876c63 add test
ikkun
parents:
diff changeset
244 return "cudaErrorLaunchPendingCountExceeded";
87128b876c63 add test
ikkun
parents:
diff changeset
245
87128b876c63 add test
ikkun
parents:
diff changeset
246 case cudaErrorNotPermitted:
87128b876c63 add test
ikkun
parents:
diff changeset
247 return "cudaErrorNotPermitted";
87128b876c63 add test
ikkun
parents:
diff changeset
248
87128b876c63 add test
ikkun
parents:
diff changeset
249 case cudaErrorNotSupported:
87128b876c63 add test
ikkun
parents:
diff changeset
250 return "cudaErrorNotSupported";
87128b876c63 add test
ikkun
parents:
diff changeset
251
87128b876c63 add test
ikkun
parents:
diff changeset
252 /* Since CUDA 6.0 */
87128b876c63 add test
ikkun
parents:
diff changeset
253 case cudaErrorHardwareStackError:
87128b876c63 add test
ikkun
parents:
diff changeset
254 return "cudaErrorHardwareStackError";
87128b876c63 add test
ikkun
parents:
diff changeset
255
87128b876c63 add test
ikkun
parents:
diff changeset
256 case cudaErrorIllegalInstruction:
87128b876c63 add test
ikkun
parents:
diff changeset
257 return "cudaErrorIllegalInstruction";
87128b876c63 add test
ikkun
parents:
diff changeset
258
87128b876c63 add test
ikkun
parents:
diff changeset
259 case cudaErrorMisalignedAddress:
87128b876c63 add test
ikkun
parents:
diff changeset
260 return "cudaErrorMisalignedAddress";
87128b876c63 add test
ikkun
parents:
diff changeset
261
87128b876c63 add test
ikkun
parents:
diff changeset
262 case cudaErrorInvalidAddressSpace:
87128b876c63 add test
ikkun
parents:
diff changeset
263 return "cudaErrorInvalidAddressSpace";
87128b876c63 add test
ikkun
parents:
diff changeset
264
87128b876c63 add test
ikkun
parents:
diff changeset
265 case cudaErrorInvalidPc:
87128b876c63 add test
ikkun
parents:
diff changeset
266 return "cudaErrorInvalidPc";
87128b876c63 add test
ikkun
parents:
diff changeset
267
87128b876c63 add test
ikkun
parents:
diff changeset
268 case cudaErrorIllegalAddress:
87128b876c63 add test
ikkun
parents:
diff changeset
269 return "cudaErrorIllegalAddress";
87128b876c63 add test
ikkun
parents:
diff changeset
270
87128b876c63 add test
ikkun
parents:
diff changeset
271 /* Since CUDA 6.5*/
87128b876c63 add test
ikkun
parents:
diff changeset
272 case cudaErrorInvalidPtx:
87128b876c63 add test
ikkun
parents:
diff changeset
273 return "cudaErrorInvalidPtx";
87128b876c63 add test
ikkun
parents:
diff changeset
274
87128b876c63 add test
ikkun
parents:
diff changeset
275 case cudaErrorInvalidGraphicsContext:
87128b876c63 add test
ikkun
parents:
diff changeset
276 return "cudaErrorInvalidGraphicsContext";
87128b876c63 add test
ikkun
parents:
diff changeset
277
87128b876c63 add test
ikkun
parents:
diff changeset
278 case cudaErrorStartupFailure:
87128b876c63 add test
ikkun
parents:
diff changeset
279 return "cudaErrorStartupFailure";
87128b876c63 add test
ikkun
parents:
diff changeset
280
87128b876c63 add test
ikkun
parents:
diff changeset
281 case cudaErrorApiFailureBase:
87128b876c63 add test
ikkun
parents:
diff changeset
282 return "cudaErrorApiFailureBase";
87128b876c63 add test
ikkun
parents:
diff changeset
283
87128b876c63 add test
ikkun
parents:
diff changeset
284 /* Since CUDA 8.0*/
87128b876c63 add test
ikkun
parents:
diff changeset
285 case cudaErrorNvlinkUncorrectable :
87128b876c63 add test
ikkun
parents:
diff changeset
286 return "cudaErrorNvlinkUncorrectable";
87128b876c63 add test
ikkun
parents:
diff changeset
287 }
87128b876c63 add test
ikkun
parents:
diff changeset
288
87128b876c63 add test
ikkun
parents:
diff changeset
289 return "<unknown>";
87128b876c63 add test
ikkun
parents:
diff changeset
290 }
87128b876c63 add test
ikkun
parents:
diff changeset
291 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
292
87128b876c63 add test
ikkun
parents:
diff changeset
293 #ifdef __cuda_cuda_h__
87128b876c63 add test
ikkun
parents:
diff changeset
294 // CUDA Driver API errors
301
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 291
diff changeset
295 const char *_cudaGetErrorEnum(CUresult error)
291
87128b876c63 add test
ikkun
parents:
diff changeset
296 {
87128b876c63 add test
ikkun
parents:
diff changeset
297 switch (error)
87128b876c63 add test
ikkun
parents:
diff changeset
298 {
87128b876c63 add test
ikkun
parents:
diff changeset
299 case CUDA_SUCCESS:
87128b876c63 add test
ikkun
parents:
diff changeset
300 return "CUDA_SUCCESS";
87128b876c63 add test
ikkun
parents:
diff changeset
301
87128b876c63 add test
ikkun
parents:
diff changeset
302 case CUDA_ERROR_INVALID_VALUE:
87128b876c63 add test
ikkun
parents:
diff changeset
303 return "CUDA_ERROR_INVALID_VALUE";
87128b876c63 add test
ikkun
parents:
diff changeset
304
87128b876c63 add test
ikkun
parents:
diff changeset
305 case CUDA_ERROR_OUT_OF_MEMORY:
87128b876c63 add test
ikkun
parents:
diff changeset
306 return "CUDA_ERROR_OUT_OF_MEMORY";
87128b876c63 add test
ikkun
parents:
diff changeset
307
87128b876c63 add test
ikkun
parents:
diff changeset
308 case CUDA_ERROR_NOT_INITIALIZED:
87128b876c63 add test
ikkun
parents:
diff changeset
309 return "CUDA_ERROR_NOT_INITIALIZED";
87128b876c63 add test
ikkun
parents:
diff changeset
310
87128b876c63 add test
ikkun
parents:
diff changeset
311 case CUDA_ERROR_DEINITIALIZED:
87128b876c63 add test
ikkun
parents:
diff changeset
312 return "CUDA_ERROR_DEINITIALIZED";
87128b876c63 add test
ikkun
parents:
diff changeset
313
87128b876c63 add test
ikkun
parents:
diff changeset
314 case CUDA_ERROR_PROFILER_DISABLED:
87128b876c63 add test
ikkun
parents:
diff changeset
315 return "CUDA_ERROR_PROFILER_DISABLED";
87128b876c63 add test
ikkun
parents:
diff changeset
316
87128b876c63 add test
ikkun
parents:
diff changeset
317 case CUDA_ERROR_PROFILER_NOT_INITIALIZED:
87128b876c63 add test
ikkun
parents:
diff changeset
318 return "CUDA_ERROR_PROFILER_NOT_INITIALIZED";
87128b876c63 add test
ikkun
parents:
diff changeset
319
87128b876c63 add test
ikkun
parents:
diff changeset
320 case CUDA_ERROR_PROFILER_ALREADY_STARTED:
87128b876c63 add test
ikkun
parents:
diff changeset
321 return "CUDA_ERROR_PROFILER_ALREADY_STARTED";
87128b876c63 add test
ikkun
parents:
diff changeset
322
87128b876c63 add test
ikkun
parents:
diff changeset
323 case CUDA_ERROR_PROFILER_ALREADY_STOPPED:
87128b876c63 add test
ikkun
parents:
diff changeset
324 return "CUDA_ERROR_PROFILER_ALREADY_STOPPED";
87128b876c63 add test
ikkun
parents:
diff changeset
325
87128b876c63 add test
ikkun
parents:
diff changeset
326 case CUDA_ERROR_NO_DEVICE:
87128b876c63 add test
ikkun
parents:
diff changeset
327 return "CUDA_ERROR_NO_DEVICE";
87128b876c63 add test
ikkun
parents:
diff changeset
328
87128b876c63 add test
ikkun
parents:
diff changeset
329 case CUDA_ERROR_INVALID_DEVICE:
87128b876c63 add test
ikkun
parents:
diff changeset
330 return "CUDA_ERROR_INVALID_DEVICE";
87128b876c63 add test
ikkun
parents:
diff changeset
331
87128b876c63 add test
ikkun
parents:
diff changeset
332 case CUDA_ERROR_INVALID_IMAGE:
87128b876c63 add test
ikkun
parents:
diff changeset
333 return "CUDA_ERROR_INVALID_IMAGE";
87128b876c63 add test
ikkun
parents:
diff changeset
334
87128b876c63 add test
ikkun
parents:
diff changeset
335 case CUDA_ERROR_INVALID_CONTEXT:
87128b876c63 add test
ikkun
parents:
diff changeset
336 return "CUDA_ERROR_INVALID_CONTEXT";
87128b876c63 add test
ikkun
parents:
diff changeset
337
87128b876c63 add test
ikkun
parents:
diff changeset
338 case CUDA_ERROR_CONTEXT_ALREADY_CURRENT:
87128b876c63 add test
ikkun
parents:
diff changeset
339 return "CUDA_ERROR_CONTEXT_ALREADY_CURRENT";
87128b876c63 add test
ikkun
parents:
diff changeset
340
87128b876c63 add test
ikkun
parents:
diff changeset
341 case CUDA_ERROR_MAP_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
342 return "CUDA_ERROR_MAP_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
343
87128b876c63 add test
ikkun
parents:
diff changeset
344 case CUDA_ERROR_UNMAP_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
345 return "CUDA_ERROR_UNMAP_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
346
87128b876c63 add test
ikkun
parents:
diff changeset
347 case CUDA_ERROR_ARRAY_IS_MAPPED:
87128b876c63 add test
ikkun
parents:
diff changeset
348 return "CUDA_ERROR_ARRAY_IS_MAPPED";
87128b876c63 add test
ikkun
parents:
diff changeset
349
87128b876c63 add test
ikkun
parents:
diff changeset
350 case CUDA_ERROR_ALREADY_MAPPED:
87128b876c63 add test
ikkun
parents:
diff changeset
351 return "CUDA_ERROR_ALREADY_MAPPED";
87128b876c63 add test
ikkun
parents:
diff changeset
352
87128b876c63 add test
ikkun
parents:
diff changeset
353 case CUDA_ERROR_NO_BINARY_FOR_GPU:
87128b876c63 add test
ikkun
parents:
diff changeset
354 return "CUDA_ERROR_NO_BINARY_FOR_GPU";
87128b876c63 add test
ikkun
parents:
diff changeset
355
87128b876c63 add test
ikkun
parents:
diff changeset
356 case CUDA_ERROR_ALREADY_ACQUIRED:
87128b876c63 add test
ikkun
parents:
diff changeset
357 return "CUDA_ERROR_ALREADY_ACQUIRED";
87128b876c63 add test
ikkun
parents:
diff changeset
358
87128b876c63 add test
ikkun
parents:
diff changeset
359 case CUDA_ERROR_NOT_MAPPED:
87128b876c63 add test
ikkun
parents:
diff changeset
360 return "CUDA_ERROR_NOT_MAPPED";
87128b876c63 add test
ikkun
parents:
diff changeset
361
87128b876c63 add test
ikkun
parents:
diff changeset
362 case CUDA_ERROR_NOT_MAPPED_AS_ARRAY:
87128b876c63 add test
ikkun
parents:
diff changeset
363 return "CUDA_ERROR_NOT_MAPPED_AS_ARRAY";
87128b876c63 add test
ikkun
parents:
diff changeset
364
87128b876c63 add test
ikkun
parents:
diff changeset
365 case CUDA_ERROR_NOT_MAPPED_AS_POINTER:
87128b876c63 add test
ikkun
parents:
diff changeset
366 return "CUDA_ERROR_NOT_MAPPED_AS_POINTER";
87128b876c63 add test
ikkun
parents:
diff changeset
367
87128b876c63 add test
ikkun
parents:
diff changeset
368 case CUDA_ERROR_ECC_UNCORRECTABLE:
87128b876c63 add test
ikkun
parents:
diff changeset
369 return "CUDA_ERROR_ECC_UNCORRECTABLE";
87128b876c63 add test
ikkun
parents:
diff changeset
370
87128b876c63 add test
ikkun
parents:
diff changeset
371 case CUDA_ERROR_UNSUPPORTED_LIMIT:
87128b876c63 add test
ikkun
parents:
diff changeset
372 return "CUDA_ERROR_UNSUPPORTED_LIMIT";
87128b876c63 add test
ikkun
parents:
diff changeset
373
87128b876c63 add test
ikkun
parents:
diff changeset
374 case CUDA_ERROR_CONTEXT_ALREADY_IN_USE:
87128b876c63 add test
ikkun
parents:
diff changeset
375 return "CUDA_ERROR_CONTEXT_ALREADY_IN_USE";
87128b876c63 add test
ikkun
parents:
diff changeset
376
87128b876c63 add test
ikkun
parents:
diff changeset
377 case CUDA_ERROR_PEER_ACCESS_UNSUPPORTED:
87128b876c63 add test
ikkun
parents:
diff changeset
378 return "CUDA_ERROR_PEER_ACCESS_UNSUPPORTED";
87128b876c63 add test
ikkun
parents:
diff changeset
379
87128b876c63 add test
ikkun
parents:
diff changeset
380 case CUDA_ERROR_INVALID_PTX:
87128b876c63 add test
ikkun
parents:
diff changeset
381 return "CUDA_ERROR_INVALID_PTX";
87128b876c63 add test
ikkun
parents:
diff changeset
382
87128b876c63 add test
ikkun
parents:
diff changeset
383 case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT:
87128b876c63 add test
ikkun
parents:
diff changeset
384 return "CUDA_ERROR_INVALID_GRAPHICS_CONTEXT";
87128b876c63 add test
ikkun
parents:
diff changeset
385
87128b876c63 add test
ikkun
parents:
diff changeset
386 case CUDA_ERROR_NVLINK_UNCORRECTABLE:
87128b876c63 add test
ikkun
parents:
diff changeset
387 return "CUDA_ERROR_NVLINK_UNCORRECTABLE";
87128b876c63 add test
ikkun
parents:
diff changeset
388
87128b876c63 add test
ikkun
parents:
diff changeset
389 case CUDA_ERROR_INVALID_SOURCE:
87128b876c63 add test
ikkun
parents:
diff changeset
390 return "CUDA_ERROR_INVALID_SOURCE";
87128b876c63 add test
ikkun
parents:
diff changeset
391
87128b876c63 add test
ikkun
parents:
diff changeset
392 case CUDA_ERROR_FILE_NOT_FOUND:
87128b876c63 add test
ikkun
parents:
diff changeset
393 return "CUDA_ERROR_FILE_NOT_FOUND";
87128b876c63 add test
ikkun
parents:
diff changeset
394
87128b876c63 add test
ikkun
parents:
diff changeset
395 case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND:
87128b876c63 add test
ikkun
parents:
diff changeset
396 return "CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND";
87128b876c63 add test
ikkun
parents:
diff changeset
397
87128b876c63 add test
ikkun
parents:
diff changeset
398 case CUDA_ERROR_SHARED_OBJECT_INIT_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
399 return "CUDA_ERROR_SHARED_OBJECT_INIT_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
400
87128b876c63 add test
ikkun
parents:
diff changeset
401 case CUDA_ERROR_OPERATING_SYSTEM:
87128b876c63 add test
ikkun
parents:
diff changeset
402 return "CUDA_ERROR_OPERATING_SYSTEM";
87128b876c63 add test
ikkun
parents:
diff changeset
403
87128b876c63 add test
ikkun
parents:
diff changeset
404 case CUDA_ERROR_INVALID_HANDLE:
87128b876c63 add test
ikkun
parents:
diff changeset
405 return "CUDA_ERROR_INVALID_HANDLE";
87128b876c63 add test
ikkun
parents:
diff changeset
406
87128b876c63 add test
ikkun
parents:
diff changeset
407 case CUDA_ERROR_NOT_FOUND:
87128b876c63 add test
ikkun
parents:
diff changeset
408 return "CUDA_ERROR_NOT_FOUND";
87128b876c63 add test
ikkun
parents:
diff changeset
409
87128b876c63 add test
ikkun
parents:
diff changeset
410 case CUDA_ERROR_NOT_READY:
87128b876c63 add test
ikkun
parents:
diff changeset
411 return "CUDA_ERROR_NOT_READY";
87128b876c63 add test
ikkun
parents:
diff changeset
412
87128b876c63 add test
ikkun
parents:
diff changeset
413 case CUDA_ERROR_ILLEGAL_ADDRESS:
87128b876c63 add test
ikkun
parents:
diff changeset
414 return "CUDA_ERROR_ILLEGAL_ADDRESS";
87128b876c63 add test
ikkun
parents:
diff changeset
415
87128b876c63 add test
ikkun
parents:
diff changeset
416 case CUDA_ERROR_LAUNCH_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
417 return "CUDA_ERROR_LAUNCH_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
418
87128b876c63 add test
ikkun
parents:
diff changeset
419 case CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES:
87128b876c63 add test
ikkun
parents:
diff changeset
420 return "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES";
87128b876c63 add test
ikkun
parents:
diff changeset
421
87128b876c63 add test
ikkun
parents:
diff changeset
422 case CUDA_ERROR_LAUNCH_TIMEOUT:
87128b876c63 add test
ikkun
parents:
diff changeset
423 return "CUDA_ERROR_LAUNCH_TIMEOUT";
87128b876c63 add test
ikkun
parents:
diff changeset
424
87128b876c63 add test
ikkun
parents:
diff changeset
425 case CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING:
87128b876c63 add test
ikkun
parents:
diff changeset
426 return "CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING";
87128b876c63 add test
ikkun
parents:
diff changeset
427
87128b876c63 add test
ikkun
parents:
diff changeset
428 case CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED:
87128b876c63 add test
ikkun
parents:
diff changeset
429 return "CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED";
87128b876c63 add test
ikkun
parents:
diff changeset
430
87128b876c63 add test
ikkun
parents:
diff changeset
431 case CUDA_ERROR_PEER_ACCESS_NOT_ENABLED:
87128b876c63 add test
ikkun
parents:
diff changeset
432 return "CUDA_ERROR_PEER_ACCESS_NOT_ENABLED";
87128b876c63 add test
ikkun
parents:
diff changeset
433
87128b876c63 add test
ikkun
parents:
diff changeset
434 case CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE:
87128b876c63 add test
ikkun
parents:
diff changeset
435 return "CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE";
87128b876c63 add test
ikkun
parents:
diff changeset
436
87128b876c63 add test
ikkun
parents:
diff changeset
437 case CUDA_ERROR_CONTEXT_IS_DESTROYED:
87128b876c63 add test
ikkun
parents:
diff changeset
438 return "CUDA_ERROR_CONTEXT_IS_DESTROYED";
87128b876c63 add test
ikkun
parents:
diff changeset
439
87128b876c63 add test
ikkun
parents:
diff changeset
440 case CUDA_ERROR_ASSERT:
87128b876c63 add test
ikkun
parents:
diff changeset
441 return "CUDA_ERROR_ASSERT";
87128b876c63 add test
ikkun
parents:
diff changeset
442
87128b876c63 add test
ikkun
parents:
diff changeset
443 case CUDA_ERROR_TOO_MANY_PEERS:
87128b876c63 add test
ikkun
parents:
diff changeset
444 return "CUDA_ERROR_TOO_MANY_PEERS";
87128b876c63 add test
ikkun
parents:
diff changeset
445
87128b876c63 add test
ikkun
parents:
diff changeset
446 case CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED:
87128b876c63 add test
ikkun
parents:
diff changeset
447 return "CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED";
87128b876c63 add test
ikkun
parents:
diff changeset
448
87128b876c63 add test
ikkun
parents:
diff changeset
449 case CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED:
87128b876c63 add test
ikkun
parents:
diff changeset
450 return "CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED";
87128b876c63 add test
ikkun
parents:
diff changeset
451
87128b876c63 add test
ikkun
parents:
diff changeset
452 case CUDA_ERROR_HARDWARE_STACK_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
453 return "CUDA_ERROR_HARDWARE_STACK_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
454
87128b876c63 add test
ikkun
parents:
diff changeset
455 case CUDA_ERROR_ILLEGAL_INSTRUCTION:
87128b876c63 add test
ikkun
parents:
diff changeset
456 return "CUDA_ERROR_ILLEGAL_INSTRUCTION";
87128b876c63 add test
ikkun
parents:
diff changeset
457
87128b876c63 add test
ikkun
parents:
diff changeset
458 case CUDA_ERROR_MISALIGNED_ADDRESS:
87128b876c63 add test
ikkun
parents:
diff changeset
459 return "CUDA_ERROR_MISALIGNED_ADDRESS";
87128b876c63 add test
ikkun
parents:
diff changeset
460
87128b876c63 add test
ikkun
parents:
diff changeset
461 case CUDA_ERROR_INVALID_ADDRESS_SPACE:
87128b876c63 add test
ikkun
parents:
diff changeset
462 return "CUDA_ERROR_INVALID_ADDRESS_SPACE";
87128b876c63 add test
ikkun
parents:
diff changeset
463
87128b876c63 add test
ikkun
parents:
diff changeset
464 case CUDA_ERROR_INVALID_PC:
87128b876c63 add test
ikkun
parents:
diff changeset
465 return "CUDA_ERROR_INVALID_PC";
87128b876c63 add test
ikkun
parents:
diff changeset
466
87128b876c63 add test
ikkun
parents:
diff changeset
467 case CUDA_ERROR_NOT_PERMITTED:
87128b876c63 add test
ikkun
parents:
diff changeset
468 return "CUDA_ERROR_NOT_PERMITTED";
87128b876c63 add test
ikkun
parents:
diff changeset
469
87128b876c63 add test
ikkun
parents:
diff changeset
470 case CUDA_ERROR_NOT_SUPPORTED:
87128b876c63 add test
ikkun
parents:
diff changeset
471 return "CUDA_ERROR_NOT_SUPPORTED";
87128b876c63 add test
ikkun
parents:
diff changeset
472
87128b876c63 add test
ikkun
parents:
diff changeset
473 case CUDA_ERROR_UNKNOWN:
87128b876c63 add test
ikkun
parents:
diff changeset
474 return "CUDA_ERROR_UNKNOWN";
87128b876c63 add test
ikkun
parents:
diff changeset
475 }
87128b876c63 add test
ikkun
parents:
diff changeset
476
87128b876c63 add test
ikkun
parents:
diff changeset
477 return "<unknown>";
87128b876c63 add test
ikkun
parents:
diff changeset
478 }
87128b876c63 add test
ikkun
parents:
diff changeset
479 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
480
87128b876c63 add test
ikkun
parents:
diff changeset
481 #ifdef CUBLAS_API_H_
87128b876c63 add test
ikkun
parents:
diff changeset
482 // cuBLAS API errors
87128b876c63 add test
ikkun
parents:
diff changeset
483 static const char *_cudaGetErrorEnum(cublasStatus_t error)
87128b876c63 add test
ikkun
parents:
diff changeset
484 {
87128b876c63 add test
ikkun
parents:
diff changeset
485 switch (error)
87128b876c63 add test
ikkun
parents:
diff changeset
486 {
87128b876c63 add test
ikkun
parents:
diff changeset
487 case CUBLAS_STATUS_SUCCESS:
87128b876c63 add test
ikkun
parents:
diff changeset
488 return "CUBLAS_STATUS_SUCCESS";
87128b876c63 add test
ikkun
parents:
diff changeset
489
87128b876c63 add test
ikkun
parents:
diff changeset
490 case CUBLAS_STATUS_NOT_INITIALIZED:
87128b876c63 add test
ikkun
parents:
diff changeset
491 return "CUBLAS_STATUS_NOT_INITIALIZED";
87128b876c63 add test
ikkun
parents:
diff changeset
492
87128b876c63 add test
ikkun
parents:
diff changeset
493 case CUBLAS_STATUS_ALLOC_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
494 return "CUBLAS_STATUS_ALLOC_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
495
87128b876c63 add test
ikkun
parents:
diff changeset
496 case CUBLAS_STATUS_INVALID_VALUE:
87128b876c63 add test
ikkun
parents:
diff changeset
497 return "CUBLAS_STATUS_INVALID_VALUE";
87128b876c63 add test
ikkun
parents:
diff changeset
498
87128b876c63 add test
ikkun
parents:
diff changeset
499 case CUBLAS_STATUS_ARCH_MISMATCH:
87128b876c63 add test
ikkun
parents:
diff changeset
500 return "CUBLAS_STATUS_ARCH_MISMATCH";
87128b876c63 add test
ikkun
parents:
diff changeset
501
87128b876c63 add test
ikkun
parents:
diff changeset
502 case CUBLAS_STATUS_MAPPING_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
503 return "CUBLAS_STATUS_MAPPING_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
504
87128b876c63 add test
ikkun
parents:
diff changeset
505 case CUBLAS_STATUS_EXECUTION_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
506 return "CUBLAS_STATUS_EXECUTION_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
507
87128b876c63 add test
ikkun
parents:
diff changeset
508 case CUBLAS_STATUS_INTERNAL_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
509 return "CUBLAS_STATUS_INTERNAL_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
510
87128b876c63 add test
ikkun
parents:
diff changeset
511 case CUBLAS_STATUS_NOT_SUPPORTED:
87128b876c63 add test
ikkun
parents:
diff changeset
512 return "CUBLAS_STATUS_NOT_SUPPORTED";
87128b876c63 add test
ikkun
parents:
diff changeset
513
87128b876c63 add test
ikkun
parents:
diff changeset
514 case CUBLAS_STATUS_LICENSE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
515 return "CUBLAS_STATUS_LICENSE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
516 }
87128b876c63 add test
ikkun
parents:
diff changeset
517
87128b876c63 add test
ikkun
parents:
diff changeset
518 return "<unknown>";
87128b876c63 add test
ikkun
parents:
diff changeset
519 }
87128b876c63 add test
ikkun
parents:
diff changeset
520 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
521
87128b876c63 add test
ikkun
parents:
diff changeset
522 #ifdef _CUFFT_H_
87128b876c63 add test
ikkun
parents:
diff changeset
523 // cuFFT API errors
87128b876c63 add test
ikkun
parents:
diff changeset
524 static const char *_cudaGetErrorEnum(cufftResult error)
87128b876c63 add test
ikkun
parents:
diff changeset
525 {
87128b876c63 add test
ikkun
parents:
diff changeset
526 switch (error)
87128b876c63 add test
ikkun
parents:
diff changeset
527 {
87128b876c63 add test
ikkun
parents:
diff changeset
528 case CUFFT_SUCCESS:
87128b876c63 add test
ikkun
parents:
diff changeset
529 return "CUFFT_SUCCESS";
87128b876c63 add test
ikkun
parents:
diff changeset
530
87128b876c63 add test
ikkun
parents:
diff changeset
531 case CUFFT_INVALID_PLAN:
87128b876c63 add test
ikkun
parents:
diff changeset
532 return "CUFFT_INVALID_PLAN";
87128b876c63 add test
ikkun
parents:
diff changeset
533
87128b876c63 add test
ikkun
parents:
diff changeset
534 case CUFFT_ALLOC_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
535 return "CUFFT_ALLOC_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
536
87128b876c63 add test
ikkun
parents:
diff changeset
537 case CUFFT_INVALID_TYPE:
87128b876c63 add test
ikkun
parents:
diff changeset
538 return "CUFFT_INVALID_TYPE";
87128b876c63 add test
ikkun
parents:
diff changeset
539
87128b876c63 add test
ikkun
parents:
diff changeset
540 case CUFFT_INVALID_VALUE:
87128b876c63 add test
ikkun
parents:
diff changeset
541 return "CUFFT_INVALID_VALUE";
87128b876c63 add test
ikkun
parents:
diff changeset
542
87128b876c63 add test
ikkun
parents:
diff changeset
543 case CUFFT_INTERNAL_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
544 return "CUFFT_INTERNAL_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
545
87128b876c63 add test
ikkun
parents:
diff changeset
546 case CUFFT_EXEC_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
547 return "CUFFT_EXEC_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
548
87128b876c63 add test
ikkun
parents:
diff changeset
549 case CUFFT_SETUP_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
550 return "CUFFT_SETUP_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
551
87128b876c63 add test
ikkun
parents:
diff changeset
552 case CUFFT_INVALID_SIZE:
87128b876c63 add test
ikkun
parents:
diff changeset
553 return "CUFFT_INVALID_SIZE";
87128b876c63 add test
ikkun
parents:
diff changeset
554
87128b876c63 add test
ikkun
parents:
diff changeset
555 case CUFFT_UNALIGNED_DATA:
87128b876c63 add test
ikkun
parents:
diff changeset
556 return "CUFFT_UNALIGNED_DATA";
87128b876c63 add test
ikkun
parents:
diff changeset
557
87128b876c63 add test
ikkun
parents:
diff changeset
558 case CUFFT_INCOMPLETE_PARAMETER_LIST:
87128b876c63 add test
ikkun
parents:
diff changeset
559 return "CUFFT_INCOMPLETE_PARAMETER_LIST";
87128b876c63 add test
ikkun
parents:
diff changeset
560
87128b876c63 add test
ikkun
parents:
diff changeset
561 case CUFFT_INVALID_DEVICE:
87128b876c63 add test
ikkun
parents:
diff changeset
562 return "CUFFT_INVALID_DEVICE";
87128b876c63 add test
ikkun
parents:
diff changeset
563
87128b876c63 add test
ikkun
parents:
diff changeset
564 case CUFFT_PARSE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
565 return "CUFFT_PARSE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
566
87128b876c63 add test
ikkun
parents:
diff changeset
567 case CUFFT_NO_WORKSPACE:
87128b876c63 add test
ikkun
parents:
diff changeset
568 return "CUFFT_NO_WORKSPACE";
87128b876c63 add test
ikkun
parents:
diff changeset
569
87128b876c63 add test
ikkun
parents:
diff changeset
570 case CUFFT_NOT_IMPLEMENTED:
87128b876c63 add test
ikkun
parents:
diff changeset
571 return "CUFFT_NOT_IMPLEMENTED";
87128b876c63 add test
ikkun
parents:
diff changeset
572
87128b876c63 add test
ikkun
parents:
diff changeset
573 case CUFFT_LICENSE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
574 return "CUFFT_LICENSE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
575
87128b876c63 add test
ikkun
parents:
diff changeset
576 case CUFFT_NOT_SUPPORTED:
87128b876c63 add test
ikkun
parents:
diff changeset
577 return "CUFFT_NOT_SUPPORTED";
87128b876c63 add test
ikkun
parents:
diff changeset
578 }
87128b876c63 add test
ikkun
parents:
diff changeset
579
87128b876c63 add test
ikkun
parents:
diff changeset
580 return "<unknown>";
87128b876c63 add test
ikkun
parents:
diff changeset
581 }
87128b876c63 add test
ikkun
parents:
diff changeset
582 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
583
87128b876c63 add test
ikkun
parents:
diff changeset
584
87128b876c63 add test
ikkun
parents:
diff changeset
585 #ifdef CUSPARSEAPI
87128b876c63 add test
ikkun
parents:
diff changeset
586 // cuSPARSE API errors
87128b876c63 add test
ikkun
parents:
diff changeset
587 static const char *_cudaGetErrorEnum(cusparseStatus_t error)
87128b876c63 add test
ikkun
parents:
diff changeset
588 {
87128b876c63 add test
ikkun
parents:
diff changeset
589 switch (error)
87128b876c63 add test
ikkun
parents:
diff changeset
590 {
87128b876c63 add test
ikkun
parents:
diff changeset
591 case CUSPARSE_STATUS_SUCCESS:
87128b876c63 add test
ikkun
parents:
diff changeset
592 return "CUSPARSE_STATUS_SUCCESS";
87128b876c63 add test
ikkun
parents:
diff changeset
593
87128b876c63 add test
ikkun
parents:
diff changeset
594 case CUSPARSE_STATUS_NOT_INITIALIZED:
87128b876c63 add test
ikkun
parents:
diff changeset
595 return "CUSPARSE_STATUS_NOT_INITIALIZED";
87128b876c63 add test
ikkun
parents:
diff changeset
596
87128b876c63 add test
ikkun
parents:
diff changeset
597 case CUSPARSE_STATUS_ALLOC_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
598 return "CUSPARSE_STATUS_ALLOC_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
599
87128b876c63 add test
ikkun
parents:
diff changeset
600 case CUSPARSE_STATUS_INVALID_VALUE:
87128b876c63 add test
ikkun
parents:
diff changeset
601 return "CUSPARSE_STATUS_INVALID_VALUE";
87128b876c63 add test
ikkun
parents:
diff changeset
602
87128b876c63 add test
ikkun
parents:
diff changeset
603 case CUSPARSE_STATUS_ARCH_MISMATCH:
87128b876c63 add test
ikkun
parents:
diff changeset
604 return "CUSPARSE_STATUS_ARCH_MISMATCH";
87128b876c63 add test
ikkun
parents:
diff changeset
605
87128b876c63 add test
ikkun
parents:
diff changeset
606 case CUSPARSE_STATUS_MAPPING_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
607 return "CUSPARSE_STATUS_MAPPING_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
608
87128b876c63 add test
ikkun
parents:
diff changeset
609 case CUSPARSE_STATUS_EXECUTION_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
610 return "CUSPARSE_STATUS_EXECUTION_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
611
87128b876c63 add test
ikkun
parents:
diff changeset
612 case CUSPARSE_STATUS_INTERNAL_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
613 return "CUSPARSE_STATUS_INTERNAL_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
614
87128b876c63 add test
ikkun
parents:
diff changeset
615 case CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED:
87128b876c63 add test
ikkun
parents:
diff changeset
616 return "CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED";
87128b876c63 add test
ikkun
parents:
diff changeset
617 }
87128b876c63 add test
ikkun
parents:
diff changeset
618
87128b876c63 add test
ikkun
parents:
diff changeset
619 return "<unknown>";
87128b876c63 add test
ikkun
parents:
diff changeset
620 }
87128b876c63 add test
ikkun
parents:
diff changeset
621 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
622
87128b876c63 add test
ikkun
parents:
diff changeset
623 #ifdef CUSOLVER_COMMON_H_
87128b876c63 add test
ikkun
parents:
diff changeset
624 //cuSOLVER API errors
87128b876c63 add test
ikkun
parents:
diff changeset
625 static const char *_cudaGetErrorEnum(cusolverStatus_t error)
87128b876c63 add test
ikkun
parents:
diff changeset
626 {
87128b876c63 add test
ikkun
parents:
diff changeset
627 switch(error)
87128b876c63 add test
ikkun
parents:
diff changeset
628 {
87128b876c63 add test
ikkun
parents:
diff changeset
629 case CUSOLVER_STATUS_SUCCESS:
87128b876c63 add test
ikkun
parents:
diff changeset
630 return "CUSOLVER_STATUS_SUCCESS";
87128b876c63 add test
ikkun
parents:
diff changeset
631 case CUSOLVER_STATUS_NOT_INITIALIZED:
87128b876c63 add test
ikkun
parents:
diff changeset
632 return "CUSOLVER_STATUS_NOT_INITIALIZED";
87128b876c63 add test
ikkun
parents:
diff changeset
633 case CUSOLVER_STATUS_ALLOC_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
634 return "CUSOLVER_STATUS_ALLOC_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
635 case CUSOLVER_STATUS_INVALID_VALUE:
87128b876c63 add test
ikkun
parents:
diff changeset
636 return "CUSOLVER_STATUS_INVALID_VALUE";
87128b876c63 add test
ikkun
parents:
diff changeset
637 case CUSOLVER_STATUS_ARCH_MISMATCH:
87128b876c63 add test
ikkun
parents:
diff changeset
638 return "CUSOLVER_STATUS_ARCH_MISMATCH";
87128b876c63 add test
ikkun
parents:
diff changeset
639 case CUSOLVER_STATUS_MAPPING_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
640 return "CUSOLVER_STATUS_MAPPING_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
641 case CUSOLVER_STATUS_EXECUTION_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
642 return "CUSOLVER_STATUS_EXECUTION_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
643 case CUSOLVER_STATUS_INTERNAL_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
644 return "CUSOLVER_STATUS_INTERNAL_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
645 case CUSOLVER_STATUS_MATRIX_TYPE_NOT_SUPPORTED:
87128b876c63 add test
ikkun
parents:
diff changeset
646 return "CUSOLVER_STATUS_MATRIX_TYPE_NOT_SUPPORTED";
87128b876c63 add test
ikkun
parents:
diff changeset
647 case CUSOLVER_STATUS_NOT_SUPPORTED :
87128b876c63 add test
ikkun
parents:
diff changeset
648 return "CUSOLVER_STATUS_NOT_SUPPORTED ";
87128b876c63 add test
ikkun
parents:
diff changeset
649 case CUSOLVER_STATUS_ZERO_PIVOT:
87128b876c63 add test
ikkun
parents:
diff changeset
650 return "CUSOLVER_STATUS_ZERO_PIVOT";
87128b876c63 add test
ikkun
parents:
diff changeset
651 case CUSOLVER_STATUS_INVALID_LICENSE:
87128b876c63 add test
ikkun
parents:
diff changeset
652 return "CUSOLVER_STATUS_INVALID_LICENSE";
87128b876c63 add test
ikkun
parents:
diff changeset
653 }
87128b876c63 add test
ikkun
parents:
diff changeset
654
87128b876c63 add test
ikkun
parents:
diff changeset
655 return "<unknown>";
87128b876c63 add test
ikkun
parents:
diff changeset
656
87128b876c63 add test
ikkun
parents:
diff changeset
657 }
87128b876c63 add test
ikkun
parents:
diff changeset
658 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
659
87128b876c63 add test
ikkun
parents:
diff changeset
660 #ifdef CURAND_H_
87128b876c63 add test
ikkun
parents:
diff changeset
661 // cuRAND API errors
87128b876c63 add test
ikkun
parents:
diff changeset
662 static const char *_cudaGetErrorEnum(curandStatus_t error)
87128b876c63 add test
ikkun
parents:
diff changeset
663 {
87128b876c63 add test
ikkun
parents:
diff changeset
664 switch (error)
87128b876c63 add test
ikkun
parents:
diff changeset
665 {
87128b876c63 add test
ikkun
parents:
diff changeset
666 case CURAND_STATUS_SUCCESS:
87128b876c63 add test
ikkun
parents:
diff changeset
667 return "CURAND_STATUS_SUCCESS";
87128b876c63 add test
ikkun
parents:
diff changeset
668
87128b876c63 add test
ikkun
parents:
diff changeset
669 case CURAND_STATUS_VERSION_MISMATCH:
87128b876c63 add test
ikkun
parents:
diff changeset
670 return "CURAND_STATUS_VERSION_MISMATCH";
87128b876c63 add test
ikkun
parents:
diff changeset
671
87128b876c63 add test
ikkun
parents:
diff changeset
672 case CURAND_STATUS_NOT_INITIALIZED:
87128b876c63 add test
ikkun
parents:
diff changeset
673 return "CURAND_STATUS_NOT_INITIALIZED";
87128b876c63 add test
ikkun
parents:
diff changeset
674
87128b876c63 add test
ikkun
parents:
diff changeset
675 case CURAND_STATUS_ALLOCATION_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
676 return "CURAND_STATUS_ALLOCATION_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
677
87128b876c63 add test
ikkun
parents:
diff changeset
678 case CURAND_STATUS_TYPE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
679 return "CURAND_STATUS_TYPE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
680
87128b876c63 add test
ikkun
parents:
diff changeset
681 case CURAND_STATUS_OUT_OF_RANGE:
87128b876c63 add test
ikkun
parents:
diff changeset
682 return "CURAND_STATUS_OUT_OF_RANGE";
87128b876c63 add test
ikkun
parents:
diff changeset
683
87128b876c63 add test
ikkun
parents:
diff changeset
684 case CURAND_STATUS_LENGTH_NOT_MULTIPLE:
87128b876c63 add test
ikkun
parents:
diff changeset
685 return "CURAND_STATUS_LENGTH_NOT_MULTIPLE";
87128b876c63 add test
ikkun
parents:
diff changeset
686
87128b876c63 add test
ikkun
parents:
diff changeset
687 case CURAND_STATUS_DOUBLE_PRECISION_REQUIRED:
87128b876c63 add test
ikkun
parents:
diff changeset
688 return "CURAND_STATUS_DOUBLE_PRECISION_REQUIRED";
87128b876c63 add test
ikkun
parents:
diff changeset
689
87128b876c63 add test
ikkun
parents:
diff changeset
690 case CURAND_STATUS_LAUNCH_FAILURE:
87128b876c63 add test
ikkun
parents:
diff changeset
691 return "CURAND_STATUS_LAUNCH_FAILURE";
87128b876c63 add test
ikkun
parents:
diff changeset
692
87128b876c63 add test
ikkun
parents:
diff changeset
693 case CURAND_STATUS_PREEXISTING_FAILURE:
87128b876c63 add test
ikkun
parents:
diff changeset
694 return "CURAND_STATUS_PREEXISTING_FAILURE";
87128b876c63 add test
ikkun
parents:
diff changeset
695
87128b876c63 add test
ikkun
parents:
diff changeset
696 case CURAND_STATUS_INITIALIZATION_FAILED:
87128b876c63 add test
ikkun
parents:
diff changeset
697 return "CURAND_STATUS_INITIALIZATION_FAILED";
87128b876c63 add test
ikkun
parents:
diff changeset
698
87128b876c63 add test
ikkun
parents:
diff changeset
699 case CURAND_STATUS_ARCH_MISMATCH:
87128b876c63 add test
ikkun
parents:
diff changeset
700 return "CURAND_STATUS_ARCH_MISMATCH";
87128b876c63 add test
ikkun
parents:
diff changeset
701
87128b876c63 add test
ikkun
parents:
diff changeset
702 case CURAND_STATUS_INTERNAL_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
703 return "CURAND_STATUS_INTERNAL_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
704 }
87128b876c63 add test
ikkun
parents:
diff changeset
705
87128b876c63 add test
ikkun
parents:
diff changeset
706 return "<unknown>";
87128b876c63 add test
ikkun
parents:
diff changeset
707 }
87128b876c63 add test
ikkun
parents:
diff changeset
708 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
709
87128b876c63 add test
ikkun
parents:
diff changeset
710 #ifdef NV_NPPIDEFS_H
87128b876c63 add test
ikkun
parents:
diff changeset
711 // NPP API errors
87128b876c63 add test
ikkun
parents:
diff changeset
712 static const char *_cudaGetErrorEnum(NppStatus error)
87128b876c63 add test
ikkun
parents:
diff changeset
713 {
87128b876c63 add test
ikkun
parents:
diff changeset
714 switch (error)
87128b876c63 add test
ikkun
parents:
diff changeset
715 {
87128b876c63 add test
ikkun
parents:
diff changeset
716 case NPP_NOT_SUPPORTED_MODE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
717 return "NPP_NOT_SUPPORTED_MODE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
718
87128b876c63 add test
ikkun
parents:
diff changeset
719 case NPP_ROUND_MODE_NOT_SUPPORTED_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
720 return "NPP_ROUND_MODE_NOT_SUPPORTED_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
721
87128b876c63 add test
ikkun
parents:
diff changeset
722 case NPP_RESIZE_NO_OPERATION_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
723 return "NPP_RESIZE_NO_OPERATION_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
724
87128b876c63 add test
ikkun
parents:
diff changeset
725 case NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY:
87128b876c63 add test
ikkun
parents:
diff changeset
726 return "NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY";
87128b876c63 add test
ikkun
parents:
diff changeset
727
87128b876c63 add test
ikkun
parents:
diff changeset
728 #if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) <= 0x5000
87128b876c63 add test
ikkun
parents:
diff changeset
729
87128b876c63 add test
ikkun
parents:
diff changeset
730 case NPP_BAD_ARG_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
731 return "NPP_BAD_ARGUMENT_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
732
87128b876c63 add test
ikkun
parents:
diff changeset
733 case NPP_COEFF_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
734 return "NPP_COEFFICIENT_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
735
87128b876c63 add test
ikkun
parents:
diff changeset
736 case NPP_RECT_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
737 return "NPP_RECTANGLE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
738
87128b876c63 add test
ikkun
parents:
diff changeset
739 case NPP_QUAD_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
740 return "NPP_QUADRANGLE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
741
87128b876c63 add test
ikkun
parents:
diff changeset
742 case NPP_MEM_ALLOC_ERR:
87128b876c63 add test
ikkun
parents:
diff changeset
743 return "NPP_MEMORY_ALLOCATION_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
744
87128b876c63 add test
ikkun
parents:
diff changeset
745 case NPP_HISTO_NUMBER_OF_LEVELS_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
746 return "NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
747
87128b876c63 add test
ikkun
parents:
diff changeset
748 case NPP_INVALID_INPUT:
87128b876c63 add test
ikkun
parents:
diff changeset
749 return "NPP_INVALID_INPUT";
87128b876c63 add test
ikkun
parents:
diff changeset
750
87128b876c63 add test
ikkun
parents:
diff changeset
751 case NPP_POINTER_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
752 return "NPP_POINTER_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
753
87128b876c63 add test
ikkun
parents:
diff changeset
754 case NPP_WARNING:
87128b876c63 add test
ikkun
parents:
diff changeset
755 return "NPP_WARNING";
87128b876c63 add test
ikkun
parents:
diff changeset
756
87128b876c63 add test
ikkun
parents:
diff changeset
757 case NPP_ODD_ROI_WARNING:
87128b876c63 add test
ikkun
parents:
diff changeset
758 return "NPP_ODD_ROI_WARNING";
87128b876c63 add test
ikkun
parents:
diff changeset
759 #else
87128b876c63 add test
ikkun
parents:
diff changeset
760
87128b876c63 add test
ikkun
parents:
diff changeset
761 // These are for CUDA 5.5 or higher
87128b876c63 add test
ikkun
parents:
diff changeset
762 case NPP_BAD_ARGUMENT_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
763 return "NPP_BAD_ARGUMENT_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
764
87128b876c63 add test
ikkun
parents:
diff changeset
765 case NPP_COEFFICIENT_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
766 return "NPP_COEFFICIENT_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
767
87128b876c63 add test
ikkun
parents:
diff changeset
768 case NPP_RECTANGLE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
769 return "NPP_RECTANGLE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
770
87128b876c63 add test
ikkun
parents:
diff changeset
771 case NPP_QUADRANGLE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
772 return "NPP_QUADRANGLE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
773
87128b876c63 add test
ikkun
parents:
diff changeset
774 case NPP_MEMORY_ALLOCATION_ERR:
87128b876c63 add test
ikkun
parents:
diff changeset
775 return "NPP_MEMORY_ALLOCATION_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
776
87128b876c63 add test
ikkun
parents:
diff changeset
777 case NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
778 return "NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
779
87128b876c63 add test
ikkun
parents:
diff changeset
780 case NPP_INVALID_HOST_POINTER_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
781 return "NPP_INVALID_HOST_POINTER_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
782
87128b876c63 add test
ikkun
parents:
diff changeset
783 case NPP_INVALID_DEVICE_POINTER_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
784 return "NPP_INVALID_DEVICE_POINTER_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
785 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
786
87128b876c63 add test
ikkun
parents:
diff changeset
787 case NPP_LUT_NUMBER_OF_LEVELS_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
788 return "NPP_LUT_NUMBER_OF_LEVELS_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
789
87128b876c63 add test
ikkun
parents:
diff changeset
790 case NPP_TEXTURE_BIND_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
791 return "NPP_TEXTURE_BIND_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
792
87128b876c63 add test
ikkun
parents:
diff changeset
793 case NPP_WRONG_INTERSECTION_ROI_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
794 return "NPP_WRONG_INTERSECTION_ROI_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
795
87128b876c63 add test
ikkun
parents:
diff changeset
796 case NPP_NOT_EVEN_STEP_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
797 return "NPP_NOT_EVEN_STEP_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
798
87128b876c63 add test
ikkun
parents:
diff changeset
799 case NPP_INTERPOLATION_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
800 return "NPP_INTERPOLATION_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
801
87128b876c63 add test
ikkun
parents:
diff changeset
802 case NPP_RESIZE_FACTOR_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
803 return "NPP_RESIZE_FACTOR_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
804
87128b876c63 add test
ikkun
parents:
diff changeset
805 case NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
806 return "NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
807
87128b876c63 add test
ikkun
parents:
diff changeset
808
87128b876c63 add test
ikkun
parents:
diff changeset
809 #if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) <= 0x5000
87128b876c63 add test
ikkun
parents:
diff changeset
810
87128b876c63 add test
ikkun
parents:
diff changeset
811 case NPP_MEMFREE_ERR:
87128b876c63 add test
ikkun
parents:
diff changeset
812 return "NPP_MEMFREE_ERR";
87128b876c63 add test
ikkun
parents:
diff changeset
813
87128b876c63 add test
ikkun
parents:
diff changeset
814 case NPP_MEMSET_ERR:
87128b876c63 add test
ikkun
parents:
diff changeset
815 return "NPP_MEMSET_ERR";
87128b876c63 add test
ikkun
parents:
diff changeset
816
87128b876c63 add test
ikkun
parents:
diff changeset
817 case NPP_MEMCPY_ERR:
87128b876c63 add test
ikkun
parents:
diff changeset
818 return "NPP_MEMCPY_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
819
87128b876c63 add test
ikkun
parents:
diff changeset
820 case NPP_MIRROR_FLIP_ERR:
87128b876c63 add test
ikkun
parents:
diff changeset
821 return "NPP_MIRROR_FLIP_ERR";
87128b876c63 add test
ikkun
parents:
diff changeset
822 #else
87128b876c63 add test
ikkun
parents:
diff changeset
823
87128b876c63 add test
ikkun
parents:
diff changeset
824 case NPP_MEMFREE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
825 return "NPP_MEMFREE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
826
87128b876c63 add test
ikkun
parents:
diff changeset
827 case NPP_MEMSET_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
828 return "NPP_MEMSET_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
829
87128b876c63 add test
ikkun
parents:
diff changeset
830 case NPP_MEMCPY_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
831 return "NPP_MEMCPY_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
832
87128b876c63 add test
ikkun
parents:
diff changeset
833 case NPP_MIRROR_FLIP_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
834 return "NPP_MIRROR_FLIP_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
835 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
836
87128b876c63 add test
ikkun
parents:
diff changeset
837 case NPP_ALIGNMENT_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
838 return "NPP_ALIGNMENT_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
839
87128b876c63 add test
ikkun
parents:
diff changeset
840 case NPP_STEP_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
841 return "NPP_STEP_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
842
87128b876c63 add test
ikkun
parents:
diff changeset
843 case NPP_SIZE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
844 return "NPP_SIZE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
845
87128b876c63 add test
ikkun
parents:
diff changeset
846 case NPP_NULL_POINTER_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
847 return "NPP_NULL_POINTER_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
848
87128b876c63 add test
ikkun
parents:
diff changeset
849 case NPP_CUDA_KERNEL_EXECUTION_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
850 return "NPP_CUDA_KERNEL_EXECUTION_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
851
87128b876c63 add test
ikkun
parents:
diff changeset
852 case NPP_NOT_IMPLEMENTED_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
853 return "NPP_NOT_IMPLEMENTED_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
854
87128b876c63 add test
ikkun
parents:
diff changeset
855 case NPP_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
856 return "NPP_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
857
87128b876c63 add test
ikkun
parents:
diff changeset
858 case NPP_SUCCESS:
87128b876c63 add test
ikkun
parents:
diff changeset
859 return "NPP_SUCCESS";
87128b876c63 add test
ikkun
parents:
diff changeset
860
87128b876c63 add test
ikkun
parents:
diff changeset
861 case NPP_WRONG_INTERSECTION_QUAD_WARNING:
87128b876c63 add test
ikkun
parents:
diff changeset
862 return "NPP_WRONG_INTERSECTION_QUAD_WARNING";
87128b876c63 add test
ikkun
parents:
diff changeset
863
87128b876c63 add test
ikkun
parents:
diff changeset
864 case NPP_MISALIGNED_DST_ROI_WARNING:
87128b876c63 add test
ikkun
parents:
diff changeset
865 return "NPP_MISALIGNED_DST_ROI_WARNING";
87128b876c63 add test
ikkun
parents:
diff changeset
866
87128b876c63 add test
ikkun
parents:
diff changeset
867 case NPP_AFFINE_QUAD_INCORRECT_WARNING:
87128b876c63 add test
ikkun
parents:
diff changeset
868 return "NPP_AFFINE_QUAD_INCORRECT_WARNING";
87128b876c63 add test
ikkun
parents:
diff changeset
869
87128b876c63 add test
ikkun
parents:
diff changeset
870 case NPP_DOUBLE_SIZE_WARNING:
87128b876c63 add test
ikkun
parents:
diff changeset
871 return "NPP_DOUBLE_SIZE_WARNING";
87128b876c63 add test
ikkun
parents:
diff changeset
872
87128b876c63 add test
ikkun
parents:
diff changeset
873 case NPP_WRONG_INTERSECTION_ROI_WARNING:
87128b876c63 add test
ikkun
parents:
diff changeset
874 return "NPP_WRONG_INTERSECTION_ROI_WARNING";
87128b876c63 add test
ikkun
parents:
diff changeset
875
87128b876c63 add test
ikkun
parents:
diff changeset
876 #if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) >= 0x6000
87128b876c63 add test
ikkun
parents:
diff changeset
877 /* These are 6.0 or higher */
87128b876c63 add test
ikkun
parents:
diff changeset
878 case NPP_LUT_PALETTE_BITSIZE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
879 return "NPP_LUT_PALETTE_BITSIZE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
880
87128b876c63 add test
ikkun
parents:
diff changeset
881 case NPP_ZC_MODE_NOT_SUPPORTED_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
882 return "NPP_ZC_MODE_NOT_SUPPORTED_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
883
87128b876c63 add test
ikkun
parents:
diff changeset
884 case NPP_QUALITY_INDEX_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
885 return "NPP_QUALITY_INDEX_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
886
87128b876c63 add test
ikkun
parents:
diff changeset
887 case NPP_CHANNEL_ORDER_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
888 return "NPP_CHANNEL_ORDER_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
889
87128b876c63 add test
ikkun
parents:
diff changeset
890 case NPP_ZERO_MASK_VALUE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
891 return "NPP_ZERO_MASK_VALUE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
892
87128b876c63 add test
ikkun
parents:
diff changeset
893 case NPP_NUMBER_OF_CHANNELS_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
894 return "NPP_NUMBER_OF_CHANNELS_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
895
87128b876c63 add test
ikkun
parents:
diff changeset
896 case NPP_COI_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
897 return "NPP_COI_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
898
87128b876c63 add test
ikkun
parents:
diff changeset
899 case NPP_DIVISOR_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
900 return "NPP_DIVISOR_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
901
87128b876c63 add test
ikkun
parents:
diff changeset
902 case NPP_CHANNEL_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
903 return "NPP_CHANNEL_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
904
87128b876c63 add test
ikkun
parents:
diff changeset
905 case NPP_STRIDE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
906 return "NPP_STRIDE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
907
87128b876c63 add test
ikkun
parents:
diff changeset
908 case NPP_ANCHOR_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
909 return "NPP_ANCHOR_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
910
87128b876c63 add test
ikkun
parents:
diff changeset
911 case NPP_MASK_SIZE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
912 return "NPP_MASK_SIZE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
913
87128b876c63 add test
ikkun
parents:
diff changeset
914 case NPP_MOMENT_00_ZERO_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
915 return "NPP_MOMENT_00_ZERO_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
916
87128b876c63 add test
ikkun
parents:
diff changeset
917 case NPP_THRESHOLD_NEGATIVE_LEVEL_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
918 return "NPP_THRESHOLD_NEGATIVE_LEVEL_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
919
87128b876c63 add test
ikkun
parents:
diff changeset
920 case NPP_THRESHOLD_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
921 return "NPP_THRESHOLD_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
922
87128b876c63 add test
ikkun
parents:
diff changeset
923 case NPP_CONTEXT_MATCH_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
924 return "NPP_CONTEXT_MATCH_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
925
87128b876c63 add test
ikkun
parents:
diff changeset
926 case NPP_FFT_FLAG_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
927 return "NPP_FFT_FLAG_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
928
87128b876c63 add test
ikkun
parents:
diff changeset
929 case NPP_FFT_ORDER_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
930 return "NPP_FFT_ORDER_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
931
87128b876c63 add test
ikkun
parents:
diff changeset
932 case NPP_SCALE_RANGE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
933 return "NPP_SCALE_RANGE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
934
87128b876c63 add test
ikkun
parents:
diff changeset
935 case NPP_DATA_TYPE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
936 return "NPP_DATA_TYPE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
937
87128b876c63 add test
ikkun
parents:
diff changeset
938 case NPP_OUT_OFF_RANGE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
939 return "NPP_OUT_OFF_RANGE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
940
87128b876c63 add test
ikkun
parents:
diff changeset
941 case NPP_DIVIDE_BY_ZERO_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
942 return "NPP_DIVIDE_BY_ZERO_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
943
87128b876c63 add test
ikkun
parents:
diff changeset
944 case NPP_RANGE_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
945 return "NPP_RANGE_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
946
87128b876c63 add test
ikkun
parents:
diff changeset
947 case NPP_NO_MEMORY_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
948 return "NPP_NO_MEMORY_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
949
87128b876c63 add test
ikkun
parents:
diff changeset
950 case NPP_ERROR_RESERVED:
87128b876c63 add test
ikkun
parents:
diff changeset
951 return "NPP_ERROR_RESERVED";
87128b876c63 add test
ikkun
parents:
diff changeset
952
87128b876c63 add test
ikkun
parents:
diff changeset
953 case NPP_NO_OPERATION_WARNING:
87128b876c63 add test
ikkun
parents:
diff changeset
954 return "NPP_NO_OPERATION_WARNING";
87128b876c63 add test
ikkun
parents:
diff changeset
955
87128b876c63 add test
ikkun
parents:
diff changeset
956 case NPP_DIVIDE_BY_ZERO_WARNING:
87128b876c63 add test
ikkun
parents:
diff changeset
957 return "NPP_DIVIDE_BY_ZERO_WARNING";
87128b876c63 add test
ikkun
parents:
diff changeset
958 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
959
87128b876c63 add test
ikkun
parents:
diff changeset
960 #if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) >= 0x7000
87128b876c63 add test
ikkun
parents:
diff changeset
961 /* These are 7.0 or higher */
87128b876c63 add test
ikkun
parents:
diff changeset
962 case NPP_OVERFLOW_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
963 return "NPP_OVERFLOW_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
964
87128b876c63 add test
ikkun
parents:
diff changeset
965 case NPP_CORRUPTED_DATA_ERROR:
87128b876c63 add test
ikkun
parents:
diff changeset
966 return "NPP_CORRUPTED_DATA_ERROR";
87128b876c63 add test
ikkun
parents:
diff changeset
967 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
968 }
87128b876c63 add test
ikkun
parents:
diff changeset
969
87128b876c63 add test
ikkun
parents:
diff changeset
970 return "<unknown>";
87128b876c63 add test
ikkun
parents:
diff changeset
971 }
87128b876c63 add test
ikkun
parents:
diff changeset
972 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
973
87128b876c63 add test
ikkun
parents:
diff changeset
974 #ifdef __DRIVER_TYPES_H__
87128b876c63 add test
ikkun
parents:
diff changeset
975 #ifndef DEVICE_RESET
87128b876c63 add test
ikkun
parents:
diff changeset
976 #define DEVICE_RESET cudaDeviceReset();
87128b876c63 add test
ikkun
parents:
diff changeset
977 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
978 #else
87128b876c63 add test
ikkun
parents:
diff changeset
979 #ifndef DEVICE_RESET
87128b876c63 add test
ikkun
parents:
diff changeset
980 #define DEVICE_RESET
87128b876c63 add test
ikkun
parents:
diff changeset
981 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
982 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
983
87128b876c63 add test
ikkun
parents:
diff changeset
984 template< typename T >
87128b876c63 add test
ikkun
parents:
diff changeset
985 void check(T result, char const *const func, const char *const file, int const line)
87128b876c63 add test
ikkun
parents:
diff changeset
986 {
87128b876c63 add test
ikkun
parents:
diff changeset
987 if (result)
87128b876c63 add test
ikkun
parents:
diff changeset
988 {
87128b876c63 add test
ikkun
parents:
diff changeset
989 fprintf(stderr, "CUDA error at %s:%d code=%d(%s) \"%s\" \n",
87128b876c63 add test
ikkun
parents:
diff changeset
990 file, line, static_cast<unsigned int>(result), _cudaGetErrorEnum(result), func);
87128b876c63 add test
ikkun
parents:
diff changeset
991 DEVICE_RESET
87128b876c63 add test
ikkun
parents:
diff changeset
992 // Make sure we call CUDA Device Reset before exiting
87128b876c63 add test
ikkun
parents:
diff changeset
993 exit(EXIT_FAILURE);
87128b876c63 add test
ikkun
parents:
diff changeset
994 }
87128b876c63 add test
ikkun
parents:
diff changeset
995 }
87128b876c63 add test
ikkun
parents:
diff changeset
996
87128b876c63 add test
ikkun
parents:
diff changeset
997 #ifdef __DRIVER_TYPES_H__
87128b876c63 add test
ikkun
parents:
diff changeset
998 // This will output the proper CUDA error strings in the event that a CUDA host call returns an error
87128b876c63 add test
ikkun
parents:
diff changeset
999 #define checkCudaErrors(val) check ( (val), #val, __FILE__, __LINE__ )
87128b876c63 add test
ikkun
parents:
diff changeset
1000
87128b876c63 add test
ikkun
parents:
diff changeset
1001 // This will output the proper error string when calling cudaGetLastError
87128b876c63 add test
ikkun
parents:
diff changeset
1002 #define getLastCudaError(msg) __getLastCudaError (msg, __FILE__, __LINE__)
87128b876c63 add test
ikkun
parents:
diff changeset
1003
87128b876c63 add test
ikkun
parents:
diff changeset
1004 inline void __getLastCudaError(const char *errorMessage, const char *file, const int line)
87128b876c63 add test
ikkun
parents:
diff changeset
1005 {
87128b876c63 add test
ikkun
parents:
diff changeset
1006 cudaError_t err = cudaGetLastError();
87128b876c63 add test
ikkun
parents:
diff changeset
1007
87128b876c63 add test
ikkun
parents:
diff changeset
1008 if (cudaSuccess != err)
87128b876c63 add test
ikkun
parents:
diff changeset
1009 {
87128b876c63 add test
ikkun
parents:
diff changeset
1010 fprintf(stderr, "%s(%i) : getLastCudaError() CUDA error : %s : (%d) %s.\n",
87128b876c63 add test
ikkun
parents:
diff changeset
1011 file, line, errorMessage, (int)err, cudaGetErrorString(err));
87128b876c63 add test
ikkun
parents:
diff changeset
1012 DEVICE_RESET
87128b876c63 add test
ikkun
parents:
diff changeset
1013 exit(EXIT_FAILURE);
87128b876c63 add test
ikkun
parents:
diff changeset
1014 }
87128b876c63 add test
ikkun
parents:
diff changeset
1015 }
87128b876c63 add test
ikkun
parents:
diff changeset
1016 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
1017
87128b876c63 add test
ikkun
parents:
diff changeset
1018 #ifndef MAX
87128b876c63 add test
ikkun
parents:
diff changeset
1019 #define MAX(a,b) (a > b ? a : b)
87128b876c63 add test
ikkun
parents:
diff changeset
1020 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
1021
87128b876c63 add test
ikkun
parents:
diff changeset
1022 // Float To Int conversion
87128b876c63 add test
ikkun
parents:
diff changeset
1023 inline int ftoi(float value)
87128b876c63 add test
ikkun
parents:
diff changeset
1024 {
87128b876c63 add test
ikkun
parents:
diff changeset
1025 return (value >= 0 ? (int)(value + 0.5) : (int)(value - 0.5));
87128b876c63 add test
ikkun
parents:
diff changeset
1026 }
87128b876c63 add test
ikkun
parents:
diff changeset
1027
87128b876c63 add test
ikkun
parents:
diff changeset
1028 // Beginning of GPU Architecture definitions
87128b876c63 add test
ikkun
parents:
diff changeset
1029 inline int _ConvertSMVer2Cores(int major, int minor)
87128b876c63 add test
ikkun
parents:
diff changeset
1030 {
87128b876c63 add test
ikkun
parents:
diff changeset
1031 // Defines for GPU Architecture types (using the SM version to determine the # of cores per SM
87128b876c63 add test
ikkun
parents:
diff changeset
1032 typedef struct
87128b876c63 add test
ikkun
parents:
diff changeset
1033 {
87128b876c63 add test
ikkun
parents:
diff changeset
1034 int SM; // 0xMm (hexidecimal notation), M = SM Major version, and m = SM minor version
87128b876c63 add test
ikkun
parents:
diff changeset
1035 int Cores;
87128b876c63 add test
ikkun
parents:
diff changeset
1036 } sSMtoCores;
87128b876c63 add test
ikkun
parents:
diff changeset
1037
87128b876c63 add test
ikkun
parents:
diff changeset
1038 sSMtoCores nGpuArchCoresPerSM[] =
87128b876c63 add test
ikkun
parents:
diff changeset
1039 {
87128b876c63 add test
ikkun
parents:
diff changeset
1040 { 0x20, 32 }, // Fermi Generation (SM 2.0) GF100 class
87128b876c63 add test
ikkun
parents:
diff changeset
1041 { 0x21, 48 }, // Fermi Generation (SM 2.1) GF10x class
87128b876c63 add test
ikkun
parents:
diff changeset
1042 { 0x30, 192}, // Kepler Generation (SM 3.0) GK10x class
87128b876c63 add test
ikkun
parents:
diff changeset
1043 { 0x32, 192}, // Kepler Generation (SM 3.2) GK10x class
87128b876c63 add test
ikkun
parents:
diff changeset
1044 { 0x35, 192}, // Kepler Generation (SM 3.5) GK11x class
87128b876c63 add test
ikkun
parents:
diff changeset
1045 { 0x37, 192}, // Kepler Generation (SM 3.7) GK21x class
87128b876c63 add test
ikkun
parents:
diff changeset
1046 { 0x50, 128}, // Maxwell Generation (SM 5.0) GM10x class
87128b876c63 add test
ikkun
parents:
diff changeset
1047 { 0x52, 128}, // Maxwell Generation (SM 5.2) GM20x class
87128b876c63 add test
ikkun
parents:
diff changeset
1048 { 0x53, 128}, // Maxwell Generation (SM 5.3) GM20x class
87128b876c63 add test
ikkun
parents:
diff changeset
1049 { 0x60, 64 }, // Pascal Generation (SM 6.0) GP100 class
87128b876c63 add test
ikkun
parents:
diff changeset
1050 { 0x61, 128}, // Pascal Generation (SM 6.1) GP10x class
87128b876c63 add test
ikkun
parents:
diff changeset
1051 { 0x62, 128}, // Pascal Generation (SM 6.2) GP10x class
87128b876c63 add test
ikkun
parents:
diff changeset
1052 { -1, -1 }
87128b876c63 add test
ikkun
parents:
diff changeset
1053 };
87128b876c63 add test
ikkun
parents:
diff changeset
1054
87128b876c63 add test
ikkun
parents:
diff changeset
1055 int index = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1056
87128b876c63 add test
ikkun
parents:
diff changeset
1057 while (nGpuArchCoresPerSM[index].SM != -1)
87128b876c63 add test
ikkun
parents:
diff changeset
1058 {
87128b876c63 add test
ikkun
parents:
diff changeset
1059 if (nGpuArchCoresPerSM[index].SM == ((major << 4) + minor))
87128b876c63 add test
ikkun
parents:
diff changeset
1060 {
87128b876c63 add test
ikkun
parents:
diff changeset
1061 return nGpuArchCoresPerSM[index].Cores;
87128b876c63 add test
ikkun
parents:
diff changeset
1062 }
87128b876c63 add test
ikkun
parents:
diff changeset
1063
87128b876c63 add test
ikkun
parents:
diff changeset
1064 index++;
87128b876c63 add test
ikkun
parents:
diff changeset
1065 }
87128b876c63 add test
ikkun
parents:
diff changeset
1066
87128b876c63 add test
ikkun
parents:
diff changeset
1067 // If we don't find the values, we default use the previous one to run properly
87128b876c63 add test
ikkun
parents:
diff changeset
1068 printf("MapSMtoCores for SM %d.%d is undefined. Default to use %d Cores/SM\n", major, minor, nGpuArchCoresPerSM[index-1].Cores);
87128b876c63 add test
ikkun
parents:
diff changeset
1069 return nGpuArchCoresPerSM[index-1].Cores;
87128b876c63 add test
ikkun
parents:
diff changeset
1070 }
87128b876c63 add test
ikkun
parents:
diff changeset
1071 // end of GPU Architecture definitions
87128b876c63 add test
ikkun
parents:
diff changeset
1072
87128b876c63 add test
ikkun
parents:
diff changeset
1073 #ifdef __CUDA_RUNTIME_H__
87128b876c63 add test
ikkun
parents:
diff changeset
1074 // General GPU Device CUDA Initialization
87128b876c63 add test
ikkun
parents:
diff changeset
1075 inline int gpuDeviceInit(int devID)
87128b876c63 add test
ikkun
parents:
diff changeset
1076 {
87128b876c63 add test
ikkun
parents:
diff changeset
1077 int device_count;
87128b876c63 add test
ikkun
parents:
diff changeset
1078 checkCudaErrors(cudaGetDeviceCount(&device_count));
87128b876c63 add test
ikkun
parents:
diff changeset
1079
87128b876c63 add test
ikkun
parents:
diff changeset
1080 if (device_count == 0)
87128b876c63 add test
ikkun
parents:
diff changeset
1081 {
87128b876c63 add test
ikkun
parents:
diff changeset
1082 fprintf(stderr, "gpuDeviceInit() CUDA error: no devices supporting CUDA.\n");
87128b876c63 add test
ikkun
parents:
diff changeset
1083 exit(EXIT_FAILURE);
87128b876c63 add test
ikkun
parents:
diff changeset
1084 }
87128b876c63 add test
ikkun
parents:
diff changeset
1085
87128b876c63 add test
ikkun
parents:
diff changeset
1086 if (devID < 0)
87128b876c63 add test
ikkun
parents:
diff changeset
1087 {
87128b876c63 add test
ikkun
parents:
diff changeset
1088 devID = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1089 }
87128b876c63 add test
ikkun
parents:
diff changeset
1090
87128b876c63 add test
ikkun
parents:
diff changeset
1091 if (devID > device_count-1)
87128b876c63 add test
ikkun
parents:
diff changeset
1092 {
87128b876c63 add test
ikkun
parents:
diff changeset
1093 fprintf(stderr, "\n");
87128b876c63 add test
ikkun
parents:
diff changeset
1094 fprintf(stderr, ">> %d CUDA capable GPU device(s) detected. <<\n", device_count);
87128b876c63 add test
ikkun
parents:
diff changeset
1095 fprintf(stderr, ">> gpuDeviceInit (-device=%d) is not a valid GPU device. <<\n", devID);
87128b876c63 add test
ikkun
parents:
diff changeset
1096 fprintf(stderr, "\n");
87128b876c63 add test
ikkun
parents:
diff changeset
1097 return -devID;
87128b876c63 add test
ikkun
parents:
diff changeset
1098 }
87128b876c63 add test
ikkun
parents:
diff changeset
1099
87128b876c63 add test
ikkun
parents:
diff changeset
1100 cudaDeviceProp deviceProp;
87128b876c63 add test
ikkun
parents:
diff changeset
1101 checkCudaErrors(cudaGetDeviceProperties(&deviceProp, devID));
87128b876c63 add test
ikkun
parents:
diff changeset
1102
87128b876c63 add test
ikkun
parents:
diff changeset
1103 if (deviceProp.computeMode == cudaComputeModeProhibited)
87128b876c63 add test
ikkun
parents:
diff changeset
1104 {
87128b876c63 add test
ikkun
parents:
diff changeset
1105 fprintf(stderr, "Error: device is running in <Compute Mode Prohibited>, no threads can use ::cudaSetDevice().\n");
87128b876c63 add test
ikkun
parents:
diff changeset
1106 return -1;
87128b876c63 add test
ikkun
parents:
diff changeset
1107 }
87128b876c63 add test
ikkun
parents:
diff changeset
1108
87128b876c63 add test
ikkun
parents:
diff changeset
1109 if (deviceProp.major < 1)
87128b876c63 add test
ikkun
parents:
diff changeset
1110 {
87128b876c63 add test
ikkun
parents:
diff changeset
1111 fprintf(stderr, "gpuDeviceInit(): GPU device does not support CUDA.\n");
87128b876c63 add test
ikkun
parents:
diff changeset
1112 exit(EXIT_FAILURE);
87128b876c63 add test
ikkun
parents:
diff changeset
1113 }
87128b876c63 add test
ikkun
parents:
diff changeset
1114
87128b876c63 add test
ikkun
parents:
diff changeset
1115 checkCudaErrors(cudaSetDevice(devID));
87128b876c63 add test
ikkun
parents:
diff changeset
1116 printf("gpuDeviceInit() CUDA Device [%d]: \"%s\n", devID, deviceProp.name);
87128b876c63 add test
ikkun
parents:
diff changeset
1117
87128b876c63 add test
ikkun
parents:
diff changeset
1118 return devID;
87128b876c63 add test
ikkun
parents:
diff changeset
1119 }
87128b876c63 add test
ikkun
parents:
diff changeset
1120
87128b876c63 add test
ikkun
parents:
diff changeset
1121 // This function returns the best GPU (with maximum GFLOPS)
87128b876c63 add test
ikkun
parents:
diff changeset
1122 inline int gpuGetMaxGflopsDeviceId()
87128b876c63 add test
ikkun
parents:
diff changeset
1123 {
87128b876c63 add test
ikkun
parents:
diff changeset
1124 int current_device = 0, sm_per_multiproc = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1125 int max_perf_device = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1126 int device_count = 0, best_SM_arch = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1127 int devices_prohibited = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1128
87128b876c63 add test
ikkun
parents:
diff changeset
1129 unsigned long long max_compute_perf = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1130 cudaDeviceProp deviceProp;
87128b876c63 add test
ikkun
parents:
diff changeset
1131 cudaGetDeviceCount(&device_count);
87128b876c63 add test
ikkun
parents:
diff changeset
1132
87128b876c63 add test
ikkun
parents:
diff changeset
1133 checkCudaErrors(cudaGetDeviceCount(&device_count));
87128b876c63 add test
ikkun
parents:
diff changeset
1134
87128b876c63 add test
ikkun
parents:
diff changeset
1135 if (device_count == 0)
87128b876c63 add test
ikkun
parents:
diff changeset
1136 {
87128b876c63 add test
ikkun
parents:
diff changeset
1137 fprintf(stderr, "gpuGetMaxGflopsDeviceId() CUDA error: no devices supporting CUDA.\n");
87128b876c63 add test
ikkun
parents:
diff changeset
1138 exit(EXIT_FAILURE);
87128b876c63 add test
ikkun
parents:
diff changeset
1139 }
87128b876c63 add test
ikkun
parents:
diff changeset
1140
87128b876c63 add test
ikkun
parents:
diff changeset
1141 // Find the best major SM Architecture GPU device
87128b876c63 add test
ikkun
parents:
diff changeset
1142 while (current_device < device_count)
87128b876c63 add test
ikkun
parents:
diff changeset
1143 {
87128b876c63 add test
ikkun
parents:
diff changeset
1144 cudaGetDeviceProperties(&deviceProp, current_device);
87128b876c63 add test
ikkun
parents:
diff changeset
1145
87128b876c63 add test
ikkun
parents:
diff changeset
1146 // If this GPU is not running on Compute Mode prohibited, then we can add it to the list
87128b876c63 add test
ikkun
parents:
diff changeset
1147 if (deviceProp.computeMode != cudaComputeModeProhibited)
87128b876c63 add test
ikkun
parents:
diff changeset
1148 {
87128b876c63 add test
ikkun
parents:
diff changeset
1149 if (deviceProp.major > 0 && deviceProp.major < 9999)
87128b876c63 add test
ikkun
parents:
diff changeset
1150 {
87128b876c63 add test
ikkun
parents:
diff changeset
1151 best_SM_arch = MAX(best_SM_arch, deviceProp.major);
87128b876c63 add test
ikkun
parents:
diff changeset
1152 }
87128b876c63 add test
ikkun
parents:
diff changeset
1153 }
87128b876c63 add test
ikkun
parents:
diff changeset
1154 else
87128b876c63 add test
ikkun
parents:
diff changeset
1155 {
87128b876c63 add test
ikkun
parents:
diff changeset
1156 devices_prohibited++;
87128b876c63 add test
ikkun
parents:
diff changeset
1157 }
87128b876c63 add test
ikkun
parents:
diff changeset
1158
87128b876c63 add test
ikkun
parents:
diff changeset
1159 current_device++;
87128b876c63 add test
ikkun
parents:
diff changeset
1160 }
87128b876c63 add test
ikkun
parents:
diff changeset
1161
87128b876c63 add test
ikkun
parents:
diff changeset
1162 if (devices_prohibited == device_count)
87128b876c63 add test
ikkun
parents:
diff changeset
1163 {
87128b876c63 add test
ikkun
parents:
diff changeset
1164 fprintf(stderr, "gpuGetMaxGflopsDeviceId() CUDA error: all devices have compute mode prohibited.\n");
87128b876c63 add test
ikkun
parents:
diff changeset
1165 exit(EXIT_FAILURE);
87128b876c63 add test
ikkun
parents:
diff changeset
1166 }
87128b876c63 add test
ikkun
parents:
diff changeset
1167
87128b876c63 add test
ikkun
parents:
diff changeset
1168 // Find the best CUDA capable GPU device
87128b876c63 add test
ikkun
parents:
diff changeset
1169 current_device = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1170
87128b876c63 add test
ikkun
parents:
diff changeset
1171 while (current_device < device_count)
87128b876c63 add test
ikkun
parents:
diff changeset
1172 {
87128b876c63 add test
ikkun
parents:
diff changeset
1173 cudaGetDeviceProperties(&deviceProp, current_device);
87128b876c63 add test
ikkun
parents:
diff changeset
1174
87128b876c63 add test
ikkun
parents:
diff changeset
1175 // If this GPU is not running on Compute Mode prohibited, then we can add it to the list
87128b876c63 add test
ikkun
parents:
diff changeset
1176 if (deviceProp.computeMode != cudaComputeModeProhibited)
87128b876c63 add test
ikkun
parents:
diff changeset
1177 {
87128b876c63 add test
ikkun
parents:
diff changeset
1178 if (deviceProp.major == 9999 && deviceProp.minor == 9999)
87128b876c63 add test
ikkun
parents:
diff changeset
1179 {
87128b876c63 add test
ikkun
parents:
diff changeset
1180 sm_per_multiproc = 1;
87128b876c63 add test
ikkun
parents:
diff changeset
1181 }
87128b876c63 add test
ikkun
parents:
diff changeset
1182 else
87128b876c63 add test
ikkun
parents:
diff changeset
1183 {
87128b876c63 add test
ikkun
parents:
diff changeset
1184 sm_per_multiproc = _ConvertSMVer2Cores(deviceProp.major, deviceProp.minor);
87128b876c63 add test
ikkun
parents:
diff changeset
1185 }
87128b876c63 add test
ikkun
parents:
diff changeset
1186
87128b876c63 add test
ikkun
parents:
diff changeset
1187 unsigned long long compute_perf = (unsigned long long) deviceProp.multiProcessorCount * sm_per_multiproc * deviceProp.clockRate;
87128b876c63 add test
ikkun
parents:
diff changeset
1188
87128b876c63 add test
ikkun
parents:
diff changeset
1189 if (compute_perf > max_compute_perf)
87128b876c63 add test
ikkun
parents:
diff changeset
1190 {
87128b876c63 add test
ikkun
parents:
diff changeset
1191 // If we find GPU with SM major > 2, search only these
87128b876c63 add test
ikkun
parents:
diff changeset
1192 if (best_SM_arch > 2)
87128b876c63 add test
ikkun
parents:
diff changeset
1193 {
87128b876c63 add test
ikkun
parents:
diff changeset
1194 // If our device==dest_SM_arch, choose this, or else pass
87128b876c63 add test
ikkun
parents:
diff changeset
1195 if (deviceProp.major == best_SM_arch)
87128b876c63 add test
ikkun
parents:
diff changeset
1196 {
87128b876c63 add test
ikkun
parents:
diff changeset
1197 max_compute_perf = compute_perf;
87128b876c63 add test
ikkun
parents:
diff changeset
1198 max_perf_device = current_device;
87128b876c63 add test
ikkun
parents:
diff changeset
1199 }
87128b876c63 add test
ikkun
parents:
diff changeset
1200 }
87128b876c63 add test
ikkun
parents:
diff changeset
1201 else
87128b876c63 add test
ikkun
parents:
diff changeset
1202 {
87128b876c63 add test
ikkun
parents:
diff changeset
1203 max_compute_perf = compute_perf;
87128b876c63 add test
ikkun
parents:
diff changeset
1204 max_perf_device = current_device;
87128b876c63 add test
ikkun
parents:
diff changeset
1205 }
87128b876c63 add test
ikkun
parents:
diff changeset
1206 }
87128b876c63 add test
ikkun
parents:
diff changeset
1207 }
87128b876c63 add test
ikkun
parents:
diff changeset
1208
87128b876c63 add test
ikkun
parents:
diff changeset
1209 ++current_device;
87128b876c63 add test
ikkun
parents:
diff changeset
1210 }
87128b876c63 add test
ikkun
parents:
diff changeset
1211
87128b876c63 add test
ikkun
parents:
diff changeset
1212 return max_perf_device;
87128b876c63 add test
ikkun
parents:
diff changeset
1213 }
87128b876c63 add test
ikkun
parents:
diff changeset
1214
87128b876c63 add test
ikkun
parents:
diff changeset
1215
87128b876c63 add test
ikkun
parents:
diff changeset
1216 // Initialization code to find the best CUDA Device
87128b876c63 add test
ikkun
parents:
diff changeset
1217 inline int findCudaDevice(int argc, const char **argv)
87128b876c63 add test
ikkun
parents:
diff changeset
1218 {
87128b876c63 add test
ikkun
parents:
diff changeset
1219 cudaDeviceProp deviceProp;
87128b876c63 add test
ikkun
parents:
diff changeset
1220 int devID = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1221
87128b876c63 add test
ikkun
parents:
diff changeset
1222 // If the command-line has a device number specified, use it
87128b876c63 add test
ikkun
parents:
diff changeset
1223 if (checkCmdLineFlag(argc, argv, "device"))
87128b876c63 add test
ikkun
parents:
diff changeset
1224 {
87128b876c63 add test
ikkun
parents:
diff changeset
1225 devID = getCmdLineArgumentInt(argc, argv, "device=");
87128b876c63 add test
ikkun
parents:
diff changeset
1226
87128b876c63 add test
ikkun
parents:
diff changeset
1227 if (devID < 0)
87128b876c63 add test
ikkun
parents:
diff changeset
1228 {
87128b876c63 add test
ikkun
parents:
diff changeset
1229 printf("Invalid command line parameter\n ");
87128b876c63 add test
ikkun
parents:
diff changeset
1230 exit(EXIT_FAILURE);
87128b876c63 add test
ikkun
parents:
diff changeset
1231 }
87128b876c63 add test
ikkun
parents:
diff changeset
1232 else
87128b876c63 add test
ikkun
parents:
diff changeset
1233 {
87128b876c63 add test
ikkun
parents:
diff changeset
1234 devID = gpuDeviceInit(devID);
87128b876c63 add test
ikkun
parents:
diff changeset
1235
87128b876c63 add test
ikkun
parents:
diff changeset
1236 if (devID < 0)
87128b876c63 add test
ikkun
parents:
diff changeset
1237 {
87128b876c63 add test
ikkun
parents:
diff changeset
1238 printf("exiting...\n");
87128b876c63 add test
ikkun
parents:
diff changeset
1239 exit(EXIT_FAILURE);
87128b876c63 add test
ikkun
parents:
diff changeset
1240 }
87128b876c63 add test
ikkun
parents:
diff changeset
1241 }
87128b876c63 add test
ikkun
parents:
diff changeset
1242 }
87128b876c63 add test
ikkun
parents:
diff changeset
1243 else
87128b876c63 add test
ikkun
parents:
diff changeset
1244 {
87128b876c63 add test
ikkun
parents:
diff changeset
1245 // Otherwise pick the device with highest Gflops/s
87128b876c63 add test
ikkun
parents:
diff changeset
1246 devID = gpuGetMaxGflopsDeviceId();
87128b876c63 add test
ikkun
parents:
diff changeset
1247 checkCudaErrors(cudaSetDevice(devID));
87128b876c63 add test
ikkun
parents:
diff changeset
1248 checkCudaErrors(cudaGetDeviceProperties(&deviceProp, devID));
87128b876c63 add test
ikkun
parents:
diff changeset
1249 printf("GPU Device %d: \"%s\" with compute capability %d.%d\n\n", devID, deviceProp.name, deviceProp.major, deviceProp.minor);
87128b876c63 add test
ikkun
parents:
diff changeset
1250 }
87128b876c63 add test
ikkun
parents:
diff changeset
1251
87128b876c63 add test
ikkun
parents:
diff changeset
1252 return devID;
87128b876c63 add test
ikkun
parents:
diff changeset
1253 }
87128b876c63 add test
ikkun
parents:
diff changeset
1254
87128b876c63 add test
ikkun
parents:
diff changeset
1255 // General check for CUDA GPU SM Capabilities
87128b876c63 add test
ikkun
parents:
diff changeset
1256 inline bool checkCudaCapabilities(int major_version, int minor_version)
87128b876c63 add test
ikkun
parents:
diff changeset
1257 {
87128b876c63 add test
ikkun
parents:
diff changeset
1258 cudaDeviceProp deviceProp;
87128b876c63 add test
ikkun
parents:
diff changeset
1259 deviceProp.major = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1260 deviceProp.minor = 0;
87128b876c63 add test
ikkun
parents:
diff changeset
1261 int dev;
87128b876c63 add test
ikkun
parents:
diff changeset
1262
87128b876c63 add test
ikkun
parents:
diff changeset
1263 checkCudaErrors(cudaGetDevice(&dev));
87128b876c63 add test
ikkun
parents:
diff changeset
1264 checkCudaErrors(cudaGetDeviceProperties(&deviceProp, dev));
87128b876c63 add test
ikkun
parents:
diff changeset
1265
87128b876c63 add test
ikkun
parents:
diff changeset
1266 if ((deviceProp.major > major_version) ||
87128b876c63 add test
ikkun
parents:
diff changeset
1267 (deviceProp.major == major_version && deviceProp.minor >= minor_version))
87128b876c63 add test
ikkun
parents:
diff changeset
1268 {
87128b876c63 add test
ikkun
parents:
diff changeset
1269 printf(" Device %d: <%16s >, Compute SM %d.%d detected\n", dev, deviceProp.name, deviceProp.major, deviceProp.minor);
87128b876c63 add test
ikkun
parents:
diff changeset
1270 return true;
87128b876c63 add test
ikkun
parents:
diff changeset
1271 }
87128b876c63 add test
ikkun
parents:
diff changeset
1272 else
87128b876c63 add test
ikkun
parents:
diff changeset
1273 {
87128b876c63 add test
ikkun
parents:
diff changeset
1274 printf(" No GPU device was found that can support CUDA compute capability %d.%d.\n", major_version, minor_version);
87128b876c63 add test
ikkun
parents:
diff changeset
1275 return false;
87128b876c63 add test
ikkun
parents:
diff changeset
1276 }
87128b876c63 add test
ikkun
parents:
diff changeset
1277 }
87128b876c63 add test
ikkun
parents:
diff changeset
1278 #endif
87128b876c63 add test
ikkun
parents:
diff changeset
1279
87128b876c63 add test
ikkun
parents:
diff changeset
1280 // end of CUDA Helper Functions
87128b876c63 add test
ikkun
parents:
diff changeset
1281
87128b876c63 add test
ikkun
parents:
diff changeset
1282
87128b876c63 add test
ikkun
parents:
diff changeset
1283 #endif