From c9c01df5c46434e1d72c846766c8ae6a30d44c9d Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 20 Aug 2021 21:33:42 +0200 Subject: [PATCH] Restore cms::cuda::ESProduct construction without GPU --- HeterogeneousCore/CUDACore/interface/ESProduct.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/HeterogeneousCore/CUDACore/interface/ESProduct.h b/HeterogeneousCore/CUDACore/interface/ESProduct.h index 8740095292380..fbe1825b0fa4d 100644 --- a/HeterogeneousCore/CUDACore/interface/ESProduct.h +++ b/HeterogeneousCore/CUDACore/interface/ESProduct.h @@ -20,10 +20,12 @@ namespace cms { class ESProduct { public: ESProduct() : gpuDataPerDevice_(numberOfDevices()) { - cms::cuda::ScopedSetDevice scopedDevice; - for (size_t i = 0; i < gpuDataPerDevice_.size(); ++i) { - scopedDevice.set(i); - gpuDataPerDevice_[i].m_event = getEventCache().get(); + if (not gpuDataPerDevice_.empty()) { + cms::cuda::ScopedSetDevice scopedDevice; + for (size_t i = 0; i < gpuDataPerDevice_.size(); ++i) { + scopedDevice.set(i); + gpuDataPerDevice_[i].m_event = getEventCache().get(); + } } }