File indexing completed on 2024-04-06 12:05:23
0001 #ifndef DataFormats_VertexSoA_interface_ZVertexSoACollection_h
0002 #define DataFormats_VertexSoA_interface_ZVertexSoACollection_h
0003
0004 #include <cstdint>
0005
0006 #include <alpaka/alpaka.hpp>
0007 #include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
0008 #include "DataFormats/VertexSoA/interface/ZVertexSoA.h"
0009 #include "DataFormats/VertexSoA/interface/ZVertexDefinitions.h"
0010 #include "DataFormats/VertexSoA/interface/ZVertexHost.h"
0011 #include "DataFormats/VertexSoA/interface/ZVertexDevice.h"
0012 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0013 #include "HeterogeneousCore/AlpakaInterface/interface/CopyToHost.h"
0014
0015 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0016
0017 using ZVertexSoACollection =
0018 std::conditional_t<std::is_same_v<Device, alpaka::DevCpu>, ZVertexHost, ZVertexDevice<Device>>;
0019
0020 }
0021
0022 namespace cms::alpakatools {
0023 template <typename TDevice>
0024 struct CopyToHost<ZVertexDevice<TDevice>> {
0025 template <typename TQueue>
0026 static auto copyAsync(TQueue& queue, ZVertexDevice<TDevice> const& deviceData) {
0027 ZVertexHost hostData(queue);
0028 alpaka::memcpy(queue, hostData.buffer(), deviceData.buffer());
0029 #ifdef GPU_DEBUG
0030 printf("ZVertexSoACollection: I'm copying to host.\n");
0031 #endif
0032 return hostData;
0033 }
0034 };
0035 }
0036
0037 ASSERT_DEVICE_MATCHES_HOST_COLLECTION(ZVertexSoACollection, ZVertexHost);
0038
0039 #endif