57 descString +=
"] memory_name";
58 boost::program_options::options_description desc(descString);
64 boost::program_options::positional_options_description
p;
68 boost::program_options::options_description all_options(
"All Options");
69 all_options.add(desc);
71 boost::program_options::variables_map vm;
73 store(boost::program_options::command_line_parser(
argc,
argv).
options(all_options).positional(p).
run(), vm);
76 std::cout <<
argv[0] <<
": Error while trying to process command line arguments:\n" 77 << iException.what() <<
"\nFor usage and an options list, please do 'cmsRun --help'.";
87 std::cout <<
" no argument given" << std::endl;
92 std::cout <<
" no second argument given" << std::endl;
107 WriteBuffer sm_buffer{memoryName, communicationChannel.fromWorkerBufferInfo()};
108 ReadBuffer sm_readbuffer{
std::string(
"Rand") + memoryName, communicationChannel.toWorkerBufferInfo()};
112 auto lockPtr = communicationChannel.accessLock();
121 TCSerializer serializer(sm_buffer);
122 TCSerializer bl_serializer(sm_buffer);
125 TCDeserializer random_deserializer(sm_readbuffer);
127 std::cerr << uniqueID <<
" process: initializing " << std::endl;
132 for (
int i = 0;
i < nlines; ++
i) {
134 std::getline(std::cin, c);
136 configuration += c +
"\n";
143 Harness harness(configuration, serviceToken);
148 std::cerr << uniqueID <<
" process: done initializing" << std::endl;
149 communicationChannel.workerSetupDone();
151 std::cerr << uniqueID <<
" process: waiting " << counter << std::endl;
152 communicationChannel.handleTransitions([&](
edm::Transition iTransition,
unsigned long long iTransitionID) {
154 switch (iTransition) {
156 std::cerr << uniqueID <<
" process: start beginLumi " << std::endl;
157 auto randState = random_deserializer.deserialize();
158 std::cerr <<
" state " << randState.seed_ << std::endl;
159 randomService->
setState(randState.state_, randState.seed_);
161 toSend.first = harness.getBeginLumiValue(iTransitionID);
162 toSend.second.state_ = randomService->
getState();
163 toSend.second.seed_ = randomService->
mySeed();
164 bl_serializer.serialize(toSend);
165 std::cerr << uniqueID <<
" process: end beginLumi " << toSend.first.value << std::endl;
170 std::cerr << uniqueID <<
" process: begin event " << counter << std::endl;
171 auto randState = random_deserializer.deserialize();
172 randomService->
setState(randState.state_, randState.seed_);
174 toSend.first = harness.getEventValue();
175 toSend.second.state_ = randomService->
getState();
176 toSend.second.seed_ = randomService->
mySeed();
177 std::cerr << uniqueID <<
" process: end event " << counter << std::endl;
179 serializer.serialize(toSend);
180 std::cerr << uniqueID <<
" process: " << toSend.first.value <<
" " << counter << std::endl;
188 std::cerr << uniqueID <<
" process: notifying and waiting" << counter << std::endl;
192 std::cerr <<
"caught exception \n" << iExcept.what() <<
"\n";
void setState(std::vector< unsigned long > const &, long seed)
void setupSignalHandling()
Sets the unix signal handler which communicates with the thread.
void setAction(std::function< void()> iFunc)
static char const *const kHelpOpt
std::vector< unsigned long > getState() const
std::pair< edmtest::IntProduct, edm::RandomNumberGeneratorState > SentType
static ServiceToken createContaining(std::unique_ptr< T > iService)
create a service token that holds the service defined by iService
std::uint32_t mySeed() const final
static char const *const kUniqueIDCommandOpt
static char const *const kMemoryNameOpt
static char const *const kHelpCommandOpt
static char const *const kMemoryNameCommandOpt
static std::atomic< unsigned int > counter
static char const *const kUniqueIDOpt