Skip to content
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

ECAL rechit fix for fill description #504

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9ca193e
make scratch use caching alloc
vkhristenko Jun 19, 2020
c7f9392
use caching allocator for input cpu
vkhristenko Jun 19, 2020
a84d731
using allocators for EventHFilter/HcalRawToDigi
vkhristenko Jul 2, 2020
d05f147
hcal/mahi/gpu switch to new input and use allocator for scratch
vkhristenko Jul 3, 2020
8ee109b
hcal/mahi/gpu move pulse offsets to use esproducer and all dev memory…
vkhristenko Jul 3, 2020
222ff2b
renaming HcalCommon -> CaloCommon and adapting all the deps
vkhristenko Jul 4, 2020
4f6061a
ecal/decoding use device allocators
vkhristenko Jul 6, 2020
bdae637
ecal/reco move to make input/output use dev allocators with caching
vkhristenko Jul 7, 2020
0bea689
cleaning/fixing
vkhristenko Jul 7, 2020
43232b8
ecal/reco movign scratch to use allocators
vkhristenko Jul 7, 2020
415e915
adding a new condition which is a configuration
vkhristenko Jul 7, 2020
5cb25ae
ecal multifit works with dev caching allocators
vkhristenko Jul 8, 2020
8c25658
ecal rec hit making config use caching allocator
vkhristenko Jul 8, 2020
2590b9a
undef ARRANGE
vkhristenko Jul 8, 2020
f4fd5bc
remove not needed
vkhristenko Jul 8, 2020
f79e031
Merged multigpu_hcal_ecal from repository vkhristenko with cms-merge-…
amassiro Jul 9, 2020
4bc7f8d
fix for ecalrehit and new handling of the configuration
amassiro Jul 10, 2020
92974cf
removal unused code, already commented out
amassiro Jul 10, 2020
f5747cf
Add missing ecalRecHitParametersGPUESProducer
fwyzard Jul 11, 2020
67f894f
Add missing ecalMultifitParametersGPUESProducer
fwyzard Jul 11, 2020
5ea37f6
Merge branch 'CMSSW_11_1_X_Patatrack' into amassiro-ecal-rechit-gpu-f…
fwyzard Jul 12, 2020
7e7a043
Apply code formatting
fwyzard Jul 12, 2020
8bad99f
Apply code formatting
fwyzard Jul 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,83 @@
#include <tuple>
#include <utility>

#include "EcalRecHitParametersGPURecord.h"
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ESProductHost.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
#include "FWCore/Framework/interface/SourceFactory.h"
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/ReusableObjectHolder.h"
#include "FWCore/Utilities/interface/typelookup.h"

#include "RecoLocalCalo/EcalRecAlgos/interface/EcalRecHitParametersGPU.h"
#include "EcalRecHitParametersGPURecord.h"

#include "FWCore/Framework/interface/SourceFactory.h"

class EcalRecHitParametersGPUESProducer
: public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
class EcalRecHitParametersGPUESProducer : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
public:
EcalRecHitParametersGPUESProducer(edm::ParameterSet const&);
~EcalRecHitParametersGPUESProducer() override = default;
EcalRecHitParametersGPUESProducer(edm::ParameterSet const&);
~EcalRecHitParametersGPUESProducer() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions&);
std::unique_ptr<EcalRecHitParametersGPU> produce(EcalRecHitParametersGPURecord const&);
static void fillDescriptions(edm::ConfigurationDescriptions&);
std::unique_ptr<EcalRecHitParametersGPU> produce(EcalRecHitParametersGPURecord const&);

protected:
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
const edm::IOVSyncValue&,
edm::ValidityInterval&) override;
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
const edm::IOVSyncValue&,
edm::ValidityInterval&) override;

private:
edm::ParameterSet const& pset_;
edm::ParameterSet const& pset_;
};

