OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExecutorResourceMgr_Namespace Namespace Reference

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< ResourceSubtypemap_resource_type_to_resource_subtypes (const ResourceType resource_type)
 Returns the 1-or-more ResourceSubtypes 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_
 

Typedef Documentation

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.

Definition at line 30 of file ExecutorResourceMgrCommon.h.

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.

Enumeration Type Documentation

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.

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).

Enumerator
CPU_SLOTS 
GPU_SLOTS 
CPU_RESULT_MEM 
GPU_RESULT_MEM 
PINNED_CPU_BUFFER_POOL_MEM 
PAGEABLE_CPU_BUFFER_POOL_MEM 
PINNED_GPU_BUFFER_POOL_MEM 
PAGEABLE_GPU_BUFFER_POOL_MEM 
INVALID_SUBTYPE 
NUM_RESOURCE_SUBTYPES 

Definition at line 144 of file ExecutorResourceMgrCommon.h.

Function Documentation

template<typename... Ts>
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().

28  {
29  std::unique_lock<std::mutex> print_lock(debug_print_mutex_);
30  (std::cout << ... << print_args);
31  std::cout << std::endl;
32 }

+ Here is the caller graph for this function:

ResourceGrantPolicy ExecutorResourceMgr_Namespace::gen_constant_resource_grant_policy ( const ResourceSubtype  resource_subtype,
size_t  constant_grant 
)

Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::CONSTANT

Parameters
resource_subtype- type of resource subtype to create a ResourceGrantPolicy for
Returns
ResourceGrantPolicy - The generated "constant-sized" ResourceGrantPolicy

Definition at line 91 of file ResourceGrantPolicy.cpp.

References CONSTANT.

93  {
94  const ResourceGrantSizeInfo size_info(constant_grant);
95  const ResourceGrantPolicy resource_grant_policy(
96  resource_subtype, ResourceGrantPolicySizeType::CONSTANT, size_info);
97  return resource_grant_policy;
98 }
ResourceGrantPolicy ExecutorResourceMgr_Namespace::gen_ratio_resource_grant_policy ( const ResourceSubtype  resource_subtype,
const double  ratio_grant 
)

Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::RATIO_TO_TOTAL

Parameters
resource_subtype- type of resource subtype to create a ResourceGrantPolicy for
Returns
ResourceGrantPolicy - The generated "ratio-to-total" ResourceGrantPolicy

Definition at line 100 of file ResourceGrantPolicy.cpp.

References RATIO_TO_TOTAL.

Referenced by generate_executor_resource_mgr().

102  {
103  const ResourceGrantSizeInfo size_info(ratio_grant);
104  const ResourceGrantPolicy resource_grant_policy(
105  resource_subtype, ResourceGrantPolicySizeType::RATIO_TO_TOTAL, size_info);
106  return resource_grant_policy;
107 }

+ Here is the caller graph for this function:

ResourceGrantPolicy ExecutorResourceMgr_Namespace::gen_unlimited_resource_grant_policy ( const ResourceSubtype  resource_subtype)

Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::UNLIMITED

Parameters
resource_subtype- type of resource subtype to create a ResourceGrantPolicy for
Returns
ResourceGrantPolicy - The generated "unlimited" ResourceGrantPolicy

Definition at line 82 of file ResourceGrantPolicy.cpp.

References UNLIMITED.

Referenced by generate_executor_resource_mgr().

83  {
84  // Make a dummy size_info union
85  const ResourceGrantSizeInfo size_info;
86  const ResourceGrantPolicy resource_grant_policy(
87  resource_subtype, ResourceGrantPolicySizeType::UNLIMITED, size_info);
88  return resource_grant_policy;
89 }

+ Here is the caller graph for this function:

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().

