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

Function is_sorted

include/hipSYCL/algorithms/algorithm.hpp:1237–1261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1235
1236template <class ForwardIt>
1237sycl::event is_sorted(sycl::queue &q, ForwardIt first, ForwardIt last,
1238 detail::early_exit_flag_t* out,
1239 const std::vector<sycl::event>& deps = {}) {
1240 std::size_t problem_size = std::distance(first, last);
1241 if(problem_size == 0)
1242 return sycl::event{};
1243
1244 auto evt = detail::early_exit_for_each(q, problem_size, out,
1245 [=](sycl::id<1> idx) -> bool {
1246 auto it = first;
1247 std::advance(it, idx[0]);
1248 if(it != last-1) {
1249 auto next = std::next(it, 1);
1250#if __cplusplus < 202002L
1251 return (*next < *it);
1252#else
1253 return std::less{}(*next, *it);
1254#endif
1255 }
1256 return false;
1257 }, deps);
1258 return q.single_task(evt, [=](){
1259 *out = static_cast<detail::early_exit_flag_t>(!(*out));
1260 });
1261}
1262
1263template <class ForwardIt, class Compare>
1264sycl::event is_sorted(sycl::queue &q, ForwardIt first, ForwardIt last,

Callers 2

test_is_sortedFunction · 0.50
test_sortFunction · 0.50

Calls 3

early_exit_for_eachFunction · 0.85
compFunction · 0.50
single_taskMethod · 0.45

Tested by 2

test_is_sortedFunction · 0.40
test_sortFunction · 0.40