49
49
50
50
// System include(s).
51
51
#include < cassert>
52
+ #include < memory_resource>
52
53
#include < vector>
53
54
54
55
namespace traccc ::cuda {
@@ -77,6 +78,11 @@ finding_algorithm<stepper_t, navigator_t>::operator()(
77
78
// Copy setup
78
79
m_copy.setup (seeds_buffer)->ignore ();
79
80
81
+ // The Thrust policy to use.
82
+ auto thrust_policy =
83
+ thrust::cuda::par_nosync (std::pmr::polymorphic_allocator (&(m_mr.main )))
84
+ .on (stream);
85
+
80
86
/* ****************************************************************
81
87
* Measurement Operations
82
88
*****************************************************************/
@@ -97,11 +103,11 @@ finding_algorithm<stepper_t, navigator_t>::operator()(
97
103
98
104
measurement_collection_types::device uniques (uniques_buffer);
99
105
100
- measurement* uniques_end = thrust::unique_copy (
101
- thrust::cuda::par ( std::pmr::polymorphic_allocator (&(m_mr. main )))
102
- . on (stream) ,
103
- measurements. ptr (), measurements. ptr () + n_measurements,
104
- uniques. begin (), measurement_equal_comp () );
106
+ measurement* uniques_end =
107
+ thrust::unique_copy (thrust_policy, measurements. ptr (),
108
+ measurements. ptr () + n_measurements ,
109
+ uniques. begin (), measurement_equal_comp ());
110
+ m_stream. synchronize ( );
105
111
n_modules = static_cast <unsigned int >(uniques_end - uniques.begin ());
106
112
}
107
113
@@ -115,12 +121,10 @@ finding_algorithm<stepper_t, navigator_t>::operator()(
115
121
116
122
measurement_collection_types::device uniques (uniques_buffer);
117
123
118
- thrust::upper_bound (
119
- thrust::cuda::par (std::pmr::polymorphic_allocator (&(m_mr.main )))
120
- .on (stream),
121
- measurements.ptr (), measurements.ptr () + n_measurements,
122
- uniques.begin (), uniques.begin () + n_modules, upper_bounds.begin (),
123
- measurement_sort_comp ());
124
+ thrust::upper_bound (thrust_policy, measurements.ptr (),
125
+ measurements.ptr () + n_measurements,
126
+ uniques.begin (), uniques.begin () + n_modules,
127
+ upper_bounds.begin (), measurement_sort_comp ());
124
128
}
125
129
126
130
/* ****************************************************************
@@ -285,12 +289,9 @@ finding_algorithm<stepper_t, navigator_t>::operator()(
285
289
keys_buffer);
286
290
vecmem::device_vector<unsigned int > param_ids_device (
287
291
param_ids_buffer);
288
- thrust::sort_by_key (
289
- thrust::cuda::par (
290
- std::pmr::polymorphic_allocator (&(m_mr.main )))
291
- .on (stream),
292
- keys_device.begin (), keys_device.end (),
293
- param_ids_device.begin ());
292
+ thrust::sort_by_key (thrust_policy, keys_device.begin (),
293
+ keys_device.end (),
294
+ param_ids_device.begin ());
294
295
295
296
m_stream.synchronize ();
296
297
}
@@ -338,10 +339,8 @@ finding_algorithm<stepper_t, navigator_t>::operator()(
338
339
vecmem::device_vector<candidate_link> out (
339
340
*(links_buffer.host_ptr () + it));
340
341
341
- thrust::copy (
342
- thrust::cuda::par (std::pmr::polymorphic_allocator (&(m_mr.main )))
343
- .on (stream),
344
- in.begin (), in.begin () + n_candidates_per_step[it], out.begin ());
342
+ thrust::copy (thrust_policy, in.begin (),
343
+ in.begin () + n_candidates_per_step[it], out.begin ());
345
344
}
346
345
347
346
/* ****************************************************************
0 commit comments