82 descString +=
"] memory_name";
83 boost::program_options::options_description desc(descString);
90 boost::program_options::positional_options_description
p;
94 boost::program_options::options_description all_options(
"All Options");
95 all_options.add(desc);
97 boost::program_options::variables_map vm;
99 store(boost::program_options::command_line_parser(
argc,
argv).
options(all_options).positional(p).
run(), vm);
102 std::cout <<
argv[0] <<
": Error while trying to process command line arguments:\n" 103 << iException.what() <<
"\nFor usage and an options list, please do 'cmsRun --help'.";
118 std::cout <<
" no argument given" << std::endl;
123 std::cout <<
" no second argument given" << std::endl;
138 WriteBuffer sm_buffer{memoryName, communicationChannel.fromWorkerBufferInfo()};
139 ReadBuffer sm_readbuffer{
std::string(
"Rand") + memoryName, communicationChannel.toWorkerBufferInfo()};
143 auto lockPtr = communicationChannel.accessLock();
158 std::cerr << uniqueID <<
" process: initializing " << std::endl;
163 for (
int i = 0;
i < nlines; ++
i) {
165 std::getline(std::cin, c);
169 configuration += c +
"\n";
175 Harness harness(configuration, serviceToken);
181 std::cerr << uniqueID <<
" process: done initializing" << std::endl;
183 communicationChannel.workerSetupDone();
186 std::cerr << uniqueID <<
" process: waiting " << counter << std::endl;
187 communicationChannel.handleTransitions([&](
edm::Transition iTransition,
unsigned long long iTransitionID) {
189 switch (iTransition) {
192 std::cerr << uniqueID <<
" process: start beginRun " << std::endl;
194 std::cerr << uniqueID <<
" process: end beginRun " << std::endl;
200 std::cerr << uniqueID <<
" process: start beginLumi " << std::endl;
201 auto randState = random_deserializer.deserialize();
203 std::cerr << uniqueID <<
" random " << randState.state_.size() <<
" " << randState.seed_ << std::endl;
204 randomService->
setState(randState.state_, randState.seed_);
205 auto value = harness.getBeginLumiValue(iTransitionID);
207 value.randomState_.seed_ = randomService->
mySeed();
209 bl_serializer.serialize(
value);
211 std::cerr << uniqueID <<
" process: end beginLumi " << std::endl;
213 std::cerr << uniqueID <<
" rand " <<
value.randomState_.state_.size() <<
" " <<
value.randomState_.seed_
219 std::cerr << uniqueID <<
" process: event " << counter << std::endl;
220 auto randState = random_deserializer.deserialize();
221 randomService->
setState(randState.state_, randState.seed_);
222 auto value = harness.getEventValue();
224 value.randomState_.seed_ = randomService->
mySeed();
227 std::cerr << uniqueID <<
" process: event " << counter << std::endl;
229 serializer.serialize(
value);
232 <<
" " << counter << std::endl;
238 std::cerr << uniqueID <<
" process: start endLumi " << std::endl;
239 auto value = harness.getEndLumiValue();
241 el_serializer.serialize(
value);
243 std::cerr << uniqueID <<
" process: end endLumi " << std::endl;
249 std::cerr << uniqueID <<
" process: start endRun " << std::endl;
250 auto value = harness.getEndRunValue();
252 er_serializer.serialize(
value);
254 std::cerr << uniqueID <<
" process: end endRun " << std::endl;
263 std::cerr << uniqueID <<
" process: notifying and waiting " << counter << std::endl;
267 std::cerr <<
"caught exception \n" << iExcept.what() <<
"\n";
static char const *const kHelpOpt
static char const *const kMemoryNameCommandOpt
void setState(std::vector< unsigned long > const &, long seed)
void setupSignalHandling()
Sets the unix signal handler which communicates with the thread.
static char const *const kMemoryNameOpt
void setAction(std::function< void()> iFunc)
static char const *const kHelpCommandOpt
std::vector< unsigned long > getState() const
static ServiceToken createContaining(std::unique_ptr< T > iService)
create a service token that holds the service defined by iService
static char const *const kVerboseOpt
static char const *const kVerboseCommandOpt
std::uint32_t mySeed() const final
static char const *const kUniqueIDCommandOpt
static char const *const kUniqueIDOpt
static std::atomic< unsigned int > counter