MCPcopy Create free account
hub / github.com/catboost/catboost / ExecRange

Method ExecRange

library/cpp/threading/local_executor/local_executor.cpp:276–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276void NPar::TLocalExecutor::ExecRange(TIntrusivePtr<ILocallyExecutable> exec, int firstId, int lastId, int flags) {
277 Y_ASSERT(lastId >= firstId);
278 if (TryExecRangeSequentially([=] (int id) { exec->LocalExec(id); }, firstId, lastId, flags)) {
279 return;
280 }
281 auto rangeExec = MakeIntrusive<TLocalRangeExecutor>(std::move(exec), firstId, lastId);
282 int queueSizeLimit = (flags & WAIT_COMPLETE) ? 10000 : -1;
283 int prior = Max<int>(Impl_->CurrentTaskPriority, flags & PRIORITY_MASK);
284 switch (prior) {
285 case HIGH_PRIORITY:
286 Impl_->LaunchRange(rangeExec, queueSizeLimit, &Impl_->QueueSize, &Impl_->JobQueue);
287 break;
288 case MED_PRIORITY:
289 Impl_->LaunchRange(rangeExec, queueSizeLimit, &Impl_->MPQueueSize, &Impl_->MedJobQueue);
290 break;
291 case LOW_PRIORITY:
292 Impl_->LaunchRange(rangeExec, queueSizeLimit, &Impl_->LPQueueSize, &Impl_->LowJobQueue);
293 break;
294 default:
295 Y_ASSERT(0);
296 break;
297 }
298 if (flags & WAIT_COMPLETE) {
299 int keepPrior = Impl_->CurrentTaskPriority;
300 Impl_->CurrentTaskPriority = prior;
301 while (rangeExec->DoSingleOp()) {
302 }
303 Impl_->CurrentTaskPriority = keepPrior;
304 rangeExec->WaitComplete();
305 }
306}
307
308void NPar::ILocalExecutor::ExecRange(TLocallyExecutableFunction exec, int firstId, int lastId, int flags) {
309 if (TryExecRangeSequentially(exec, firstId, lastId, flags)) {

Callers 15

LaunchOpsMethod · 0.45
LaunchMethod · 0.45
BinarizeLineFunction · 0.45
DoMapMethod · 0.45
UpdateApproxFunction · 0.45

Calls 5

LaunchRangeMethod · 0.80
DoSingleOpMethod · 0.80
moveFunction · 0.50
LocalExecMethod · 0.45
WaitCompleteMethod · 0.45

Tested by

no test coverage detected