From 295295f24cea3964d80ec85aed9db75b82341e1a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 17 Jan 2020 09:10:53 -0600 Subject: [PATCH] Implement changes from the CUDA framework review (cms-patatrack#429) Rename the cudautils namespace to cms::cuda or cms::cudatest, and drop the CUDA prefix from the symbols defined there. Always record and query the CUDA event, to minimize need for error checking in CUDAScopedContextProduce destructor. Add comments to highlight the pieces in CachingDeviceAllocator that have been changed wrt. cub. Various other updates and clean up: - enable CUDA for compute capability 3.5. - clean up CUDAService, CUDA tests and plugins. - add CUDA existence protections to BuildFiles. - mark thread-safe static variables with CMS_THREAD_SAFE. --- RecoLocalCalo/EcalRecAlgos/interface/EcalGainRatiosGPU.h | 4 ++-- RecoLocalCalo/EcalRecAlgos/interface/EcalPedestalsGPU.h | 4 ++-- .../EcalRecAlgos/interface/EcalPulseCovariancesGPU.h | 4 ++-- RecoLocalCalo/EcalRecAlgos/interface/EcalPulseShapesGPU.h | 4 ++-- .../EcalRecAlgos/interface/EcalSamplesCorrelationGPU.h | 4 ++-- .../EcalRecAlgos/interface/EcalTimeBiasCorrectionsGPU.h | 4 ++-- .../EcalRecAlgos/interface/EcalTimeCalibConstantsGPU.h | 4 ++-- .../plugins/EcalUncalibRecHitProducerGPU.cc | 8 ++++---- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/RecoLocalCalo/EcalRecAlgos/interface/EcalGainRatiosGPU.h b/RecoLocalCalo/EcalRecAlgos/interface/EcalGainRatiosGPU.h index 41f02518c9fc8..e268e5d3d5c13 100644 --- a/RecoLocalCalo/EcalRecAlgos/interface/EcalGainRatiosGPU.h +++ b/RecoLocalCalo/EcalRecAlgos/interface/EcalGainRatiosGPU.h @@ -5,7 +5,7 @@ #ifndef __CUDACC__ #include "HeterogeneousCore/CUDAUtilities/interface/CUDAHostAllocator.h" -#include "HeterogeneousCore/CUDACore/interface/CUDAESProduct.h" +#include "HeterogeneousCore/CUDACore/interface/ESProduct.h" #endif #include @@ -37,7 +37,7 @@ class EcalGainRatiosGPU { std::vector> gain12Over6_; std::vector> gain6Over1_; - CUDAESProduct product_; + cms::cuda::ESProduct product_; #endif }; diff --git a/RecoLocalCalo/EcalRecAlgos/interface/EcalPedestalsGPU.h b/RecoLocalCalo/EcalRecAlgos/interface/EcalPedestalsGPU.h index 973501ed25a8d..420697dea6bda 100644 --- a/RecoLocalCalo/EcalRecAlgos/interface/EcalPedestalsGPU.h +++ b/RecoLocalCalo/EcalRecAlgos/interface/EcalPedestalsGPU.h @@ -5,7 +5,7 @@ #ifndef __CUDACC__ #include "HeterogeneousCore/CUDAUtilities/interface/CUDAHostAllocator.h" -#include "HeterogeneousCore/CUDACore/interface/CUDAESProduct.h" +#include "HeterogeneousCore/CUDACore/interface/ESProduct.h" #endif #include @@ -42,7 +42,7 @@ class EcalPedestalsGPU { std::vector> mean_x1_; std::vector> rms_x1_; - CUDAESProduct product_; + cms::cuda::ESProduct product_; #endif }; diff --git a/RecoLocalCalo/EcalRecAlgos/interface/EcalPulseCovariancesGPU.h b/RecoLocalCalo/EcalRecAlgos/interface/EcalPulseCovariancesGPU.h index 4bc347233e75d..b5b9271f6e65e 100644 --- a/RecoLocalCalo/EcalRecAlgos/interface/EcalPulseCovariancesGPU.h +++ b/RecoLocalCalo/EcalRecAlgos/interface/EcalPulseCovariancesGPU.h @@ -5,7 +5,7 @@ #ifndef __CUDACC__ #include "HeterogeneousCore/CUDAUtilities/interface/CUDAHostAllocator.h" -#include "HeterogeneousCore/CUDACore/interface/CUDAESProduct.h" +#include "HeterogeneousCore/CUDACore/interface/ESProduct.h" #endif #include @@ -35,7 +35,7 @@ class EcalPulseCovariancesGPU { std::vector const& valuesEB_; std::vector const& valuesEE_; - CUDAESProduct product_; + cms::cuda::ESProduct product_; #endif }; diff --git a/RecoLocalCalo/EcalRecAlgos/interface/EcalPulseShapesGPU.h b/RecoLocalCalo/EcalRecAlgos/interface/EcalPulseShapesGPU.h index 2d9d118b2c024..88893b626ce05 100644 --- a/RecoLocalCalo/EcalRecAlgos/interface/EcalPulseShapesGPU.h +++ b/RecoLocalCalo/EcalRecAlgos/interface/EcalPulseShapesGPU.h @@ -5,7 +5,7 @@ #ifndef __CUDACC__ #include "HeterogeneousCore/CUDAUtilities/interface/CUDAHostAllocator.h" -#include "HeterogeneousCore/CUDACore/interface/CUDAESProduct.h" +#include "HeterogeneousCore/CUDACore/interface/ESProduct.h" #endif #include @@ -35,7 +35,7 @@ class EcalPulseShapesGPU { std::vector const& valuesEB_; std::vector const& valuesEE_; - CUDAESProduct product_; + cms::cuda::ESProduct product_; #endif }; diff --git a/RecoLocalCalo/EcalRecAlgos/interface/EcalSamplesCorrelationGPU.h b/RecoLocalCalo/EcalRecAlgos/interface/EcalSamplesCorrelationGPU.h index 3c9ee6718a5f9..dac1ee041bfc5 100644 --- a/RecoLocalCalo/EcalRecAlgos/interface/EcalSamplesCorrelationGPU.h +++ b/RecoLocalCalo/EcalRecAlgos/interface/EcalSamplesCorrelationGPU.h @@ -5,7 +5,7 @@ #ifndef __CUDACC__ #include "HeterogeneousCore/CUDAUtilities/interface/CUDAHostAllocator.h" -#include "HeterogeneousCore/CUDACore/interface/CUDAESProduct.h" +#include "HeterogeneousCore/CUDACore/interface/ESProduct.h" #endif #include @@ -39,7 +39,7 @@ class EcalSamplesCorrelationGPU { std::vector const& EEG6SamplesCorrelation_; std::vector const& EEG1SamplesCorrelation_; - CUDAESProduct product_; + cms::cuda::ESProduct product_; #endif }; diff --git a/RecoLocalCalo/EcalRecAlgos/interface/EcalTimeBiasCorrectionsGPU.h b/RecoLocalCalo/EcalRecAlgos/interface/EcalTimeBiasCorrectionsGPU.h index 93bc395e449a3..70af33b52f216 100644 --- a/RecoLocalCalo/EcalRecAlgos/interface/EcalTimeBiasCorrectionsGPU.h +++ b/RecoLocalCalo/EcalRecAlgos/interface/EcalTimeBiasCorrectionsGPU.h @@ -5,7 +5,7 @@ #ifndef __CUDACC__ #include "HeterogeneousCore/CUDAUtilities/interface/CUDAHostAllocator.h" -#include "HeterogeneousCore/CUDACore/interface/CUDAESProduct.h" +#include "HeterogeneousCore/CUDACore/interface/ESProduct.h" #endif #include @@ -44,7 +44,7 @@ class EcalTimeBiasCorrectionsGPU { std::vector const& EETimeCorrShiftBins_; #ifndef __CUDACC__ - CUDAESProduct product_; + cms::cuda::ESProduct product_; #endif }; diff --git a/RecoLocalCalo/EcalRecAlgos/interface/EcalTimeCalibConstantsGPU.h b/RecoLocalCalo/EcalRecAlgos/interface/EcalTimeCalibConstantsGPU.h index 2c6c3075dde8d..fd640e7c989b3 100644 --- a/RecoLocalCalo/EcalRecAlgos/interface/EcalTimeCalibConstantsGPU.h +++ b/RecoLocalCalo/EcalRecAlgos/interface/EcalTimeCalibConstantsGPU.h @@ -5,7 +5,7 @@ #ifndef __CUDACC__ #include "HeterogeneousCore/CUDAUtilities/interface/CUDAHostAllocator.h" -#include "HeterogeneousCore/CUDACore/interface/CUDAESProduct.h" +#include "HeterogeneousCore/CUDACore/interface/ESProduct.h" #endif #include @@ -38,7 +38,7 @@ class EcalTimeCalibConstantsGPU { std::vector const& valuesEB_; std::vector const& valuesEE_; - CUDAESProduct product_; + cms::cuda::ESProduct product_; #endif }; diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc index 786ba409525e6..a90cc1536c482 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc @@ -4,7 +4,7 @@ //#include "HeterogeneousCore/Producer/interface/HeterogeneousEvent.h" #include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" -#include "HeterogeneousCore/CUDACore/interface/CUDAScopedContext.h" +#include "HeterogeneousCore/CUDACore/interface/ScopedContext.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -79,7 +79,7 @@ class EcalUncalibRecHitProducerGPU : public edm::stream::EDProducer> ebRecHits_{nullptr}, eeRecHits_{nullptr}; @@ -294,7 +294,7 @@ void EcalUncalibRecHitProducerGPU::acquire(edm::Event const& event, //DurationMeasurer timer{std::string{"acquire duration"}}; // raii - CUDAScopedContextAcquire ctx{event.streamID(), std::move(holder), cudaState_}; + cms::cuda::ScopedContextAcquire ctx{event.streamID(), std::move(holder), cudaState_}; // conditions setup.get().get(pedestalsHandle_); @@ -364,7 +364,7 @@ void EcalUncalibRecHitProducerGPU::acquire(edm::Event const& event, void EcalUncalibRecHitProducerGPU::produce(edm::Event& event, edm::EventSetup const& setup) { //DurationMeasurer timer{std::string{"produce duration"}}; - CUDAScopedContextProduce ctx{cudaState_}; + cms::cuda::ScopedContextProduce ctx{cudaState_}; if (shouldTransferToHost_) { // rec hits objects were not originally member variables