Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.14 KB | None | 0 0
  1. #include "SequenceVisitor.cuh"
  2. #include "MatchUpstreamMuon.h"
  3.  
  4. #include "SequenceVisitor.cuh"
  5. #include "RunForwardCPU.h"
  6. #include "Tools.h"
  7. #include "MuonFeaturesExtraction.cuh"
  8.  
  9. template<>
  10. void SequenceVisitor::set_arguments_size<cpu_match_upstream_muon_t>(
  11.   cpu_match_upstream_muon_t::arguments_t arguments,
  12.   const RuntimeOptions& runtime_options,
  13.   const Constants& constants,
  14.   const HostBuffers& host_buffers)
  15. {
  16.   arguments.set_size<dev_muon_hits>(runtime_options.number_of_events);
  17.   arguments.set_size<dev_match_upstream_muon>(host_buffers.host_number_of_selected_events[0]);
  18. }
  19.  
  20. template<>
  21. void SequenceVisitor::visit<cpu_match_upstream_muon_t>(
  22.   cpu_match_upstream_muon_t& state,
  23.   const cpu_match_upstream_muon_t::arguments_t& arguments,
  24.   const RuntimeOptions& runtime_options,
  25.   const Constants& constants,
  26.   HostBuffers& host_buffers,
  27.   cudaStream_t& cuda_stream,
  28.   cudaEvent_t& cuda_generic_event)
  29. {
  30.  
  31.   cudaEventRecord(cuda_generic_event, cuda_stream);
  32.   cudaEventSynchronize(cuda_generic_event);
  33.  
  34.   std::vector<Muon::HitsSoA> muon_hits_events(host_buffers.host_number_of_selected_events[0]);
  35.   //std::vector<Muon::HitsSoA> muon_hits_events(host_buffers.host_number_of_selected_events[0]);
  36.  
  37.   cudaCheck(cudaMemcpyAsync(
  38.       muon_hits_events.data(),
  39.       arguments.offset<dev_muon_hits>(),
  40.       runtime_options.number_of_events * sizeof(Muon::HitsSoA),
  41.       cudaMemcpyDeviceToHost,
  42.       cuda_stream
  43.   ));
  44.  
  45.   std::vector<bool> MuonMatch = state.invoke(
  46.     constants.host_inv_clus_res,
  47.     host_buffers.host_atomics_velo,
  48.     host_buffers.host_velo_track_hit_number,
  49.     host_buffers.host_kalmanvelo_states,
  50.     host_buffers.host_atomics_ut,
  51.     host_buffers.host_ut_track_hit_number,
  52.     host_buffers.host_ut_qop,
  53.     host_buffers.host_ut_track_velo_indices,
  54.     muon_hits_events.data(),
  55.     //host_buffers.host_muon_hits_events.data(),
  56.     runtime_options.number_of_events);
  57.  
  58.   cudaCheck(cudaMemcpyAsync(
  59.       arguments.offset<dev_match_upstream_muon>(),
  60.       MuonMatch.data(),
  61.       host_buffers.host_number_of_selected_events[0] * sizeof(bool),
  62.       cudaMemcpyHostToDevice,
  63.       cuda_stream
  64.   ));  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement