From 3e6170c572428a30f5668e252e34f1687d6110cb Mon Sep 17 00:00:00 2001 From: Peter van Gemmeren <gemmeren@anl.gov> Date: Mon, 13 Aug 2018 15:55:23 -0500 Subject: [PATCH] Move setting of ROOT IMT to start() transition and limit nuber of threads (Thanks Scott). Former-commit-id: c85754c2f8b670872c2e3dc877a800e3d8a3de90 --- .../APR/RootStorageSvc/src/RootDomain.cpp | 10 ++++++--- Database/AthenaPOOL/PoolSvc/src/PoolSvc.cxx | 21 ++++++++++++------- Database/AthenaPOOL/PoolSvc/src/PoolSvc.h | 1 + 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Database/APR/RootStorageSvc/src/RootDomain.cpp b/Database/APR/RootStorageSvc/src/RootDomain.cpp index 6fe0734c1fc..36c4e427d6c 100755 --- a/Database/APR/RootStorageSvc/src/RootDomain.cpp +++ b/Database/APR/RootStorageSvc/src/RootDomain.cpp @@ -98,10 +98,14 @@ DbStatus RootDomain::setOption(const DbOption& opt) { return sc; } else if ( !strcasecmp(n, "ENABLE_IMPLICITMT") ) { - bool implicitMT = false; + int implicitMT = -1; DbStatus sc = opt._getValue(implicitMT); - if ( sc.isSuccess() && implicitMT ) { - ROOT::EnableImplicitMT(); + if ( sc.isSuccess() ) { + if ( implicitMT == 0 ) { + ROOT::EnableImplicitMT(); + } else if ( implicitMT > 0 ) { + ROOT::EnableImplicitMT(implicitMT); + } } return sc; } diff --git a/Database/AthenaPOOL/PoolSvc/src/PoolSvc.cxx b/Database/AthenaPOOL/PoolSvc/src/PoolSvc.cxx index f2a7ed23024..1ffbeabd6a6 100644 --- a/Database/AthenaPOOL/PoolSvc/src/PoolSvc.cxx +++ b/Database/AthenaPOOL/PoolSvc/src/PoolSvc.cxx @@ -203,14 +203,6 @@ StatusCode PoolSvc::setupPersistencySvc() { ATH_MSG_FATAL("Failed to enable thread safety in ROOT via PersistencySvc."); return(StatusCode::FAILURE); } - // Switiching on ROOT implicit multi threading for AthenaMT - if (Gaudi::Concurrency::ConcurrencyFlags::numThreads() > 1) { - - if (!m_persistencySvcVec[IPoolSvc::kInputStream]->session().technologySpecificAttributes(pool::ROOT_StorageType.type()).setAttribute<bool>("ENABLE_IMPLICITMT", true)) { - ATH_MSG_FATAL("Failed to enable implicit multithreading in ROOT via PersistencySvc."); - return(StatusCode::FAILURE); - } - } m_contextMaxFile.insert(std::pair<unsigned int, int>(IPoolSvc::kInputStream, m_dbAgeLimit)); if (!connect(pool::ITransaction::READ).isSuccess()) { ATH_MSG_FATAL("Failed to connect Input PersistencySvc."); @@ -228,6 +220,19 @@ StatusCode PoolSvc::setupPersistencySvc() { return(StatusCode::SUCCESS); } //__________________________________________________________________________ +StatusCode PoolSvc::start() { + // Switiching on ROOT implicit multi threading for AthenaMT + if (Gaudi::Concurrency::ConcurrencyFlags::numThreads() > 1) { + + if (!m_persistencySvcVec[IPoolSvc::kInputStream]->session().technologySpecificAttributes(pool::ROOT_StorageType.type()).setAttribute<int>("ENABLE_IMPLICITMT", Gaudi::Concurrency::ConcurrencyFlags::numThreads() - 1)) { + ATH_MSG_FATAL("Failed to enable implicit multithreading in ROOT via PersistencySvc."); + return(StatusCode::FAILURE); + } + ATH_MSG_INFO("Enabled implicit multithreading in ROOT via PersistencySvc to: " << Gaudi::Concurrency::ConcurrencyFlags::numThreads() - 1); + } + return(StatusCode::SUCCESS); +} +//__________________________________________________________________________ StatusCode PoolSvc::stop() { bool retError = false; for (unsigned int contextId = 0, imax = m_persistencySvcVec.size(); contextId < imax; contextId++) { diff --git a/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h b/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h index da58694eb3c..f3e51efd7b6 100644 --- a/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h +++ b/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h @@ -41,6 +41,7 @@ public: // Non-static members StatusCode initialize(); StatusCode io_reinit(); /// Required of all Gaudi services: + StatusCode start(); StatusCode stop(); /// Required of all Gaudi services: StatusCode finalize(); -- GitLab