diff --git a/DataFormats/BeamSpot/interface/BeamSpotHostProduct.h b/DataFormats/BeamSpot/interface/BeamSpotHostProduct.h deleted file mode 100644 index 596fdef0d45e6..0000000000000 --- a/DataFormats/BeamSpot/interface/BeamSpotHostProduct.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef DataFormats_BeamSpot_interface_BeamSpotHostProduct_h -#define DataFormats_BeamSpot_interface_BeamSpotHostProduct_h - -#include "DataFormats/BeamSpot/interface/BeamSpotPOD.h" -#include "DataFormats/Portable/interface/PortableHostProduct.h" - -// simplified representation of the beamspot data, in host memory -using BeamSpotHostProduct = PortableHostProduct; - -#endif // DataFormats_BeamSpot_interface_BeamSpotHostProduct_h diff --git a/DataFormats/BeamSpot/interface/alpaka/BeamSpotDeviceProduct.h b/DataFormats/BeamSpot/interface/alpaka/BeamSpotDeviceProduct.h deleted file mode 100644 index 1f77135a8b96b..0000000000000 --- a/DataFormats/BeamSpot/interface/alpaka/BeamSpotDeviceProduct.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef DataFormats_BeamSpot_interface_alpaka_BeamSpotDeviceProduct_h -#define DataFormats_BeamSpot_interface_alpaka_BeamSpotDeviceProduct_h - -#include "DataFormats/BeamSpot/interface/BeamSpotPOD.h" -#include "DataFormats/Portable/interface/alpaka/PortableProduct.h" -#include "HeterogeneousCore/AlpakaInterface/interface/config.h" - -namespace ALPAKA_ACCELERATOR_NAMESPACE { - - // simplified representation of the beamspot data, in device global memory - using BeamSpotDeviceProduct = PortableProduct; - -} // namespace ALPAKA_ACCELERATOR_NAMESPACE - -#endif // DataFormats_BeamSpot_interface_alpaka_BeamSpotDeviceProduct_h diff --git a/DataFormats/Portable/interface/PortableDeviceProduct.h b/DataFormats/Portable/interface/PortableDeviceProduct.h deleted file mode 100644 index 2d9dcac7b676c..0000000000000 --- a/DataFormats/Portable/interface/PortableDeviceProduct.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef DataFormats_Portable_interface_PortableDeviceProduct_h -#define DataFormats_Portable_interface_PortableDeviceProduct_h - -#include -#include -#include - -#include - -#include "HeterogeneousCore/AlpakaInterface/interface/config.h" -#include "HeterogeneousCore/AlpakaInterface/interface/memory.h" - -// generic SoA-based product in device memory -template >> -class PortableDeviceProduct { - static_assert(not std::is_same_v, - "Use PortableHostProduct instead of PortableDeviceProduct"); - -public: - using Product = T; - using Buffer = cms::alpakatools::device_buffer; - using ConstBuffer = cms::alpakatools::const_device_buffer; - - PortableDeviceProduct() = default; - - PortableDeviceProduct(TDev const& device) - // allocate global device memory - : buffer_{cms::alpakatools::make_device_buffer(device)} { - assert(reinterpret_cast(buffer_->data()) % alignof(Product) == 0); - } - - template >> - PortableDeviceProduct(TQueue const& queue) - // allocate global device memory with queue-ordered semantic - : buffer_{cms::alpakatools::make_device_buffer(queue)} { - assert(reinterpret_cast(buffer_->data()) % alignof(Product) == 0); - } - - // non-copyable - PortableDeviceProduct(PortableDeviceProduct const&) = delete; - PortableDeviceProduct& operator=(PortableDeviceProduct const&) = delete; - - // movable - PortableDeviceProduct(PortableDeviceProduct&&) = default; - PortableDeviceProduct& operator=(PortableDeviceProduct&&) = default; - - // default destructor - ~PortableDeviceProduct() = default; - - // access the product - Product& value() { return *buffer_->data(); } - Product const& value() const { return *buffer_->data(); } - - Product* data() { return buffer_->data(); } - Product const* data() const { return buffer_->data(); } - - Product& operator*() { return *buffer_->data(); } - Product const& operator*() const { return *buffer_->data(); } - - Product* operator->() { return buffer_->data(); } - Product const* operator->() const { return buffer_->data(); } - - // access the buffer - Buffer buffer() { return *buffer_; } - ConstBuffer buffer() const { return *buffer_; } - ConstBuffer const_buffer() const { return *buffer_; } - -private: - std::optional buffer_; -}; - -#endif // DataFormats_Portable_interface_PortableDeviceProduct_h diff --git a/DataFormats/Portable/interface/PortableHostProduct.h b/DataFormats/Portable/interface/PortableHostProduct.h deleted file mode 100644 index a897b2fb39b96..0000000000000 --- a/DataFormats/Portable/interface/PortableHostProduct.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef DataFormats_Portable_interface_PortableHostProduct_h -#define DataFormats_Portable_interface_PortableHostProduct_h - -#include -#include - -#include - -#include "HeterogeneousCore/AlpakaInterface/interface/config.h" -#include "HeterogeneousCore/AlpakaInterface/interface/host.h" -#include "HeterogeneousCore/AlpakaInterface/interface/memory.h" - -// generic SoA-based product in host memory -template -class PortableHostProduct { -public: - using Product = T; - using Buffer = cms::alpakatools::host_buffer; - using ConstBuffer = cms::alpakatools::const_host_buffer; - - PortableHostProduct() = default; - - PortableHostProduct(alpaka_common::DevHost const& host) - // allocate pageable host memory - : buffer_{cms::alpakatools::make_host_buffer()}, product_{buffer_->data()} { - assert(reinterpret_cast(product_) % alignof(Product) == 0); - } - - template >> - PortableHostProduct(TQueue const& queue) - // allocate pinned host memory associated to the given work queue, accessible by the queue's device - : buffer_{cms::alpakatools::make_host_buffer(queue)}, product_{buffer_->data()} { - assert(reinterpret_cast(product_) % alignof(Product) == 0); - } - - // non-copyable - PortableHostProduct(PortableHostProduct const&) = delete; - PortableHostProduct& operator=(PortableHostProduct const&) = delete; - - // movable - PortableHostProduct(PortableHostProduct&&) = default; - PortableHostProduct& operator=(PortableHostProduct&&) = default; - - // default destructor - ~PortableHostProduct() = default; - - // access the product - Product& value() { return *product_; } - Product const& value() const { return *product_; } - - Product* data() { return product_; } - Product const* data() const { return product_; } - - Product& operator*() { return *product_; } - Product const& operator*() const { return *product_; } - - Product* operator->() { return product_; } - Product const* operator->() const { return product_; } - - // access the buffer - Buffer buffer() { return *buffer_; } - ConstBuffer buffer() const { return *buffer_; } - ConstBuffer const_buffer() const { return *buffer_; } - - // part of the ROOT read streamer - static void ROOTReadStreamer(PortableHostProduct* newObj, Product& product) { - std::cerr << "ROOT object at " << &product << std::endl; - std::cerr << "id: " << product.id << std::endl; - - std::cerr << "CMSSW object at " << newObj << std::endl; - std::cerr << "buffer present ? " << newObj->buffer_.has_value() << std::endl; - if (newObj->buffer_.has_value()) { - std::cerr << "buffer content at " << newObj->buffer_->data() << std::endl; - } - std::cerr << "struct content at " << newObj->product_ << std::endl; - if (newObj->product_) { - std::cerr << "id: " << newObj->product_->id << std::endl; - } - newObj->~PortableHostProduct(); - // use the global "host" object returned by cms::alpakatools::host() - new (newObj) PortableHostProduct(cms::alpakatools::host()); - std::memcpy(newObj->product_, &product, sizeof(Product)); - std::cerr << "CMSSW object at " << newObj << std::endl; - std::cerr << "buffer present ? " << newObj->buffer_.has_value() << std::endl; - if (newObj->buffer_.has_value()) { - std::cerr << "buffer content at " << newObj->buffer_->data() << std::endl; - } - std::cerr << "struct content at " << newObj->product_ << std::endl; - if (newObj->product_) { - std::cerr << "id: " << newObj->product_->id << std::endl; - } - } - -private: - std::optional buffer_; //! - Product* product_; -}; - -#endif // DataFormats_Portable_interface_PortableHostProduct_h diff --git a/DataFormats/Portable/interface/PortableProduct.h b/DataFormats/Portable/interface/PortableProduct.h deleted file mode 100644 index 32acd91bbe1c9..0000000000000 --- a/DataFormats/Portable/interface/PortableProduct.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef DataFormats_Portable_interface_PortableProduct_h -#define DataFormats_Portable_interface_PortableProduct_h - -#include "HeterogeneousCore/AlpakaInterface/interface/traits.h" - -namespace traits { - - // trait for a generic SoA-based product - template >> - class PortableProductTrait; - -} // namespace traits - -// type alias for a generic SoA-based product -template >> -using PortableProduct = typename traits::PortableProductTrait::ProductType; - -#endif // DataFormats_Portable_interface_PortableProduct_h diff --git a/DataFormats/Portable/interface/alpaka/PortableProduct.h b/DataFormats/Portable/interface/alpaka/PortableProduct.h deleted file mode 100644 index 7982d394863af..0000000000000 --- a/DataFormats/Portable/interface/alpaka/PortableProduct.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef DataFormats_Portable_interface_alpaka_PortableProduct_h -#define DataFormats_Portable_interface_alpaka_PortableProduct_h - -#include - -#include "DataFormats/Portable/interface/PortableProduct.h" -#include "DataFormats/Portable/interface/PortableHostProduct.h" -#include "DataFormats/Portable/interface/PortableDeviceProduct.h" -#include "HeterogeneousCore/AlpakaInterface/interface/config.h" -#include "HeterogeneousCore/AlpakaInterface/interface/CopyToDevice.h" -#include "HeterogeneousCore/AlpakaInterface/interface/CopyToHost.h" - -namespace ALPAKA_ACCELERATOR_NAMESPACE { - -#if defined ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED - // ... or any other CPU-based accelerators - - // generic SoA-based product in host memory - template - using PortableProduct = ::PortableHostProduct; - -#else - - // generic SoA-based product in device memory - template - using PortableProduct = ::PortableDeviceProduct; - -#endif // ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED - -} // namespace ALPAKA_ACCELERATOR_NAMESPACE - -namespace traits { - - // specialise the trait for the device provided by the ALPAKA_ACCELERATOR_NAMESPACE - template - class PortableProductTrait { - using ProductType = ALPAKA_ACCELERATOR_NAMESPACE::PortableProduct; - }; - -} // namespace traits - -namespace cms::alpakatools { - template - struct CopyToHost> { - template - static auto copyAsync(TQueue& queue, PortableDeviceProduct const& srcData) { - PortableHostProduct dstData(queue); - alpaka::memcpy(queue, dstData.buffer(), srcData.buffer()); - return dstData; - } - }; - - template - struct CopyToDevice> { - template - static auto copyAsync(TQueue& queue, PortableHostProduct const& srcData) { - using TDevice = typename alpaka::trait::DevType::type; - PortableDeviceProduct dstData(queue); - alpaka::memcpy(queue, dstData.buffer(), srcData.buffer()); - return dstData; - } - }; -} // namespace cms::alpakatools - -#endif // DataFormats_Portable_interface_alpaka_PortableProduct_h diff --git a/DataFormats/PortableTestObjects/interface/TestHostProduct.h b/DataFormats/PortableTestObjects/interface/TestHostProduct.h deleted file mode 100644 index c6b93e431c220..0000000000000 --- a/DataFormats/PortableTestObjects/interface/TestHostProduct.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef DataFormats_PortableTestObjects_interface_TestHostProduct_h -#define DataFormats_PortableTestObjects_interface_TestHostProduct_h - -#include "DataFormats/Portable/interface/PortableHostProduct.h" -#include "DataFormats/PortableTestObjects/interface/TestStruct.h" - -namespace portabletest { - - // struct with x, y, z, id fields in host memory - using TestHostProduct = PortableHostProduct; - -} // namespace portabletest - -#endif // DataFormats_PortableTestObjects_interface_TestHostProduct_h diff --git a/DataFormats/PortableTestObjects/interface/alpaka/TestDeviceProduct.h b/DataFormats/PortableTestObjects/interface/alpaka/TestDeviceProduct.h deleted file mode 100644 index 3d1b0671085c9..0000000000000 --- a/DataFormats/PortableTestObjects/interface/alpaka/TestDeviceProduct.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef DataFormats_PortableTestObjects_interface_alpaka_TestDeviceProduct_h -#define DataFormats_PortableTestObjects_interface_alpaka_TestDeviceProduct_h - -#include "DataFormats/Portable/interface/alpaka/PortableProduct.h" -#include "DataFormats/PortableTestObjects/interface/TestStruct.h" -#include "HeterogeneousCore/AlpakaInterface/interface/config.h" - -namespace ALPAKA_ACCELERATOR_NAMESPACE { - - namespace portabletest { - - // make the names from the top-level portabletest namespace visible for unqualified lookup - // inside the ALPAKA_ACCELERATOR_NAMESPACE::portabletest namespace - using namespace ::portabletest; - - // struct with x, y, z, id fields in device global memory - using TestDeviceProduct = PortableProduct; - - } // namespace portabletest - -} // namespace ALPAKA_ACCELERATOR_NAMESPACE - -#endif // DataFormats_PortableTestObjects_interface_alpaka_TestDeviceProduct_h diff --git a/HLTrigger/Configuration/python/customizeHLTforPatatrack.py b/HLTrigger/Configuration/python/customizeHLTforPatatrack.py index 55aa3479d0375..7d0cab3658b03 100644 --- a/HLTrigger/Configuration/python/customizeHLTforPatatrack.py +++ b/HLTrigger/Configuration/python/customizeHLTforPatatrack.py @@ -175,7 +175,7 @@ def customizeHLTforAlpakaPixelRecoLocal(process): # consumes # - reco::BeamSpot # produces - # - BeamSpotDeviceProduct + # - BeamSpotDevice process.hltOnlineBeamSpotDevice = cms.EDProducer('BeamSpotDeviceProducer@alpaka', src = cms.InputTag('hltOnlineBeamSpot'), alpaka = cms.untracked.PSet( @@ -248,7 +248,7 @@ def customizeHLTforAlpakaPixelRecoLocal(process): # alpaka EDProducer # consumes - # - BeamSpotDeviceProduct + # - BeamSpotDevice # - SiPixelClustersSoA # - SiPixelDigisCollection # produces diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/alpaka/SiPixelRecHitAlpaka.cc b/RecoLocalTracker/SiPixelRecHits/plugins/alpaka/SiPixelRecHitAlpaka.cc index a463fad652d24..0b85ae2ba17ce 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/alpaka/SiPixelRecHitAlpaka.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/alpaka/SiPixelRecHitAlpaka.cc @@ -1,5 +1,5 @@ #include "DataFormats/BeamSpot/interface/BeamSpotPOD.h" -#include "DataFormats/BeamSpot/interface/alpaka/BeamSpotDeviceProduct.h" +#include "DataFormats/BeamSpot/interface/alpaka/BeamSpotDevice.h" #include "DataFormats/SiPixelClusterSoA/interface/SiPixelClustersDevice.h" #include "DataFormats/SiPixelClusterSoA/interface/alpaka/SiPixelClustersCollection.h" #include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisDevice.h" @@ -48,7 +48,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { void produce(edm::StreamID streamID, device::Event& iEvent, const device::EventSetup& iSetup) const override; const device::ESGetToken, PixelCPEFastParamsRecord> cpeToken_; - const device::EDGetToken tBeamSpot; + const device::EDGetToken tBeamSpot; const device::EDGetToken tokenClusters_; const device::EDGetToken tokenDigi_; const device::EDPutToken> tokenHit_; diff --git a/RecoVertex/BeamSpotProducer/plugins/alpaka/BeamSpotDeviceProducer.cc b/RecoVertex/BeamSpotProducer/plugins/alpaka/BeamSpotDeviceProducer.cc index cbdb1360b4a64..bd597164827fa 100644 --- a/RecoVertex/BeamSpotProducer/plugins/alpaka/BeamSpotDeviceProducer.cc +++ b/RecoVertex/BeamSpotProducer/plugins/alpaka/BeamSpotDeviceProducer.cc @@ -1,7 +1,7 @@ #include "DataFormats/BeamSpot/interface/BeamSpot.h" -#include "DataFormats/BeamSpot/interface/BeamSpotHostProduct.h" +#include "DataFormats/BeamSpot/interface/BeamSpotHost.h" #include "DataFormats/BeamSpot/interface/BeamSpotPOD.h" -#include "DataFormats/BeamSpot/interface/alpaka/BeamSpotDeviceProduct.h" +#include "DataFormats/BeamSpot/interface/alpaka/BeamSpotDevice.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -20,7 +20,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { void produce(edm::StreamID, device::Event& event, device::EventSetup const& setup) const override { reco::BeamSpot const& beamspot = event.get(legacyToken_); - BeamSpotHostProduct hostProduct{event.queue()}; + BeamSpotHost hostProduct{event.queue()}; hostProduct->x = beamspot.x0(); hostProduct->y = beamspot.y0(); hostProduct->z = beamspot.z0(); @@ -36,7 +36,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { if constexpr (std::is_same_v) { event.emplace(deviceToken_, std::move(hostProduct)); } else { - BeamSpotDeviceProduct deviceProduct{event.queue()}; + BeamSpotDevice deviceProduct{event.queue()}; alpaka::memcpy(event.queue(), deviceProduct.buffer(), hostProduct.const_buffer()); event.emplace(deviceToken_, std::move(deviceProduct)); } @@ -50,7 +50,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { private: const edm::EDGetTokenT legacyToken_; - const device::EDPutToken deviceToken_; + const device::EDPutToken deviceToken_; }; } // namespace ALPAKA_ACCELERATOR_NAMESPACE