Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-08 23:51:35

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