33 std::vector<int64_t> value_dsizes_host =
35 std::vector<int64_t> value_blocks_per_element_host =
37 n_values_ = value_blocks_per_element_host.size();
45 value_dsizes_host.data(),
48 value_blocks_per_element_host.data(),
58 std::vector<uint8_t *> value_ptrs(
n_values_);
60 value_ptrs[i] = value_buffers[i].GetDataPtr<uint8_t>();
61 cudaMemset(value_ptrs[i], 0,
capacity_ * value_dsizes_host[i]);
63 values_ =
static_cast<uint8_t **
>(
85 heap_[index - 1] = ptr;
#define CLOUDVIEWER_CUDA_CHECK(err)
__device__ void DeviceFree(buf_index_t ptr)
__device__ void * GetValuePtr(buf_index_t ptr, int value_idx=0)
__device__ buf_index_t DeviceAllocate()
__host__ void Shutdown(const Device &device)
__device__ void * GetKeyPtr(buf_index_t ptr)
int64_t * value_blocks_per_element_
int64_t common_block_size_
__host__ void Setup(HashBackendBuffer &hashmap_buffer)
int64_t GetKeyDsize() const
Return key's data size in bytes.
Tensor GetKeyBuffer() const
Return the key buffer tensor.
Device GetDevice() const
Return device of the buffer.
std::vector< int64_t > GetValueDsizes() const
Return value's data sizes in bytes.
std::vector< int64_t > GetValueBlocksPerElement() const
Return value's data sizes in the unit of common block size divisor.
int64_t GetCommonBlockSize() const
Get the common block size divisor of all values types.
std::vector< Tensor > GetValueBuffers() const
Return the value buffer tensors.
int64_t GetCapacity() const
Return capacity of the buffer.
Tensor GetIndexHeap() const
Return the index heap tensor.
static void MemcpyFromHost(void *dst_ptr, const Device &dst_device, const void *host_ptr, size_t num_bytes)
Same as Memcpy, but with host (CPU:0) as default src_device.
static void * Malloc(size_t byte_size, const Device &device)
static void Free(void *ptr, const Device &device)
Frees previously allocated memory at address ptr on device device.
Generic file read and write utility for python interface.