1 #include "boost/program_options.hpp" 10 #include "DataFormats/TestObjects/interface/ToyProducts.h" 31 using SentType = std::pair<edmtest::IntProduct, edm::RandomNumberGeneratorState>;
40 auto lumi = tester_.testBeginLuminosityBlock(iLumi);
41 return *
lumi.get<edmtest::IntProduct>(
"lumi");
45 auto event = tester_.test();
46 return *
event.get<edmtest::IntProduct>();
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;
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);
148 std::cerr << uniqueID <<
" process: done initializing" << std::endl;
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_);
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;
171 auto randState = random_deserializer.deserialize();
172 randomService->
setState(randState.state_, randState.seed_);
175 toSend.second.state_ = randomService->
getState();
176 toSend.second.seed_ = randomService->
mySeed();
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";
std::vector< unsigned long > getState() const
edmtest::ThingCollection getEventValue()
boost::interprocess::scoped_lock< boost::interprocess::named_mutex > * accessLock()
the lock is made accessible so that the WorkerMonitorThread can be used to unlock it in the event of ...
edmtest::ThingCollection getBeginLumiValue(unsigned int iLumi)
void setState(std::vector< unsigned long > const &, long seed)
void handleTransitions(F &&iF)
void setupSignalHandling()
Sets the unix signal handler which communicates with the thread.
void setAction(std::function< void()> iFunc)
static char const *const kHelpOpt
edmtest::IntProduct getBeginLumiValue(unsigned int iLumi)
BufferInfo * toWorkerBufferInfo()
This can be used with ReadBuffer to keep Controller and Worker in sync.
void workerSetupDone()
Matches the ControllerChannel::setupWorker call.
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
edmtest::IntProduct getEventValue()
BufferInfo * fromWorkerBufferInfo()
This can be used with WriteBuffer to keep Controller and Worker in sync.
static char const *const kUniqueIDCommandOpt
static char const *const kMemoryNameOpt
static char const *const kHelpCommandOpt
Harness(std::string const &iConfig, edm::ServiceToken iToken)
static char const *const kMemoryNameCommandOpt
static std::atomic< unsigned int > counter
static char const *const kUniqueIDOpt
int main(int argc, char *argv[])