Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
- general renaming to have *Device, *Host, *Collection data formats
- consistent package naming with XSoA
- fix for resolutions
- adding various new functionalities to all dataformatas (automatic dictionaries for Host SoA and Device-Host assert, ...)
  • Loading branch information
AdrianoDee committed Nov 29, 2023
1 parent 9facf5e commit 5adcc40
Show file tree
Hide file tree
Showing 132 changed files with 744 additions and 795 deletions.
3 changes: 1 addition & 2 deletions Configuration/StandardSequences/python/Services_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ def _addProcessAcceleratorsAlpaka(process):
from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
from Configuration.ProcessModifiers.alpaka_cff import alpaka

modifyConfigurationStandardSequencesServicesAddProcessAccelerators_ = (gpu | pixelNtupletFit ).makeProcessModifier(_addProcessAccelerators)

modifyConfigurationStandardSequencesServicesAddProcessAccelerators_ = (gpu | pixelNtupletFit | alpaka).makeProcessModifier(_addProcessAccelerators)
modifyConfigurationStandardSequencesServicesAddProcessAcceleratorsAlpaka_ = alpaka.makeProcessModifier(_addProcessAcceleratorsAlpaka)


Expand Down
2 changes: 1 addition & 1 deletion DQM/SiPixelHeterogeneous/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<use name="Geometry/TrackerGeometryBuilder"/>
<use name="DataFormats/TrackingRecHitSoA"/>
<use name="DataFormats/TrackSoA"/>
<use name="DataFormats/Vertex"/>
<use name="DataFormats/VertexSoA"/>
<use name="DataFormats/BeamSpot"/>
<use name="CUDADataFormats/TrackingRecHit"/>
<use name="CUDADataFormats/Track"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include "DataFormats/Math/interface/approx_atan2.h"
#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "DataFormats/TrackingRecHitSoA/interface/TrackingRecHitSoAHost.h"
#include "DataFormats/TrackingRecHitSoA/interface/TrackingRecHitsLayout.h"
#include "DataFormats/TrackingRecHitSoA/interface/TrackingRecHitsHost.h"
#include "DataFormats/TrackingRecHitSoA/interface/TrackingRecHitsSoA.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"
// DataFormats
#include "DataFormats/TrackSoA/interface/TrackSoAHost.h"
#include "DataFormats/TrackSoA/interface/TracksHost.h"
#include "DataFormats/TrackSoA/interface/alpaka/TrackUtilities.h"

