CMS 3D CMS Logo

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  __attribute__((unused))
69  nvtxRangeId_t nvtxDomainRangeStart(nvtxDomainHandle_t domain, const char* message) {
70  nvtxEventAttributes_t eventAttrib = { 0 };
71  eventAttrib.version = NVTX_VERSION;
72  eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
73  eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
74  eventAttrib.message.ascii = message;
75  return nvtxDomainRangeStartEx(domain, &eventAttrib);
76  }
77 
78  nvtxRangeId_t nvtxDomainRangeStartColor(nvtxDomainHandle_t domain, const char* message, uint32_t color) {
79  nvtxEventAttributes_t eventAttrib = { 0 };
80  eventAttrib.version = NVTX_VERSION;
81  eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
82  eventAttrib.colorType = NVTX_COLOR_ARGB;
83  eventAttrib.color = color;
84  eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
85  eventAttrib.message.ascii = message;
86  return nvtxDomainRangeStartEx(domain, &eventAttrib);
87  }
88 
89  void nvtxDomainMark(nvtxDomainHandle_t domain, const char* message) {
90  nvtxEventAttributes_t eventAttrib = { 0 };
91  eventAttrib.version = NVTX_VERSION;
92  eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
93  eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
94  eventAttrib.message.ascii = message;
95  nvtxDomainMarkEx(domain, &eventAttrib);
96  }
97 
98  __attribute__((unused))
99  void nvtxDomainMarkColor(nvtxDomainHandle_t domain, const char* message, uint32_t color) {
100  nvtxEventAttributes_t eventAttrib = { 0 };
101  eventAttrib.version = NVTX_VERSION;
102  eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
103  eventAttrib.colorType = NVTX_COLOR_ARGB;
104  eventAttrib.color = color;
105  eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
106  eventAttrib.message.ascii = message;
107  nvtxDomainMarkEx(domain, &eventAttrib);
108  }
109 
110  enum {
111  nvtxBlack = 0x00000000,
112  nvtxRed = 0x00ff0000,
113  nvtxDarkGreen = 0x00009900,
114  nvtxGreen = 0x0000ff00,
115  nvtxLightGreen = 0x00ccffcc,
116  nvtxBlue = 0x000000ff,
117  nvtxAmber = 0x00ffbf00,
118  nvtxLightAmber = 0x00fff2cc,
119  nvtxWhite = 0x00ffffff
120  };
121 }
122 
124 public:
127 
128  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
129 
130  void preallocate(edm::service::SystemBounds const&);
131 
132  // these signal pair are NOT guaranteed to be called by the same thread
133  void preBeginJob(edm::PathsAndConsumesOfModulesBase const&, edm::ProcessContext const&);
134  void postBeginJob();
135 
136  // there is no preEndJob() signal
137  void postEndJob();
138 
139  // these signal pair are NOT guaranteed to be called by the same thread
140  void preGlobalBeginRun(edm::GlobalContext const&);
141  void postGlobalBeginRun(edm::GlobalContext const&);
142 
143  // these signal pair are NOT guaranteed to be called by the same thread
144  void preGlobalEndRun(edm::GlobalContext const&);
145  void postGlobalEndRun(edm::GlobalContext const&);
146 
147  // these signal pair are NOT guaranteed to be called by the same thread
148  void preStreamBeginRun(edm::StreamContext const&);
149  void postStreamBeginRun(edm::StreamContext const&);
150 
151  // these signal pair are NOT guaranteed to be called by the same thread
152  void preStreamEndRun(edm::StreamContext const&);
153  void postStreamEndRun(edm::StreamContext const&);
154 
155  // these signal pair are NOT guaranteed to be called by the same thread
156  void preGlobalBeginLumi(edm::GlobalContext const&);
157  void postGlobalBeginLumi(edm::GlobalContext const&);
158 
159  // these signal pair are NOT guaranteed to be called by the same thread
160  void preGlobalEndLumi(edm::GlobalContext const&);
161  void postGlobalEndLumi(edm::GlobalContext const&);
162 
163  // these signal pair are NOT guaranteed to be called by the same thread
164  void preStreamBeginLumi(edm::StreamContext const&);
165  void postStreamBeginLumi(edm::StreamContext const&);
166 
167  // these signal pair are NOT guaranteed to be called by the same thread
168  void preStreamEndLumi(edm::StreamContext const&);
169  void postStreamEndLumi(edm::StreamContext const&);
170 
171  // these signal pair are NOT guaranteed to be called by the same thread
172  void preEvent(edm::StreamContext const&);
173  void postEvent(edm::StreamContext const&);
174 
175  // these signal pair are NOT guaranteed to be called by the same thread
176  void prePathEvent(edm::StreamContext const&, edm::PathContext const&);
177  void postPathEvent(edm::StreamContext const&, edm::PathContext const&, edm::HLTPathStatus const&);
178 
179  // these signal pair are NOT guaranteed to be called by the same thread
180  void preModuleEventPrefetching(edm::StreamContext const&, edm::ModuleCallingContext const&);
181  void postModuleEventPrefetching(edm::StreamContext const&, edm::ModuleCallingContext const&);
182 
183  // these signal pair are guaranteed to be called by the same thread
184  void preOpenFile(std::string const&, bool);
185  void postOpenFile(std::string const&, bool);
186 
187  // these signal pair are guaranteed to be called by the same thread
188  void preCloseFile(std::string const&, bool);
189  void postCloseFile(std::string const&, bool);
190 
191  // these signal pair are guaranteed to be called by the same thread
192  void preSourceConstruction(edm::ModuleDescription const&);
193  void postSourceConstruction(edm::ModuleDescription const&);
194 
195  // these signal pair are guaranteed to be called by the same thread
196  void preSourceRun(edm::RunIndex);
197  void postSourceRun(edm::RunIndex);
198 
199  // these signal pair are guaranteed to be called by the same thread
200  void preSourceLumi(edm::LuminosityBlockIndex);
201  void postSourceLumi(edm::LuminosityBlockIndex);
202 
203  // these signal pair are guaranteed to be called by the same thread
204  void preSourceEvent(edm::StreamID);
205  void postSourceEvent(edm::StreamID);
206 
207  // these signal pair are guaranteed to be called by the same thread
208  void preModuleConstruction(edm::ModuleDescription const&);
209  void postModuleConstruction(edm::ModuleDescription const&);
210 
211  // these signal pair are guaranteed to be called by the same thread
212  void preModuleBeginJob(edm::ModuleDescription const&);
213  void postModuleBeginJob(edm::ModuleDescription const&);
214 
215  // these signal pair are guaranteed to be called by the same thread
216  void preModuleEndJob(edm::ModuleDescription const&);
217  void postModuleEndJob(edm::ModuleDescription const&);
218 
219  // these signal pair are guaranteed to be called by the same thread
220  void preModuleBeginStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
221  void postModuleBeginStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
222 
223  // these signal pair are guaranteed to be called by the same thread
224  void preModuleEndStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
225  void postModuleEndStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
226 
227  // these signal pair are guaranteed to be called by the same thread
228  void preModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
229  void postModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
230 
231  // these signal pair are guaranteed to be called by the same thread
232  void preModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
233  void postModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
234 
235  // these signal pair are guaranteed to be called by the same thread
236  void preModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
237  void postModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
238 
239  // these signal pair are guaranteed to be called by the same thread
240  void preModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
241  void postModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
242 
243  // these signal pair are guaranteed to be called by the same thread
244  void preModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
245  void postModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
246 
247  // these signal pair are guaranteed to be called by the same thread
248  void preModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
249  void postModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
250 
251  // these signal pair are guaranteed to be called by the same thread
252  void preModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
253  void postModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
254 
255  // these signal pair are guaranteed to be called by the same thread
256  void preModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
257  void postModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
258 
259  // these signal pair are guaranteed to be called by the same thread
260  void preModuleEvent(edm::StreamContext const&, edm::ModuleCallingContext const&);
261  void postModuleEvent(edm::StreamContext const&, edm::ModuleCallingContext const&);
262 
263  // these signal pair are guaranteed to be called by the same thread
264  void preModuleEventDelayedGet(edm::StreamContext const&, edm::ModuleCallingContext const&);
265  void postModuleEventDelayedGet(edm::StreamContext const&, edm::ModuleCallingContext const&);
266 
267  // these signal pair are guaranteed to be called by the same thread
268  void preEventReadFromSource(edm::StreamContext const&, edm::ModuleCallingContext const&);
269  void postEventReadFromSource(edm::StreamContext const&, edm::ModuleCallingContext const&);
270 
271 private:
272  bool highlight(std::string const&);
273 
274  std::vector<std::string> highlightModules_;
276 
277  unsigned int concurrentStreams_;
278  std::vector<nvtxRangeId_t> event_; // per-stream event ranges
279  std::vector<std::vector<nvtxRangeId_t>> stream_modules_; // per-stream, per-module ranges
280  // use a tbb::concurrent_vector rather than an std::vector because its final size is not known
281  tbb::concurrent_vector<nvtxRangeId_t> global_modules_; // global per-module events
282 
283 private:
284  struct Domains {
285  nvtxDomainHandle_t global;
286  std::vector<nvtxDomainHandle_t> stream;
287 
289  global = nvtxDomainCreate("EDM Global");
290  allocate_streams(service->concurrentStreams_);
291  }
292 
294  nvtxDomainDestroy(global);
295  for (unsigned int sid = 0; sid < stream.size(); ++sid) {
296  nvtxDomainDestroy(stream[sid]);
297  }
298  }
299 
300  void allocate_streams(unsigned int streams) {
301  stream.resize(streams);
302  for (unsigned int sid = 0; sid < streams; ++sid) {
303  stream[sid] = nvtxDomainCreate((boost::format("EDM Stream %d") % sid).str().c_str());
304  }
305  }
306  };
307 
308  // allow access to concurrentStreams_
309  friend struct Domains;
310 
311  tbb::enumerable_thread_specific<Domains> domains_;
312 
313  nvtxDomainHandle_t global_domain() {
314  return domains_.local().global;
315  }
316 
317  nvtxDomainHandle_t stream_domain(unsigned int sid) {
318  return domains_.local().stream.at(sid);
319  }
320 
321 };
322 
324  highlightModules_(config.getUntrackedParameter<std::vector<std::string>>("highlightModules")),
325  showModulePrefetching_(config.getUntrackedParameter<bool>("showModulePrefetching")),
326  concurrentStreams_(0),
327  domains_(this)
328 {
329  std::sort(highlightModules_.begin(), highlightModules_.end());
330 
331  // enables profile collection; if profiling is already enabled, has no effect
332  cudaProfilerStart();
333 
335 
336  // these signal pair are NOT guaranteed to be called by the same thread
339 
340  // there is no preEndJob() signal
342 
343  // these signal pair are NOT guaranteed to be called by the same thread
346 
347  // these signal pair are NOT guaranteed to be called by the same thread
350 
351  // these signal pair are NOT guaranteed to be called by the same thread
354 
355  // these signal pair are NOT guaranteed to be called by the same thread
358 
359  // these signal pair are NOT guaranteed to be called by the same thread
362 
363  // these signal pair are NOT guaranteed to be called by the same thread
366 
367  // these signal pair are NOT guaranteed to be called by the same thread
370 
371  // these signal pair are NOT guaranteed to be called by the same thread
374 
375  // these signal pair are NOT guaranteed to be called by the same thread
378 
379  // these signal pair are NOT guaranteed to be called by the same thread
382 
383  // these signal pair are NOT guaranteed to be called by the same thread
386 
387  // these signal pair are guaranteed to be called by the same thread
390 
391  // these signal pair are guaranteed to be called by the same thread
394 
395  // these signal pair are guaranteed to be called by the same thread
398 
399  // these signal pair are guaranteed to be called by the same thread
402 
403  // these signal pair are guaranteed to be called by the same thread
406 
407  // these signal pair are guaranteed to be called by the same thread
410 
411  // these signal pair are guaranteed to be called by the same thread
414 
415  // these signal pair are guaranteed to be called by the same thread
418 
419  // these signal pair are guaranteed to be called by the same thread
422 
423  // these signal pair are guaranteed to be called by the same thread
426 
427  // these signal pair are guaranteed to be called by the same thread
430 
431  // these signal pair are guaranteed to be called by the same thread
434 
435  // these signal pair are guaranteed to be called by the same thread
438 
439  // these signal pair are guaranteed to be called by the same thread
442 
443  // these signal pair are guaranteed to be called by the same thread
446 
447  // these signal pair are guaranteed to be called by the same thread
450 
451  // these signal pair are guaranteed to be called by the same thread
454 
455  // these signal pair are guaranteed to be called by the same thread
458 
459  // these signal pair are guaranteed to be called by the same thread
462 
463  // these signal pair are guaranteed to be called by the same thread
466 
467  // these signal pair are guaranteed to be called by the same thread
470 
471  // these signal pair are guaranteed to be called by the same thread
474 }
475 
477  cudaProfilerStop();
478 }
479 
480 bool
482  return (std::binary_search(highlightModules_.begin(), highlightModules_.end(), label));
483 }
484 
485 void
488  desc.addUntracked<std::vector<std::string>>("highlightModules", {})->setComment("");
489  desc.addUntracked<bool>("showModulePrefetching", false)->setComment("Show the stack of dependencies that requested to run a module.");
490  descriptions.add("NVProfilerService", desc);
491  descriptions.setComment(R"(This Service provides CMSSW-aware annotations to nvprof/nvvm.
492 
493 Notes:
494  - the option '--cpu-profiling on' currently results in cmsRun being stuck at the beginning of the job.
495  - the option '--cpu-thread-tracing on' is not compatible with jemalloc, and should only be used with cmsRunGlibC.)");
496 }
497 
498 void
500  std::stringstream out;
501  out << "preallocate: " << bounds.maxNumberOfConcurrentRuns() << " concurrent runs, "
502  << bounds.maxNumberOfConcurrentLuminosityBlocks() << " luminosity sections, "
503  << bounds.maxNumberOfStreams() << " streams\nrunning on"
504  << bounds.maxNumberOfThreads() << " threads";
505  nvtxDomainMark(global_domain(), out.str().c_str());
506 
508  for (auto& domain: domains_) {
509  domain.allocate_streams(concurrentStreams_);
510  }
511  event_.resize(concurrentStreams_);
512  stream_modules_.resize(concurrentStreams_);
513 }
514 
515 void
517  nvtxDomainMark(global_domain(), "preBeginJob");
518 
519  // FIXME this probably works only in the absence of subprocesses
520  unsigned int modules = pathsAndConsumes.allModules().size();
521  global_modules_.resize(modules);
522  for (unsigned int sid = 0; sid < concurrentStreams_; ++sid) {
523  stream_modules_[sid].resize(modules);
524  }
525 }
526 
527 void
529  nvtxDomainMark(global_domain(), "postBeginJob");
530 }
531 
532 void
534  nvtxDomainMark(global_domain(), "postEndJob");
535 }
536 
537 void
539  nvtxDomainRangePush(stream_domain(sid), "source");
540 }
541 
542 void
544  nvtxDomainRangePop(stream_domain(sid));
545 }
546 
547 void
549  nvtxDomainRangePush(global_domain(), "source lumi");
550 }
551 
552 void
554  nvtxDomainRangePop(global_domain());
555 }
556 
557 void
559  nvtxDomainRangePush(global_domain(), "source run");
560 }
561 
562 void
564  nvtxDomainRangePop(global_domain());
565 }
566 
567 void
569  nvtxDomainRangePush(global_domain(), ("open file "s + lfn).c_str());
570 }
571 
572 void
574  nvtxDomainRangePop(global_domain());
575 }
576 
577 void
579  nvtxDomainRangePush(global_domain(), ("close file "s + lfn).c_str());
580 }
581 
582 void
584  nvtxDomainRangePop(global_domain());
585 }
586 
587 void
589  auto sid = sc.streamID();
590  auto mid = mcc.moduleDescription()->id();
591  auto const & label = mcc.moduleDescription()->moduleLabel();
592  auto const & msg = label + " begin stream";
593  if (highlight(label))
594  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
595  else
596  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxGreen);;
597 }
598 
599 void
601  auto sid = sc.streamID();
602  auto mid = mcc.moduleDescription()->id();
603  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
604 }
605 
606 void
608  auto sid = sc.streamID();
609  auto mid = mcc.moduleDescription()->id();
610  auto const & label = mcc.moduleDescription()->moduleLabel();
611  auto const & msg = label + " end stream";
612  if (highlight(label))
613  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
614  else
615  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxGreen);;
616 }
617 
618 void
620  auto sid = sc.streamID();
621  auto mid = mcc.moduleDescription()->id();
622  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
623 }
624 
625 void
627  nvtxDomainRangePush(global_domain(), "global begin run");
628 }
629 
630 void
632  nvtxDomainRangePop(global_domain());
633 }
634 
635 void
637  nvtxDomainRangePush(global_domain(), "global end run");
638 }
639 
640 void
642  nvtxDomainRangePop(global_domain());
643 }
644 
645 void
647  auto sid = sc.streamID();
648  nvtxDomainRangePush(stream_domain(sid), "stream begin run");
649 }
650 
651 void
653  auto sid = sc.streamID();
654  nvtxDomainRangePop(stream_domain(sid));
655 }
656 
657 void
659  auto sid = sc.streamID();
660  nvtxDomainRangePush(stream_domain(sid), "stream end run");
661 }
662 
663 void
665  auto sid = sc.streamID();
666  nvtxDomainRangePop(stream_domain(sid));
667 }
668 
669 void
671  nvtxDomainRangePush(global_domain(), "global begin lumi");
672 }
673 
674 void
676  nvtxDomainRangePop(global_domain());
677 }
678 
679 void
681  nvtxDomainRangePush(global_domain(), "global end lumi");
682 }
683 
684 void
686  nvtxDomainRangePop(global_domain());
687 }
688 
689 void
691  auto sid = sc.streamID();
692  nvtxDomainRangePush(stream_domain(sid), "stream begin lumi");
693 }
694 
695 void
697  auto sid = sc.streamID();
698  nvtxDomainRangePop(stream_domain(sid));
699 }
700 
701 void
703  auto sid = sc.streamID();
704  nvtxDomainRangePush(stream_domain(sid), "stream end lumi");
705 }
706 
707 void
709  auto sid = sc.streamID();
710  nvtxDomainRangePop(stream_domain(sid));
711 }
712 
713 void
715  auto sid = sc.streamID();
716  event_[sid] = nvtxDomainRangeStartColor(stream_domain(sid), "event", nvtxDarkGreen);
717 }
718 
719 void
721  auto sid = sc.streamID();
722  nvtxDomainRangeEnd(stream_domain(sid), event_[sid]);
723 }
724 
725 void
727  auto sid = sc.streamID();
728  nvtxDomainMark(global_domain(), ("before path "s + pc.pathName()).c_str());
729 }
730 
731 void
733  auto sid = sc.streamID();
734  nvtxDomainMark(global_domain(), ("after path "s + pc.pathName()).c_str());
735 }
736 
737 void
740  auto sid = sc.streamID();
741  auto mid = mcc.moduleDescription()->id();
742  auto const & label = mcc.moduleDescription()->moduleLabel();
743  auto const & msg = label + " prefetching";
744  if (highlight(label))
745  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxLightAmber);
746  else
747  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxLightGreen);
748  }
749 }
750 
751 void
754  auto sid = sc.streamID();
755  auto mid = mcc.moduleDescription()->id();
756  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
757  }
758 }
759 
760 void
762  auto mid = desc.id();
763  global_modules_.grow_to_at_least(mid+1);
764  auto const & label = desc.moduleLabel();
765  auto const & msg = label + " construction";
766  if (highlight(label))
767  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
768  else
769  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxGreen);;
770 }
771 
772 void
774  auto mid = desc.id();
775  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
776 }
777 
778 void
780  auto mid = desc.id();
781  auto const & label = desc.moduleLabel();
782  auto const & msg = label + " begin job";
783  if (highlight(label))
784  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
785  else
786  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxGreen);;
787 }
788 
789 void
791  auto mid = desc.id();
792  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
793 }
794 
795 void
797  auto mid = desc.id();
798  auto const & label = desc.moduleLabel();
799  auto const & msg = label + " end job";
800  if (highlight(label))
801  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
802  else
803  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxGreen);;
804 }
805 
806 void
808  auto mid = desc.id();
809  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
810 }
811 
812 void
814  auto sid = sc.streamID();
815  auto mid = mcc.moduleDescription()->id();
816  auto const & label = mcc.moduleDescription()->moduleLabel();
817  if (highlight(label))
818  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), label.c_str(), nvtxAmber);
819  else
820  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), label.c_str(), nvtxGreen);;
821 }
822 
823 void
825  auto sid = sc.streamID();
826  auto mid = mcc.moduleDescription()->id();
827  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
828 }
829 
830 void
832  /* FIXME
833  auto sid = sc.streamID();
834  auto mid = mcc.moduleDescription()->id();
835  auto const & label = mcc.moduleDescription()->moduleLabel();
836  auto const & msg = label + " delayed get";
837  if (highlight(label))
838  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), label.c_str(), nvtxAmber);
839  else
840  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), label.c_str(), nvtxGreen);;
841  */
842 }
843 
844 void
846  /* FIXME
847  auto sid = sc.streamID();
848  auto mid = mcc.moduleDescription()->id();
849  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
850  */
851 }
852 
853 void
855  /* FIXME
856  auto sid = sc.streamID();
857  auto mid = mcc.moduleDescription()->id();
858  auto const & label = mcc.moduleDescription()->moduleLabel();
859  auto const & msg = label + " read from source";
860  if (highlight(label))
861  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
862  else
863  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxGreen);;
864  */
865 }
866 
867 void
869  /* FIXME
870  auto sid = sc.streamID();
871  auto mid = mcc.moduleDescription()->id();
872  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
873  */
874 }
875 
876 void
878  auto sid = sc.streamID();
879  auto mid = mcc.moduleDescription()->id();
880  auto const & label = mcc.moduleDescription()->moduleLabel();
881  auto const & msg = label + " stream begin run";
882  if (highlight(label))
883  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
884  else
885  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxGreen);;
886 }
887 
888 void
890  auto sid = sc.streamID();
891  auto mid = mcc.moduleDescription()->id();
892  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
893 }
894 
895 void
897  auto sid = sc.streamID();
898  auto mid = mcc.moduleDescription()->id();
899  auto const & label = mcc.moduleDescription()->moduleLabel();
900  auto const & msg = label + " stream end run";
901  if (highlight(label))
902  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
903  else
904  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxGreen);;
905 }
906 
907 void
909  auto sid = sc.streamID();
910  auto mid = mcc.moduleDescription()->id();
911  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
912 }
913 
914 void
916  auto sid = sc.streamID();
917  auto mid = mcc.moduleDescription()->id();
918  auto const & label = mcc.moduleDescription()->moduleLabel();
919  auto const & msg = label + " stream begin lumi";
920  if (highlight(label))
921  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
922  else
923  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxGreen);;
924 }
925 
926 void
928  auto sid = sc.streamID();
929  auto mid = mcc.moduleDescription()->id();
930  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
931 }
932 
933 void
935  auto sid = sc.streamID();
936  auto mid = mcc.moduleDescription()->id();
937  auto const & label = mcc.moduleDescription()->moduleLabel();
938  auto const & msg = label + " stream end lumi";
939  if (highlight(label))
940  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxAmber);
941  else
942  stream_modules_[sid][mid] = nvtxDomainRangeStartColor(stream_domain(sid), msg.c_str(), nvtxGreen);;
943 }
944 
945 void
947  auto sid = sc.streamID();
948  auto mid = mcc.moduleDescription()->id();
949  nvtxDomainRangeEnd(stream_domain(sid), stream_modules_[sid][mid]);
950 }
951 
952 void
954  auto mid = mcc.moduleDescription()->id();
955  auto const & label = mcc.moduleDescription()->moduleLabel();
956  auto const & msg = label + " global begin run";
957  if (highlight(label))
958  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
959  else
960  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxGreen);;
961 }
962 
963 void
965  auto mid = mcc.moduleDescription()->id();
966  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
967 }
968 
969 void
971  auto mid = mcc.moduleDescription()->id();
972  auto const & label = mcc.moduleDescription()->moduleLabel();
973  auto const & msg = label + " global end run";
974  if (highlight(label))
975  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
976  else
977  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxGreen);;
978 }
979 
980 void
982  auto mid = mcc.moduleDescription()->id();
983  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
984 }
985 
986 void
988  auto mid = mcc.moduleDescription()->id();
989  auto const & label = mcc.moduleDescription()->moduleLabel();
990  auto const & msg = label + " global begin lumi";
991  if (highlight(label))
992  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
993  else
994  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxGreen);;
995 }
996 
997 void
999  auto mid = mcc.moduleDescription()->id();
1000  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
1001 }
1002 
1003 void
1005  auto mid = mcc.moduleDescription()->id();
1006  auto const & label = mcc.moduleDescription()->moduleLabel();
1007  auto const & msg = label + " global end lumi";
1008  if (highlight(label))
1009  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
1010  else
1011  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxGreen);;
1012 }
1013 
1014 void
1016  auto mid = mcc.moduleDescription()->id();
1017  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
1018 }
1019 
1020 void
1022  auto mid = desc.id();
1023  global_modules_.grow_to_at_least(mid+1);
1024  auto const & label = desc.moduleLabel();
1025  auto const & msg = label + " construction";
1026  if (highlight(label))
1027  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxAmber);
1028  else
1029  global_modules_[mid] = nvtxDomainRangeStartColor(global_domain(), msg.c_str(), nvtxGreen);;
1030 }
1031 
1032 void
1034  auto mid = desc.id();
1035  nvtxDomainRangeEnd(global_domain(), global_modules_[mid]);
1036 }
1037 
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 preSourceRun(edm::RunIndex)
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 postSourceLumi(edm::LuminosityBlockIndex)
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)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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 postSourceRun(edm::RunIndex)
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 preSourceLumi(edm::LuminosityBlockIndex)
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