Xmipp  v3.23.11-Nereus
cudaAsserts.h
Go to the documentation of this file.
1 #ifndef CUFFTADVISOR_CUFFTASSERTS_H_
2 #define CUFFTADVISOR_CUFFTASSERTS_H_
3 
4 #include <cuda_runtime.h>
5 #include <cufft.h>
6 #include <cstdio>
7 #include <stdexcept>
8 
9 namespace cuFFTAdvisor {
10 
11 void (gpuErrchk)(cudaError_t code, const char *file=__FILE__, int line=__LINE__, bool abort = true);
12 
13 static inline const char *_cudaGetErrorEnum(cufftResult error) {
14  switch (error) {
15  case CUFFT_SUCCESS:
16  return "CUFFT_SUCCESS";
17 
18  case CUFFT_INVALID_PLAN:
19  return "CUFFT_INVALID_PLAN";
20 
21  case CUFFT_ALLOC_FAILED:
22  return "CUFFT_ALLOC_FAILED";
23 
24  case CUFFT_INVALID_TYPE:
25  return "CUFFT_INVALID_TYPE";
26 
27  case CUFFT_INVALID_VALUE:
28  return "CUFFT_INVALID_VALUE";
29 
30  case CUFFT_INTERNAL_ERROR:
31  return "CUFFT_INTERNAL_ERROR";
32 
33  case CUFFT_EXEC_FAILED:
34  return "CUFFT_EXEC_FAILED";
35 
36  case CUFFT_SETUP_FAILED:
37  return "CUFFT_SETUP_FAILED";
38 
39  case CUFFT_INVALID_SIZE:
40  return "CUFFT_INVALID_SIZE";
41 
42  case CUFFT_UNALIGNED_DATA:
43  return "CUFFT_UNALIGNED_DATA";
44 
45  case CUFFT_INCOMPLETE_PARAMETER_LIST:
46  return "CUFFT_INCOMPLETE_PARAMETER_LIST";
47 
48  case CUFFT_INVALID_DEVICE:
49  return "CUFFT_INVALID_DEVICE";
50 
51  case CUFFT_PARSE_ERROR:
52  return "CUFFT_PARSE_ERROR";
53 
54  case CUFFT_NO_WORKSPACE:
55  return "CUFFT_NO_WORKSPACE";
56 #if CUDART_VERSION > 7050
57  case CUFFT_NOT_IMPLEMENTED:
58  return "CUFFT_NOT_IMPLEMENTED";
59 
60  case CUFFT_LICENSE_ERROR:
61  return "CUFFT_LICENSE_ERROR";
62 
63  case CUFFT_NOT_SUPPORTED:
64  return "CUFFT_NOT_SUPPORTED";
65 #endif
66  }
67 
68  return "<unknown>";
69 }
70 
71 void (gpuErrchkFFT)(cufftResult_t code, const char *file = __FILE__, int line = __LINE__,
72  bool abort = true);
73 
74 } // namespace cuFFTAdvisor
75 
76 #endif // CUFFTADVISOR_CUFFTASSERTS_H_
void gpuErrchk(cudaError_t code, const char *file, int line, bool abort)
Definition: cudaAsserts.cpp:5
void gpuErrchkFFT(cufftResult_t code, const char *file, int line, bool abort)
Definition: cudaAsserts.cpp:14