11 #include "GaudiKernel/IEvtSelector.h"
12 #include "GaudiKernel/IConversionSvc.h"
13 #include "GaudiKernel/IIoComponentMgr.h"
19 ,
const std::string&
name
20 ,
const IInterface*
parent)
23 , m_sharedRankQueue(nullptr)
37 m_cnvSvc = serviceLocator()->service(
"AthenaPoolCnvSvc");
40 return StatusCode::SUCCESS;
48 return StatusCode::SUCCESS;
51 int SharedWriterTool::makePool(
int ,
int nprocs,
const std::string& topdir)
63 SmartIF<IProperty> propertyServer(
m_cnvSvc);
65 ATH_MSG_ERROR(
"Unable to cast conversion service to IProperty");
69 std::string propertyName =
"ParallelCompression";
70 bool parallelCompression(
false);
71 BooleanProperty parallelCompressionProp(propertyName,parallelCompression);
72 if(propertyServer->getProperty(¶llelCompressionProp).isFailure()) {
73 ATH_MSG_INFO(
"Conversion service does not have ParallelCompression property");
76 SmartIF<IProperty>
poolSvc(serviceLocator()->service(
"PoolSvc"));
80 else if(parallelCompressionProp.value()) {
81 if (
poolSvc->setProperty(
"FileOpen",
"update").isFailure()) {
109 return StatusCode::FAILURE;
115 return StatusCode::FAILURE;
117 return StatusCode::SUCCESS;
125 filenames.push_back(writer_rundir.string()+std::string(
"/AthenaMP.log"));
159 *(
int*)(outwork->
data) = 1;
177 if(
mkdir(writer_rundir.string().c_str(),S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)==-1) {
178 ATH_MSG_ERROR(
"Unable to make writer run directory: " << writer_rundir.string() <<
". " <<
fmterror(errno));
187 ATH_MSG_INFO(
"Logs redirected in the AthenaMP Shared Writer PID=" << getpid());
194 ATH_MSG_INFO(
"Io registry updated in the AthenaMP Shared Writer PID=" << getpid());
205 ATH_MSG_INFO(
"File descriptors re-opened in the AthenaMP Shared Writer PID=" << getpid());
208 SmartIF<IAthenaSharedWriterSvc> sharedWriterSvc(serviceLocator()->service(
"AthenaRootSharedWriterSvc"));
209 if(!sharedWriterSvc) {
210 ATH_MSG_WARNING(
"Error retrieving AthenaRootSharedWriterSvc from SharedWriterTool::bootstrap_func()");
214 SmartIF<IDataShare> cnvSvc(
m_cnvSvc);
215 if (!cnvSvc || !cnvSvc->makeServer(-
m_nprocs - 1 - 1024 *
m_rankId).isSuccess()) {
216 ATH_MSG_ERROR(
"Failed to make the conversion service a share server");
220 ATH_MSG_DEBUG(
"Successfully made the conversion service a share server");
224 if(!
m_ioMgr->io_reinitialize().isSuccess()) {
232 if(chdir(writer_rundir.string().c_str())==-1) {
233 ATH_MSG_ERROR(
"Failed to chdir to " << writer_rundir.string());
238 *(
int*)(outwork->
data) = 0;
244 ATH_MSG_INFO(
"Exec function in the AthenaMP Shared Writer PID=" << getpid());
247 SmartIF<IAthenaSharedWriterSvc> sharedWriterSvc(serviceLocator()->service(
"AthenaRootSharedWriterSvc"));
248 if(!sharedWriterSvc) {
266 if(
m_appMgr->finalize().isFailure()) {
267 std::cerr <<
"Unable to finalize AppMgr" << std::endl;
274 *(
int*)(outwork->
data) = (all_ok?0:1);
289 *(
int*)(outwork->
data) = 0;