EcalRecHitParametersGPUESProducer::EcalRecHitParametersGPUESProducer(
edm::ParameterSet const& pset) : pset_{pset}
{
setWhatProduced(this);
findingRecord<EcalRecHitParametersGPURecord>();
EcalRecHitParametersGPUESProducer::EcalRecHitParametersGPUESProducer(edm::ParameterSet const& pset) : pset_{pset} {
setWhatProduced(this);
findingRecord<EcalRecHitParametersGPURecord>();
}

void EcalRecHitParametersGPUESProducer::setIntervalFor(
const edm::eventsetup::EventSetupRecordKey& iKey,
const edm::IOVSyncValue& iTime,
edm::ValidityInterval& oInterval) {
oInterval = edm::ValidityInterval(
edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime());
void EcalRecHitParametersGPUESProducer::setIntervalFor(const edm::eventsetup::EventSetupRecordKey& iKey,
const edm::IOVSyncValue& iTime,
edm::ValidityInterval& oInterval) {
oInterval = edm::ValidityInterval(edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime());
}

void EcalRecHitParametersGPUESProducer::fillDescriptions(
edm::ConfigurationDescriptions& desc) {
edm::ParameterSetDescription d;
void EcalRecHitParametersGPUESProducer::fillDescriptions(edm::ConfigurationDescriptions& desc) {
edm::ParameterSetDescription d;

//---- db statuses to be exluded from reconstruction
d.add<std::vector<std::string>>("ChannelStatusToBeExcluded",
{
"kDAC",
"kNoisy",
"kNNoisy",
"kFixedG6",
"kFixedG1",
"kFixedG0",
"kNonRespondingIsolated",
"kDeadVFE",
"kDeadFE",
"kNoDataNoTP",
});

// reco flags association to DB flag
edm::ParameterSetDescription desc_list_flagsMapDBReco;
desc_list_flagsMapDBReco.add<std::vector<std::string>>("kGood", {"kOk", "kDAC", "kNoLaser", "kNoisy"});
desc_list_flagsMapDBReco.add<std::vector<std::string>>("kNoisy", {"kNNoisy", "kFixedG6", "kFixedG1"});
desc_list_flagsMapDBReco.add<std::vector<std::string>>("kNeighboursRecovered",
{"kFixedG0", "kNonRespondingIsolated", "kDeadVFE"});
desc_list_flagsMapDBReco.add<std::vector<std::string>>("kTowerRecovered", {"kDeadFE"});
desc_list_flagsMapDBReco.add<std::vector<std::string>>("kDead", {"kNoDataNoTP"});

// ## db statuses to be exluded from reconstruction (some will be recovered)
edm::ParameterSetDescription desc_ChannelStatusToBeExcluded;
desc_ChannelStatusToBeExcluded.add<std::string>("kDAC");
desc_ChannelStatusToBeExcluded.add<std::string>("kNoisy");
desc_ChannelStatusToBeExcluded.add<std::string>("kNNoisy");
desc_ChannelStatusToBeExcluded.add<std::string>("kFixedG6");
desc_ChannelStatusToBeExcluded.add<std::string>("kFixedG1");
desc_ChannelStatusToBeExcluded.add<std::string>("kFixedG0");
desc_ChannelStatusToBeExcluded.add<std::string>("kNonRespondingIsolated");
desc_ChannelStatusToBeExcluded.add<std::string>("kDeadVFE");
desc_ChannelStatusToBeExcluded.add<std::string>("kDeadFE");
desc_ChannelStatusToBeExcluded.add<std::string>("kNoDataNoTP");
std::vector<edm::ParameterSet> default_ChannelStatusToBeExcluded(1);
d.addVPSet("ChannelStatusToBeExcluded", desc_ChannelStatusToBeExcluded, default_ChannelStatusToBeExcluded);
d.add<edm::ParameterSetDescription>("flagsMapDBReco", desc_list_flagsMapDBReco);

desc.addWithDefaultLabel(d);
desc.addWithDefaultLabel(d);
}

std::unique_ptr<EcalRecHitParametersGPU> EcalRecHitParametersGPUESProducer::produce(
EcalRecHitParametersGPURecord const&) {
return std::make_unique<EcalRecHitParametersGPU>(pset_);
EcalRecHitParametersGPURecord const&) {
return std::make_unique<EcalRecHitParametersGPU>(pset_);
}

DEFINE_FWK_EVENTSETUP_SOURCE(EcalRecHitParametersGPUESProducer);
39 changes: 8 additions & 31 deletions RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducerGPU.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalLaserAPDPNRatiosRefGPU.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalLaserAlphasGPU.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalLinearCorrectionsGPU.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalRecHitParametersGPU.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalRechitADCToGeVConstantGPU.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalRechitChannelStatusGPU.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalRecHitParametersGPU.h"

#include "EcalRecHitBuilderKernels.h"
#include "EcalRecHitParametersGPURecord.h"
Expand Down Expand Up @@ -73,15 +73,7 @@ class EcalRecHitProducerGPU : public edm::stream::EDProducer<edm::ExternalWork>
edm::ESHandle<EcalLinearCorrectionsGPU> LinearCorrectionsHandle_;
edm::ESHandle<EcalRecHitParametersGPU> recHitParametersHandle_;

// configuration
std::vector<int> v_chstatus_;

//
// https://github.com/cms-sw/cmssw/blob/266e21cfc9eb409b093e4cf064f4c0a24c6ac293/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitWorkerSimple.h
//

// Associate reco flagbit ( outer vector) to many db status flags (inner vector)
// std::vector<std::vector<uint32_t> > v_DB_reco_flags_;
// Associate reco flagbit (outer vector) to many db status flags (inner vector)
std::vector<int>
expanded_v_DB_reco_flags_; // Transform a map in a vector // FIXME AM: int or uint32 to be checked
std::vector<uint32_t> expanded_Sizes_v_DB_reco_flags_; // Saving the size for each piece
Expand Down Expand Up @@ -113,20 +105,12 @@ void EcalRecHitProducerGPU::fillDescriptions(edm::ConfigurationDescriptions& con

EcalRecHitProducerGPU::EcalRecHitProducerGPU(const edm::ParameterSet& ps) {
//---- input
uncalibRecHitsInEBToken_ = consumes<InputProduct>(
ps.getParameter<edm::InputTag>("uncalibrecHitsInLabelEB"));
uncalibRecHitsInEEToken_ = consumes<InputProduct>(
ps.getParameter<edm::InputTag>("uncalibrecHitsInLabelEE"));
uncalibRecHitsInEBToken_ = consumes<InputProduct>(ps.getParameter<edm::InputTag>("uncalibrecHitsInLabelEB"));
uncalibRecHitsInEEToken_ = consumes<InputProduct>(ps.getParameter<edm::InputTag>("uncalibrecHitsInLabelEE"));

//---- output
recHitsTokenEB_ =
produces<OutputProduct>(ps.getParameter<std::string>("recHitsLabelEB"));
recHitsTokenEE_ =
produces<OutputProduct>(ps.getParameter<std::string>("recHitsLabelEE"));

//---- db statuses to be exluded from reconstruction
v_chstatus_ = StringToEnumValue<EcalChannelStatusCode::Code>(
ps.getParameter<std::vector<std::string>>("ChannelStatusToBeExcluded"));
recHitsTokenEB_ = produces<OutputProduct>(ps.getParameter<std::string>("recHitsLabelEB"));
recHitsTokenEE_ = produces<OutputProduct>(ps.getParameter<std::string>("recHitsLabelEE"));

bool killDeadChannels = ps.getParameter<bool>("killDeadChannels");
configParameters_.killDeadChannels = killDeadChannels;
Expand Down Expand Up @@ -240,20 +224,13 @@ void EcalRecHitProducerGPU::acquire(edm::Event const& event,

edm::TimeValue_t event_time = event.time().value();

ecal::rechit::create_ecal_rehit(inputDataGPU,
eventOutputDataGPU_,
// eventDataForScratchGPU_,
conditions,
configParameters_,
nchannelsEB,
event_time,
ctx.stream());
ecal::rechit::create_ecal_rehit(
inputDataGPU, eventOutputDataGPU_, conditions, configParameters_, nchannelsEB, event_time, ctx.stream());

cudaCheck(cudaGetLastError());
}

void EcalRecHitProducerGPU::produce(edm::Event& event, edm::EventSetup const& setup) {
//DurationMeasurer<std::chrono::milliseconds> timer{std::string{"produce duration"}};
cms::cuda::ScopedContextProduce ctx{cudaState_};

eventOutputDataGPU_.recHitsEB.size = neb_;
Expand Down
11 changes: 11 additions & 0 deletions RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@

#process.ecalMultiFitUncalibRecHitgpu.algoPSet.threads = cms.vint32(256, 1, 1)

#from RecoLocalCalo.EcalRecProducers.ecalMultifitParametersGPUESProducer_cfi import ecalMultifitParametersGPUESProducer
process.load("RecoLocalCalo.EcalRecProducers.ecalMultifitParametersGPUESProducer_cfi")

#
#
# No "EcalRecHitParametersGPURecord" record found in the EventSetup.n
# #--->
#
process.load("RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi")
#ecalRecHitParametersGPUESProducer_cfi.py


##
## force HLT configuration for ecalMultiFitUncalibRecHit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
#process.ecalMultiFitUncalibRecHitgpu.algoPSet.threads = cms.vint32(256, 1, 1)


process.load("RecoLocalCalo.EcalRecProducers.ecalMultifitParametersGPUESProducer_cfi")



##
## force HLT configuration for ecalMultiFitUncalibRecHit
##
Expand Down