12 #include "GaudiKernel/IEvtSelector.h"
13 #include "GaudiKernel/IConversionSvc.h"
14 #include "GaudiKernel/IIoComponentMgr.h"
20 ,
const std::string&
name
21 ,
const IInterface*
parent)
24 , m_sharedRankQueue(nullptr)
38 m_cnvSvc = serviceLocator()->service(
"AthenaPoolSharedIOCnvSvc");
41 return StatusCode::SUCCESS;
49 return StatusCode::SUCCESS;
52 int SharedWriterTool::makePool(
int ,
int nprocs,
const std::string& topdir)
64 SmartIF<IProperty> propertyServer(
m_cnvSvc);
66 ATH_MSG_ERROR(
"Unable to cast conversion service to IProperty");
70 std::string propertyName =
"ParallelCompression";
71 bool parallelCompression(
false);
72 BooleanProperty parallelCompressionProp(std::move(propertyName),parallelCompression);
73 if(propertyServer->getProperty(¶llelCompressionProp).isFailure()) {
74 ATH_MSG_INFO(
"Conversion service does not have ParallelCompression property");
77 SmartIF<IProperty>
poolSvc(serviceLocator()->service(
"PoolSvc"));
81 else if(parallelCompressionProp.value()) {
82 if (
poolSvc->setProperty(
"FileOpen",
"update").isFailure()) {
110 return StatusCode::FAILURE;
116 return StatusCode::FAILURE;
118 return StatusCode::SUCCESS;
126 filenames.push_back(writer_rundir.string()+std::string(
"/AthenaMP.log"));
160 *(
int*)(outwork->
data) = 1;
178 if(
mkdir(writer_rundir.string().c_str(),S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)==-1) {
179 ATH_MSG_ERROR(
"Unable to make writer run directory: " << writer_rundir.string() <<
". " <<
fmterror(errno));
188 ATH_MSG_INFO(
"Logs redirected in the AthenaMP Shared Writer PID=" << getpid());
195 ATH_MSG_INFO(
"Io registry updated in the AthenaMP Shared Writer PID=" << getpid());
206 ATH_MSG_INFO(
"File descriptors re-opened in the AthenaMP Shared Writer PID=" << getpid());
209 SmartIF<IAthenaSharedWriterSvc> sharedWriterSvc(serviceLocator()->service(
"AthenaRootSharedWriterSvc"));
210 if(!sharedWriterSvc) {
211 ATH_MSG_WARNING(
"Error retrieving AthenaRootSharedWriterSvc from SharedWriterTool::bootstrap_func()");
215 SmartIF<IDataShare> cnvSvc(
m_cnvSvc);
216 if (!cnvSvc || !cnvSvc->makeServer(-
m_nprocs - 1 - 1024 *
m_rankId).isSuccess()) {
217 ATH_MSG_ERROR(
"Failed to make the conversion service a share server");
221 ATH_MSG_DEBUG(
"Successfully made the conversion service a share server");
225 if(!
m_ioMgr->io_reinitialize().isSuccess()) {
233 if(chdir(writer_rundir.string().c_str())==-1) {
234 ATH_MSG_ERROR(
"Failed to chdir to " << writer_rundir.string());
239 *(
int*)(outwork->
data) = 0;
245 ATH_MSG_INFO(
"Exec function in the AthenaMP Shared Writer PID=" << getpid());
248 SmartIF<IAthenaSharedWriterSvc> sharedWriterSvc(serviceLocator()->service(
"AthenaRootSharedWriterSvc"));
249 if(!sharedWriterSvc) {
267 if(
m_appMgr->finalize().isFailure()) {
268 std::cerr <<
"Unable to finalize AppMgr" << std::endl;
275 *(
int*)(outwork->
data) = (all_ok?0:1);
290 *(
int*)(outwork->
data) = 0;