OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 232 of file OverlapsJoinHashTable.cpp.

Member Enumeration Documentation

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

Definition at line 249 of file OverlapsJoinHashTable.cpp.

249 { 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 233 of file OverlapsJoinHashTable.cpp.

238  , 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 263 of file OverlapsJoinHashTable.cpp.

References CHECK, UNREACHABLE, and VLOG.

263  {
265  crt_props = new_props;
266  crt_step++;
267 
269  if (hashTableTooBig()) {
270  VLOG(1) << "Reached hash table size limit: " << overlaps_max_table_size_bytes
271  << " with " << crt_props.hash_table_size << " byte hash table, "
272  << crt_props.keys_per_bin << " keys per bin.";
273  } else if (keysPerBinIncreasing()) {
274  VLOG(1) << "Keys per bin increasing from " << prev_props.keys_per_bin << " to "
277  }
278  if (previousIterationValid()) {
279  VLOG(1) << "Using previous threshold value " << chosen_overlaps_threshold;
281  return false;
282  } else {
285  chosen_overlaps_threshold = new_overlaps_threshold;
286 
288  VLOG(1) << "Hit maximum number (" << max_reverse_search_iterations
289  << ") of reverse tuning iterations. Aborting tuning";
290  // use the crt props, but don't bother trying to tune any farther
291  return false;
292  }
293 
296  // hash table size is not changing, bail
297  VLOG(1) << "Hash table size not decreasing (" << crt_props.hash_table_size
298  << " bytes) and still above maximum allowed size ("
299  << overlaps_max_table_size_bytes << " bytes). Aborting tuning";
300  return false;
301  }
302 
303  // if the hash table is too big on the very first step, change direction towards
304  // larger bins to see if a slightly smaller hash table will fit
305  if (crt_step == 1 && crt_reverse_search_iteration == 1) {
306  VLOG(1)
307  << "First iteration of overlaps tuning led to hash table size over "
308  "limit. Reversing search to try larger bin sizes (previous threshold: "
309  << chosen_overlaps_threshold << ")";
310  // Need to change direction of tuning to tune "up" towards larger bins
311  tuning_direction = TuningDirection::LARGER;
312  }
313  return true;
314  }
315  UNREACHABLE();
316  }
317 
318  chosen_overlaps_threshold = new_overlaps_threshold;
319 
320  if (keysPerBinUnderThreshold()) {
321  VLOG(1) << "Hash table reached size " << crt_props.hash_table_size
322  << " with keys per bin " << crt_props.keys_per_bin << " under threshold "
323  << overlaps_target_entries_per_bin << ". Terminating bucket size loop.";
324  return false;
325  }
326 
328  // We always take the first tuning iteration that succeeds when reversing
329  // direction, as if we're here we haven't had a successful iteration and we're
330  // "backtracking" our search by making bin sizes larger
331  VLOG(1) << "On reverse (larger tuning direction) search found workable "
332  << " hash table size of " << crt_props.hash_table_size
333  << " with keys per bin " << crt_props.keys_per_bin
334  << ". Terminating bucket size loop.";
335  return false;
336  }
337 
338  return true;
339  }
#define UNREACHABLE()
Definition: Logger.h:247
#define CHECK(condition)
Definition: Logger.h:203
#define VLOG(n)
Definition: Logger.h:297
bool anonymous_namespace{OverlapsJoinHashTable.cpp}::TuningState::previousIterationValid ( ) const
inline

Member Data Documentation

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

Definition at line 248 of file OverlapsJoinHashTable.cpp.

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

Definition at line 244 of file OverlapsJoinHashTable.cpp.

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

Definition at line 254 of file OverlapsJoinHashTable.cpp.

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

Definition at line 253 of file OverlapsJoinHashTable.cpp.

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

Definition at line 257 of file OverlapsJoinHashTable.cpp.

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

Definition at line 255 of file OverlapsJoinHashTable.cpp.

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

Definition at line 256 of file OverlapsJoinHashTable.cpp.

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

Definition at line 245 of file OverlapsJoinHashTable.cpp.


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