624  {
625  CHECK_GT(num_cpu_slots, size_t(0));
626  CHECK_GT(cpu_result_mem, size_t(0));
627  CHECK_GT(cpu_buffer_pool_mem, size_t(0));
628  CHECK_GT(per_query_max_cpu_slots_ratio, size_t(0));
629  CHECK_EQ(!(allow_cpu_kernel_concurrency || allow_cpu_gpu_kernel_concurrency) &&
630  allow_cpu_slot_oversubscription_concurrency,
631  false);
632  CHECK_EQ(!(allow_cpu_kernel_concurrency || allow_cpu_gpu_kernel_concurrency) &&
633  allow_cpu_result_mem_oversubscription_concurrency,
634  false);
635  CHECK_GT(max_available_resource_use_ratio, 0.0);
636  CHECK_LE(max_available_resource_use_ratio, 1.0);
637 
638  const std::vector<std::pair<ResourceType, size_t>> total_resources = {
639  std::make_pair(ResourceType::CPU_SLOTS, num_cpu_slots),
640  std::make_pair(ResourceType::GPU_SLOTS, num_gpu_slots),
641  std::make_pair(ResourceType::CPU_RESULT_MEM, cpu_result_mem),
642  std::make_pair(ResourceType::CPU_BUFFER_POOL_MEM, cpu_buffer_pool_mem),
643  std::make_pair(ResourceType::GPU_BUFFER_POOL_MEM, gpu_buffer_pool_mem)};
644 
645  const auto max_per_request_cpu_slots_grant_policy = gen_ratio_resource_grant_policy(
646  ResourceSubtype::CPU_SLOTS, per_query_max_cpu_slots_ratio);
647 
648  // Use unlimited policy for now as some GPU query plans can need more kernels than gpus
649  const auto max_per_request_gpu_slots_grant_policy =
650  gen_unlimited_resource_grant_policy(ResourceSubtype::GPU_SLOTS);
651  const auto max_per_request_cpu_result_mem_grant_policy =
652  gen_ratio_resource_grant_policy(ResourceSubtype::CPU_RESULT_MEM,
653  per_query_max_cpu_result_mem_ratio);
654 
655  const auto max_per_request_pinned_cpu_buffer_pool_mem =
656  gen_ratio_resource_grant_policy(ResourceSubtype::PINNED_CPU_BUFFER_POOL_MEM,
657  per_query_max_pinned_cpu_buffer_pool_mem_ratio);
658  const auto max_per_request_pageable_cpu_buffer_pool_mem =
659  gen_ratio_resource_grant_policy(ResourceSubtype::PAGEABLE_CPU_BUFFER_POOL_MEM,
660  per_query_max_pageable_cpu_buffer_pool_mem_ratio);
661 
662  const std::vector<ResourceGrantPolicy> max_per_request_resource_grant_policies = {
663  max_per_request_cpu_slots_grant_policy,
664  max_per_request_gpu_slots_grant_policy,
665  max_per_request_cpu_result_mem_grant_policy,
666  max_per_request_pinned_cpu_buffer_pool_mem,
667  max_per_request_pageable_cpu_buffer_pool_mem};
668 
669  const auto cpu_slots_undersubscription_concurrency_policy =
670  allow_cpu_kernel_concurrency ? ResourceConcurrencyPolicy::ALLOW_CONCURRENT_REQUESTS
672  // Whether a single query can oversubscribe CPU slots should be controlled with
673  // per_query_max_cpu_slots_ratio
674  const auto cpu_slots_oversubscription_concurrency_policy =
675  allow_cpu_slot_oversubscription_concurrency
678  const auto gpu_slots_undersubscription_concurrency_policy =
679  allow_cpu_gpu_kernel_concurrency
682  const auto gpu_slots_oversubscription_concurrency_policy =
683  !allow_gpu_slot_oversubscription
685  : (allow_cpu_gpu_kernel_concurrency
688 
689  // Whether a single query can oversubscribe CPU memory should be controlled with
690  // per_query_max_cpu_result_mem_ratio
691  const auto cpu_result_mem_oversubscription_concurrency_policy =
692  allow_cpu_result_mem_oversubscription_concurrency
695 
696  const auto concurrent_cpu_slots_grant_policy =
697  ConcurrentResourceGrantPolicy(ResourceType::CPU_SLOTS,
698  cpu_slots_undersubscription_concurrency_policy,
699  cpu_slots_oversubscription_concurrency_policy);
700  const ConcurrentResourceGrantPolicy concurrent_gpu_slots_grant_policy(
701  ResourceType::GPU_SLOTS,
702  gpu_slots_undersubscription_concurrency_policy,
703  gpu_slots_oversubscription_concurrency_policy);
704 
705  const auto concurrent_cpu_result_mem_grant_policy =
706  ConcurrentResourceGrantPolicy(ResourceType::CPU_RESULT_MEM,
708  cpu_result_mem_oversubscription_concurrency_policy);
709 
710  const std::vector<ConcurrentResourceGrantPolicy> concurrent_resource_grant_policies{
711  concurrent_cpu_slots_grant_policy,
712  concurrent_gpu_slots_grant_policy,
713  concurrent_cpu_result_mem_grant_policy};
714 
715  return std::make_shared<ExecutorResourceMgr>(total_resources,
716  concurrent_resource_grant_policies,
717  max_per_request_resource_grant_policies,
718  max_available_resource_use_ratio);
719 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
ResourceGrantPolicy gen_unlimited_resource_grant_policy(const ResourceSubtype resource_subtype)
Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::UNLIMITED
#define CHECK_GT(x, y)
Definition: Logger.h:305
ResourceGrantPolicy gen_ratio_resource_grant_policy(const ResourceSubtype resource_subtype, const double ratio_grant)
Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::RATIO_TO_TOTAL
#define CHECK_LE(x, y)
Definition: Logger.h:304

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

110  {
111  std::ostringstream oss;
112  switch (resource_concurrency_policy) {
114  oss << "Allow concurrent requests";
115  break;
117  oss << "Allow single request for resource type";
118  break;
120  oss << "Allow single request globally";
121  break;
122  case DISALLOW_REQUESTS:
123  oss << "Disallow requests";
124  break;
125  default:
126  UNREACHABLE();
127  }
128  return oss.str();
129 }
#define UNREACHABLE()
Definition: Logger.h:338

+ Here is the caller graph for this function:

ResourceType ExecutorResourceMgr_Namespace::map_resource_subtype_to_resource_type ( const ResourceSubtype  resource_subtype)
inline

Returns the ResourceType associated with a given ResourceSubtype

Parameters
resource_subtype- The ResourceSubtype to find the parent ResourceType for
Returns
ResourceType - The resource type that subsumes (as a category) the specified 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().

37  {
38  switch (resource_subtype) {
39  case ResourceSubtype::CPU_SLOTS:
40  return ResourceType::CPU_SLOTS;
41  case ResourceSubtype::GPU_SLOTS:
42  return ResourceType::GPU_SLOTS;
43  case ResourceSubtype::CPU_RESULT_MEM:
44  return ResourceType::CPU_RESULT_MEM;
45  case ResourceSubtype::GPU_RESULT_MEM:
46  return ResourceType::GPU_RESULT_MEM;
47  case ResourceSubtype::PINNED_CPU_BUFFER_POOL_MEM:
48  return ResourceType::CPU_BUFFER_POOL_MEM;
49  case ResourceSubtype::PINNED_GPU_BUFFER_POOL_MEM:
50  return ResourceType::GPU_BUFFER_POOL_MEM;
51  case ResourceSubtype::PAGEABLE_CPU_BUFFER_POOL_MEM:
52  return ResourceType::CPU_BUFFER_POOL_MEM;
53  case ResourceSubtype::PAGEABLE_GPU_BUFFER_POOL_MEM:
54  return ResourceType::GPU_BUFFER_POOL_MEM;
55  default:
56  UNREACHABLE();
57  return ResourceType::INVALID_TYPE;
58  }
59 }
#define UNREACHABLE()
Definition: Logger.h:338

+ Here is the caller graph for this function:

std::vector<ResourceSubtype> ExecutorResourceMgr_Namespace::map_resource_type_to_resource_subtypes ( const ResourceType  resource_type)
inline

Returns the 1-or-more ResourceSubtypes associated with a given ResourceType.

Parameters
resource_type- The parent ResourceType
Returns
std::vector<ResourceSubtype> - A vector of one or more ResourceSubtypes 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().

70  {
71  switch (resource_type) {
72  case ResourceType::CPU_SLOTS:
73  return {ResourceSubtype::CPU_SLOTS};
74  case ResourceType::GPU_SLOTS:
75  return {ResourceSubtype::GPU_SLOTS};
76  case ResourceType::CPU_RESULT_MEM:
77  return {ResourceSubtype::CPU_RESULT_MEM};
78  case ResourceType::GPU_RESULT_MEM:
79  return {ResourceSubtype::GPU_RESULT_MEM};
80  case ResourceType::CPU_BUFFER_POOL_MEM:
81  return {ResourceSubtype::PINNED_CPU_BUFFER_POOL_MEM,
82  ResourceSubtype::PAGEABLE_CPU_BUFFER_POOL_MEM};
83  case ResourceType::GPU_BUFFER_POOL_MEM:
84  return {ResourceSubtype::PINNED_GPU_BUFFER_POOL_MEM,
85  ResourceSubtype::PAGEABLE_GPU_BUFFER_POOL_MEM};
86  default:
87  UNREACHABLE();
88  return {ResourceSubtype::INVALID_SUBTYPE};
89  }
90 }
#define UNREACHABLE()
Definition: Logger.h:338

+ Here is the caller graph for this function:

std::string ExecutorResourceMgr_Namespace::resource_subtype_to_string ( const ResourceSubtype  resource_subtype)
inline

Definition at line 170 of file ExecutorResourceMgrCommon.h.

References ResourceSubtypeStrings.

170  {
171  return ResourceSubtypeStrings[static_cast<size_t>(resource_subtype)];
172 }
static const char * ResourceSubtypeStrings[]
std::string ExecutorResourceMgr_Namespace::resource_type_to_string ( const ResourceType  resource_type)
inline

Definition at line 129 of file ExecutorResourceMgrCommon.h.

References ResourceTypeStrings.

Referenced by ExecutorResourceMgr_Namespace::ExecutorResourcePool::log_parameters(), and ExecutorResourceMgr_Namespace::ConcurrentResourceGrantPolicy::to_string().

129  {
130  return ResourceTypeStrings[static_cast<size_t>(resource_type)];
131 }

+ Here is the caller graph for this function:

Variable Documentation

std::mutex ExecutorResourceMgr_Namespace::debug_print_mutex_
static

Definition at line 25 of file ExecutorResourcePool.cpp.

Referenced by debug_print().

constexpr size_t ExecutorResourceMgr_Namespace::ResourceSubtypeSize
static
Initial value:
=
static_cast<size_t>(ResourceSubtype::NUM_RESOURCE_SUBTYPES)

Definition at line 157 of file ExecutorResourceMgrCommon.h.

const char* ExecutorResourceMgr_Namespace::ResourceSubtypeStrings[]
static
Initial value:
= {"cpu_slots",
"gpu_slots",
"cpu_result_mem",
"gpu_result_mem",
"pinned_cpu_buffer_pool_mem",
"pinned_gpu_buffer_pool_mem",
"pageable_cpu_buffer_pool_mem",
"pageable_gpu_buffer_pool_mem",
"invalid_type"}

Definition at line 160 of file ExecutorResourceMgrCommon.h.

Referenced by resource_subtype_to_string(), and ExecutorResourceMgr_Namespace::ResourceGrantPolicy::to_string().

constexpr size_t ExecutorResourceMgr_Namespace::ResourceTypeSize
static
Initial value:
=
static_cast<size_t>(ResourceType::NUM_RESOURCE_TYPES)

Definition at line 119 of file ExecutorResourceMgrCommon.h.

Referenced by ExecutorResourceMgr_Namespace::ExecutorResourcePool::log_parameters().

const char* ExecutorResourceMgr_Namespace::ResourceTypeStrings[]
static
Initial value:
= {"cpu_slots",
"gpu_slots",
"cpu_result_mem",
"gpu_result_mem",
"cpu_buffer_pool_mem",
"gpu_buffer_pool_mem"}

Definition at line 122 of file ExecutorResourceMgrCommon.h.

Referenced by resource_type_to_string().