Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:01

0001 // A minimal test to ensure that
0002 //   - portabletest::TestSoA can be compiled
0003 //   - portabletest::TestHostCollection can be allocated
0004 //   - view-based element access works
0005 
0006 #include "DataFormats/PortableTestObjects/interface/TestHostCollection.h"
0007 #include "DataFormats/PortableTestObjects/interface/TestSoA.h"
0008 #include "HeterogeneousCore/AlpakaInterface/interface/host.h"
0009 
0010 int main() {
0011   constexpr const int size = 42;
0012   portabletest::TestHostCollection collection(size, cms::alpakatools::host());
0013 
0014   const portabletest::Matrix matrix{{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10, 12}, {3, 6, 9, 12, 15, 18}};
0015   const portabletest::Array flags = {{6, 4, 2, 0}};
0016 
0017   collection.view().r() = 1.;
0018 
0019   for (int i = 0; i < size; ++i) {
0020     collection.view()[i] = {0.568, 0.823, 0., i, flags, matrix * i};
0021   }
0022 
0023   return 0;
0024 }