Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef HeterogeneousCore_AlpakaTest_interface_AlpakaESTestData_h
0002 #define HeterogeneousCore_AlpakaTest_interface_AlpakaESTestData_h
0003 
0004 #include "DataFormats/Portable/interface/PortableHostCollection.h"
0005 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0006 #include "HeterogeneousCore/AlpakaInterface/interface/memory.h"
0007 #include "HeterogeneousCore/AlpakaTest/interface/AlpakaESTestSoA.h"
0008 
0009 namespace cms::alpakatest {
0010   // Model 2
0011   template <typename TDev>
0012   class AlpakaESTestDataB {
0013   public:
0014     using Buffer = cms::alpakatools::device_buffer<TDev, int[]>;
0015     using ConstBuffer = cms::alpakatools::const_device_buffer<TDev, int[]>;
0016 
0017     explicit AlpakaESTestDataB(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 = PortableHostCollection<AlpakaESTestSoAC>;
0032   using AlpakaESTestDataDHost = PortableHostCollection<AlpakaESTestSoAD>;
0033 }  // namespace cms::alpakatest
0034 
0035 #endif