OmniSciDB
a5dc49c757
|
Classes | |
struct | ExecutorStats |
Stores current key statistics relating to ExecutorResourceMgr state, particularly around the number of requests in queue and currently executing. More... | |
struct | RequestStats |
Stores info pertaining to a single request made to ExecutorResourceMgr , including its request_id , min and max possible resource grants, actual resource_grant, and various timing stats. More... | |
class | ExecutorResourceMgr |
ExecutorResourceMgr is the central manager for resources available to all executors in the system. It manages an ExecutorResourcePool to keep track of available and allocated resources (currently CPU slots/threads, GPUs, CPU result memory, and CPU and GPU buffer pool memory). It also manages a thread queue which keeps requesting threads (from Executor::launchKernelsViaResourceMgr ) waiting until there it can schedule them. At that point, it gives the calling executor thread a ResourceHandle detailing the resources granted to the query, which once it goes out of scope will return the granted resources to the ExecutorResourcePool. More... | |
class | ExecutorResourceHandle |
A wrapper returned by ExecutorResourceMgr to the requestee, containing the ResourceGrant that was granted. When this class goes out of scope (i.e. the executing thread finishes its query step, the destructor will automatically instruct ExecutorResourceMgr to release the granted resources back to the ExecutorResourcePool . More... | |
class | ExecutorResourceMgrError |
class | QueryTimedOutWaitingInQueue |
class | QueryNeedsTooMuchBufferPoolMem |
class | QueryNeedsTooManyCpuSlots |
class | QueryNeedsTooManyGpuSlots |
class | QueryNeedsTooMuchCpuResultMem |
struct | ResourcePoolInfo |
A container for various stats about the current state of the ExecutorResourcePool . Note that ExecutorResourcePool does not persist a struct of this type, but rather builds one on the fly when ExecutorResourcePool::get_resource_info() is called. More... | |
struct | ResourceGrant |
Specifies the resources of each type for a given resource grant. More... | |
class | ExecutorResourcePool |
ExecutorResourcePool keeps track of available compute and memory resources and can be queried to get the min and max resources grantable (embodied in a ResourceGrant) for a request, given a ResourceRequest. More... | |
class | OutstandingQueueRequests |
Stores and allows access to a binary semaphore per RequestId (using an std::unordered_map ), as well as accessing all outstanding RequestIds for waiting requests. More... | |
union | ResourceGrantSizeInfo |
struct | ResourceGrantPolicy |
Specifies the policy for granting a resource of a specific ResourceSubtype . Note that this policy only pertains to resource grants on an isolated basis, and that grant policy with respect to concurrent requests is controlled by ConcurrentResourceGrantPolicy . More... | |
struct | ConcurrentResourceGrantPolicy |
Specifies the policies for resource grants in the presence of other requests, both under situations of resource undersubscription (i.e there are still resources of the given type in the pool) and oversubscription. More... | |
struct | ChunkRequestInfo |
Specifies all DataMgr chunks needed for a query step/request, along with their sizes in bytes. It also keeps track of other metadata to avoid having to recompute this info, such as total_bytes and a vector of total byte sizes for each kernel. The latter is relevant if bytes_scales_per_kernel is true, as the ExecutorResourceMgr / ExecutorResourcePool can scale back the number of kernels allowed to run simultaneously to ensure that a query step can run. More... | |
struct | ResourceRequest |
Specifies the minimum and maximum quanity either requested or granted for a request of resource_subtype . More... | |
struct | RequestInfo |
A container to store requested and minimum neccessary resource requests across all resource types currently supported by ExecutorResourceMgr /ExecutorResourcePool . It also includes a ChunkRequestInfo struct to denote which DataMgr chunks (with their sizes in bytes) are neccesary for the query. More... | |
Typedefs | |
using | ChunkKey = std::vector< int > |
using | RequestId = size_t |
using | BufferPoolChunkMap = std::map< ChunkKey, std::pair< size_t, size_t >> |
using | ResourceRequestGrant = ResourceRequest |
Alias of ResourceRequest to ResourceRequestGrant to better semantically differentiate between resource requests and resource grants in ExecutorResourcePool More... | |
Enumerations | |
enum | ExecutionRequestStage { QUEUED, EXECUTING } |
enum | ResourceType { ResourceType::CPU_SLOTS = 0, ResourceType::GPU_SLOTS = 1, ResourceType::CPU_RESULT_MEM = 2, ResourceType::GPU_RESULT_MEM = 3, ResourceType::CPU_BUFFER_POOL_MEM = 4, ResourceType::GPU_BUFFER_POOL_MEM = 5, ResourceType::INVALID_TYPE = 6, ResourceType::NUM_RESOURCE_TYPES = 6 } |
Stores the resource type for a ExecutorResourcePool request. More... | |
enum | ResourceSubtype { ResourceSubtype::CPU_SLOTS = 0, ResourceSubtype::GPU_SLOTS = 1, ResourceSubtype::CPU_RESULT_MEM = 2, ResourceSubtype::GPU_RESULT_MEM = 3, ResourceSubtype::PINNED_CPU_BUFFER_POOL_MEM = 4, ResourceSubtype::PAGEABLE_CPU_BUFFER_POOL_MEM = 5, ResourceSubtype::PINNED_GPU_BUFFER_POOL_MEM = 6, ResourceSubtype::PAGEABLE_GPU_BUFFER_POOL_MEM = 7, ResourceSubtype::INVALID_SUBTYPE = 8, ResourceSubtype::NUM_RESOURCE_SUBTYPES = 8 } |
Stores the resource sub-type for a ExecutorResourcePool request. More... | |
enum | ResourceGrantPolicySizeType { UNLIMITED, CONSTANT, RATIO_TO_TOTAL } |
The sizing type for a ResourceGrantPolicy of a given resource type, specifying whether resource grants for a request should be UNLIMITED , CONSTANT , or RATIO_TO_TOTAL (i.e. a ratio of the total available resource). More... | |
enum | ResourceConcurrencyPolicy { ALLOW_CONCURRENT_REQUESTS, ALLOW_SINGLE_REQUEST, ALLOW_SINGLE_REQUEST_GLOBALLY, DISALLOW_REQUESTS } |
Specifies whether grants for a specified resource can be made concurrently (ALLOW_CONCURRENT_REQEUSTS ), can only be made to one request at a time (ALOW_SINGLE_REQUEST ), can be made only if there are no other requests in flight, regardless of type (ALLOW_SINGLE_REQUEST_GLOBALLY ), or are not allowed at all (DISALLOW_REQUESTS ). More... | |
Functions | |
std::shared_ptr < ExecutorResourceMgr > | generate_executor_resource_mgr (const size_t num_cpu_slots, const size_t num_gpu_slots, const size_t cpu_result_mem, const size_t cpu_buffer_pool_mem, const size_t gpu_buffer_pool_mem, const double per_query_max_cpu_slots_ratio, const double per_query_max_cpu_result_mem_ratio, const double per_query_max_pinned_cpu_buffer_pool_mem_ratio, const double per_query_max_pageable_cpu_buffer_pool_mem_ratio, const bool allow_cpu_kernel_concurrency, const bool allow_cpu_gpu_kernel_concurrency, const bool allow_cpu_slot_oversubscription_concurrency, const bool allow_gpu_slot_oversubscription, const bool allow_cpu_result_mem_oversubscription_concurrency, const double max_available_resource_use_ratio) |
Convenience factory-esque method that allows us to use the same logic to generate an ExecutorResourceMgr both internally and for ExecutorResourceMgr tests. More... | |
std::string | resource_type_to_string (const ResourceType resource_type) |
std::string | resource_subtype_to_string (const ResourceSubtype resource_subtype) |
template<typename... Ts> | |
void | debug_print (Ts &&...print_args) |
ResourceType | map_resource_subtype_to_resource_type (const ResourceSubtype resource_subtype) |
Returns the ResourceType associated with a given ResourceSubtype More... | |
std::vector< ResourceSubtype > | map_resource_type_to_resource_subtypes (const ResourceType resource_type) |
Returns the 1-or-more ResourceSubtype s associated with a given ResourceType . More... | |
ResourceGrantPolicy | gen_unlimited_resource_grant_policy (const ResourceSubtype resource_subtype) |
Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::UNLIMITED More... | |
ResourceGrantPolicy | gen_constant_resource_grant_policy (const ResourceSubtype resource_subtype, size_t constant_grant) |
Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::CONSTANT More... | |
ResourceGrantPolicy | gen_ratio_resource_grant_policy (const ResourceSubtype resource_subtype, const double ratio_grant) |
Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::RATIO_TO_TOTAL More... | |
std::string | get_resource_concurrency_policy_string (const ResourceConcurrencyPolicy &resource_concurrency_policy) |
std::string | get_resouce_concurrency_policy_string (const ResourceConcurrencyPolicy &resource_concurrency_policy) |
Variables | |
static constexpr size_t | ResourceTypeSize |
static const char * | ResourceTypeStrings [] |
static constexpr size_t | ResourceSubtypeSize |
static const char * | ResourceSubtypeStrings [] |
const bool | ENABLE_DEBUG_PRINTING {false} |
static std::mutex | debug_print_mutex_ |
using ExecutorResourceMgr_Namespace::BufferPoolChunkMap = typedef std::map<ChunkKey, std::pair<size_t, size_t>> |
Definition at line 196 of file ExecutorResourcePool.h.
using ExecutorResourceMgr_Namespace::ChunkKey = typedef std::vector<int> |
Definition at line 29 of file ExecutorResourceMgrCommon.h.
using ExecutorResourceMgr_Namespace::RequestId = typedef size_t |
Definition at line 30 of file ExecutorResourceMgrCommon.h.
using ExecutorResourceMgr_Namespace::ResourceRequestGrant = typedef ResourceRequest |
Alias of ResourceRequest to ResourceRequestGrant to better semantically differentiate between resource requests and resource grants in ExecutorResourcePool
Definition at line 59 of file ResourceRequest.h.
Specifies whether grants for a specified resource can be made concurrently (ALLOW_CONCURRENT_REQEUSTS
), can only be made to one request at a time (ALOW_SINGLE_REQUEST
), can be made only if there are no other requests in flight, regardless of type (ALLOW_SINGLE_REQUEST_GLOBALLY
), or are not allowed at all (DISALLOW_REQUESTS
).
The policy is qualified with a ResourceType
and whether the resource is under-subscribed or over-subscribed in ConcurrentResourceGrantPolicy
. For example, DISALLOW_REQUESTS
would generally only be used to specify resource oversubscription policy, as if it was used for the under-subscription policy for that resource, the resource could not be used at all.
Enumerator | |
---|---|
ALLOW_CONCURRENT_REQUESTS | |
ALLOW_SINGLE_REQUEST | |
ALLOW_SINGLE_REQUEST_GLOBALLY | |
DISALLOW_REQUESTS |
Definition at line 149 of file ResourceGrantPolicy.h.
The sizing type for a ResourceGrantPolicy
of a given resource type, specifying whether resource grants for a request should be UNLIMITED
, CONSTANT
, or RATIO_TO_TOTAL
(i.e. a ratio of the total available resource).
Enumerator | |
---|---|
UNLIMITED | |
CONSTANT | |
RATIO_TO_TOTAL |
Definition at line 28 of file ResourceGrantPolicy.h.
|
strong |
Stores the resource sub-type for a ExecutorResourcePool request.
ResourceSubtype The concept of a ResourceSubtype needs to be distinguished from ResourceType as certain categories of resource requests, i.e. buffer pool mem, can be further distinguished by whether the memory is pinned or pageable (i.e. input chunks, which can be evicted, are considered pageable, while kernel result memory is considered pinned as it cannot currently be evicted or deleted during a query).
Definition at line 144 of file ExecutorResourceMgrCommon.h.
|
strong |
Stores the resource type for a ExecutorResourcePool request.
ResourceType
Enumerator | |
---|---|
CPU_SLOTS | |
GPU_SLOTS | |
CPU_RESULT_MEM | |
GPU_RESULT_MEM | |
CPU_BUFFER_POOL_MEM | |
GPU_BUFFER_POOL_MEM | |
INVALID_TYPE | |
NUM_RESOURCE_TYPES |
Definition at line 108 of file ExecutorResourceMgrCommon.h.
void ExecutorResourceMgr_Namespace::debug_print | ( | Ts &&... | print_args | ) |
Definition at line 28 of file ExecutorResourcePool.cpp.
References debug_print_mutex_.
Referenced by ExecutorResourceMgr_Namespace::ExecutorResourcePool::add_chunk_requests_to_allocated_pool(), ExecutorResourceMgr_Namespace::ExecutorResourcePool::can_currently_satisfy_chunk_request(), and ExecutorResourceMgr_Namespace::ExecutorResourcePool::remove_chunk_requests_from_allocated_pool().
ResourceGrantPolicy ExecutorResourceMgr_Namespace::gen_constant_resource_grant_policy | ( | const ResourceSubtype | resource_subtype, |
size_t | constant_grant | ||
) |
Generates a ResourceGrantPolicy
with ResourceGrantPolicySizeType::CONSTANT
resource_subtype | - type of resource subtype to create a ResourceGrantPolicy for |
ResourceGrantPolicy
Definition at line 91 of file ResourceGrantPolicy.cpp.
References CONSTANT.
ResourceGrantPolicy ExecutorResourceMgr_Namespace::gen_ratio_resource_grant_policy | ( | const ResourceSubtype | resource_subtype, |
const double | ratio_grant | ||
) |
Generates a ResourceGrantPolicy
with ResourceGrantPolicySizeType::RATIO_TO_TOTAL
resource_subtype | - type of resource subtype to create a ResourceGrantPolicy for |
ResourceGrantPolicy
Definition at line 100 of file ResourceGrantPolicy.cpp.
References RATIO_TO_TOTAL.
Referenced by generate_executor_resource_mgr().
ResourceGrantPolicy ExecutorResourceMgr_Namespace::gen_unlimited_resource_grant_policy | ( | const ResourceSubtype | resource_subtype | ) |
Generates a ResourceGrantPolicy
with ResourceGrantPolicySizeType::UNLIMITED
resource_subtype | - type of resource subtype to create a ResourceGrantPolicy for |
ResourceGrantPolicy
Definition at line 82 of file ResourceGrantPolicy.cpp.
References UNLIMITED.
Referenced by generate_executor_resource_mgr().
std::shared_ptr< ExecutorResourceMgr > ExecutorResourceMgr_Namespace::generate_executor_resource_mgr | ( | const size_t | num_cpu_slots, |
const size_t | num_gpu_slots, | ||
const size_t | cpu_result_mem, | ||
const size_t | cpu_buffer_pool_mem, | ||
const size_t | gpu_buffer_pool_mem, | ||
const double | per_query_max_cpu_slots_ratio, | ||
const double | per_query_max_cpu_result_mem_ratio, | ||
const double | per_query_max_pinned_cpu_buffer_pool_mem_ratio, | ||
const double | per_query_max_pageable_cpu_buffer_pool_mem_ratio, | ||
const bool | allow_cpu_kernel_concurrency, | ||
const bool | allow_cpu_gpu_kernel_concurrency, | ||
const bool | allow_cpu_slot_oversubscription_concurrency, | ||
const bool | allow_gpu_slot_oversubscription, | ||
const bool | allow_cpu_result_mem_oversubscription_concurrency, | ||
const double | max_available_resource_use_ratio | ||
) |
Convenience factory-esque method that allows us to use the same logic to generate an ExecutorResourceMgr
both internally and for ExecutorResourceMgr
tests.
Definition at line 609 of file ExecutorResourceMgr.cpp.
References ALLOW_CONCURRENT_REQUESTS, ALLOW_SINGLE_REQUEST, ALLOW_SINGLE_REQUEST_GLOBALLY, CHECK_EQ, CHECK_GT, CHECK_LE, CPU_BUFFER_POOL_MEM, CPU_RESULT_MEM, CPU_SLOTS, DISALLOW_REQUESTS, gen_ratio_resource_grant_policy(), gen_unlimited_resource_grant_policy(), GPU_BUFFER_POOL_MEM, GPU_SLOTS, PAGEABLE_CPU_BUFFER_POOL_MEM, and PINNED_CPU_BUFFER_POOL_MEM.
Referenced by Executor::init_resource_mgr().
std::string ExecutorResourceMgr_Namespace::get_resouce_concurrency_policy_string | ( | const ResourceConcurrencyPolicy & | resource_concurrency_policy | ) |
std::string ExecutorResourceMgr_Namespace::get_resource_concurrency_policy_string | ( | const ResourceConcurrencyPolicy & | resource_concurrency_policy | ) |
Definition at line 109 of file ResourceGrantPolicy.cpp.
References ALLOW_CONCURRENT_REQUESTS, ALLOW_SINGLE_REQUEST, ALLOW_SINGLE_REQUEST_GLOBALLY, DISALLOW_REQUESTS, and UNREACHABLE.
Referenced by ExecutorResourceMgr_Namespace::ConcurrentResourceGrantPolicy::to_string().
|
inline |
Returns the ResourceType
associated with a given ResourceSubtype
resource_subtype | - The ResourceSubtype to find the parent ResourceType for |
resource_subtype
Definition at line 36 of file ExecutorResourcePool.h.
References CPU_BUFFER_POOL_MEM, CPU_RESULT_MEM, CPU_SLOTS, GPU_BUFFER_POOL_MEM, GPU_RESULT_MEM, GPU_SLOTS, INVALID_TYPE, PAGEABLE_CPU_BUFFER_POOL_MEM, PAGEABLE_GPU_BUFFER_POOL_MEM, PINNED_CPU_BUFFER_POOL_MEM, PINNED_GPU_BUFFER_POOL_MEM, and UNREACHABLE.
Referenced by ExecutorResourceMgr_Namespace::ExecutorResourcePool::init_max_resource_grants_per_requests().
|
inline |
Returns the 1-or-more ResourceSubtype
s associated with a given ResourceType
.
resource_type | - The parent ResourceType |
ResourceSubtype
s associated with the ResourceType
Definition at line 69 of file ExecutorResourcePool.h.
References CPU_BUFFER_POOL_MEM, CPU_RESULT_MEM, CPU_SLOTS, GPU_BUFFER_POOL_MEM, GPU_RESULT_MEM, GPU_SLOTS, INVALID_SUBTYPE, PAGEABLE_CPU_BUFFER_POOL_MEM, PAGEABLE_GPU_BUFFER_POOL_MEM, PINNED_CPU_BUFFER_POOL_MEM, PINNED_GPU_BUFFER_POOL_MEM, and UNREACHABLE.
Referenced by ExecutorResourceMgr_Namespace::ExecutorResourcePool::get_allocated_resource_of_type(), and ExecutorResourceMgr_Namespace::ExecutorResourcePool::log_parameters().
|
inline |
Definition at line 170 of file ExecutorResourceMgrCommon.h.
References ResourceSubtypeStrings.
|
inline |
Definition at line 129 of file ExecutorResourceMgrCommon.h.
References ResourceTypeStrings.
Referenced by ExecutorResourceMgr_Namespace::ExecutorResourcePool::log_parameters(), and ExecutorResourceMgr_Namespace::ConcurrentResourceGrantPolicy::to_string().
|
static |
Definition at line 25 of file ExecutorResourcePool.cpp.
Referenced by debug_print().
const bool ExecutorResourceMgr_Namespace::ENABLE_DEBUG_PRINTING {false} |
Definition at line 24 of file ExecutorResourcePool.cpp.
Referenced by ExecutorResourceMgr_Namespace::ExecutorResourcePool::add_chunk_requests_to_allocated_pool(), ExecutorResourceMgr_Namespace::ExecutorResourcePool::can_currently_satisfy_chunk_request(), and ExecutorResourceMgr_Namespace::ExecutorResourcePool::remove_chunk_requests_from_allocated_pool().
|
static |
Definition at line 157 of file ExecutorResourceMgrCommon.h.
|
static |
Definition at line 160 of file ExecutorResourceMgrCommon.h.
Referenced by resource_subtype_to_string(), and ExecutorResourceMgr_Namespace::ResourceGrantPolicy::to_string().
|
static |
Definition at line 119 of file ExecutorResourceMgrCommon.h.
Referenced by ExecutorResourceMgr_Namespace::ExecutorResourcePool::log_parameters().
|
static |
Definition at line 122 of file ExecutorResourceMgrCommon.h.
Referenced by resource_type_to_string().