Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-11-24 00:02:23

0001 #ifndef HeterogeneousCore_AlpakaTest_interface_alpaka_AlpakaESTestData_h
0002 #define HeterogeneousCore_AlpakaTest_interface_alpaka_AlpakaESTestData_h
0003 
0004 #include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
0005 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0006 #include "HeterogeneousCore/AlpakaInterface/interface/memory.h"
0007 #include "HeterogeneousCore/AlpakaTest/interface/AlpakaESTestData.h"
0008 #include "HeterogeneousCore/AlpakaTest/interface/AlpakaESTestSoA.h"
0009 
0010 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0011   // Model 1
0012   class AlpakaESTestDataA {
0013   public:
0014     using Buffer = cms::alpakatools::device_buffer<Device, int[]>;
0015     using ConstBuffer = cms::alpakatools::const_device_buffer<Device, int[]>;
0016 
0017     explicit AlpakaESTestDataA(Buffer buffer) : buffer_(std::move(buffer)) {}
0018 
0019     Buffer buffer() { return buffer_; }
0020     ConstBuffer buffer() const { return buffer_; }
0021     ConstBuffer const_buffer() const { return buffer_; }
0022 
0023     int const* data() const { return buffer_.data(); }
0024     auto size() const { return alpaka::getExtentProduct(buffer_); }
0025 
0026   private:
0027     Buffer buffer_;
0028   };
0029 
0030   // Model 3
0031   using AlpakaESTestDataCHost = cms::alpakatest::AlpakaESTestDataCHost;
0032   using AlpakaESTestDataCDevice = PortableCollection<cms::alpakatest::AlpakaESTestSoAC>;
0033 
0034   using AlpakaESTestDataDHost = cms::alpakatest::AlpakaESTestDataDHost;
0035   using AlpakaESTestDataDDevice = PortableCollection<cms::alpakatest::AlpakaESTestSoAD>;
0036 }  // namespace ALPAKA_ACCELERATOR_NAMESPACE
0037 
0038 #endif