@@ -54,10 +54,14 @@ namespace {
5454
5555 class HistoryNode {
5656 public:
57- HistoryNode () : config_(), simpleId_( 0 ) {}
57+ HistoryNode () = default ;
5858
59- HistoryNode (edm::ProcessConfiguration const & iConfig, unsigned int iSimpleId)
60- : config_(iConfig), simpleId_(iSimpleId) {}
59+ HistoryNode (edm::ProcessConfiguration const & iConfig,
60+ unsigned int iSimpleId,
61+ bool printHardwareResourcesDescription)
62+ : config_(iConfig),
63+ simpleId_ (iSimpleId),
64+ printHardwareResourcesDescription_(printHardwareResourcesDescription) {}
6165
6266 void addChild (HistoryNode const & child) { children_.push_back (child); }
6367
@@ -79,9 +83,21 @@ namespace {
7983 const_iterator end () const { return children_.end (); }
8084
8185 void print (std::ostream& os) const {
82- // TODO: add printout of HardwareResourcesDescription
8386 os << config_.processName () << " '" << config_.releaseVersion () << " ' [" << simpleId_ << " ] ("
84- << config_.parameterSetID () << " )" << std::endl;
87+ << config_.parameterSetID () << " )" ;
88+ if (printHardwareResourcesDescription_) {
89+ auto const & hwresources = config_.hardwareResourcesDescription ();
90+ os << " (" << hwresources.microarchitecture ;
91+ if (not hwresources.selectedAccelerators .empty ()) {
92+ os << " ; " << hwresources.selectedAccelerators .front ();
93+ for (auto it = hwresources.selectedAccelerators .begin () + 1 ; it != hwresources.selectedAccelerators .end ();
94+ ++it) {
95+ os << " ," << *it;
96+ }
97+ }
98+ os << " )" ;
99+ }
100+ os << std::endl;
85101 }
86102
87103 void printHistory (std::string const & iIndent = std::string(" " )) const ;
@@ -103,7 +119,8 @@ namespace {
103119 private:
104120 edm::ProcessConfiguration config_;
105121 std::vector<HistoryNode> children_;
106- unsigned int simpleId_;
122+ unsigned int simpleId_ = 0 ;
123+ bool printHardwareResourcesDescription_ = false ;
107124 };
108125
109126 std::ostream& operator <<(std::ostream& os, HistoryNode const & node) {
@@ -447,7 +464,8 @@ class ProvenanceDumper {
447464 std::vector<std::string> const & findMatch,
448465 bool dontPrintProducts,
449466 std::string const & dumpPSetID,
450- int productIDEntry);
467+ int productIDEntry,
468+ bool printHardwareResourcesDescription);
451469
452470 ProvenanceDumper (ProvenanceDumper const &) = delete ; // Disallow copying and moving
453471 ProvenanceDumper& operator =(ProvenanceDumper const &) = delete ; // Disallow copying and moving
@@ -489,6 +507,7 @@ class ProvenanceDumper {
489507 bool dontPrintProducts_;
490508 std::string dumpPSetID_;
491509 int const productIDEntry_;
510+ bool const printHardwareResourcesDescription_;
492511
493512 void work_ ();
494513 void dumpProcessHistory_ ();
@@ -508,7 +527,8 @@ ProvenanceDumper::ProvenanceDumper(std::string const& filename,
508527 std::vector<std::string> const & findMatch,
509528 bool dontPrintProducts,
510529 std::string const & dumpPSetID,
511- int productIDEntry)
530+ int productIDEntry,
531+ bool printHardwareResourcesDescription)
512532 : filename_(filename),
513533 inputFile_ (makeTFile(filename)),
514534 exitCode_(0 ),
@@ -524,7 +544,8 @@ ProvenanceDumper::ProvenanceDumper(std::string const& filename,
524544 findMatch_(findMatch),
525545 dontPrintProducts_(dontPrintProducts),
526546 dumpPSetID_(dumpPSetID),
527- productIDEntry_(productIDEntry) {}
547+ productIDEntry_(productIDEntry),
548+ printHardwareResourcesDescription_(printHardwareResourcesDescription) {}
528549
529550void ProvenanceDumper::dump () { work_ (); }
530551
@@ -614,7 +635,7 @@ void ProvenanceDumper::dumpProcessHistory_() {
614635 id = 1 ;
615636 simpleIDs[pc.id ()] = id;
616637 }
617- parent->addChild (HistoryNode (pc, id));
638+ parent->addChild (HistoryNode (pc, id, printHardwareResourcesDescription_ ));
618639 parent = parent->lastChildAddress ();
619640 } else {
620641 // see if this is unique
@@ -628,7 +649,7 @@ void ProvenanceDumper::dumpProcessHistory_() {
628649 }
629650 if (isUnique) {
630651 simpleIDs[pc.id ()] = parent->size () + 1 ;
631- parent->addChild (HistoryNode (pc, simpleIDs[pc.id ()]));
652+ parent->addChild (HistoryNode (pc, simpleIDs[pc.id ()], printHardwareResourcesDescription_ ));
632653 parent = parent->lastChildAddress ();
633654 }
634655 }
@@ -1131,6 +1152,7 @@ static char const* const kFileNameOpt = "input-file";
11311152static char const * const kDumpPSetIDOpt = " dumpPSetID" ;
11321153static char const * const kDumpPSetIDCommandOpt = " dumpPSetID,i" ;
11331154static char const * const kProductIDEntryOpt = " productIDEntry" ;
1155+ static char const * const kHardwareOpt = " hardware" ;
11341156
11351157int main (int argc, char * argv[]) {
11361158 using namespace boost ::program_options;
@@ -1158,7 +1180,9 @@ int main(int argc, char* argv[]) {
11581180 " print the parameter set associated with the parameter set ID string (and print nothing else)" )(
11591181 kProductIDEntryOpt ,
11601182 value<int >(),
1161- " show ProductID instead of BranchID using the specified entry in the Events tree" );
1183+ " show ProductID instead of BranchID using the specified entry in the Events tree" )(
1184+ kHardwareOpt ,
1185+ " include hardware provenance" );
11621186 // clang-format on
11631187
11641188 // we don't want users to see these in the help messages since this
@@ -1270,6 +1294,11 @@ int main(int argc, char* argv[]) {
12701294 }
12711295 }
12721296
1297+ bool printHardwareResourcesDescription = false ;
1298+ if (vm.count (kHardwareOpt )) {
1299+ printHardwareResourcesDescription = true ;
1300+ }
1301+
12731302 // silence ROOT warnings about missing dictionaries
12741303 gErrorIgnoreLevel = kError ;
12751304
@@ -1283,7 +1312,8 @@ int main(int argc, char* argv[]) {
12831312 findMatch,
12841313 dontPrintProducts,
12851314 dumpPSetID,
1286- productIDEntry);
1315+ productIDEntry,
1316+ printHardwareResourcesDescription);
12871317 int exitCode (0 );
12881318 try {
12891319 dumper.dump ();
0 commit comments