OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner Class Reference
+ Collaboration diagram for anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner:

Public Member Functions

 BucketSizeTuner (const double bucket_threshold, const double step, const double min_threshold, const Data_Namespace::MemoryLevel effective_memory_level, const std::vector< ColumnsForDevice > &columns_per_device, const std::vector< InnerOuter > &inner_outer_pairs, const size_t table_tuple_count, const Executor *executor)
 
bool tuneOneStep ()
 
bool tuneOneStep (const TuningState::TuningDirection tuning_direction)
 
bool tuneOneStep (const TuningState::TuningDirection tuning_direction, const double step_overide)
 
auto getMinBucketSize () const
 
std::vector< double > getInverseBucketSizes ()
 

Private Member Functions

bool bucketThresholdsBelowMinThreshold () const
 
std::vector< double > computeBucketSizes () const
 
bool tuneSmallerOneStep (const double step_overide)
 
bool tuneLargerOneStep (const double step_overide)
 

Private Attributes

size_t num_dims_
 
std::vector< double > bucket_thresholds_
 
size_t num_steps_ {0}
 
const double step_
 
const double min_threshold_
 
const Data_Namespace::MemoryLevel effective_memory_level_
 
const std::vector
< ColumnsForDevice > & 
columns_per_device_
 
const std::vector< InnerOuter > & inner_outer_pairs_
 
const size_t table_tuple_count_
 
const Executorexecutor_
 
std::vector< double > current_bucket_sizes_
 

Friends

std::ostream & operator<< (std::ostream &os, const BucketSizeTuner &tuner)
 

Detailed Description

Definition at line 386 of file OverlapsJoinHashTable.cpp.

Constructor & Destructor Documentation

anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::BucketSizeTuner ( const double  bucket_threshold,
const double  step,
const double  min_threshold,
const Data_Namespace::MemoryLevel  effective_memory_level,
const std::vector< ColumnsForDevice > &  columns_per_device,
const std::vector< InnerOuter > &  inner_outer_pairs,
const size_t  table_tuple_count,
const Executor executor 
)
inline

Definition at line 388 of file OverlapsJoinHashTable.cpp.

References CHECK.

396  : num_dims_(2) // Todo: allow varying number of dims
397  , bucket_thresholds_(/*count=*/num_dims_, /*value=*/bucket_threshold)
398  , step_(step)
399  , min_threshold_(min_threshold)
400  , effective_memory_level_(effective_memory_level)
401  , columns_per_device_(columns_per_device)
402  , inner_outer_pairs_(inner_outer_pairs)
403  , table_tuple_count_(table_tuple_count)
404  , executor_(executor) {
405  CHECK(!columns_per_device_.empty());
406  }
#define CHECK(condition)
Definition: Logger.h:209

Member Function Documentation

bool anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::bucketThresholdsBelowMinThreshold ( ) const
inlineprivate

Definition at line 449 of file OverlapsJoinHashTable.cpp.

References t.

449  {
450  for (const auto& t : bucket_thresholds_) {
451  if (t < min_threshold_) {
452  return true;
453  }
454  }
455  return false;
456  }
char * t
std::vector<double> anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::computeBucketSizes ( ) const
inlineprivate

Definition at line 458 of file OverlapsJoinHashTable.cpp.

References anonymous_namespace{OverlapsJoinHashTable.cpp}::compute_bucket_sizes().

458  {
459  if (table_tuple_count_ == 0) {
460  return std::vector<double>(/*count=*/num_dims_, /*val=*/0);
461  }
464  columns_per_device_.front().join_columns[0],
465  columns_per_device_.front().join_column_types[0],
467  executor_);
468  }
std::vector< double > compute_bucket_sizes(const std::vector< double > &bucket_thresholds, const Data_Namespace::MemoryLevel effective_memory_level, const JoinColumn &join_column, const JoinColumnTypeInfo &join_column_type, const std::vector< InnerOuter > &inner_outer_pairs, const Executor *executor)

+ Here is the call graph for this function:

std::vector<double> anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::getInverseBucketSizes ( )
inline

Method to retrieve inverted bucket sizes, which are what are used elsewhere in the OverlapsHashTable framework

Returns
the inverted bucket sizes, i.e. a set of that will place a raw value in a bucket when multiplied by the raw value

Definition at line 435 of file OverlapsJoinHashTable.cpp.

References CHECK_EQ.

435  {
436  if (num_steps_ == 0) {
437  CHECK_EQ(current_bucket_sizes_.size(), static_cast<size_t>(0));
439  }
441  std::vector<double> inverse_bucket_sizes;
442  for (const auto s : current_bucket_sizes_) {
443  inverse_bucket_sizes.emplace_back(1.0 / s);
444  }
445  return inverse_bucket_sizes;
446  }
#define CHECK_EQ(x, y)
Definition: Logger.h:217
auto anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::getMinBucketSize ( ) const
inline

