44 "[DefaultHash] Only support keys whose byte size is " 45 "multiples of sizeof(int)");
50 uint64_t hash = UINT64_C(14695981039346656037);
52 auto cast_key_ptr =
static_cast<const int*
>(key_ptr);
54 hash ^= cast_key_ptr[i];
55 hash *= UINT64_C(1099511628211);
72 if (lhs ==
nullptr || rhs ==
nullptr) {
76 auto lhs_key_ptr =
static_cast<const int*
>(lhs);
77 auto rhs_key_ptr =
static_cast<const int*
>(rhs);
81 is_eq = is_eq && (lhs_key_ptr[i] == rhs_key_ptr[i]);
90 template <
typename Hash,
typename KeyEq>
99 : bucket_count_(init_buckets),
100 capacity_(init_capacity),
101 dsize_key_(dsize_key),
102 dsize_value_(dsize_value),
112 virtual void Rehash(
size_t buckets) = 0;
115 virtual void Insert(
const void* input_keys,
116 const void* input_values,
124 virtual void Activate(
const void* input_keys,
130 virtual void Find(
const void* input_keys,
136 virtual void Erase(
const void* input_keys,
141 virtual size_t GetIterators(
iterator_t* output_iterators) = 0;
144 virtual void UnpackIterators(
const iterator_t* input_iterators,
145 const bool* input_masks,
151 virtual void AssignIterators(
iterator_t* input_iterators,
152 const bool* input_masks,
153 const void* input_values,
156 virtual size_t Size()
const = 0;
160 virtual std::vector<size_t> BucketSizes()
const = 0;
163 virtual float LoadFactor()
const = 0;
179 return float(capacity_) /
float(bucket_count_);
195 size_t init_capacity,
202 size_t init_capacity,
209 size_t init_capacity,
std::shared_ptr< DefaultDeviceHashmap > CreateDefaultDeviceHashmap(size_t init_buckets, size_t init_capacity, size_t dsize_key, size_t dsize_value, const Device &device)
Definition: DeviceHashmap.cpp:43
Definition: DeviceHashmap.h:63
bool OPEN3D_HOST_DEVICE operator()(const void *lhs, const void *rhs) const
Definition: DeviceHashmap.h:71
float avg_capacity_bucket_ratio()
Definition: DeviceHashmap.h:178
void LogError(const char *format, const Args &... args)
Definition: Console.h:176
size_t key_size_in_int_
Definition: DeviceHashmap.h:86
size_t bucket_count_
Definition: DeviceHashmap.h:172
int GetCapacity() const
Definition: DeviceHashmap.h:166
std::shared_ptr< DefaultDeviceHashmap > CreateDefaultCPUHashmap(size_t init_buckets, size_t init_capacity, size_t dsize_key, size_t dsize_value, const Device &device)
Non-templated factory.
Definition: DefaultHashmapCPU.cpp:33
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample uint64_t
Definition: K4aPlugin.cpp:349
Base class: shared interface.
Definition: DeviceHashmap.h:91
int GetBucketCount() const
Definition: DeviceHashmap.h:165
Definition: DeviceHashmap.h:35
#define OPEN3D_HOST_DEVICE
Definition: CUDAUtils.h:54
size_t capacity_
Definition: DeviceHashmap.h:173
std::shared_ptr< DefaultDeviceHashmap > CreateDefaultCUDAHashmap(size_t init_buckets, size_t init_capacity, size_t dsize_key, size_t dsize_value, const Device &device)
uint64_t OPEN3D_HOST_DEVICE operator()(const void *key_ptr) const
Definition: DeviceHashmap.h:49
Device GetDevice() const
Definition: DeviceHashmap.h:169
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c int
Definition: K4aPlugin.cpp:476
int count
Definition: FilePCD.cpp:61
DefaultHash()
Definition: DeviceHashmap.h:40
DefaultHash(size_t key_size)
Definition: DeviceHashmap.h:41
DeviceHashmap< DefaultHash, DefaultKeyEq > DefaultDeviceHashmap
Definition: DeviceHashmap.h:191
Device device_
Definition: DeviceHashmap.h:176
Definition: PinholeCameraIntrinsic.cpp:35
DefaultKeyEq()
Definition: DeviceHashmap.h:68
int GetValueBytesize() const
Definition: DeviceHashmap.h:168
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle float
Definition: K4aPlugin.cpp:462
DeviceHashmap(size_t init_buckets, size_t init_capacity, size_t dsize_key, size_t dsize_value, const Device &device)
Comprehensive constructor for the developer.
Definition: DeviceHashmap.h:94
virtual ~DeviceHashmap()
Definition: DeviceHashmap.h:104
size_t key_size_in_int_
Definition: DeviceHashmap.h:60
size_t dsize_key_
Definition: DeviceHashmap.h:174
DefaultKeyEq(size_t key_size)
Definition: DeviceHashmap.h:69
size_t dsize_value_
Definition: DeviceHashmap.h:175
int GetKeyBytesize() const
Definition: DeviceHashmap.h:167