OmniSciDB  085a039ca4
 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 254 of file OverlapsJoinHashTable.cpp.

Member Enumeration Documentation

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

Definition at line 271 of file OverlapsJoinHashTable.cpp.

271 { 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 255 of file OverlapsJoinHashTable.cpp.

260  , 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 285 of file OverlapsJoinHashTable.cpp.

References CHECK, UNREACHABLE, and VLOG.

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

Member Data Documentation

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

Definition at line 270 of file OverlapsJoinHashTable.cpp.

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

Definition at line 266 of file OverlapsJoinHashTable.cpp.

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

Definition at line 276 of file OverlapsJoinHashTable.cpp.

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

Definition at line 275 of file OverlapsJoinHashTable.cpp.

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

Definition at line 279 of file OverlapsJoinHashTable.cpp.

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

Definition at line 277 of file OverlapsJoinHashTable.cpp.

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

Definition at line 278 of file OverlapsJoinHashTable.cpp.

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

Definition at line 267 of file OverlapsJoinHashTable.cpp.


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