File indexing completed on 2024-04-06 12:05:11
0001 #include <cstdlib>
0002
0003 #include <alpaka/alpaka.hpp>
0004
0005 #include "DataFormats/SiPixelClusterSoA/interface/SiPixelClustersDevice.h"
0006 #include "DataFormats/SiPixelClusterSoA/interface/SiPixelClustersHost.h"
0007 #include "DataFormats/SiPixelClusterSoA/interface/SiPixelClustersSoA.h"
0008 #include "DataFormats/SiPixelClusterSoA/interface/alpaka/SiPixelClustersSoACollection.h"
0009 #include "FWCore/Utilities/interface/stringize.h"
0010 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0011 #include "HeterogeneousCore/AlpakaInterface/interface/devices.h"
0012 #include "HeterogeneousCore/AlpakaInterface/interface/memory.h"
0013 #include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"
0014
0015 #include "Clusters_test.h"
0016
0017 using namespace ALPAKA_ACCELERATOR_NAMESPACE;
0018
0019 int main() {
0020
0021 auto const& devices = cms::alpakatools::devices<Platform>();
0022 if (devices.empty()) {
0023 std::cerr << "No devices available for the " EDM_STRINGIZE(ALPAKA_ACCELERATOR_NAMESPACE) " backend, "
0024 "the test will be skipped.\n";
0025 exit(EXIT_FAILURE);
0026 }
0027
0028
0029 for (const auto& device : devices) {
0030 Queue queue(device);
0031
0032
0033 {
0034
0035
0036 SiPixelClustersSoACollection clusters_d(100, queue);
0037 testClusterSoA::runKernels(clusters_d.view(), queue);
0038
0039
0040
0041 SiPixelClustersHost clusters_h(clusters_d.view().metadata().size(), queue);
0042
0043 std::cout << clusters_h.view().metadata().size() << std::endl;
0044 alpaka::memcpy(queue, clusters_h.buffer(), clusters_d.const_buffer());
0045 alpaka::wait(queue);
0046 }
0047 }
0048
0049 return EXIT_SUCCESS;
0050 }