-
Notifications
You must be signed in to change notification settings - Fork 4.6k
HBHEGPU: added taggedBadByDb by ChannelQuality in GPU [12_0_X] #35355
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
Merged
cmsbuild
merged 2 commits into
cms-sw:CMSSW_12_0_X
from
mariadalfonso:channelQualityGPU
Sep 30, 2021
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #ifndef CondFormats_HcalObjects_interface_HcalChannelQualityGPU_h | ||
| #define CondFormats_HcalObjects_interface_HcalChannelQualityGPU_h | ||
|
|
||
| #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" | ||
| #include "FWCore/Utilities/interface/propagate_const_array.h" | ||
| #include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h" | ||
|
|
||
| #ifndef __CUDACC__ | ||
| #include "HeterogeneousCore/CUDAUtilities/interface/HostAllocator.h" | ||
| #include "HeterogeneousCore/CUDACore/interface/ESProduct.h" | ||
| #endif | ||
|
|
||
| class HcalChannelQualityGPU { | ||
| public: | ||
| struct Product { | ||
| edm::propagate_const_array<cms::cuda::device::unique_ptr<uint32_t[]>> status; | ||
| }; | ||
|
|
||
| #ifndef __CUDACC__ | ||
| // rearrange reco params | ||
| HcalChannelQualityGPU(HcalChannelQuality const &); | ||
|
|
||
| // will trigger deallocation of Product thru ~Product | ||
| ~HcalChannelQualityGPU() = default; | ||
|
|
||
| // get device pointers | ||
| Product const &getProduct(cudaStream_t) const; | ||
|
|
||
| private: | ||
| uint64_t totalChannels_; | ||
| std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t>> status_; | ||
|
|
||
| cms::cuda::ESProduct<Product> product_; | ||
| #endif // __CUDACC__ | ||
| }; | ||
|
|
||
|
|
||
| #endif // RecoLocalCalo_HcalRecAlgos_interface_HcalChannelQualityGPU_h | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" | ||
| #include "CondFormats/HcalObjects/interface/HcalChannelQualityGPU.h" | ||
| #include "FWCore/Utilities/interface/typelookup.h" | ||
| #include "HeterogeneousCore/CUDAUtilities/interface/copyAsync.h" | ||
|
|
||
| // FIXME: add proper getters to conditions | ||
| HcalChannelQualityGPU::HcalChannelQualityGPU(HcalChannelQuality const& quality) | ||
| : totalChannels_{quality.getAllContainers()[0].second.size() + quality.getAllContainers()[1].second.size()}, | ||
| status_(totalChannels_) { | ||
| auto const containers = quality.getAllContainers(); | ||
|
|
||
| // fill in eb | ||
| auto const& barrelValues = containers[0].second; | ||
| for (uint64_t i = 0; i < barrelValues.size(); ++i) { | ||
| status_[i] = barrelValues[i].getValue(); | ||
| } | ||
|
|
||
| // fill in ee | ||
| auto const& endcapValues = containers[1].second; | ||
| auto const offset = barrelValues.size(); | ||
| for (uint64_t i = 0; i < endcapValues.size(); ++i) { | ||
| status_[i + offset] = endcapValues[i].getValue(); | ||
| } | ||
| } | ||
|
|
||
| HcalChannelQualityGPU::Product const& HcalChannelQualityGPU::getProduct(cudaStream_t stream) const { | ||
| auto const& product = | ||
| product_.dataForCurrentDeviceAsync(stream, [this](HcalChannelQualityGPU::Product& product, cudaStream_t stream) { | ||
| // allocate | ||
| product.status = cms::cuda::make_device_unique<uint32_t[]>(status_.size(), stream); | ||
|
|
||
| // transfer | ||
| cms::cuda::copyAsync(product.status, status_, stream); | ||
|
|
||
| }); | ||
|
|
||
| return product; | ||
| } | ||
|
|
||
| TYPELOOKUP_DATA_REG(HcalChannelQualityGPU); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,7 @@ namespace hcal { | |
| float* method0Time, | ||
| uint32_t* outputdid, | ||
| uint32_t const nchannels, | ||
| uint32_t const* qualityStatus, | ||
| uint32_t const* recoParam1Values, | ||
| uint32_t const* recoParam2Values, | ||
| float const* qieCoderOffsets, | ||
|
|
@@ -389,6 +390,17 @@ namespace hcal { | |
| printf("tsTOT = %f tstrig = %f ts4Thresh = %f\n", shrEnergyM0TotalAccum[lch], energym0_per_ts_gain0, ts4Thresh); | ||
| #endif | ||
|
|
||
| // Channel quality check | ||
| // https://github.com/cms-sw/cmssw/blob/master/RecoLocalCalo/HcalRecAlgos/plugins/HcalChannelPropertiesEP.cc#L107-L109 | ||
| // https://github.com/cms-sw/cmssw/blob/6d2f66057131baacc2fcbdd203588c41c885b42c/CondCore/HcalPlugins/plugins/HcalChannelQuality_PayloadInspector.cc#L30 | ||
| // const bool taggedBadByDb = severity.dropChannel(digistatus->getValue()); | ||
| // do not run MAHI if taggedBadByDb = true | ||
|
|
||
| auto const digiStatus_ = qualityStatus[hashedId]; | ||
| const bool taggedBadByDb = (digiStatus_/32770); | ||
|
|
||
| if(taggedBadByDb) outputChi2[gch] = -9999.f; | ||
|
|
||
| // check as in cpu version if mahi is not needed | ||
| // FIXME: KNOWN ISSUE: observed a problem when rawCharge and pedestal | ||
| // are basically equal and generate -0.00000... | ||
|
|
@@ -418,7 +430,7 @@ namespace hcal { | |
|
|
||
| #ifdef HCAL_MAHI_GPUDEBUG | ||
| printf( | ||
| "charrge(%d) = %f pedestal(%d) = %f dfc(%d) = %f pedestalWidth(%d) = %f noiseADC(%d) = %f noisPhoto(%d) = " | ||
| "charge(%d) = %f pedestal(%d) = %f dfc(%d) = %f pedestalWidth(%d) = %f noiseADC(%d) = %f noisPhoto(%d) = " | ||
| "%f\n", | ||
| sample, | ||
| rawCharge, | ||
|
|
@@ -1100,6 +1112,7 @@ namespace hcal { | |
| outputGPU.recHits.timeM0.get(), | ||
| outputGPU.recHits.did.get(), | ||
| totalChannels, | ||
| conditions.channelQuality.status, | ||
|
Contributor
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. this seems like an odd choice by the code-format
Contributor
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 has a tab instead of eight spaces |
||
| conditions.recoParams.param1, | ||
| conditions.recoParams.param2, | ||
| conditions.qieCoders.offsets, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Sorry for the (maybe) naive question, but should this object be
COND_SERIALIZABLE?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.
@mariadalfonso @fwyzard please have a look at this comment
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.
CondFormats/HcalObjects/interface/HcalChannelQuality.h is already COND_SERIALIZABLE
HcalChannelQualityGPU.h is not, but usually include the main .h
This is a common pattern for all conditions if need to do this change should be done in synch for all ECAL/HCAL/TRK ... and outside of this PR
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.
Indeed, I don't think these conditions need to be declared
COND_SERIALIZABLE.They are never persisted or read from the database - they are only transient conditions, derived from the persistent ones and "repackaged" for use on GPUs.
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.
ok thanks for the explanation @mariadalfonso and @fwyzard, makes sense!