CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
ROCmMonitoringService Class Reference

Public Member Functions

void postEvent (edm::StreamContext const &sc)
 
void postModuleBeginStream (edm::StreamContext const &, edm::ModuleCallingContext const &mcc)
 
void postModuleConstruction (edm::ModuleDescription const &desc)
 
void postModuleEvent (edm::StreamContext const &sc, edm::ModuleCallingContext const &mcc)
 
 ROCmMonitoringService (edm::ParameterSet const &iConfig, edm::ActivityRegistry &iRegistry)
 
 ~ROCmMonitoringService ()=default
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

int numberOfDevices_ = 0
 

Detailed Description

Definition at line 21 of file ROCmMonitoringService.cc.

Constructor & Destructor Documentation

◆ ROCmMonitoringService()

ROCmMonitoringService::ROCmMonitoringService ( edm::ParameterSet const &  iConfig,
edm::ActivityRegistry iRegistry 
)

Definition at line 37 of file ROCmMonitoringService.cc.

References numberOfDevices_, or, postEvent(), postModuleBeginStream(), postModuleConstruction(), postModuleEvent(), edm::ActivityRegistry::watchPostEvent(), edm::ActivityRegistry::watchPostModuleBeginStream(), edm::ActivityRegistry::watchPostModuleConstruction(), and edm::ActivityRegistry::watchPostModuleEvent().

37  {
38  // make sure that ROCm is initialised, and that the ROCmService destructor is called after this service's destructor
40  if (not service or not service->enabled())
41  return;
42 
43  numberOfDevices_ = service->numberOfDevices();
44 
45  if (config.getUntrackedParameter<bool>("memoryConstruction")) {
46  registry.watchPostModuleConstruction(this, &ROCmMonitoringService::postModuleConstruction);
47  }
48  if (config.getUntrackedParameter<bool>("memoryBeginStream")) {
49  registry.watchPostModuleBeginStream(this, &ROCmMonitoringService::postModuleBeginStream);
50  }
51  if (config.getUntrackedParameter<bool>("memoryPerModule")) {
52  registry.watchPostModuleEvent(this, &ROCmMonitoringService::postModuleEvent);
53  }
54  if (config.getUntrackedParameter<bool>("memoryPerEvent")) {
55  registry.watchPostEvent(this, &ROCmMonitoringService::postEvent);
56  }
57 }
void postModuleEvent(edm::StreamContext const &sc, edm::ModuleCallingContext const &mcc)
Definition: config.py:1
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void postModuleBeginStream(edm::StreamContext const &, edm::ModuleCallingContext const &mcc)
void postEvent(edm::StreamContext const &sc)
void postModuleConstruction(edm::ModuleDescription const &desc)

◆ ~ROCmMonitoringService()

ROCmMonitoringService::~ROCmMonitoringService ( )
default

Member Function Documentation

◆ fillDescriptions()

void ROCmMonitoringService::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 59 of file ROCmMonitoringService.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and edm::ConfigurationDescriptions::setComment().

59  {
61 
62  desc.addUntracked<bool>("memoryConstruction", false)
63  ->setComment("Print memory information for each device after the construction of each module");
64  desc.addUntracked<bool>("memoryBeginStream", true)
65  ->setComment("Print memory information for each device after the beginStream() of each module");
66  desc.addUntracked<bool>("memoryPerModule", true)
67  ->setComment("Print memory information for each device after the event of each module");
68  desc.addUntracked<bool>("memoryPerEvent", true)
69  ->setComment("Print memory information for each device after each event");
70 
71  descriptions.add("ROCmMonitoringService", desc);
72  descriptions.setComment(
73  "The memory information is the global state of the device. This gets confusing if there are multiple processes "
74  "running on the same device. Probably the information retrieval should be re-thought?");
75 }
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ postEvent()

void ROCmMonitoringService::postEvent ( edm::StreamContext const &  sc)

Definition at line 115 of file ROCmMonitoringService.cc.

References dqm-mbProfile::log, and numberOfDevices_.

Referenced by ROCmMonitoringService().

115  {
116  auto log = edm::LogPrint("ROCmMonitoringService");
117  log << "ROCm device memory after event";
118  dumpUsedMemory(log, numberOfDevices_);
119 }
Log< level::Warning, true > LogPrint

◆ postModuleBeginStream()

void ROCmMonitoringService::postModuleBeginStream ( edm::StreamContext const &  ,
edm::ModuleCallingContext const &  mcc 
)

Definition at line 101 of file ROCmMonitoringService.cc.

References dqm-mbProfile::log, edm::ModuleCallingContext::moduleDescription(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), and numberOfDevices_.

Referenced by ROCmMonitoringService().

101  {
102  auto log = edm::LogPrint("ROCmMonitoringService");
103  log << "ROCm device memory after beginStream() of " << mcc.moduleDescription()->moduleLabel() << " ("
104  << mcc.moduleDescription()->moduleName() << ")";
105  dumpUsedMemory(log, numberOfDevices_);
106 }
Log< level::Warning, true > LogPrint

◆ postModuleConstruction()

void ROCmMonitoringService::postModuleConstruction ( edm::ModuleDescription const &  desc)

Definition at line 95 of file ROCmMonitoringService.cc.

References submitPVResolutionJobs::desc, dqm-mbProfile::log, and numberOfDevices_.

Referenced by ROCmMonitoringService().

95  {
96  auto log = edm::LogPrint("ROCmMonitoringService");
97  log << "ROCm device memory after construction of " << desc.moduleLabel() << " (" << desc.moduleName() << ")";
98  dumpUsedMemory(log, numberOfDevices_);
99 }
Log< level::Warning, true > LogPrint

◆ postModuleEvent()

void ROCmMonitoringService::postModuleEvent ( edm::StreamContext const &  sc,
edm::ModuleCallingContext const &  mcc 
)

Definition at line 108 of file ROCmMonitoringService.cc.

References dqm-mbProfile::log, edm::ModuleCallingContext::moduleDescription(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), and numberOfDevices_.

Referenced by ROCmMonitoringService().

108  {
109  auto log = edm::LogPrint("ROCmMonitoringService");
110  log << "ROCm device memory after processing an event by " << mcc.moduleDescription()->moduleLabel() << " ("
111  << mcc.moduleDescription()->moduleName() << ")";
112  dumpUsedMemory(log, numberOfDevices_);
113 }
Log< level::Warning, true > LogPrint

Member Data Documentation

◆ numberOfDevices_

int ROCmMonitoringService::numberOfDevices_ = 0
private