OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SharedKernelContext Class Reference

#include <ExecutionKernel.h>

+ Collaboration diagram for SharedKernelContext:

Public Member Functions

 SharedKernelContext (const std::vector< InputTableInfo > &query_infos)
 
const std::vector< uint64_t > & getFragOffsets ()
 
void addDeviceResults (ResultSetPtr &&device_results, std::vector< size_t > outer_table_fragment_ids)
 
std::vector< std::pair
< ResultSetPtr, std::vector
< size_t > > > & 
getFragmentResults ()
 
const std::vector
< InputTableInfo > & 
getQueryInfos () const
 
void setNumAllocatedThreads (size_t num_threads)
 
size_t getNumAllocatedThreads ()
 

Public Attributes

std::atomic_flag dynamic_watchdog_set = ATOMIC_FLAG_INIT
 

Private Attributes

std::mutex reduce_mutex_
 
std::vector< std::pair
< ResultSetPtr, std::vector
< size_t > > > 
all_fragment_results_
 
std::vector< uint64_t > all_frag_row_offsets_
 
std::mutex all_frag_row_offsets_mutex_
 
const std::vector
< InputTableInfo > & 
query_infos_
 
const RegisteredQueryHint query_hint_
 
size_t num_allocated_threads_ {1}
 

Detailed Description

Definition at line 29 of file ExecutionKernel.h.

Constructor & Destructor Documentation

SharedKernelContext::SharedKernelContext ( const std::vector< InputTableInfo > &  query_infos)
inline

Definition at line 31 of file ExecutionKernel.h.

32  : query_infos_(query_infos)
33 #ifdef HAVE_TBB
34  , task_group_(nullptr)
35 #endif
36  {
37  }
const std::vector< InputTableInfo > & query_infos_

Member Function Documentation

void SharedKernelContext::addDeviceResults ( ResultSetPtr &&  device_results,
std::vector< size_t >  outer_table_fragment_ids 
)

Definition at line 115 of file ExecutionKernel.cpp.

References all_fragment_results_, anonymous_namespace{ExecutionKernel.cpp}::needs_skip_result(), and reduce_mutex_.

Referenced by Executor::launchKernelsImpl(), and ExecutionKernel::runImpl().

116  {
117  std::lock_guard<std::mutex> lock(reduce_mutex_);
118  if (!needs_skip_result(device_results)) {
119  all_fragment_results_.emplace_back(std::move(device_results),
120  outer_table_fragment_ids);
121  }
122 }
bool needs_skip_result(const ResultSetPtr &res)
std::vector< std::pair< ResultSetPtr, std::vector< size_t > > > all_fragment_results_
std::mutex reduce_mutex_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< std::pair< ResultSetPtr, std::vector< size_t > > > & SharedKernelContext::getFragmentResults ( )

Definition at line 125 of file ExecutionKernel.cpp.

References all_fragment_results_.

Referenced by Executor::collectAllDeviceResults(), Executor::collectAllDeviceShardedTopResults(), Executor::executeUpdate(), Executor::executeWorkUnitImpl(), Executor::executeWorkUnitPerFragment(), and Executor::resultsUnion().

125  {
126  return all_fragment_results_;
127 }
std::vector< std::pair< ResultSetPtr, std::vector< size_t > > > all_fragment_results_

+ Here is the caller graph for this function:

const std::vector< uint64_t > & SharedKernelContext::getFragOffsets ( )

Definition at line 102 of file ExecutionKernel.cpp.

References all_frag_row_offsets_, all_frag_row_offsets_mutex_, and query_infos_.

Referenced by Executor::createKernels(), Executor::executeUpdate(), and ExecutionKernel::runImpl().

102  {
103  std::lock_guard<std::mutex> lock(all_frag_row_offsets_mutex_);
104  if (all_frag_row_offsets_.empty()) {
105  all_frag_row_offsets_.resize(query_infos_.front().info.fragments.size() + 1);
106  for (size_t i = 1; i <= query_infos_.front().info.fragments.size(); ++i) {
108  all_frag_row_offsets_[i - 1] +
109  query_infos_.front().info.fragments[i - 1].getNumTuples();
110  }
111  }
112  return all_frag_row_offsets_;
113 }
std::vector< uint64_t > all_frag_row_offsets_
std::mutex all_frag_row_offsets_mutex_
const std::vector< InputTableInfo > & query_infos_

+ Here is the caller graph for this function:

size_t SharedKernelContext::getNumAllocatedThreads ( )
inline

Definition at line 54 of file ExecutionKernel.h.

References num_allocated_threads_.

Referenced by anonymous_namespace{ExecutionKernel.cpp}::get_available_cpu_threads_per_task().

54  {
56  }

+ Here is the caller graph for this function:

const std::vector<InputTableInfo>& SharedKernelContext::getQueryInfos ( ) const
inline

Definition at line 46 of file ExecutionKernel.h.

References query_infos_.

Referenced by Executor::launchKernelsViaResourceMgr(), and ExecutionKernel::runImpl().

46  {
47  return query_infos_;
48  }
const std::vector< InputTableInfo > & query_infos_

+ Here is the caller graph for this function:

void SharedKernelContext::setNumAllocatedThreads ( size_t  num_threads)
inline

Definition at line 50 of file ExecutionKernel.h.

References num_allocated_threads_.

Referenced by Executor::launchKernelsImpl().

50  {
51  num_allocated_threads_ = num_threads;
52  }

+ Here is the caller graph for this function:

Member Data Documentation

std::vector<uint64_t> SharedKernelContext::all_frag_row_offsets_
private

Definition at line 76 of file ExecutionKernel.h.

Referenced by getFragOffsets().

std::mutex SharedKernelContext::all_frag_row_offsets_mutex_
private

Definition at line 77 of file ExecutionKernel.h.

Referenced by getFragOffsets().

std::vector<std::pair<ResultSetPtr, std::vector<size_t> > > SharedKernelContext::all_fragment_results_
private

Definition at line 74 of file ExecutionKernel.h.

Referenced by addDeviceResults(), and getFragmentResults().

std::atomic_flag SharedKernelContext::dynamic_watchdog_set = ATOMIC_FLAG_INIT

Definition at line 58 of file ExecutionKernel.h.

Referenced by ExecutionKernel::runImpl().

size_t SharedKernelContext::num_allocated_threads_ {1}
private

Definition at line 83 of file ExecutionKernel.h.

Referenced by getNumAllocatedThreads(), and setNumAllocatedThreads().

const RegisteredQueryHint SharedKernelContext::query_hint_
private

Definition at line 79 of file ExecutionKernel.h.

const std::vector<InputTableInfo>& SharedKernelContext::query_infos_
private

Definition at line 78 of file ExecutionKernel.h.

Referenced by getFragOffsets(), and getQueryInfos().

std::mutex SharedKernelContext::reduce_mutex_
private

Definition at line 73 of file ExecutionKernel.h.

Referenced by addDeviceResults().


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