Definition at line 425 of file OverlapsJoinHashTable.cpp.

425  {
426  return *std::min_element(bucket_thresholds_.begin(), bucket_thresholds_.end());
427  }
bool anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::tuneLargerOneStep ( const double  step_overide)
inlineprivate

Definition at line 494 of file OverlapsJoinHashTable.cpp.

References CHECK_EQ, and t.

494  {
495  if (!current_bucket_sizes_.empty()) {
498  }
499  // If current_bucket_sizes was empty, we will start from our initial threshold
500  for (auto& t : bucket_thresholds_) {
501  t *= step_overide;
502  }
503  // When tuning up, do not dynamically compute bucket_sizes, as compute_bucket_sizes as
504  // written will pick the largest bin size below the threshold, meaning our bucket_size
505  // will never increase beyond the size of the largest polygon. This could mean that we
506  // can never make the bucket sizes large enough to get our hash table below the
507  // maximum size Possible todo: enable templated version of compute_bucket_sizes that
508  // allows for optionally finding smallest extent above threshold, to mirror default
509  // behavior finding largest extent below threshold, and use former variant here
511  num_steps_++;
512  return true;
513  }
#define CHECK_EQ(x, y)
Definition: Logger.h:217
char * t
bool anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::tuneOneStep ( )
inline

Definition at line 408 of file OverlapsJoinHashTable.cpp.

References tuneOneStep().

Referenced by tuneOneStep().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::tuneOneStep ( const TuningState::TuningDirection  tuning_direction)
inline
bool anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::tuneOneStep ( const TuningState::TuningDirection  tuning_direction,
const double  step_overide 
)
inline

Definition at line 414 of file OverlapsJoinHashTable.cpp.

bool anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::tuneSmallerOneStep ( const double  step_overide)
inlineprivate

Definition at line 470 of file OverlapsJoinHashTable.cpp.

References CHECK_EQ, t, and VLOG.

470  {
471  if (!current_bucket_sizes_.empty()) {
474  for (auto& t : bucket_thresholds_) {
475  t /= step_overide;
476  }
477  }
479  VLOG(1) << "Aborting overlaps tuning as at least one bucket size is below min "
480  "threshold";
481  return false;
482  }
483  const auto next_bucket_sizes = computeBucketSizes();
484  if (next_bucket_sizes == current_bucket_sizes_) {
485  VLOG(1) << "Aborting overlaps tuning as bucket size is no longer changing.";
486  return false;
487  }
488 
489  current_bucket_sizes_ = next_bucket_sizes;
490  num_steps_++;
491  return true;
492  }
#define CHECK_EQ(x, y)
Definition: Logger.h:217
char * t
#define VLOG(n)
Definition: Logger.h:303

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const BucketSizeTuner tuner 
)
friend

Definition at line 531 of file OverlapsJoinHashTable.cpp.

531  {
532  os << "Step Num: " << tuner.num_steps_ << ", Threshold: " << std::fixed << "("
533  << tuner.bucket_thresholds_[0] << ", " << tuner.bucket_thresholds_[1] << ")"
534  << ", Step Size: " << std::fixed << tuner.step_ << ", Min: " << std::fixed
535  << tuner.min_threshold_;
536  return os;
537 }

Member Data Documentation

std::vector<double> anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::bucket_thresholds_
private
const std::vector<ColumnsForDevice>& anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::columns_per_device_
private

Definition at line 521 of file OverlapsJoinHashTable.cpp.

std::vector<double> anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::current_bucket_sizes_
private

Definition at line 526 of file OverlapsJoinHashTable.cpp.

const Data_Namespace::MemoryLevel anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::effective_memory_level_
private

Definition at line 520 of file OverlapsJoinHashTable.cpp.

const Executor* anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::executor_
private

Definition at line 524 of file OverlapsJoinHashTable.cpp.

const std::vector<InnerOuter>& anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::inner_outer_pairs_
private

Definition at line 522 of file OverlapsJoinHashTable.cpp.

const double anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::min_threshold_
private
size_t anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::num_dims_
private

Definition at line 515 of file OverlapsJoinHashTable.cpp.

size_t anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::num_steps_ {0}
private
const double anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::step_
private
const size_t anonymous_namespace{OverlapsJoinHashTable.cpp}::BucketSizeTuner::table_tuple_count_
private

Definition at line 523 of file OverlapsJoinHashTable.cpp.


The documentation for this class was generated from the following file: