Thread-safe prediction by making the prediction cache thread-local. (#5853)

Co-authored-by: Jiaming Yuan <jm.yuan@outlook.com>
This commit is contained in:
boxdot
2020-07-30 06:33:50 +02:00
committed by GitHub
parent fa3715f584
commit d268a2a463
5 changed files with 71 additions and 14 deletions

View File

@@ -26,7 +26,6 @@ void PredictionContainer::ClearExpiredEntries() {
}
PredictionCacheEntry &PredictionContainer::Cache(std::shared_ptr<DMatrix> m, int32_t device) {
std::lock_guard<std::mutex> guard { cache_lock_ };
this->ClearExpiredEntries();
container_[m.get()].ref = m;
if (device != GenericParameter::kCpuId) {