OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExtensionFunctionsTesting.hpp
Go to the documentation of this file.
1 /*
2 
3  Compile-time UDFs. Used in RBC: rbc/tests/test_omnisci_device_selection.py
4 
5  */
6 
7 #define CPU_DEVICE_CODE 0x637075 // 'cpu' in hex
8 #define GPU_DEVICE_CODE 0x677075 // 'gpu' in hex
9 
11 int32_t ct_device_selection_udf_any(int32_t input) {
12 #ifdef __CUDACC__
13  return GPU_DEVICE_CODE;
14 #else
15  return CPU_DEVICE_CODE;
16 #endif
17 }
18 
19 #ifndef __CUDACC__
20 
22 int32_t ct_device_selection_udf_cpu__cpu_(int32_t input) {
23  return CPU_DEVICE_CODE;
24 }
25 
26 #endif
27 
29 int32_t ct_device_selection_udf_gpu__gpu_(int32_t input) {
30  return GPU_DEVICE_CODE;
31 }
32 
33 #ifndef __CUDACC__
34 
36 int32_t ct_device_selection_udf_both__cpu_(int32_t input) {
37  return CPU_DEVICE_CODE;
38 }
39 
40 #endif
41 
43 int32_t ct_device_selection_udf_both__gpu_(int32_t input) {
44  return GPU_DEVICE_CODE;
45 }
46 
47 #ifndef __CUDACC__
48 
49 #include <chrono>
50 #include <thread>
52 int32_t ct_sleep_us__cpu_(int64_t usec) {
53  std::this_thread::sleep_for(std::chrono::microseconds(usec));
54  return usec;
55 }
56 
57 #endif // #ifndef __CUDACC__
58 
59 #undef CPU_DEVICE_CODE
60 #undef GPU_DEVICE_CODE
EXTENSION_NOINLINE int32_t ct_device_selection_udf_both__gpu_(int32_t input)
#define EXTENSION_NOINLINE
Definition: heavydbTypes.h:58
#define CPU_DEVICE_CODE
EXTENSION_NOINLINE_HOST int32_t ct_device_selection_udf_cpu__cpu_(int32_t input)
#define EXTENSION_NOINLINE_HOST
Definition: heavydbTypes.h:55
EXTENSION_NOINLINE int32_t ct_device_selection_udf_gpu__gpu_(int32_t input)
#define GPU_DEVICE_CODE
EXTENSION_NOINLINE int32_t ct_device_selection_udf_any(int32_t input)
EXTENSION_NOINLINE int32_t ct_sleep_us__cpu_(int64_t usec)
EXTENSION_NOINLINE_HOST int32_t ct_device_selection_udf_both__cpu_(int32_t input)