MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / for_each

Function for_each

include/hipSYCL/algorithms/algorithm.hpp:97–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95
96template <class ForwardIt, class UnaryFunction2>
97sycl::event for_each(sycl::queue &q, ForwardIt first, ForwardIt last,
98 UnaryFunction2 f,
99 const std::vector<sycl::event> &deps = {}) {
100 if(first == last)
101 return sycl::event{};
102 return q.parallel_for(sycl::range{std::distance(first, last)}, deps,
103 [=](sycl::id<1> id) {
104 auto it = first;
105 std::advance(it, id[0]);
106 f(*it);
107 });
108}
109
110template <class ForwardIt, class Size, class UnaryFunction2>
111sycl::event for_each_n(sycl::queue &q, ForwardIt first, Size n,

Callers 7

replaceFunction · 0.70
replace_ifFunction · 0.70
for_each_nodeMethod · 0.50
test_fetch_opFunction · 0.50
BOOST_AUTO_TEST_CASEFunction · 0.50
BOOST_AUTO_TEST_CASEFunction · 0.50

Calls 2

fFunction · 0.85
parallel_forMethod · 0.45

Tested by 1

test_fetch_opFunction · 0.40