29 #include <tbb/parallel_for.h> 30 #include <tbb/parallel_scan.h> 33 #if TBB_INTERFACE_VERSION >= 10000 34 #ifdef OPEN3D_USE_ONEAPI_PACKAGES 35 #include <oneapi/dpl/execution> 36 #include <oneapi/dpl/numeric> 41 #ifdef __cpp_lib_parallel_algorithm 45 #include <pstl/execution> 46 #include <pstl/numeric> 51 #if __PSTL_CPP17_EXECUTION_POLICIES_PRESENT 52 #include <pstl/internal/glue_execution_defs.h> 64 template <
class Tin,
class Tout>
71 ScanSumBody(Tout* out_,
const Tin* in_) : sum(0), in(in_), out(out_) {}
72 Tout get_sum()
const {
return sum; }
75 void operator()(
const tbb::blocked_range<size_t>& r, Tag) {
77 for (
size_t i = r.begin(); i < r.end(); ++i) {
79 if (Tag::is_final_scan()) out[i] = temp;
83 ScanSumBody(ScanSumBody& b, tbb::split) : sum(0), in(b.in), out(b.out) {}
84 void reverse_join(ScanSumBody& a) { sum = a.sum + sum; }
85 void assign(ScanSumBody& b) { sum = b.sum; }
89 template <
class Tin,
class Tout>
91 #if TBB_INTERFACE_VERSION >= 10000 93 #ifdef OPEN3D_USE_ONEAPI_PACKAGES 94 std::inclusive_scan(oneapi::dpl::execution::par_unseq, first, last, out);
97 std::inclusive_scan(std::execution::par_unseq, first, last, out);
100 ScanSumBody<Tin, Tout> body(out, first);
101 size_t n = std::distance(first, last);
102 tbb::parallel_scan(tbb::blocked_range<size_t>(0, n), body);
void InclusivePrefixSum(const Tin *first, const Tin *last, Tout *out)
Definition: ParallelScan.h:90
Definition: PinholeCameraIntrinsic.cpp:35