File indexing completed on 2024-04-06 12:05:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <cstdlib>
0017 #include <unistd.h>
0018
0019 #include <alpaka/alpaka.hpp>
0020
0021 #include "DataFormats/TrackSoA/interface/TracksDevice.h"
0022 #include "DataFormats/TrackSoA/interface/TracksHost.h"
0023 #include "DataFormats/TrackSoA/interface/alpaka/TracksSoACollection.h"
0024 #include "FWCore/Utilities/interface/stringize.h"
0025 #include "Geometry/CommonTopologies/interface/SimplePixelTopology.h"
0026 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0027 #include "HeterogeneousCore/AlpakaInterface/interface/devices.h"
0028 #include "HeterogeneousCore/AlpakaInterface/interface/memory.h"
0029 #include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"
0030
0031 #include "TrackSoAHeterogeneous_test.h"
0032
0033 using namespace ALPAKA_ACCELERATOR_NAMESPACE;
0034 using namespace ALPAKA_ACCELERATOR_NAMESPACE::pixelTrack;
0035
0036 int main() {
0037
0038 auto const& devices = cms::alpakatools::devices<Platform>();
0039 if (devices.empty()) {
0040 std::cerr << "No devices available for the " EDM_STRINGIZE(ALPAKA_ACCELERATOR_NAMESPACE) " backend, "
0041 "the test will be skipped.\n";
0042 exit(EXIT_FAILURE);
0043 }
0044
0045
0046 for (const auto& device : devices) {
0047 Queue queue(device);
0048
0049
0050 {
0051
0052
0053 TracksSoACollection<pixelTopology::Phase1> tracks_d(queue);
0054 testTrackSoA::runKernels<pixelTopology::Phase1>(tracks_d.view(), queue);
0055
0056
0057
0058 TracksHost<pixelTopology::Phase1> tracks_h(queue);
0059
0060 std::cout << tracks_h.view().metadata().size() << std::endl;
0061 alpaka::memcpy(queue, tracks_h.buffer(), tracks_d.const_buffer());
0062 alpaka::wait(queue);
0063
0064
0065 std::cout << "pt"
0066 << "\t"
0067 << "eta"
0068 << "\t"
0069 << "chi2"
0070 << "\t"
0071 << "quality"
0072 << "\t"
0073 << "nLayers"
0074 << "\t"
0075 << "hitIndices off" << std::endl;
0076
0077 for (int i = 0; i < 10; ++i) {
0078 std::cout << tracks_h.view()[i].pt() << "\t" << tracks_h.view()[i].eta() << "\t" << tracks_h.view()[i].chi2()
0079 << "\t" << (int)tracks_h.view()[i].quality() << "\t" << (int)tracks_h.view()[i].nLayers() << "\t"
0080 << tracks_h.view().hitIndices().off[i] << std::endl;
0081 }
0082 }
0083 }
0084
0085 return EXIT_SUCCESS;
0086 }