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

Public Types

enum  TuningDirection { TuningDirection::SMALLER, TuningDirection::LARGER }
 

Public Member Functions

 TuningState (const size_t overlaps_max_table_size_bytes, const double overlaps_target_entries_per_bin)
 
bool operator() (const HashTableProps &new_props, const bool new_overlaps_threshold)
 
bool hashTableTooBig () const
 
bool keysPerBinIncreasing () const
 
bool previousIterationValid () const
 
bool keysPerBinUnderThreshold () const
 

Public Attributes

HashTableProps crt_props
 
HashTableProps prev_props
 
double chosen_overlaps_threshold
 
size_t crt_step
 
size_t crt_reverse_search_iteration
 
size_t overlaps_max_table_size_bytes
 
double overlaps_target_entries_per_bin
 
const size_t max_reverse_search_iterations {8}
 

Detailed Description

Definition at line 260 of file OverlapsJoinHashTable.cpp.

Member Enumeration Documentation

enum anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::TuningDirection
strong
Enumerator
SMALLER 
LARGER 

Definition at line 277 of file OverlapsJoinHashTable.cpp.

277 { SMALLER, LARGER };

Constructor & Destructor Documentation

anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::TuningState ( const size_t  overlaps_max_table_size_bytes,
const double  overlaps_target_entries_per_bin 
)
inline

Definition at line 261 of file OverlapsJoinHashTable.cpp.

266  , crt_step(0)

Member Function Documentation

bool anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::hashTableTooBig ( ) const
inline
bool anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::keysPerBinIncreasing ( ) const
inline
bool anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::keysPerBinUnderThreshold ( ) const
inline
bool anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::operator() ( const HashTableProps new_props,
const bool  new_overlaps_threshold 
)
inline

Returns true to continue tuning, false to end the loop with the above overlaps threshold

Definition at line 291 of file OverlapsJoinHashTable.cpp.

References CHECK, UNREACHABLE, and VLOG.

291  {
293  crt_props = new_props;
294  crt_step++;
295 
297  if (hashTableTooBig()) {
298  VLOG(1) << "Reached hash table size limit: " << overlaps_max_table_size_bytes
299  << " with " << crt_props.hash_table_size << " byte hash table, "
300  << crt_props.keys_per_bin << " keys per bin.";
301  } else if (keysPerBinIncreasing()) {
302  VLOG(1) << "Keys per bin increasing from " << prev_props.keys_per_bin << " to "
305  }
306  if (previousIterationValid()) {
307  VLOG(1) << "Using previous threshold value " << chosen_overlaps_threshold;
309  return false;
310  } else {
313  chosen_overlaps_threshold = new_overlaps_threshold;
314 
316  VLOG(1) << "Hit maximum number (" << max_reverse_search_iterations
317  << ") of reverse tuning iterations. Aborting tuning";
318  // use the crt props, but don't bother trying to tune any farther
319  return false;
320  }
321 
324  // hash table size is not changing, bail
325  VLOG(1) << "Hash table size not decreasing (" << crt_props.hash_table_size
326  << " bytes) and still above maximum allowed size ("
327  << overlaps_max_table_size_bytes << " bytes). Aborting tuning";
328  return false;
329  }
330 
331  // if the hash table is too big on the very first step, change direction towards
332  // larger bins to see if a slightly smaller hash table will fit
333  if (crt_step == 1 && crt_reverse_search_iteration == 1) {
334  VLOG(1)
335  << "First iteration of overlaps tuning led to hash table size over "
336  "limit. Reversing search to try larger bin sizes (previous threshold: "
337  << chosen_overlaps_threshold << ")";
338  // Need to change direction of tuning to tune "up" towards larger bins
339  tuning_direction = TuningDirection::LARGER;
340  }
341  return true;
342  }
343  UNREACHABLE();
344  }
345 
346  chosen_overlaps_threshold = new_overlaps_threshold;
347 
348  if (keysPerBinUnderThreshold()) {
349  VLOG(1) << "Hash table reached size " << crt_props.hash_table_size
350  << " with keys per bin " << crt_props.keys_per_bin << " under threshold "
351  << overlaps_target_entries_per_bin << ". Terminating bucket size loop.";
352  return false;
353  }
354 
356  // We always take the first tuning iteration that succeeds when reversing
357  // direction, as if we're here we haven't had a successful iteration and we're
358  // "backtracking" our search by making bin sizes larger
359  VLOG(1) << "On reverse (larger tuning direction) search found workable "
360  << " hash table size of " << crt_props.hash_table_size
361  << " with keys per bin " << crt_props.keys_per_bin
362  << ". Terminating bucket size loop.";
363  return false;
364  }
365 
366  return true;
367  }
#define UNREACHABLE()
Definition: Logger.h:253
#define CHECK(condition)
Definition: Logger.h:209
#define VLOG(n)
Definition: Logger.h:303
bool anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::previousIterationValid ( ) const
inline

Member Data Documentation

double anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::chosen_overlaps_threshold

Definition at line 276 of file OverlapsJoinHashTable.cpp.

HashTableProps anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::crt_props

Definition at line 272 of file OverlapsJoinHashTable.cpp.

size_t anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::crt_reverse_search_iteration

Definition at line 282 of file OverlapsJoinHashTable.cpp.

size_t anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::crt_step

Definition at line 281 of file OverlapsJoinHashTable.cpp.

const size_t anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::max_reverse_search_iterations {8}

Definition at line 285 of file OverlapsJoinHashTable.cpp.

size_t anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::overlaps_max_table_size_bytes

Definition at line 283 of file OverlapsJoinHashTable.cpp.

double anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::overlaps_target_entries_per_bin

Definition at line 284 of file OverlapsJoinHashTable.cpp.

HashTableProps anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::prev_props

Definition at line 273 of file OverlapsJoinHashTable.cpp.


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