CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
NVProfilerService.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Services
4 // Class : NVProfilerService
5 
6 #include <algorithm>
7 #include <iostream>
8 #include <sstream>
9 #include <string>
10 #include <vector>
11 
12 #include <tbb/enumerable_thread_specific.h>
13 #include <tbb/concurrent_vector.h>
14 
15 #include <boost/format.hpp>
16 
17 #include <cuda_profiler_api.h>
18 #include <nvToolsExt.h>
19 
43 
44 using namespace std::string_literals;
45 
46 namespace {
47  int nvtxDomainRangePush(nvtxDomainHandle_t domain, const char* message) {
48  nvtxEventAttributes_t eventAttrib = { 0 };
49  eventAttrib.version = NVTX_VERSION;
50  eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
51  eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
52  eventAttrib.message.ascii = message;
53  return nvtxDomainRangePushEx(domain, &eventAttrib);
54  }
55 
56  __attribute__((unused))
57  int nvtxDomainRangePushColor(nvtxDomainHandle_t domain, const char* message, uint32_t color) {
58  nvtxEventAttributes_t eventAttrib = { 0 };
59  eventAttrib.version = NVTX_VERSION;
60  eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
61  eventAttrib.colorType = NVTX_COLOR_ARGB;
62  eventAttrib.color = color;
63  eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
64  eventAttrib.message.ascii = message;
65  return nvtxDomainRangePushEx(domain, &eventAttrib);
66  }
67 
68  nvtxRangeId_t nvtxDomainRangeStart(nvtxDomainHandle_t domain, const char* message) {
69  nvtxEventAttributes_t eventAttrib = { 0 };
70  eventAttrib.version = NVTX_VERSION;
71  eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
72  eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
73  eventAttrib.message.ascii = message;
74  return nvtxDomainRangeStartEx(domain, &eventAttrib);
75  }
76 
77  nvtxRangeId_t nvtxDomainRangeStartColor(nvtxDomainHandle_t domain, const char* message, uint32_t color) {
78  nvtxEventAttributes_t eventAttrib = { 0 };
79  eventAttrib.version = NVTX_VERSION;
80  eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
81  eventAttrib.colorType = NVTX_COLOR_ARGB;
82  eventAttrib.color = color;
83  eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
84  eventAttrib.message.ascii = message;
85  return nvtxDomainRangeStartEx(domain, &eventAttrib);
86  }
87 
88  void nvtxDomainMark(nvtxDomainHandle_t domain, const char* message) {
89  nvtxEventAttributes_t eventAttrib = { 0 };
90  eventAttrib.version = NVTX_VERSION;
91  eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
92  eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
93  eventAttrib.message.ascii = message;
94  nvtxDomainMarkEx(domain, &eventAttrib);
95  }
96 
97  __attribute__((unused))
98  void nvtxDomainMarkColor(nvtxDomainHandle_t domain, const char* message, uint32_t color) {
99  nvtxEventAttributes_t eventAttrib = { 0 };
100  eventAttrib.version = NVTX_VERSION;
101  eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
102  eventAttrib.colorType = NVTX_COLOR_ARGB;
103  eventAttrib.color = color;
104  eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
105  eventAttrib.message.ascii = message;
106  nvtxDomainMarkEx(domain, &eventAttrib);
107  }
108 
109  enum {
110  nvtxBlack = 0x00000000,
111  nvtxRed = 0x00ff0000,
112  nvtxDarkGreen = 0x0000c000,
113  nvtxGreen = 0x0000ff00,
114  nvtxBlue = 0x000000ff,
115  nvtxAmber = 0x00ffbf00,
116  nvtxWhite = 0x00ffffff
117  };
118 }
119 
121 public:
124 
125  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
126 
127  void preallocate(edm::service::SystemBounds const&);
128 
129  // these signal pair are NOT guaranteed to be called by the same thread
130  void preBeginJob(edm::PathsAndConsumesOfModulesBase const&, edm::ProcessContext const&);
131  void postBeginJob();
132 
133  // there is no preEndJob() signal
134  void postEndJob();
135 
136  // these signal pair are NOT guaranteed to be called by the same thread
137  void preGlobalBeginRun(edm::GlobalContext const&);
138  void postGlobalBeginRun(edm::GlobalContext const&);
139 
140  // these signal pair are NOT guaranteed to be called by the same thread
141  void preGlobalEndRun(edm::GlobalContext const&);
142  void postGlobalEndRun(edm::GlobalContext const&);
143 
144  // these signal pair are NOT guaranteed to be called by the same thread
145  void preStreamBeginRun(edm::StreamContext const&);
146  void postStreamBeginRun(edm::StreamContext const&);
147 
148  // these signal pair are NOT guaranteed to be called by the same thread
149  void preStreamEndRun(edm::StreamContext const&);
150  void postStreamEndRun(edm::StreamContext const&);
151 
152  // these signal pair are NOT guaranteed to be called by the same thread
153  void preGlobalBeginLumi(edm::GlobalContext const&);
154  void postGlobalBeginLumi(edm::GlobalContext const&);
155 
156  // these signal pair are NOT guaranteed to be called by the same thread
157  void preGlobalEndLumi(edm::GlobalContext const&);
158  void postGlobalEndLumi(edm::GlobalContext const&);
159 
160  // these signal pair are NOT guaranteed to be called by the same thread
161  void preStreamBeginLumi(edm::StreamContext const&);
162  void postStreamBeginLumi(edm::StreamContext const&);
163 
164  // these signal pair are NOT guaranteed to be called by the same thread
165  void preStreamEndLumi(edm::StreamContext const&);
166  void postStreamEndLumi(edm::StreamContext const&);
167 
168  // these signal pair are NOT guaranteed to be called by the same thread
169  void preEvent(edm::StreamContext const&);
170  void postEvent(edm::StreamContext const&);
171 
172  // these signal pair are NOT guaranteed to be called by the same thread
173  void prePathEvent(edm::StreamContext const&, edm::PathContext const&);
174  void postPathEvent(edm::StreamContext const&, edm::PathContext const&, edm::HLTPathStatus const&);
175 
176  // these signal pair are NOT guaranteed to be called by the same thread
177  void preModuleEventPrefetching(edm::StreamContext const&, edm::ModuleCallingContext const&);
178  void postModuleEventPrefetching(edm::StreamContext const&, edm::ModuleCallingContext const&);
179 
180  // these signal pair are guaranteed to be called by the same thread
181  void preOpenFile(std::string const&, bool);
182  void postOpenFile(std::string const&, bool);
183 
184  // these signal pair are guaranteed to be called by the same thread
185  void preCloseFile(std::string const&, bool);
186  void postCloseFile(std::string const&, bool);
187 
188  // these signal pair are guaranteed to be called by the same thread
189  void preSourceConstruction(edm::ModuleDescription const&);
190  void postSourceConstruction(edm::ModuleDescription const&);
191 
192  // these signal pair are guaranteed to be called by the same thread
193  void preSourceRun();
194  void postSourceRun();
195 
196  // these signal pair are guaranteed to be called by the same thread
197  void preSourceLumi();
198  void postSourceLumi();
199 
200  // these signal pair are guaranteed to be called by the same thread
201  void preSourceEvent(edm::StreamID);
202  void postSourceEvent(edm::StreamID);
203 
204  // these signal pair are guaranteed to be called by the same thread
205  void preModuleConstruction(edm::ModuleDescription const&);
206  void postModuleConstruction(edm::ModuleDescription const&);
207 
208  // these signal pair are guaranteed to be called by the same thread
209  void preModuleBeginJob(edm::ModuleDescription const&);
210  void postModuleBeginJob(edm::ModuleDescription const&);
211 
212  // these signal pair are guaranteed to be called by the same thread
213  void preModuleEndJob(edm::ModuleDescription const&);
214  void postModuleEndJob(edm::ModuleDescription const&);
215 
216  // these signal pair are guaranteed to be called by the same thread
217  void preModuleBeginStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
218  void postModuleBeginStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
219 
220  // these signal pair are guaranteed to be called by the same thread
221  void preModuleEndStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
222  void postModuleEndStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
223 
224  // these signal pair are guaranteed to be called by the same thread
225  void preModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
226  void postModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
227 
228  // these signal pair are guaranteed to be called by the same thread
229  void preModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
230  void postModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
231 
232  // these signal pair are guaranteed to be called by the same thread
233  void preModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
234  void postModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
235 
236  // these signal pair are guaranteed to be called by the same thread
237  void preModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
238  void postModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
239 
240  // these signal pair are guaranteed to be called by the same thread
241  void preModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
242  void postModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
243 
244  // these signal pair are guaranteed to be called by the same thread
245  void preModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
246  void postModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
247 
248  // these signal pair are guaranteed to be called by the same thread
249  void preModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
250  void postModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
251 
252  // these signal pair are guaranteed to be called by the same thread
253  void preModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
254  void postModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
255 
256  // these signal pair are guaranteed to be called by the same thread
257  void preModuleEvent(edm::StreamContext const&, edm::ModuleCallingContext const&);
258  void postModuleEvent(edm::StreamContext const&, edm::ModuleCallingContext const&);
259 
260  // these signal pair are guaranteed to be called by the same thread
261  void preModuleEventDelayedGet(edm::StreamContext const&, edm::ModuleCallingContext const&);
262  void postModuleEventDelayedGet(edm::StreamContext const&, edm::ModuleCallingContext const&);
263 
264  // these signal pair are guaranteed to be called by the same thread
265  void preEventReadFromSource(edm::StreamContext const&, edm::ModuleCallingContext const&);
266  void postEventReadFromSource(edm::StreamContext const&, edm::ModuleCallingContext const&);
267 
268 private:
269  bool highlight(std::string const&);
270 
271  std::vector<std::string> highlightModules_;
272 
273  unsigned int concurrentStreams_;
274  std::vector<nvtxRangeId_t> event_; // per-stream event ranges
275  std::vector<std::vector<nvtxRangeId_t>> stream_modules_; // per-stream, per-module ranges
276  // use a tbb::concurrent_vector rather than an std::vector because its final size is not known
277  tbb::concurrent_vector<nvtxRangeId_t> global_modules_; // global per-module events
278 
279 private:
280  struct Domains {
281  nvtxDomainHandle_t global;
282  std::vector<nvtxDomainHandle_t> stream;
283 
285  global = nvtxDomainCreate("EDM Global");
286  allocate_streams(service->concurrentStreams_);
287  }
288 
290  nvtxDomainDestroy(global);
291  for (unsigned int sid = 0; sid < stream.size(); ++sid) {
292  nvtxDomainDestroy(stream[sid]);
293  }
294  }
295 
296  void allocate_streams(unsigned int streams) {
297  stream.resize(streams);
298  for (unsigned int sid = 0; sid < streams; ++sid) {
299  stream[sid] = nvtxDomainCreate((boost::format("EDM Stream %d") % sid).str().c_str());
300  }
301  }
302  };
303 
304  // allow access to concurrentStreams_
305  friend struct Domains;
306 
307  tbb::enumerable_thread_specific<Domains> domains_;
308 
309  nvtxDomainHandle_t global_domain() {
310  return domains_.local().global;
311  }
312 
313  nvtxDomainHandle_t stream_domain(unsigned int sid) {
314  return domains_.local().stream.at(sid);
315  }
316 
317 };
318 
320  highlightModules_(config.getUntrackedParameter<std::vector<std::string>>("highlightModules")),
321  concurrentStreams_(0),
322  domains_(this)
323 {
324  std::sort(highlightModules_.begin(), highlightModules_.end());
325 
326  // enables profile collection; if profiling is already enabled, has no effect
327  cudaProfilerStart();
328 
330 
331  // these signal pair are NOT guaranteed to be called by the same thread
334 
335  // there is no preEndJob() signal
337 
338  // these signal pair are NOT guaranteed to be called by the same thread
341 
342  // these signal pair are NOT guaranteed to be called by the same thread
345 
346  // these signal pair are NOT guaranteed to be called by the same thread
349 
350  // these signal pair are NOT guaranteed to be called by the same thread
353 
354  // these signal pair are NOT guaranteed to be called by the same thread
357 
358  // these signal pair are NOT guaranteed to be called by the same thread
361 
362  // these signal pair are NOT guaranteed to be called by the same thread
365 
366  // these signal pair are NOT guaranteed to be called by the same thread
369 
370  // these signal pair are NOT guaranteed to be called by the same thread
373 
374  // these signal pair are NOT guaranteed to be called by the same thread
377 
378  // these signal pair are NOT guaranteed to be called by the same thread
381 
382  // these signal pair are guaranteed to be called by the same thread
385 
386  // these signal pair are guaranteed to be called by the same thread
389 
390  // these signal pair are guaranteed to be called by the same thread
393 
394  // these signal pair are guaranteed to be called by the same thread
397 
398  // these signal pair are guaranteed to be called by the same thread
401 
402  // these signal pair are guaranteed to be called by the same thread
405 
406  // these signal pair are guaranteed to be called by the same thread
409 
410  // these signal pair are guaranteed to be called by the same thread
413 
414  // these signal pair are guaranteed to be called by the same thread
417 
418  // these signal pair are guaranteed to be called by the same thread
421 
422  // these signal pair are guaranteed to be called by the same thread
425 
426  // these signal pair are guaranteed to be called by the same thread
429 
430  // these signal pair are guaranteed to be called by the same thread
433 
434  // these signal pair are guaranteed to be called by the same thread
437 
438  // these signal pair are guaranteed to be called by the same thread
441 
442  // these signal pair are guaranteed to be called by the same thread
445 
446  // these signal pair are guaranteed to be called by the same thread
449 
450  // these signal pair are guaranteed to be called by the same thread
453 
454  // these signal pair are guaranteed to be called by the same thread
457 
458  // these signal pair are guaranteed to be called by the same thread
461 
462  // these signal pair are guaranteed to be called by the same thread
465 
466  // these signal pair are guaranteed to be called by the same thread
469 }
470 
472  cudaProfilerStop();
473 }
474 
475 bool
477  return (std::binary_search(highlightModules_.begin(), highlightModules_.end(), label));
478 }
479 
480 void
483  desc.addUntracked<std::vector<std::string>>("highlightModules", {})->setComment("");
484  desc.addUntracked<bool>("showDelayedModules", true)->setComment("");
485  descriptions.add("NVProfilerService", desc);
486  descriptions.setComment("This Service provides CMSSW-aware annotations to nvprof/nvvm.");
487 }
488 
489 void
491  std::stringstream out;
492  out << "preallocate: " << bounds.maxNumberOfConcurrentRuns() << " concurrent runs, "
493  << bounds.maxNumberOfConcurrentLuminosityBlocks() << " luminosity sections, "
494  << bounds.maxNumberOfStreams() << " streams\nrunning on"
495  << bounds.maxNumberOfThreads() << " threads";
496  nvtxDomainMark(global_domain(), out.str().c_str());
497 
499  for (auto& domain: domains_) {
500  domain.allocate_streams(concurrentStreams_);
501  }
502  event_.resize(concurrentStreams_);
503  stream_modules_.resize(concurrentStreams_);
504 }
505 
506 void
508  nvtxDomainMark(global_domain(), "preBeginJob");
509 
510  // FIXME this probably works only in the absence of subprocesses
511  unsigned int modules = pathsAndConsumes.allModules().size();
512  global_modules_.resize(modules);
513  for (unsigned int sid = 0; sid < concurrentStreams_; ++sid) {
514  stream_modules_[sid].resize(modules);
515  }
516 }
517 
518 void
520  nvtxDomainMark(global_domain(), "postBeginJob");
521 }
522 
523 void
525  nvtxDomainMark(global_domain(), "postEndJob");
526 }
527 
528 void
530  nvtxDomainRangePush(stream_domain(sid), "source");
531 }
532 
533 void
535  nvtxDomainRangePop(stream_domain(sid));
536 }
537 
538 void
540  nvtxDomainRangePush(global_domain(), "source lumi");
541 }
542 
543 void
545  nvtxDomainRangePop(global_domain());
546 }
547 
548 void
550  nvtxDomainRangePush(global_domain(), "source run");
551 }
552 
553 void
555  nvtxDomainRangePop(global_domain());
556 }
557 
558 void
560  nvtxDomainRangePush(global_domain(), ("open file "s + lfn).c_str());
561 }
562 
563 void
565  nvtxDomainRangePop(global_domain());
566 }
567 
568 void
570  nvtxDomainRangePush(global_domain(), ("close file "s + lfn).c_str());
571 }
572 
573 void
575  nvtxDomainRangePop(global_domain());
576 }
577 
578 void
580  auto sid = sc.streamID();
581  auto mid = mcc.moduleDescription()->id();
582  auto const & label = mcc.moduleDescription()->moduleLabel();
583  auto const & msg = label + " begin stream";
584  if (highlight(label))
585  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
586  else
587  stream_modules_[sid][mid] = nvtxDomainRangeStart(stream_domain(sid), msg.c_str());
588 }
589 
590 void
592  auto sid = sc.streamID();
593  auto mid = mcc.moduleDescription()->id();
594  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
595 }
596 
597 void
599  auto sid = sc.streamID();
600  auto mid = mcc.moduleDescription()->id();
601  auto const & label = mcc.moduleDescription()->moduleLabel();
602  auto const & msg = label + " end stream";
603  if (highlight(label))
604  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
605  else
606  stream_modules_[sid][mid] = nvtxDomainRangeStart(stream_domain(sid), msg.c_str());
607 }
608 
609 void
611  auto sid = sc.streamID();
612  auto mid = mcc.moduleDescription()->id();
613  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
614 }
615 
616 void
618  nvtxDomainRangePush(global_domain(), "global begin run");
619 }
620 
621 void
623  nvtxDomainRangePop(global_domain());
624 }
625 
626 void
628  nvtxDomainRangePush(global_domain(), "global end run");
629 }
630 
631 void
633  nvtxDomainRangePop(global_domain());
634 }
635 
636 void
638  auto sid = sc.streamID();
639  nvtxDomainRangePush(stream_domain(sid), "stream begin run");
640 }
641 
642 void
644  auto sid = sc.streamID();
645  nvtxDomainRangePop(stream_domain(sid));
646 }
647 
648 void
650  auto sid = sc.streamID();
651  nvtxDomainRangePush(stream_domain(sid), "stream end run");
652 }
653 
654 void
656  auto sid = sc.streamID();
657  nvtxDomainRangePop(stream_domain(sid));
658 }
659 
660 void
662  nvtxDomainRangePush(global_domain(), "global begin lumi");
663 }
664 
665 void
667  nvtxDomainRangePop(global_domain());
668 }
669 
670 void
672  nvtxDomainRangePush(global_domain(), "global end lumi");
673 }
674 
675 void
677  nvtxDomainRangePop(global_domain());
678 }
679 
680 void
682  auto sid = sc.streamID();
683  nvtxDomainRangePush(stream_domain(sid), "stream begin lumi");
684 }
685 
686 void
688  auto sid = sc.streamID();
689  nvtxDomainRangePop(stream_domain(sid));
690 }
691 
692 void
694  auto sid = sc.streamID();
695  nvtxDomainRangePush(stream_domain(sid), "stream end lumi");
696 }
697 
698 void
700  auto sid = sc.streamID();
701  nvtxDomainRangePop(stream_domain(sid));
702 }
703 
704 void
706  auto sid = sc.streamID();
707  event_[sid] = nvtxDomainRangeStartColor(stream_domain(sid), "event", nvtxDarkGreen);
708 }
709 
710 void
712  auto sid = sc.streamID();
713  nvtxDomainRangeEnd(stream_domain(sid), event_[sid]);
714 }
715 
716 void
718  auto sid = sc.streamID();
719  nvtxDomainMark(global_domain(), ("before path "s + pc.pathName()).c_str());
720 }
721 
722 void
724  auto sid = sc.streamID();
725  nvtxDomainMark(global_domain(), ("after path "s + pc.pathName()).c_str());
726 }
727 
728 void
730  auto sid = sc.streamID();
731  auto mid = mcc.moduleDescription()->id();
732  auto const & label = mcc.moduleDescription()->moduleLabel();
733  auto const & msg = label + " prefetching";
734  if (highlight(label))
735  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), label.c_str(), nvtxAmber);
736  else
737  stream_modules_[sid][mid] = nvtxDomainRangeStart(stream_domain(sid), label.c_str());
738 }
739 
740 void
742  auto sid = sc.streamID();
743  auto mid = mcc.moduleDescription()->id();
744  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
745 }
746 
747 void
749  auto mid = desc.id();
750  global_modules_.grow_to_at_least(mid+1);
751  auto const & label = desc.moduleLabel();
752  auto const & msg = label + " construction";
753  if (highlight(label))
754  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
755  else
756  global_modules_[mid] = nvtxDomainRangeStart(global_domain(), msg.c_str());
757 }
758 
759 void
761  auto mid = desc.id();
762  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
763 }
764 
765 void
767  auto mid = desc.id();
768  auto const & label = desc.moduleLabel();
769  auto const & msg = label + " begin job";
770  if (highlight(label))
771  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
772  else
773  global_modules_[mid] = nvtxDomainRangeStart(global_domain(), msg.c_str());
774 }
775 
776 void
778  auto mid = desc.id();
779  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
780 }
781 
782 void
784  auto mid = desc.id();
785  auto const & label = desc.moduleLabel();
786  auto const & msg = label + " end job";
787  if (highlight(label))
788  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
789  else
790  global_modules_[mid] = nvtxDomainRangeStart(global_domain(), msg.c_str());
791 }
792 
793 void
795  auto mid = desc.id();
796  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
797 }
798 
799 void
801  auto sid = sc.streamID();
802  auto mid = mcc.moduleDescription()->id();
803  auto const & label = mcc.moduleDescription()->moduleLabel();
804  if (highlight(label))
805  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), label.c_str(), nvtxAmber);
806  else
807  stream_modules_[sid][mid] = nvtxDomainRangeStart(stream_domain(sid), label.c_str());
808 }
809 
810 void
812  auto sid = sc.streamID();
813  auto mid = mcc.moduleDescription()->id();
814  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
815 }
816 
817 void
819  /* FIXME
820  auto sid = sc.streamID();
821  auto mid = mcc.moduleDescription()->id();
822  auto const & label = mcc.moduleDescription()->moduleLabel();
823  auto const & msg = label + " delayed get";
824  if (highlight(label))
825  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), label.c_str(), nvtxAmber);
826  else
827  stream_modules_[sid][mid] = nvtxDomainRangeStart(stream_domain(sid), label.c_str());
828  */
829 }
830 
831 void
833  /* FIXME
834  auto sid = sc.streamID();
835  auto mid = mcc.moduleDescription()->id();
836  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
837  */
838 }
839 
840 void
842  /* FIXME
843  auto sid = sc.streamID();
844  auto mid = mcc.moduleDescription()->id();
845  auto const & label = mcc.moduleDescription()->moduleLabel();
846  auto const & msg = label + " read from source";
847  if (highlight(label))
848  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
849  else
850  stream_modules_[sid][mid] = nvtxDomainRangeStart(stream_domain(sid), msg.c_str());
851  */
852 }
853 
854 void
856  /* FIXME
857  auto sid = sc.streamID();
858  auto mid = mcc.moduleDescription()->id();
859  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
860  */
861 }
862 
863 void
865  auto sid = sc.streamID();
866  auto mid = mcc.moduleDescription()->id();
867  auto const & label = mcc.moduleDescription()->moduleLabel();
868  auto const & msg = label + " stream begin run";
869  if (highlight(label))
870  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
871  else
872  stream_modules_[sid][mid] = nvtxDomainRangeStart(stream_domain(sid), msg.c_str());
873 }
874 
875 void
877  auto sid = sc.streamID();
878  auto mid = mcc.moduleDescription()->id();
879  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
880 }
881 
882 void
884  auto sid = sc.streamID();
885  auto mid = mcc.moduleDescription()->id();
886  auto const & label = mcc.moduleDescription()->moduleLabel();
887  auto const & msg = label + " stream end run";
888  if (highlight(label))
889  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
890  else
891  stream_modules_[sid][mid] = nvtxDomainRangeStart(stream_domain(sid), msg.c_str());
892 }
893 
894 void
896  auto sid = sc.streamID();
897  auto mid = mcc.moduleDescription()->id();
898  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
899 }
900 
901 void
903  auto sid = sc.streamID();
904  auto mid = mcc.moduleDescription()->id();
905  auto const & label = mcc.moduleDescription()->moduleLabel();
906  auto const & msg = label + " stream begin lumi";
907  if (highlight(label))
908  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
909  else
910  stream_modules_[sid][mid] = nvtxDomainRangeStart(stream_domain(sid), msg.c_str());
911 }
912 
913 void
915  auto sid = sc.streamID();
916  auto mid = mcc.moduleDescription()->id();
917  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
918 }
919 
920 void
922  auto sid = sc.streamID();
923  auto mid = mcc.moduleDescription()->id();
924  auto const & label = mcc.moduleDescription()->moduleLabel();
925  auto const & msg = label + " stream end lumi";
926  if (highlight(label))
927  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
928  else
929  stream_modules_[sid][mid] = nvtxDomainRangeStart(stream_domain(sid), msg.c_str());
930 }
931 
932 void
934  auto sid = sc.streamID();
935  auto mid = mcc.moduleDescription()->id();
936  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
937 }
938 
939 void
941  auto mid = mcc.moduleDescription()->id();
942  auto const & label = mcc.moduleDescription()->moduleLabel();
943  auto const & msg = label + " global begin run";
944  if (highlight(label))
945  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
946  else
947  global_modules_[mid] = nvtxDomainRangeStart(global_domain(), msg.c_str());
948 }
949 
950 void
952  auto mid = mcc.moduleDescription()->id();
953  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
954 }
955 
956 void
958  auto mid = mcc.moduleDescription()->id();
959  auto const & label = mcc.moduleDescription()->moduleLabel();
960  auto const & msg = label + " global end run";
961  if (highlight(label))
962  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
963  else
964  global_modules_[mid] = nvtxDomainRangeStart(global_domain(), msg.c_str());
965 }
966 
967 void
969  auto mid = mcc.moduleDescription()->id();
970  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
971 }
972 
973 void
975  auto mid = mcc.moduleDescription()->id();
976  auto const & label = mcc.moduleDescription()->moduleLabel();
977  auto const & msg = label + " global begin lumi";
978  if (highlight(label))
979  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
980  else
981  global_modules_[mid] = nvtxDomainRangeStart(global_domain(), msg.c_str());
982 }
983 
984 void
986  auto mid = mcc.moduleDescription()->id();
987  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
988 }
989 
990 void
992  auto mid = mcc.moduleDescription()->id();
993  auto const & label = mcc.moduleDescription()->moduleLabel();
994  auto const & msg = label + " global end lumi";
995  if (highlight(label))
996  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
997  else
998  global_modules_[mid] = nvtxDomainRangeStart(global_domain(), msg.c_str());
999 }
1000 
1001 void
1003  auto mid = mcc.moduleDescription()->id();
1004  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
1005 }
1006 
1007 void
1009  auto mid = desc.id();
1010  global_modules_.grow_to_at_least(mid+1);
1011  auto const & label = desc.moduleLabel();
1012  auto const & msg = label + " construction";
1013  if (highlight(label))
1014  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
1015  else
1016  global_modules_[mid] = nvtxDomainRangeStart(global_domain(), msg.c_str());
1017 }
1018 
1019 void
1021  auto mid = desc.id();
1022  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
1023 }
1024 
void watchPostModuleGlobalEndLumi(PostModuleGlobalEndLumi::slot_type const &iSlot)
void watchPostModuleConstruction(PostModuleConstruction::slot_type const &iSlot)
std::string const & pathName() const
Definition: PathContext.h:37
unsigned int maxNumberOfThreads() const
Definition: SystemBounds.h:46
void watchPreModuleGlobalBeginRun(PreModuleGlobalBeginRun::slot_type const &iSlot)
void watchPreEvent(PreEvent::slot_type const &iSlot)
void postStreamEndLumi(edm::StreamContext const &)
void preOpenFile(std::string const &, bool)
void preModuleEventPrefetching(edm::StreamContext const &, edm::ModuleCallingContext const &)
void preGlobalBeginRun(edm::GlobalContext const &)
void postGlobalEndRun(edm::GlobalContext const &)
void preGlobalEndLumi(edm::GlobalContext const &)
void postOpenFile(std::string const &, bool)
void postModuleEventDelayedGet(edm::StreamContext const &, edm::ModuleCallingContext const &)
void postModuleStreamBeginLumi(edm::StreamContext const &, edm::ModuleCallingContext const &)
void watchPrePathEvent(PrePathEvent::slot_type const &iSlot)
void watchPreallocate(Preallocate::slot_type const &iSlot)
void postModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
tbb::enumerable_thread_specific< Domains > domains_
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void preModuleEndStream(edm::StreamContext const &, edm::ModuleCallingContext const &)
void watchPostModuleEndStream(PostModuleEndStream::slot_type const &iSlot)
void postCloseFile(std::string const &, bool)
void watchPreModuleEvent(PreModuleEvent::slot_type const &iSlot)
void watchPreModuleConstruction(PreModuleConstruction::slot_type const &iSlot)
void watchPreGlobalEndLumi(PreGlobalEndLumi::slot_type const &iSlot)
void watchPostEvent(PostEvent::slot_type const &iSlot)
void preStreamBeginLumi(edm::StreamContext const &)
void preModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
Domains(NVProfilerService *service)
void watchPreStreamEndRun(PreStreamEndRun::slot_type const &iSlot)
void watchPreSourceConstruction(PreSourceConstruction::slot_type const &iSlot)
void watchPostSourceConstruction(PostSourceConstruction::slot_type const &iSlot)
void watchPostStreamEndLumi(PostStreamEndLumi::slot_type const &iSlot)
void watchPreGlobalBeginLumi(PreGlobalBeginLumi::slot_type const &iSlot)
void preModuleStreamBeginLumi(edm::StreamContext const &, edm::ModuleCallingContext const &)
void postSourceConstruction(edm::ModuleDescription const &)
void preModuleStreamBeginRun(edm::StreamContext const &, edm::ModuleCallingContext const &)
void watchPreEventReadFromSource(PreEventReadFromSource::slot_type const &iSlot)
void watchPostPathEvent(PostPathEvent::slot_type const &iSlot)
float __attribute__((vector_size(8))) cms_float32x2_t
Definition: ExtVec.h:12
void watchPostModuleEvent(PostModuleEvent::slot_type const &iSlot)
void watchPostModuleGlobalBeginLumi(PostModuleGlobalBeginLumi::slot_type const &iSlot)
void preCloseFile(std::string const &, bool)
void watchPostModuleStreamEndLumi(PostModuleStreamEndLumi::slot_type const &iSlot)
void watchPostGlobalBeginLumi(PostGlobalBeginLumi::slot_type const &iSlot)
void watchPostModuleStreamBeginRun(PostModuleStreamBeginRun::slot_type const &iSlot)
void watchPostSourceEvent(PostSourceEvent::slot_type const &iSlot)
nvtxDomainHandle_t global_domain()
void postStreamEndRun(edm::StreamContext const &)
std::vector< nvtxDomainHandle_t > stream
Definition: config.py:1
std::vector< std::vector< nvtxRangeId_t > > stream_modules_
void postModuleEndJob(edm::ModuleDescription const &)
void postGlobalEndLumi(edm::GlobalContext const &)
void preModuleEndJob(edm::ModuleDescription const &)
void preModuleGlobalBeginLumi(edm::GlobalContext const &, edm::ModuleCallingContext const &)
void watchPreModuleBeginStream(PreModuleBeginStream::slot_type const &iSlot)
void preGlobalBeginLumi(edm::GlobalContext const &)
void watchPreStreamEndLumi(PreStreamEndLumi::slot_type const &iSlot)
std::string const & moduleLabel() const
void watchPreModuleGlobalEndRun(PreModuleGlobalEndRun::slot_type const &iSlot)
void watchPreModuleEventPrefetching(PreModuleEventPrefetching::slot_type const &iSlot)
void preModuleStreamEndLumi(edm::StreamContext const &, edm::ModuleCallingContext const &)
void postModuleConstruction(edm::ModuleDescription const &)
std::vector< ModuleDescription const * > const & allModules() const
void postModuleEventPrefetching(edm::StreamContext const &, edm::ModuleCallingContext const &)
void preModuleGlobalBeginRun(edm::GlobalContext const &, edm::ModuleCallingContext const &)
void preGlobalEndRun(edm::GlobalContext const &)
void postSourceEvent(edm::StreamID)
void watchPostModuleEventPrefetching(PostModuleEventPrefetching::slot_type const &iSlot)
void preStreamEndRun(edm::StreamContext const &)
unsigned int maxNumberOfStreams() const
Definition: SystemBounds.h:43
void postModuleGlobalEndLumi(edm::GlobalContext const &, edm::ModuleCallingContext const &)
void watchPreOpenFile(PreOpenFile::slot_type const &iSlot)
void watchPostGlobalBeginRun(PostGlobalBeginRun::slot_type const &iSlot)
void watchPostCloseFile(PostCloseFile::slot_type const &iSlot)
void watchPreGlobalEndRun(PreGlobalEndRun::slot_type const &iSlot)
void preModuleEventDelayedGet(edm::StreamContext const &, edm::ModuleCallingContext const &)
void watchPostSourceRun(PostSourceRun::slot_type const &iSlot)
void watchPostStreamBeginLumi(PostStreamBeginLumi::slot_type const &iSlot)
void preSourceConstruction(edm::ModuleDescription const &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void watchPreSourceLumi(PreSourceLumi::slot_type const &iSlot)
void postModuleGlobalEndRun(edm::GlobalContext const &, edm::ModuleCallingContext const &)
void watchPreModuleEventDelayedGet(PreModuleEventDelayedGet::slot_type const &iSlot)
ModuleDescription const * moduleDescription() const
void preModuleGlobalEndRun(edm::GlobalContext const &, edm::ModuleCallingContext const &)
void preBeginJob(edm::PathsAndConsumesOfModulesBase const &, edm::ProcessContext const &)
void watchPreModuleEndJob(PreModuleEndJob::slot_type const &iSlot)
void postPathEvent(edm::StreamContext const &, edm::PathContext const &, edm::HLTPathStatus const &)
void postStreamBeginLumi(edm::StreamContext const &)
void preStreamEndLumi(edm::StreamContext const &)
void watchPostGlobalEndLumi(PostGlobalEndLumi::slot_type const &iSlot)
format
Some error handling for the usage.
void watchPreSourceRun(PreSourceRun::slot_type const &iSlot)
void preModuleBeginJob(edm::ModuleDescription const &)
void watchPreModuleBeginJob(PreModuleBeginJob::slot_type const &iSlot)
void postGlobalBeginLumi(edm::GlobalContext const &)
void watchPostStreamEndRun(PostStreamEndRun::slot_type const &iSlot)
tbb::concurrent_vector< nvtxRangeId_t > global_modules_
std::vector< nvtxRangeId_t > event_
void postEventReadFromSource(edm::StreamContext const &, edm::ModuleCallingContext const &)
void postModuleBeginStream(edm::StreamContext const &, edm::ModuleCallingContext const &)
void watchPostModuleStreamEndRun(PostModuleStreamEndRun::slot_type const &iSlot)
void watchPreModuleGlobalBeginLumi(PreModuleGlobalBeginLumi::slot_type const &iSlot)
void postModuleGlobalBeginRun(edm::GlobalContext const &, edm::ModuleCallingContext const &)
void preModuleBeginStream(edm::StreamContext const &, edm::ModuleCallingContext const &)
StreamID const & streamID() const
Definition: StreamContext.h:57
void preSourceEvent(edm::StreamID)
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
void watchPreModuleStreamBeginLumi(PreModuleStreamBeginLumi::slot_type const &iSlot)
#define DEFINE_FWK_SERVICE(type)
Definition: ServiceMaker.h:113
void setComment(std::string const &value)
void watchPostModuleBeginStream(PostModuleBeginStream::slot_type const &iSlot)
void allocate_streams(unsigned int streams)
void preModuleConstruction(edm::ModuleDescription const &)
unsigned int maxNumberOfConcurrentLuminosityBlocks() const
Definition: SystemBounds.h:45
void watchPostSourceLumi(PostSourceLumi::slot_type const &iSlot)
NVProfilerService(const edm::ParameterSet &, edm::ActivityRegistry &)
unsigned int concurrentStreams_
void watchPreCloseFile(PreCloseFile::slot_type const &iSlot)
void watchPostModuleEventDelayedGet(PostModuleEventDelayedGet::slot_type const &iSlot)
void watchPostModuleGlobalEndRun(PostModuleGlobalEndRun::slot_type const &iSlot)
void watchPostModuleStreamBeginLumi(PostModuleStreamBeginLumi::slot_type const &iSlot)
void preStreamBeginRun(edm::StreamContext const &)
void postModuleStreamBeginRun(edm::StreamContext const &, edm::ModuleCallingContext const &)
void preModuleStreamEndRun(edm::StreamContext const &, edm::ModuleCallingContext const &)
void watchPreModuleStreamEndLumi(PreModuleStreamEndLumi::slot_type const &iSlot)
void watchPreModuleStreamBeginRun(PreModuleStreamBeginRun::slot_type const &iSlot)
void watchPostGlobalEndRun(PostGlobalEndRun::slot_type const &iSlot)
void watchPreStreamBeginLumi(PreStreamBeginLumi::slot_type const &iSlot)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void watchPostOpenFile(PostOpenFile::slot_type const &iSlot)
tuple msg
Definition: mps_check.py:277
void watchPreModuleEndStream(PreModuleEndStream::slot_type const &iSlot)
void postGlobalBeginRun(edm::GlobalContext const &)
void watchPreBeginJob(PreBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
void postModuleStreamEndLumi(edm::StreamContext const &, edm::ModuleCallingContext const &)
void postEvent(edm::StreamContext const &)
void watchPostStreamBeginRun(PostStreamBeginRun::slot_type const &iSlot)
void watchPreStreamBeginRun(PreStreamBeginRun::slot_type const &iSlot)
void preallocate(edm::service::SystemBounds const &)
void watchPreModuleStreamEndRun(PreModuleStreamEndRun::slot_type const &iSlot)
void postModuleEndStream(edm::StreamContext const &, edm::ModuleCallingContext const &)
void watchPostModuleBeginJob(PostModuleBeginJob::slot_type const &iSlot)
bool highlight(std::string const &)
void watchPostEventReadFromSource(PostEventReadFromSource::slot_type const &iSlot)
void watchPostModuleGlobalBeginRun(PostModuleGlobalBeginRun::slot_type const &iSlot)
void preEventReadFromSource(edm::StreamContext const &, edm::ModuleCallingContext const &)
unsigned int maxNumberOfConcurrentRuns() const
Definition: SystemBounds.h:44
nvtxDomainHandle_t stream_domain(unsigned int sid)
void preEvent(edm::StreamContext const &)
void preModuleGlobalEndLumi(edm::GlobalContext const &, edm::ModuleCallingContext const &)
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
void postStreamBeginRun(edm::StreamContext const &)
void prePathEvent(edm::StreamContext const &, edm::PathContext const &)
static Interceptor::Registry registry("Interceptor")
void postModuleStreamEndRun(edm::StreamContext const &, edm::ModuleCallingContext const &)
void postModuleGlobalBeginLumi(edm::GlobalContext const &, edm::ModuleCallingContext const &)
void watchPostModuleEndJob(PostModuleEndJob::slot_type const &iSlot)
std::vector< std::string > highlightModules_
void watchPreModuleGlobalEndLumi(PreModuleGlobalEndLumi::slot_type const &iSlot)
unsigned int id() const
void postModuleBeginJob(edm::ModuleDescription const &)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal