OmniSciDB  bf83d84833
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TableFunctions.hpp File Reference
+ Include dependency graph for TableFunctions.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EXTENSION_INLINE   extern "C" ALWAYS_INLINE DEVICE
 
#define EXTENSION_NOINLINE   extern "C" NEVER_INLINE DEVICE
 

Functions

EXTENSION_NOINLINE int32_t row_copier (const Column< double > &input_col, int copy_multiplier, Column< double > &output_col)
 
EXTENSION_NOINLINE int32_t row_adder (const int copy_multiplier, const Column< double > &input_col1, const Column< double > &input_col2, Column< double > &output_col)
 
EXTENSION_NOINLINE int32_t row_addsub (const int copy_multiplier, const Column< double > &input_col1, const Column< double > &input_col2, Column< double > &output_col1, Column< double > &output_col2)
 
EXTENSION_NOINLINE int32_t get_max_with_row_offset (const Column< int > &input_col, Column< int > &output_max_col, Column< int > &output_max_row_col)
 

Macro Definition Documentation

#define EXTENSION_INLINE   extern "C" ALWAYS_INLINE DEVICE

Definition at line 20 of file TableFunctions.hpp.

#define EXTENSION_NOINLINE   extern "C" NEVER_INLINE DEVICE

Definition at line 21 of file TableFunctions.hpp.

Function Documentation

EXTENSION_NOINLINE int32_t get_max_with_row_offset ( const Column< int > &  input_col,
Column< int > &  output_max_col,
Column< int > &  output_max_row_col 
)

Definition at line 124 of file TableFunctions.hpp.

References Column< T >::getSize().

126  {
127  if ((output_max_col.getSize() != 1) || output_max_row_col.getSize() != 1) {
128  return -1;
129  }
130 #ifdef __CUDACC__
131  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
132  int32_t stop = static_cast<int32_t>(input_col.getSize());
133  int32_t step = blockDim.x * gridDim.x;
134 #else
135  auto start = 0;
136  auto stop = input_col.getSize();
137  auto step = 1;
138 #endif
139 
140  int curr_max = -2147483648;
141  int curr_max_row = -1;
142  for (auto i = start; i < stop; i += step) {
143  if (input_col[i] > curr_max) {
144  curr_max = input_col[i];
145  curr_max_row = i;
146  }
147  }
148  output_max_col[0] = curr_max;
149  output_max_row_col[0] = curr_max_row;
150  return 1;
151 }
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:154

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t row_adder ( const int  copy_multiplier,
const Column< double > &  input_col1,
const Column< double > &  input_col2,
Column< double > &  output_col 
)

Definition at line 54 of file TableFunctions.hpp.

References Column< T >::getSize(), Column< T >::isNull(), and Column< T >::setNull().

57  {
58  int32_t output_row_count = copy_multiplier * input_col1.getSize();
59  if (output_row_count > 100) {
60  // Test failure propagation.
61  return -1;
62  }
63  if (output_col.getSize() != output_row_count) {
64  return -1;
65  }
66 
67 #ifdef __CUDACC__
68  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
69  int32_t stop = static_cast<int32_t>(input_col1.getSize());
70  int32_t step = blockDim.x * gridDim.x;
71 #else
72  auto start = 0;
73  auto stop = input_col1.getSize();
74  auto step = 1;
75 #endif
76  auto stride = input_col1.getSize();
77  for (auto i = start; i < stop; i += step) {
78  for (int c = 0; c < copy_multiplier; c++) {
79  if (input_col1.isNull(i) || input_col2.isNull(i)) {
80  output_col.setNull(i + (c * stride));
81  } else {
82  output_col[i + (c * stride)] = input_col1[i] + input_col2[i];
83  }
84  }
85  }
86 
87  return output_row_count;
88 }
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:154
DEVICE bool isNull(int64_t index) const
Definition: OmniSciTypes.h:157
DEVICE void setNull(int64_t index)
Definition: OmniSciTypes.h:158

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t row_addsub ( const int  copy_multiplier,
const Column< double > &  input_col1,
const Column< double > &  input_col2,
Column< double > &  output_col1,
Column< double > &  output_col2 
)

Definition at line 90 of file TableFunctions.hpp.

References Column< T >::getSize().

94  {
95  int32_t output_row_count = copy_multiplier * input_col1.getSize();
96  if (output_row_count > 100) {
97  // Test failure propagation.
98  return -1;
99  }
100  if ((output_col1.getSize() != output_row_count) ||
101  (output_col2.getSize() != output_row_count)) {
102  return -1;
103  }
104 
105 #ifdef __CUDACC__
106  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
107  int32_t stop = static_cast<int32_t>(input_col1.getSize());
108  int32_t step = blockDim.x * gridDim.x;
109 #else
110  auto start = 0;
111  auto stop = input_col1.getSize();
112  auto step = 1;
113 #endif
114  auto stride = input_col1.getSize();
115  for (auto i = start; i < stop; i += step) {
116  for (int c = 0; c < copy_multiplier; c++) {
117  output_col1[i + (c * stride)] = input_col1[i] + input_col2[i];
118  output_col2[i + (c * stride)] = input_col1[i] - input_col2[i];
119  }
120  }
121  return output_row_count;
122 }
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:154

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t row_copier ( const Column< double > &  input_col,
int  copy_multiplier,
Column< double > &  output_col 
)

Definition at line 23 of file TableFunctions.hpp.

References Column< T >::getSize().

25  {
26  int32_t output_row_count = copy_multiplier * input_col.getSize();
27  if (output_row_count > 100) {
28  // Test failure propagation.
29  return -1;
30  }
31  if (output_col.getSize() != output_row_count) {
32  return -1;
33  }
34 
35 #ifdef __CUDACC__
36  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
37  int32_t stop = static_cast<int32_t>(input_col.getSize());
38  int32_t step = blockDim.x * gridDim.x;
39 #else
40  auto start = 0;
41  auto stop = input_col.getSize();
42  auto step = 1;
43 #endif
44 
45  for (auto i = start; i < stop; i += step) {
46  for (int c = 0; c < copy_multiplier; c++) {
47  output_col[i + (c * input_col.getSize())] = input_col[i];
48  }
49  }
50 
51  return output_row_count;
52 }
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:154

+ Here is the call graph for this function: