OmniSciDB  1dac507f6e
 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_pod_vector_to_gpu (const std::vector< T > &vec, ThrustAllocator &allocator)
 
template<class T >
T * transfer_object_to_gpu (const T &object, ThrustAllocator &allocator)
 

Function Documentation

template<class T >
T* transfer_object_to_gpu ( const T &  object,
ThrustAllocator allocator 
)

Definition at line 38 of file JoinHashTableGpuUtils.h.

References ThrustAllocator::allocateScopedBuffer(), copy_to_gpu(), ThrustAllocator::getDataMgr(), and ThrustAllocator::getDeviceId().

Referenced by OverlapsJoinHashTable::approximateTupleCount(), BaselineJoinHashTable::approximateTupleCount(), OverlapsJoinHashTable::computeBucketSizes(), OverlapsJoinHashTable::initHashTableOnGpu(), and BaselineJoinHashTable::initHashTableOnGpu().

38  {
39  static_assert(std::is_standard_layout<T>::value,
40  "Transferring an object to GPU only works for standard layout elements");
41  const auto bytes = sizeof(T);
42  auto gpu_ptr = allocator.allocateScopedBuffer(bytes);
43  copy_to_gpu(allocator.getDataMgr(),
44  reinterpret_cast<CUdeviceptr>(gpu_ptr),
45  &object,
46  bytes,
47  allocator.getDeviceId());
48  return reinterpret_cast<T*>(gpu_ptr);
49 }
int getDeviceId() const
unsigned long long CUdeviceptr
Definition: nocuda.h:27
Data_Namespace::DataMgr * getDataMgr() const
int8_t * allocateScopedBuffer(std::ptrdiff_t num_bytes)
void copy_to_gpu(Data_Namespace::DataMgr *data_mgr, CUdeviceptr dst, const void *src, const size_t num_bytes, const int device_id)
Definition: GpuMemUtils.cpp:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 24 of file JoinHashTableGpuUtils.h.

References ThrustAllocator::allocateScopedBuffer(), copy_to_gpu(), ThrustAllocator::getDataMgr(), and ThrustAllocator::getDeviceId().

Referenced by OverlapsJoinHashTable::approximateTupleCount(), BaselineJoinHashTable::approximateTupleCount(), OverlapsJoinHashTable::computeBucketSizes(), OverlapsJoinHashTable::initHashTableOnGpu(), and BaselineJoinHashTable::initHashTableOnGpu().

24  {
25  static_assert(std::is_pod<T>::value,
26  "Transferring a vector to GPU only works for POD elements");
27  const auto vec_bytes = vec.size() * sizeof(T);
28  auto gpu_vec = allocator.allocateScopedBuffer(vec_bytes);
29  copy_to_gpu(allocator.getDataMgr(),
30  reinterpret_cast<CUdeviceptr>(gpu_vec),
31  &vec[0],
32  vec_bytes,
33  allocator.getDeviceId());
34  return reinterpret_cast<T*>(gpu_vec);
35 }
int getDeviceId() const
unsigned long long CUdeviceptr
Definition: nocuda.h:27
Data_Namespace::DataMgr * getDataMgr() const
int8_t * allocateScopedBuffer(std::ptrdiff_t num_bytes)
void copy_to_gpu(Data_Namespace::DataMgr *data_mgr, CUdeviceptr dst, const void *src, const size_t num_bytes, const int device_id)
Definition: GpuMemUtils.cpp:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function: