| 329 | } |
| 330 | |
| 331 | TAtomicSharedPtr<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 | |
| 353 | size_t GetMultiQuantileApproxSize(const TString& lossFunctionDescription) { |
| 354 | const auto& paramsMap = ParseLossParams(lossFunctionDescription).GetParamsMap(); |
no outgoing calls
no test coverage detected