OmniSciDB  c1a53651b2
 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
 
TuningDirection tuning_direction {TuningDirection::SMALLER}
 
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 253 of file OverlapsJoinHashTable.cpp.

Member Enumeration Documentation

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

Definition at line 270 of file OverlapsJoinHashTable.cpp.

270 { 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 254 of file OverlapsJoinHashTable.cpp.

259  , 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 284 of file OverlapsJoinHashTable.cpp.

References CHECK, UNREACHABLE, and VLOG.

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

Member Data Documentation

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

Definition at line 269 of file OverlapsJoinHashTable.cpp.

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

Definition at line 265 of file OverlapsJoinHashTable.cpp.

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

Definition at line 275 of file OverlapsJoinHashTable.cpp.

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

Definition at line 274 of file OverlapsJoinHashTable.cpp.

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

Definition at line 278 of file OverlapsJoinHashTable.cpp.

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

Definition at line 276 of file OverlapsJoinHashTable.cpp.

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

Definition at line 277 of file OverlapsJoinHashTable.cpp.

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

Definition at line 266 of file OverlapsJoinHashTable.cpp.

TuningDirection anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::tuning_direction {TuningDirection::SMALLER}

Definition at line 271 of file OverlapsJoinHashTable.cpp.


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