Column-oriented GPU-accelerated Database Management System
CoGaDB
|
00001 00002 #pragma once 00003 00004 #include <thrust/version.h> 00005 #include <thrust/device_vector.h> 00006 #include <thrust/iterator/zip_iterator.h> 00007 #include <thrust/partition.h> 00008 #include <thrust/copy.h> 00009 #include <thrust/functional.h> 00010 #include <thrust/sequence.h> 00011 #include <thrust/generate.h> 00012 00013 #include <cstdlib> 00014 #include <cstdio> 00015 #include <iostream> 00016 00017 #include <gpu/gpu_algorithms.hpp> 00018 #include <gpu/gpu_typed_base_column.hpp> 00019 #include <gpu/gpu_positionlist.hpp> 00020 00021 00022 using namespace std; 00023 00024 namespace CoGaDB{ 00025 00026 namespace gpu{ 00027 00028 00029 00030 template <typename T> 00031 struct Functor_Selection_Tuple_Equal : public thrust::unary_function<thrust::tuple<T,unsigned int>&,bool> 00032 { 00033 const T a; 00034 Functor_Selection_Tuple_Equal(T _a) : a(_a) {} 00035 00036 __host__ __device__ 00037 bool operator()(const thrust::tuple<T,unsigned int>& x) const 00038 { 00039 return ( thrust::get<0>(x)==a); 00040 } 00041 }; 00042 00043 template <typename T> 00044 struct Functor_Selection_Tuple_Lesser : public thrust::unary_function<thrust::tuple<T,unsigned int>&,bool> 00045 { 00046 const T a; 00047 00048 Functor_Selection_Tuple_Lesser(T _a) : a(_a) {} 00049 00050 __host__ __device__ 00051 bool operator()(const thrust::tuple<T,unsigned int>& x) const 00052 { 00053 return (thrust::get<0>(x)<a); 00054 } 00055 }; 00056 00057 template <typename T> 00058 struct Functor_Selection_Tuple_Lesser_Equal : public thrust::unary_function<thrust::tuple<T,unsigned int>&,bool> 00059 { 00060 const T a; 00061 00062 Functor_Selection_Tuple_Lesser_Equal(T _a) : a(_a) {} 00063 00064 __host__ __device__ 00065 bool operator()(const thrust::tuple<T,unsigned int>& x) const 00066 { 00067 return (thrust::get<0>(x)<=a); 00068 } 00069 }; 00070 00071 template <typename T> 00072 struct Functor_Selection_Tuple_Greater : public thrust::unary_function<thrust::tuple<T,unsigned int>&,bool> 00073 { 00074 const T a; 00075 00076 Functor_Selection_Tuple_Greater(T _a) : a(_a) {} 00077 00078 __host__ __device__ 00079 bool operator()(const thrust::tuple<T,unsigned int>& x) const 00080 { 00081 return (thrust::get<0>(x)>a); 00082 } 00083 }; 00084 00085 template <typename T> 00086 struct Functor_Selection_Tuple_Greater_Equal : public thrust::unary_function<thrust::tuple<T,unsigned int>&,bool> 00087 { 00088 const T a; 00089 00090 Functor_Selection_Tuple_Greater_Equal(T _a) : a(_a) {} 00091 00092 __host__ __device__ 00093 bool operator()(const thrust::tuple<T,unsigned int>& x) const 00094 { 00095 return (thrust::get<0>(x)>=a); 00096 } 00097 }; 00098 00099 template <typename T> 00100 struct Functor_Tuple_to_TID : public thrust::unary_function<thrust::tuple<T,unsigned int>&,unsigned int> 00101 { 00102 __host__ __device__ 00103 unsigned int operator()(const thrust::tuple<T,unsigned int>& x) const 00104 { 00105 return thrust::get<1>(x); //return tid 00106 } 00107 }; 00108 00109 }; //end namespace gpu 00110 00111 }; //end namespace CoGaDB 00112