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

Go to the source code of this file.

Functions

template<class T >
T * transfer_vector_of_flat_objects_to_gpu (const std::vector< T > &vec, DeviceAllocator &allocator)
 
template<class T >
T * transfer_flat_object_to_gpu (const T &object, DeviceAllocator &allocator)
 

Function Documentation

template<class T >
T* transfer_flat_object_to_gpu ( const T &  object,
DeviceAllocator allocator 
)

Definition at line 35 of file JoinHashTableGpuUtils.h.

References Allocator::alloc(), DeviceAllocator::copyToDevice(), and omnisci.dtypes::T.

Referenced by RangeJoinHashTable::approximateTupleCount(), OverlapsJoinHashTable::approximateTupleCount(), BaselineJoinHashTable::approximateTupleCount(), anonymous_namespace{OverlapsJoinHashTable.cpp}::compute_bucket_sizes(), and BaselineJoinHashTableBuilder::initHashTableOnGpu().

35  {
36  static_assert(std::is_standard_layout<T>::value,
37  "Transferring an object to GPU only works for standard layout elements");
38  const auto bytes = sizeof(T);
39  auto gpu_ptr = allocator.alloc(bytes);
40  allocator.copyToDevice(gpu_ptr, reinterpret_cast<const int8_t*>(&object), bytes);
41  return reinterpret_cast<T*>(gpu_ptr);
42 }
virtual int8_t * alloc(const size_t num_bytes)=0
virtual void copyToDevice(void *device_dst, const void *host_src, const size_t num_bytes) const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
T* transfer_vector_of_flat_objects_to_gpu ( const std::vector< T > &  vec,
DeviceAllocator allocator 
)

Definition at line 24 of file JoinHashTableGpuUtils.h.

References Allocator::alloc(), DeviceAllocator::copyToDevice(), and omnisci.dtypes::T.

Referenced by RangeJoinHashTable::approximateTupleCount(), OverlapsJoinHashTable::approximateTupleCount(), BaselineJoinHashTable::approximateTupleCount(), anonymous_namespace{OverlapsJoinHashTable.cpp}::compute_bucket_sizes(), and BaselineJoinHashTable::initHashTableForDevice().

25  {
26  static_assert(std::is_trivially_copyable<T>::value && std::is_standard_layout<T>::value,
27  "Transferring a vector to GPU only works for flat object elements");
28  const auto vec_bytes = vec.size() * sizeof(T);
29  auto gpu_vec = allocator.alloc(vec_bytes);
30  allocator.copyToDevice(gpu_vec, reinterpret_cast<const int8_t*>(vec.data()), vec_bytes);
31  return reinterpret_cast<T*>(gpu_vec);
32 }
virtual int8_t * alloc(const size_t num_bytes)=0
virtual void copyToDevice(void *device_dst, const void *host_src, const size_t num_bytes) const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function: