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

Function GetCachedLocalExecutor

catboost/python-package/catboost/helpers.cpp:331–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331TAtomicSharedPtr<NPar::TTbbLocalExecutor<false>> GetCachedLocalExecutor(int threadsCount) {
332 static TMutex lock;
333 static TAtomicSharedPtr<NPar::TTbbLocalExecutor<false>> cachedExecutor;
334
335 CB_ENSURE(threadsCount == -1 || 0 < threadsCount, "threadsCount should be positive or -1");
336
337 if (threadsCount == -1) {
338 threadsCount = NSystemInfo::CachedNumberOfCpus();
339 }
340
341 with_lock (lock) {
342 if (cachedExecutor && cachedExecutor->GetThreadCount() + 1 == threadsCount) {
343 return cachedExecutor;
344 }
345
346 cachedExecutor.Reset();
347 cachedExecutor = MakeAtomicShared<NPar::TTbbLocalExecutor<false>>(threadsCount);
348
349 return cachedExecutor;
350 }
351}
352
353size_t GetMultiQuantileApproxSize(const TString& lossFunctionDescription) {
354 const auto& paramsMap = ParseLossParams(lossFunctionDescription).GetParamsMap();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected