OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ResourceRequest.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <vector>
20 
22 
23 namespace ExecutorResourceMgr_Namespace {
24 
36  std::vector<std::pair<ChunkKey, size_t>> chunks_with_byte_sizes;
37  size_t num_chunks{0};
38  size_t total_bytes{0};
39  std::vector<size_t> bytes_per_kernel;
42 };
43 
50  size_t max_quantity{0};
51  size_t min_quantity{0};
52 };
53 
60 
70 struct RequestInfo {
72  size_t priority_level{0};
73  size_t cpu_slots{0};
74  size_t min_cpu_slots{0};
75  size_t gpu_slots{0};
76  size_t min_gpu_slots{0};
77  size_t cpu_result_mem{0};
78  size_t min_cpu_result_mem{0};
84 
86  const size_t priority_level,
87  const size_t cpu_slots,
88  const size_t min_cpu_slots,
89  const size_t gpu_slots,
90  const size_t min_gpu_slots,
91  const size_t cpu_result_mem,
92  const size_t min_cpu_result_mem,
95  : request_device_type(request_device_type)
96  , priority_level(priority_level)
97  , cpu_slots(cpu_slots)
98  , min_cpu_slots(min_cpu_slots)
99  , gpu_slots(gpu_slots)
100  , min_gpu_slots(min_gpu_slots)
101  , cpu_result_mem(cpu_result_mem)
102  , min_cpu_result_mem(min_cpu_result_mem)
103  , chunk_request_info(chunk_request_info)
104  , output_buffers_reusable_intra_thread(output_buffers_reusable_intra_thread) {}
105 
111  const size_t num_kernels,
112  const size_t cpu_result_mem)
113  : request_device_type(request_device_type)
114  , priority_level(static_cast<size_t>(0))
115  , cpu_slots(num_kernels)
116  , min_cpu_slots(num_kernels)
117  , gpu_slots(request_device_type == ExecutorDeviceType::GPU ? num_kernels
118  : static_cast<size_t>(0))
119  , min_gpu_slots(request_device_type == ExecutorDeviceType::GPU
120  ? num_kernels
121  : static_cast<size_t>(0))
122  , cpu_result_mem(cpu_result_mem)
123  , min_cpu_result_mem(cpu_result_mem) {}
124 };
125 
126 } // namespace ExecutorResourceMgr_Namespace
A container to store requested and minimum neccessary resource requests across all resource types cur...
Specifies the minimum and maximum quanity either requested or granted for a request of resource_subty...
std::vector< std::pair< ChunkKey, size_t > > chunks_with_byte_sizes
RequestInfo(const ExecutorDeviceType request_device_type, const size_t num_kernels, const size_t cpu_result_mem)
Simple constructor assuming no difference between min and requested resources, and no intra-thread cp...
ExecutorDeviceType
ResourceSubtype
Stores the resource sub-type for a ExecutorResourcePool request.
RequestInfo(const ExecutorDeviceType request_device_type, const size_t priority_level, const size_t cpu_slots, const size_t min_cpu_slots, const size_t gpu_slots, const size_t min_gpu_slots, const size_t cpu_result_mem, const size_t min_cpu_result_mem, const ChunkRequestInfo &chunk_request_info, const bool output_buffers_reusable_intra_thread)
Specifies all DataMgr chunks needed for a query step/request, along with their sizes in bytes...