1908
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 // enum to string
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 // これ自分で書くのあれだよね
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 const char* convert_error_status(unsigned int status){
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 static const struct {
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 const unsigned int status;
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 const char* status_string;
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 } Error_Status[] = {
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 {cudaSuccess, "cudaSuccess"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 {cudaErrorMissingConfiguration, "cudaErrorMissingConfiguration"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 {cudaErrorMemoryAllocation, "cudaErrorMemoryAllocation"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 {cudaErrorInitializationError, "cudaErrorInitializationError"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 {cudaErrorLaunchFailure, "cudaErrorLaunchFailure"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 {cudaErrorLaunchTimeout, "cudaErrorLaunchTimeout"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 {cudaErrorLaunchOutOfResources, "cudaErrorLaunchOutOfResources"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 {cudaErrorInvalidDeviceFunction, "cudaErrorInvalidDeviceFunction"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 {cudaErrorInvalidConfiguration, "cudaErrorInvalidConfiguration"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 {cudaErrorInvalidDevice, "cudaErrorInvalidDevice"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 {cudaErrorInvalidValue, "cudaErrorInvalidValue"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 {cudaErrorInvalidPitchValue, "cudaErrorInvalidPitchValue"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 {cudaErrorInvalidSymbol, "cudaErrorInvalidSymbol"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 {cudaErrorUnmapBufferObjectFailed, "cudaErrorUnmapBufferObjectFailed"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 {cudaErrorInvalidHostPointer, "cudaErrorInvalidHostPointer"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 {cudaErrorInvalidDevicePointer, "cudaErrorInvalidDevicePointer"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 {cudaErrorInvalidTexture, "cudaErrorInvalidTexture"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 {cudaErrorInvalidTextureBinding, "cudaErrorInvalidTextureBinding"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 {cudaErrorInvalidChannelDescriptor, "cudaErrorInvalidChannelDescriptor"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 {cudaErrorInvalidMemcpyDirection, "cudaErrorInvalidMemcpyDirection"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 {cudaErrorInvalidFilterSetting, "cudaErrorInvalidFilterSetting"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 {cudaErrorInvalidNormSetting, "cudaErrorInvalidNormSetting"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 {cudaErrorUnknown, "cudaErrorUnknown"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 {cudaErrorInvalidResourceHandle, "cudaErrorInvalidResourceHandle"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 {cudaErrorInsufficientDriver, "cudaErrorInsufficientDriver"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 {cudaErrorSetOnActiveProcess, "cudaErrorSetOnActiveProcess"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 {cudaErrorStartupFailure, "cudaErrorStartupFailure"},
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 {0, NULL}
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 };
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 const char* message;
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 for(int i=0; Error_Status[i].status_string != NULL; i++) {
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 if (Error_Status[i].status = status) {
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 message = Error_Status[i].status_string;
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 }
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 }
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 return message;
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45 }
|