namespace {
Expand Down Expand Up @@ -68,7 +68,7 @@ namespace {
template <typename T>
class SiPixelCompareTrackSoAAlpaka : public DQMEDAnalyzer {
public:
using PixelTrackSoA = TrackSoAHost<T>;
using PixelTrackSoA = TracksHost<T>;

explicit SiPixelCompareTrackSoAAlpaka(const edm::ParameterSet&);
~SiPixelCompareTrackSoAAlpaka() override = default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DataFormats/Vertex/interface/ZVertexSoAHost.h"
#include "DataFormats/VertexSoA/interface/ZVertexHost.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"

class SiPixelCompareVertexSoAAlpaka : public DQMEDAnalyzer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "DataFormats/Math/interface/approx_atan2.h"
#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "DataFormats/TrackingRecHitSoA/interface/TrackingRecHitSoAHost.h"
#include "DataFormats/TrackingRecHitSoA/interface/TrackingRecHitsHost.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DataFormats/TrackSoA/interface/TrackSoAHost.h"
#include "DataFormats/TrackSoA/interface/TracksHost.h"

template <typename T>
class SiPixelMonitorTrackSoAAlpaka : public DQMEDAnalyzer {
public:
using PixelTrackHeterogeneous = TrackSoAHost<T>;
using PixelTrackHeterogeneous = TracksHost<T>;
explicit SiPixelMonitorTrackSoAAlpaka(const edm::ParameterSet&);
~SiPixelMonitorTrackSoAAlpaka() override = default;
void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DataFormats/Vertex/interface/ZVertexSoAHost.h"
#include "DataFormats/VertexSoA/interface/ZVertexHost.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"

class SiPixelMonitorVertexSoAAlpaka : public DQMEDAnalyzer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
from DQM.SiPixelHeterogeneous.siPixelPhase2CompareTrackSoAAlpaka_cfi import *
from DQM.SiPixelHeterogeneous.siPixelHIonPhase1CompareTrackSoAAlpaka_cfi import *
from DQM.SiPixelHeterogeneous.siPixelCompareVertexSoAAlpaka_cfi import *
# from DQM.SiPixelHeterogeneous.siPixelPhase1RawDataErrorComparator_cfi import *
# from DQM.SiPixelPhase1Common.SiPixelPhase1RawData_cfi import *

# digi errors
SiPixelPhase1RawDataConfForCPU = copy.deepcopy(SiPixelPhase1RawDataConf)
Expand Down
3 changes: 3 additions & 0 deletions DataFormats/BeamSpot/interface/alpaka/BeamSpotDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
ASSERT_DEVICE_MATCHES_HOST_COLLECTION(BeamSpotDevice, BeamSpotHost);

#endif // DataFormats_BeamSpot_interface_alpaka_BeamSpotDevice_h

// check that the portable device collection for the host device is the same as the portable host collection
ASSERT_DEVICE_MATCHES_HOST_COLLECTION(BeamSpotDevice, BeamSpotHost);
3 changes: 3 additions & 0 deletions DataFormats/Portable/interface/PortableObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <type_traits>

#include "HeterogeneousCore/AlpakaInterface/interface/traits.h"
// This header is not used by PortableObject, but is included here to automatically
// provide its content to users of ALPAKA_ACCELERATOR_NAMESPACE::PortableObject.
#include "HeterogeneousCore/AlpakaInterface/interface/AssertDeviceMatchesHostCollection.h"

namespace traits {

Expand Down
1 change: 0 additions & 1 deletion DataFormats/SiPixelClusterSoA/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- <use name="alpaka"/> -->
<use name="rootcore"/>
<use name="DataFormats/Common"/>
<use name="DataFormats/Portable"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DataFormats_SiPixelClusterSoA_interface_alpaka_SiPixelClustersCollection_h
#define DataFormats_SiPixelClusterSoA_interface_alpaka_SiPixelClustersCollection_h
#ifndef DataFormats_SiPixelClusterSoA_interface_alpaka_SiPixelClustersSoACollection_h
#define DataFormats_SiPixelClusterSoA_interface_alpaka_SiPixelClustersSoACollection_h

#include <alpaka/alpaka.hpp>

Expand All @@ -11,7 +11,7 @@
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {
using SiPixelClustersCollection =
using SiPixelClustersSoACollection =
std::conditional_t<std::is_same_v<Device, alpaka::DevCpu>, SiPixelClustersHost, SiPixelClustersDevice<Device>>;
} // namespace ALPAKA_ACCELERATOR_NAMESPACE

Expand All @@ -23,10 +23,13 @@ namespace cms::alpakatools {
SiPixelClustersHost dstData(srcData->metadata().size(), queue);
alpaka::memcpy(queue, dstData.buffer(), srcData.buffer());
dstData.setNClusters(srcData.nClusters(), srcData.offsetBPIX2());
#ifdef GPU_DEBUG //keeping this untiil copies are in the Tracer
printf("SiPixelClustersSoACollection: I'm copying to host.\n");
#endif
return dstData;
}
};
} // namespace cms::alpakatools

ASSERT_DEVICE_MATCHES_HOST_COLLECTION(SiPixelClustersCollection, SiPixelClustersHost);
#endif // DataFormats_SiPixelClusterSoA_interface_alpaka_SiPixelClustersCollection_h
ASSERT_DEVICE_MATCHES_HOST_COLLECTION(SiPixelClustersSoACollection, SiPixelClustersHost);
#endif // DataFormats_SiPixelClusterSoA_interface_alpaka_SiPixelClustersSoACollection_h
2 changes: 1 addition & 1 deletion DataFormats/SiPixelClusterSoA/src/alpaka/classes_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Common/interface/DeviceProduct.h"
#include "DataFormats/SiPixelClusterSoA/interface/alpaka/SiPixelClustersCollection.h"
#include "DataFormats/SiPixelClusterSoA/interface/alpaka/SiPixelClustersSoACollection.h"

#endif // DataFormats_SiPixelClusterSoA_src_alpaka_classes_cuda_h
6 changes: 3 additions & 3 deletions DataFormats/SiPixelClusterSoA/src/alpaka/classes_cuda_def.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<lcgdict>
<class name="alpaka_cuda_async::PortableCollection<SiPixelClustersSoA>" persistent="false"/>
<class name="alpaka_cuda_async::SiPixelClustersCollection" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_cuda_async::SiPixelClustersCollection>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_cuda_async::SiPixelClustersCollection>>" persistent="false"/>
<class name="alpaka_cuda_async::SiPixelClustersSoACollection" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_cuda_async::SiPixelClustersSoACollection>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_cuda_async::SiPixelClustersSoACollection>>" persistent="false"/>
</lcgdict>
2 changes: 1 addition & 1 deletion DataFormats/SiPixelClusterSoA/src/alpaka/classes_rocm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Common/interface/DeviceProduct.h"
#include "DataFormats/SiPixelClusterSoA/interface/alpaka/SiPixelClustersCollection.h"
#include "DataFormats/SiPixelClusterSoA/interface/alpaka/SiPixelClustersSoACollection.h"

#endif // DataFormats_SiPixelClusterSoA_src_alpaka_classes_rocm_h
6 changes: 3 additions & 3 deletions DataFormats/SiPixelClusterSoA/src/alpaka/classes_rocm_def.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<lcgdict>
<class name="alpaka_rocm_async::PortableCollection<SiPixelClustersSoA>" persistent="false"/>
<class name="alpaka_rocm_async::SiPixelClustersCollection" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_rocm_async::SiPixelClustersCollection>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_rocm_async::SiPixelClustersCollection>>" persistent="false"/>
<class name="alpaka_rocm_async::SiPixelClustersSoACollection" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_rocm_async::SiPixelClustersSoACollection>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_rocm_async::SiPixelClustersSoACollection>>" persistent="false"/>
</lcgdict>
4 changes: 2 additions & 2 deletions DataFormats/SiPixelClusterSoA/test/alpaka/Clusters_test.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <alpaka/alpaka.hpp>

#include "DataFormats/SiPixelClusterSoA/interface/alpaka/SiPixelClustersCollection.h"
#include "DataFormats/SiPixelClusterSoA/interface/alpaka/SiPixelClustersSoACollection.h"
#include "DataFormats/SiPixelClusterSoA/interface/SiPixelClustersDevice.h"
#include "DataFormats/SiPixelClusterSoA/interface/SiPixelClustersHost.h"
#include "DataFormats/SiPixelClusterSoA/interface/SiPixelClustersSoA.h"
Expand Down Expand Up @@ -29,7 +29,7 @@ int main() {
{
// Instantiate tracks on device. PortableDeviceCollection allocates
// SoA on device automatically.
SiPixelClustersCollection clusters_d(100, queue);
SiPixelClustersSoACollection clusters_d(100, queue);
testClusterSoA::runKernels(clusters_d.view(), queue);

// Instantate tracks on host. This is where the data will be
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "DataFormats/SiPixelClusterSoA/interface/alpaka/SiPixelClustersCollection.h"
#include "DataFormats/SiPixelClusterSoA/interface/alpaka/SiPixelClustersSoACollection.h"
#include "DataFormats/SiPixelClusterSoA/interface/SiPixelClustersDevice.h"
#include "DataFormats/SiPixelClusterSoA/interface/SiPixelClustersHost.h"
#include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"
Expand Down
1 change: 0 additions & 1 deletion DataFormats/SiPixelDigiSoA/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<use name="alpaka"/>
<use name="rootcore"/>
<use name="DataFormats/Common"/>
<use name="DataFormats/Portable"/>
Expand Down
8 changes: 4 additions & 4 deletions DataFormats/SiPixelDigiSoA/interface/SiPixelDigisDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
#include <alpaka/alpaka.hpp>

#include "DataFormats/Portable/interface/PortableDeviceCollection.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisSoAv2.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisSoA.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"

template <typename TDev>
class SiPixelDigisDevice : public PortableDeviceCollection<SiPixelDigisSoAv2, TDev> {
class SiPixelDigisDevice : public PortableDeviceCollection<SiPixelDigisSoA, TDev> {
public:
SiPixelDigisDevice() = default;
template <typename TQueue>
explicit SiPixelDigisDevice(size_t maxFedWords, TQueue queue)
: PortableDeviceCollection<SiPixelDigisSoAv2, TDev>(maxFedWords + 1, queue) {}
: PortableDeviceCollection<SiPixelDigisSoA, TDev>(maxFedWords + 1, queue) {}

// Constructor which specifies the SoA size
explicit SiPixelDigisDevice(size_t maxFedWords, TDev const &device)
: PortableDeviceCollection<SiPixelDigisSoAv2, TDev>(maxFedWords + 1, device) {}
: PortableDeviceCollection<SiPixelDigisSoA, TDev>(maxFedWords + 1, device) {}

void setNModulesDigis(uint32_t nModules, uint32_t nDigis) {
nModules_h = nModules;
Expand Down
6 changes: 3 additions & 3 deletions DataFormats/SiPixelDigiSoA/interface/SiPixelDigisHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
#define DataFormats_SiPixelDigiSoA_interface_SiPixelDigisHost_h

#include "DataFormats/Portable/interface/PortableHostCollection.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisSoAv2.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisSoA.h"

// TODO: The class is created via inheritance of the PortableDeviceCollection.
// This is generally discouraged, and should be done via composition.
// See: https://github.com/cms-sw/cmssw/pull/40465#discussion_r1067364306
class SiPixelDigisHost : public PortableHostCollection<SiPixelDigisSoAv2> {
class SiPixelDigisHost : public PortableHostCollection<SiPixelDigisSoA> {
public:
SiPixelDigisHost() = default;
template <typename TQueue>
explicit SiPixelDigisHost(size_t maxFedWords, TQueue queue)
: PortableHostCollection<SiPixelDigisSoAv2>(maxFedWords + 1, queue) {}
: PortableHostCollection<SiPixelDigisSoA>(maxFedWords + 1, queue) {}

void setNModulesDigis(uint32_t nModules, uint32_t nDigis) {
nModules_h = nModules;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DataFormats_SiPixelDigiSoA_interface_SiPixelDigisSoAv2_h
#define DataFormats_SiPixelDigiSoA_interface_SiPixelDigisSoAv2_h
#ifndef DataFormats_SiPixelDigiSoA_interface_SiPixelDigisSoA_h
#define DataFormats_SiPixelDigiSoA_interface_SiPixelDigisSoA_h

#include "DataFormats/SoATemplate/interface/SoALayout.h"

Expand All @@ -12,8 +12,8 @@ GENERATE_SOA_LAYOUT(SiPixelDigisLayout,
SOA_COLUMN(uint16_t, yy),
SOA_COLUMN(uint16_t, moduleId))

using SiPixelDigisSoAv2 = SiPixelDigisLayout<>;
using SiPixelDigisSoAv2View = SiPixelDigisSoAv2::View;
using SiPixelDigisSoAv2ConstView = SiPixelDigisSoAv2::ConstView;
using SiPixelDigisSoA = SiPixelDigisLayout<>;
using SiPixelDigisSoAView = SiPixelDigisSoA::View;
using SiPixelDigisSoAConstView = SiPixelDigisSoA::ConstView;

#endif // DataFormats_SiPixelDigiSoA_interface_SiPixelDigisSoAv2_h
#endif // DataFormats_SiPixelDigiSoA_interface_SiPixelDigisSoA_h
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
#ifndef DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsCollection_h
#define DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsCollection_h
#ifndef DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsSoACollection_h
#define DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsSoACollection_h

#include <cstdint>

#include <alpaka/alpaka.hpp>

#include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigiErrorsHost.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigiErrorsDevice.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h"
#include "HeterogeneousCore/AlpakaInterface/interface/CopyToHost.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {
#ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
using SiPixelDigiErrorsCollection = SiPixelDigiErrorsHost;
#else
using SiPixelDigiErrorsCollection = SiPixelDigiErrorsDevice<Device>;
#endif

using SiPixelDigiErrorsSoACollection =
std::conditional_t<std::is_same_v<Device, alpaka::DevCpu>, SiPixelDigiErrorsHost, SiPixelDigiErrorsDevice<Device>>;

} // namespace ALPAKA_ACCELERATOR_NAMESPACE

namespace cms::alpakatools {
template <>
struct CopyToHost<ALPAKA_ACCELERATOR_NAMESPACE::SiPixelDigiErrorsCollection> {
template <typename TDevice>
struct CopyToHost<SiPixelDigiErrorsDevice<TDevice>> {
template <typename TQueue>
static auto copyAsync(TQueue& queue, ALPAKA_ACCELERATOR_NAMESPACE::SiPixelDigiErrorsCollection const& srcData) {
static auto copyAsync(TQueue& queue, SiPixelDigiErrorsDevice<TDevice> const& srcData) {
SiPixelDigiErrorsHost dstData(srcData.maxFedWords(), queue);
alpaka::memcpy(queue, dstData.buffer(), srcData.buffer());

#ifdef GPU_DEBUG
printf("SiPixelDigiErrorsSoACollection: I'm copying to host.\n");
#endif
return dstData;
}
};
} // namespace cms::alpakatools

#endif // DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsCollection_h
ASSERT_DEVICE_MATCHES_HOST_COLLECTION(SiPixelDigiErrorsSoACollection, SiPixelDigiErrorsHost);

#endif // DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsSoACollection_h
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
#ifndef DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigisCollection_h
#define DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigisCollection_h
#ifndef DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigisSoACollection_h
#define DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigisSoACollection_h

#include <cstdint>

#include <alpaka/alpaka.hpp>

#include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisDevice.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisHost.h"
#include "HeterogeneousCore/AlpakaInterface/interface/CopyToHost.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {

#ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
using SiPixelDigisCollection = SiPixelDigisHost;
#else
using SiPixelDigisCollection = SiPixelDigisDevice<Device>;
#endif
using SiPixelDigisSoACollection =
std::conditional_t<std::is_same_v<Device, alpaka::DevCpu>, SiPixelDigisHost, SiPixelDigisDevice<Device>>;

} // namespace ALPAKA_ACCELERATOR_NAMESPACE

namespace cms::alpakatools {
template <>
struct CopyToHost<ALPAKA_ACCELERATOR_NAMESPACE::SiPixelDigisCollection> {
template <typename TDevice>
struct CopyToHost<SiPixelDigisDevice<TDevice>> {
template <typename TQueue>
static auto copyAsync(TQueue &queue, ALPAKA_ACCELERATOR_NAMESPACE::SiPixelDigisCollection const &srcData) {
static auto copyAsync(TQueue &queue, SiPixelDigisDevice<TDevice> const &srcData) {
SiPixelDigisHost dstData(srcData.view().metadata().size(), queue);
alpaka::memcpy(queue, dstData.buffer(), srcData.buffer());
dstData.setNModulesDigis(srcData.nModules(), srcData.nDigis());
Expand All @@ -33,4 +31,6 @@ namespace cms::alpakatools {
};
} // namespace cms::alpakatools

#endif // DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigisCollection_h
ASSERT_DEVICE_MATCHES_HOST_COLLECTION(SiPixelDigisSoACollection, SiPixelDigisHost);

#endif // DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigisSoACollection_h
6 changes: 3 additions & 3 deletions DataFormats/SiPixelDigiSoA/src/alpaka/classes_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigiErrorsSoA.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisSoAv2.h"
#include "DataFormats/SiPixelDigiSoA/interface/alpaka/SiPixelDigiErrorsCollection.h"
#include "DataFormats/SiPixelDigiSoA/interface/alpaka/SiPixelDigisCollection.h"
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisSoA.h"
#include "DataFormats/SiPixelDigiSoA/interface/alpaka/SiPixelDigiErrorsSoACollection.h"
#include "DataFormats/SiPixelDigiSoA/interface/alpaka/SiPixelDigisSoACollection.h"

#endif // DataFormats_SiPixelDigiSoA_src_alpaka_classes_cuda_h
Loading

0 comments on commit 5adcc40

Please sign in to comment.