12#include "GaudiKernel/IEvtSelector.h"
13#include "GaudiKernel/IConversionSvc.h"
14#include "GaudiKernel/IIoComponentMgr.h"
20 ,
const std::string& name
21 ,
const IInterface* parent)
36 m_cnvSvc = serviceLocator()->service(
"AthenaPoolSharedIOCnvSvc");
39 return StatusCode::SUCCESS;
46 return StatusCode::SUCCESS;
49int SharedWriterTool::makePool(
int ,
int nprocs,
const std::string& topdir)
63 "SharedWriterTool_RankQueue_" +
m_randStr, 1,
sizeof(
int));
83 return StatusCode::FAILURE;
89 return StatusCode::FAILURE;
91 return StatusCode::SUCCESS;
99 filenames.push_back((writer_rundir /
"AthenaMP.log").
string());
131 auto outwork = std::make_unique<AthenaInterprocess::ScheduledWork>();
133 *
static_cast<int*
>(outwork->data) = 1;
134 outwork->size =
sizeof(int);
151 if(mkdir(writer_rundir.string().c_str(),S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)==-1) {
152 ATH_MSG_ERROR(
"Unable to make writer run directory: " << writer_rundir.string() <<
". " <<
fmterror(errno));
161 ATH_MSG_INFO(
"Logs redirected in the AthenaMP Shared Writer PID=" << getpid());
168 ATH_MSG_INFO(
"Io registry updated in the AthenaMP Shared Writer PID=" << getpid());
171 std::filesystem::path abs_writer_rundir = std::filesystem::absolute(writer_rundir);
179 ATH_MSG_INFO(
"File descriptors re-opened in the AthenaMP Shared Writer PID=" << getpid());
182 SmartIF<IAthenaSharedWriterSvc> sharedWriterSvc(serviceLocator()->service(
"AthenaRootSharedWriterSvc"));
183 if(!sharedWriterSvc) {
184 ATH_MSG_WARNING(
"Error retrieving AthenaRootSharedWriterSvc from SharedWriterTool::bootstrap_func()");
188 SmartIF<IDataShare> cnvSvc(
m_cnvSvc);
189 if (!cnvSvc || !cnvSvc->makeServer(-
m_nprocs - 1 - 1024 *
m_rankId).isSuccess()) {
190 ATH_MSG_ERROR(
"Failed to make the conversion service a share server");
194 ATH_MSG_DEBUG(
"Successfully made the conversion service a share server");
198 if(!
m_ioMgr->io_reinitialize().isSuccess()) {
206 if(chdir(writer_rundir.string().c_str())==-1) {
207 ATH_MSG_ERROR(
"Failed to chdir to " << writer_rundir.string());
212 *
static_cast<int*
>(outwork->data) = 0;
218 ATH_MSG_INFO(
"Exec function in the AthenaMP Shared Writer PID=" << getpid());
221 SmartIF<IAthenaSharedWriterSvc> sharedWriterSvc(serviceLocator()->service(
"AthenaRootSharedWriterSvc"));
222 if(!sharedWriterSvc) {
241 if(
m_appMgr->finalize().isFailure()) {
242 std::cerr <<
"Unable to finalize AppMgr" << std::endl;
247 auto outwork = std::make_unique<AthenaInterprocess::ScheduledWork>();
249 *
static_cast<int*
>(outwork->data) = (all_ok ? 0 : 1);
250 outwork->size =
sizeof(int);
262 auto outwork = std::make_unique<AthenaInterprocess::ScheduledWork>();
264 *
static_cast<int*
>(outwork->data) = 0;
265 outwork->size =
sizeof(int);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
Base class for all conversion services.
virtual StatusCode disconnectOutput(const std::string &output)
Disconnect output files from the service.
std::map< std::string, SingleWorkerOutputs > AllWorkerOutputs
std::unique_ptr< AllWorkerOutputs > AllWorkerOutputs_ptr
void * xmalloc(size_t size)
Trapping version of malloc.
::StatusCode StatusCode
StatusCode definition for legacy code.
Trapping version of malloc.