10 #include <tbb/parallel_for.h>
11 #include <tbb/parallel_scan.h>
14 #if TBB_INTERFACE_VERSION >= 10000
15 #ifdef OPEN3D_USE_ONEAPI_PACKAGES
16 #include <oneapi/dpl/execution>
17 #include <oneapi/dpl/numeric>
22 #ifdef __cpp_lib_parallel_algorithm
26 #include <pstl/execution>
27 #include <pstl/numeric>
32 #if __PSTL_CPP17_EXECUTION_POLICIES_PRESENT
33 #include <pstl/internal/glue_execution_defs.h>
45 template <
class Tin,
class Tout>
52 ScanSumBody(Tout* out_,
const Tin* in_) : sum(0), in(in_), out(out_) {}
53 Tout get_sum()
const {
return sum; }
56 void operator()(
const tbb::blocked_range<size_t>& r, Tag) {
58 for (
size_t i = r.begin(); i < r.end(); ++i) {
60 if (Tag::is_final_scan()) out[i] = temp;
64 ScanSumBody(ScanSumBody& b, tbb::split) : sum(0), in(b.in), out(b.out) {}
65 void reverse_join(ScanSumBody& a) { sum = a.sum + sum; }
66 void assign(ScanSumBody& b) { sum = b.sum; }
70 template <
class Tin,
class Tout>
72 #if TBB_INTERFACE_VERSION >= 10000
74 #ifdef OPEN3D_USE_ONEAPI_PACKAGES
75 std::inclusive_scan(oneapi::dpl::execution::par_unseq, first, last, out);
78 std::inclusive_scan(std::execution::par_unseq, first, last, out);
81 ScanSumBody<Tin, Tout> body(out, first);
82 size_t n = std::distance(first, last);
83 tbb::parallel_scan(tbb::blocked_range<size_t>(0, n), body);
void InclusivePrefixSum(const Tin *first, const Tin *last, Tout *out)
Definition: ParallelScan.h:71
Definition: PinholeCameraIntrinsic.cpp:16