-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create new ECAL DQM GpuTask to monitor and compare CPU and GPU generated ECAL RECO objects #36742
Changes from 2 commits
c26b2fc
0ba018e
856c2fd
c45503a
33736e9
f19e451
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#ifndef DQM_EcalMonitorTasks_GpuTask_H | ||
#define DQM_EcalMonitorTasks_GpuTask_H | ||
|
||
#include "DQWorkerTask.h" | ||
|
||
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" | ||
#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" | ||
|
||
namespace ecaldqm { | ||
|
||
class GpuTask : public DQWorkerTask { | ||
public: | ||
GpuTask(); | ||
~GpuTask() override = default; | ||
|
||
void addDependencies(DependencySet&) override; | ||
|
||
bool filterRunType(short const*) override; | ||
|
||
void beginEvent(edm::Event const&, edm::EventSetup const&, bool const&, bool&) override; | ||
bool analyze(void const*, Collections) override; | ||
|
||
template <typename DigiCollection> | ||
void runOnCpuDigis(DigiCollection const&, Collections); | ||
template <typename DigiCollection> | ||
void runOnGpuDigis(DigiCollection const&, Collections); | ||
void runOnCpuUncalibRecHits(EcalUncalibratedRecHitCollection const&, Collections); | ||
void runOnGpuUncalibRecHits(EcalUncalibratedRecHitCollection const&, Collections); | ||
void runOnCpuRecHits(EcalRecHitCollection const&, Collections); | ||
void runOnGpuRecHits(EcalRecHitCollection const&, Collections); | ||
|
||
private: | ||
void setParams(edm::ParameterSet const&) override; | ||
|
||
bool runGpuTask_; | ||
bool gpuOnlyPlots_; | ||
std::vector<int> uncalibOOTAmps_; | ||
|
||
EBDigiCollection const* EBCpuDigis_; | ||
EEDigiCollection const* EECpuDigis_; | ||
|
||
EcalUncalibratedRecHitCollection const* EBCpuUncalibRecHits_; | ||
EcalUncalibratedRecHitCollection const* EECpuUncalibRecHits_; | ||
|
||
EcalRecHitCollection const* EBCpuRecHits_; | ||
EcalRecHitCollection const* EECpuRecHits_; | ||
}; | ||
|
||
inline bool GpuTask::analyze(void const* p, Collections collection) { | ||
switch (collection) { | ||
case kEBCpuDigi: | ||
if (p && runGpuTask_) | ||
runOnCpuDigis(*static_cast<EBDigiCollection const*>(p), collection); | ||
return runGpuTask_; | ||
break; | ||
case kEECpuDigi: | ||
if (p && runGpuTask_) | ||
runOnCpuDigis(*static_cast<EEDigiCollection const*>(p), collection); | ||
return runGpuTask_; | ||
break; | ||
case kEBGpuDigi: | ||
if (p && runGpuTask_) | ||
runOnGpuDigis(*static_cast<EBDigiCollection const*>(p), collection); | ||
return runGpuTask_; | ||
break; | ||
case kEEGpuDigi: | ||
if (p && runGpuTask_) | ||
runOnGpuDigis(*static_cast<EEDigiCollection const*>(p), collection); | ||
return runGpuTask_; | ||
break; | ||
case kEBCpuUncalibRecHit: | ||
case kEECpuUncalibRecHit: | ||
if (p && runGpuTask_) | ||
runOnCpuUncalibRecHits(*static_cast<EcalUncalibratedRecHitCollection const*>(p), collection); | ||
return runGpuTask_; | ||
break; | ||
case kEBGpuUncalibRecHit: | ||
case kEEGpuUncalibRecHit: | ||
if (p && runGpuTask_) | ||
runOnGpuUncalibRecHits(*static_cast<EcalUncalibratedRecHitCollection const*>(p), collection); | ||
return runGpuTask_; | ||
break; | ||
case kEBCpuRecHit: | ||
case kEECpuRecHit: | ||
if (p && runGpuTask_) | ||
runOnCpuRecHits(*static_cast<EcalRecHitCollection const*>(p), collection); | ||
return runGpuTask_; | ||
break; | ||
case kEBGpuRecHit: | ||
case kEEGpuRecHit: | ||
if (p && runGpuTask_) | ||
runOnGpuRecHits(*static_cast<EcalRecHitCollection const*>(p), collection); | ||
return runGpuTask_; | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
} // namespace ecaldqm | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
from DQM.EcalMonitorTasks.EcalMonitorTask_cfi import * | ||
|
||
# Customization to run the CPU vs GPU comparison task if the job runs on a GPU enabled machine | ||
from Configuration.ProcessModifiers.gpu_cff import gpu | ||
from DQM.EcalMonitorTasks.GpuTask_cfi import ecalGpuTask | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! |
||
|
||
gpu.toModify(ecalGpuTask.params, runGpuTask = cms.untracked.bool(True)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that by setting As discussed in #35879 we should use a different modifier that is only given when the GPU vs. CPU comparison should be done. @jfernan2 does such a modifier exist already from DQM? In the issue mentioned it was proposed to call it |
||
gpu.toModify(ecalMonitorTask.workers, func = lambda workers: workers.append("GpuTask")) | ||
gpu.toModify(ecalMonitorTask, workerParameters = dict(GpuTask = ecalGpuTask)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMS code rule 2.12 says to not use single character variable names except for loop indices. Please rename
p
.