| 248 | } |
| 249 | |
| 250 | kstatus ComputeWindowKernel::run() { |
| 251 | CodeTimer timer; |
| 252 | |
| 253 | int self_node_idx = context->getNodeIndex(ral::communication::CommunicationData::getInstance().getSelfNode()); |
| 254 | int num_nodes = context->getTotalNodes(); |
| 255 | |
| 256 | bool is_first_batch = true; |
| 257 | bool is_last_batch = false; |
| 258 | bool is_first_node = self_node_idx == 0; |
| 259 | bool is_last_node = self_node_idx == num_nodes - 1; |
| 260 | |
| 261 | std::unique_ptr<ral::cache::CacheData> cache_data = this->input_cache()->pullCacheData(); |
| 262 | |
| 263 | if (this->remove_overlap){ |
| 264 | while (cache_data != nullptr ){ |
| 265 | std::vector<std::unique_ptr <ral::cache::CacheData> > inputs; |
| 266 | inputs.push_back(std::move(cache_data)); |
| 267 | |
| 268 | cache_data = this->input_cache()->pullCacheData(); |
| 269 | if (cache_data == nullptr){ |
| 270 | is_last_batch = true; |
| 271 | } |
| 272 | |
| 273 | std::map<std::string, std::string> task_args; |
| 274 | task_args[TASK_ARG_REMOVE_PRECEDING_OVERLAP] = !(is_first_batch && is_first_node) ? TRUE : FALSE; |
| 275 | task_args[TASK_ARG_REMOVE_FOLLOWING_OVERLAP] = !(is_last_batch && is_last_node) ? TRUE : FALSE; |
| 276 | |
| 277 | ral::execution::executor::get_instance()->add_task( |
| 278 | std::move(inputs), |
| 279 | this->output_cache(), |
| 280 | this, |
| 281 | task_args); |
| 282 | |
| 283 | is_first_batch = false; |
| 284 | } |
| 285 | } else { |
| 286 | while (cache_data != nullptr ){ |
| 287 | std::vector<std::unique_ptr <ral::cache::CacheData> > inputs; |
| 288 | inputs.push_back(std::move(cache_data)); |
| 289 | |
| 290 | ral::execution::executor::get_instance()->add_task( |
| 291 | std::move(inputs), |
| 292 | this->output_cache(), |
| 293 | this); |
| 294 | |
| 295 | cache_data = this->input_cache()->pullCacheData(); |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | |
| 300 | |
| 301 | std::unique_lock<std::mutex> lock(kernel_mutex); |
| 302 | kernel_cv.wait(lock,[this]{ |
| 303 | return this->tasks.empty(); |
| 304 | }); |
| 305 | |
| 306 | if (logger != nullptr) { |
| 307 | logger->debug("{query_id}|{step}|{substep}|{info}|{duration}|kernel_id|{kernel_id}||", |
nothing calls this directly
no test coverage detected