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

Function MakeRunOnRangeImpl

library/cpp/par/par_util.cpp:305–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303 };
304
305 void MakeRunOnRangeImpl(TJobDescription* job, int start, int finish, IDistrCmd* finalMap) {
306 CHROMIUM_TRACE_FUNCTION();
307 int jobCount = finish - start;
308 if (jobCount < 2000) {
309 // direct way is faster
310 job->SetCurrentOperation(finalMap);
311 for (int i = start; i < finish; ++i) {
312 job->AddMap(i);
313 }
314 } else {
315 int partCount = 1000;
316 int jobPerPart = (jobCount + partCount - 1) / partCount;
317 job->SetCurrentOperation(new TRemoteRangeExecutor(finalMap));
318 for (int part = 0; part < partCount; ++part) {
319 TExecRange range;
320 range.Start = start + part * jobPerPart;
321 range.Finish = start + Min((part + 1) * jobPerPart, jobCount);
322 if (range.Finish > range.Start)
323 job->AddMap(range);
324 }
325 }
326 job->MergeResults();
327 }
328}
329using namespace NPar;
330REGISTER_SAVELOAD_CLASS(0xD669C40, TRemoteReduce)

Callers 1

RunMapReduceOnRangeFunction · 0.85

Calls 4

SetCurrentOperationMethod · 0.80
AddMapMethod · 0.80
MergeResultsMethod · 0.80
MinFunction · 0.50

Tested by

no test coverage detected