OmniSciDB  340b00dbf6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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, CudaAllocator &allocator)
 
template<class T >
T * transfer_flat_object_to_gpu (const T &object, CudaAllocator &allocator)
 

Function Documentation

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

Definition at line 35 of file JoinHashTableGpuUtils.h.

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

Referenced by OverlapsJoinHashTable::approximateTupleCount(), BaselineJoinHashTable::approximateTupleCount(), OverlapsJoinHashTable::computeBucketSizes(), 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 }
void copyToDevice(int8_t *device_dst, const int8_t *host_src, const size_t num_bytes) const override
int8_t * alloc(const size_t num_bytes) override

+ 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,
CudaAllocator allocator 
)

Definition at line 24 of file JoinHashTableGpuUtils.h.

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

Referenced by OverlapsJoinHashTable::approximateTupleCount(), BaselineJoinHashTable::approximateTupleCount(), OverlapsJoinHashTable::computeBucketSizes(), OverlapsJoinHashTable::initHashTableForDevice(), 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 }
void copyToDevice(int8_t *device_dst, const int8_t *host_src, const size_t num_bytes) const override
int8_t * alloc(const size_t num_bytes) override

+ Here is the call graph for this function:

+ Here is the caller graph for this function: