oneapi-src / oneTBB

oneAPI Threading Building Blocks (oneTBB)
https://oneapi-src.github.io/oneTBB/
Apache License 2.0
5.72k stars 1.02k forks source link

why did you break parallel_reduce? #965

Closed jeffhammond closed 1 year ago

jeffhammond commented 1 year ago

I've been supporting TBB in the PRK project for years. Now it seems you've completely changed parallel_reduce such that none of the code compiles anymore.

Why do you keep doing this? Is there a migration documentation?

PRK help: Consider setting USE_PRK_TBB_PARTITIONER={static,affinity,simple} when invoking make
g++-11 -std=gnu++20 -pthread -fmax-errors=1 -O3 -mtune=native -ffast-math -g3 -Wall  -DPRKVERSION="2020" stencil-tbb.cc -I/opt/homebrew/Cellar/tbb/2021.7.0/include -L/opt/homebrew/Cellar/tbb/2021.7.0/lib -ltbb -DPRK_TBB_PARTITIONER=0 -o stencil-tbb
stencil-tbb.cc: In function 'int main(int, char**)':
stencil-tbb.cc:221:30: error: no matching function for call to 'parallel_reduce(tbb::detail::d1::blocked_range2d<int>&, double, main(int, char**)::<lambda(tbb::detail::d1::blocked_range2d<int>&, double)>, main(int, char**)::<lambda(double, double)>, tbb::detail::d1::auto_partitioner&)'
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:621:7: note: candidate: 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, tbb::detail::d1::affinity_partitioner&, tbb::detail::d1::task_group_context&)'
  621 | Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
      |       ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:621:7: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 6 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:608:7: note: candidate: 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, const tbb::detail::d1::static_partitioner&, tbb::detail::d1::task_group_context&)'
  608 | Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
      |       ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:608:7: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 6 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:595:7: note: candidate: 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, const tbb::detail::d1::auto_partitioner&, tbb::detail::d1::task_group_context&)'
  595 | Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
      |       ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:595:7: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 6 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:582:7: note: candidate: 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, const tbb::detail::d1::simple_partitioner&, tbb::detail::d1::task_group_context&)'
  582 | Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
      |       ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:582:7: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 6 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:569:7: note: candidate: 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, tbb::detail::d1::task_group_context&)'
  569 | Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
      |       ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:569:7: note:   template argument deduction/substitution failed:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:569:7: note: constraints not satisfied
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h: In substitution of 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, tbb::detail::d1::task_group_context&) [with Range = tbb::detail::d1::blocked_range2d<int>; Value = double; RealBody = main(int, char**)::<lambda(tbb::detail::d1::blocked_range2d<int>&, double)>; Reduction = main(int, char**)::<lambda(double, double)>]':
stencil-tbb.cc:221:30:   required from here
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:44:9:   required for the satisfaction of 'parallel_reduce_function<RealBody, Range, Value>' [with RealBody = main::._anon_153; Range = tbb::detail::d1::blocked_range2d<int, int>; Value = double]
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:44:36:   in requirements with 'std::remove_reference_t<_Tp>& func', 'const Range& range', 'const Value& value' [with Value = double; Range = tbb::detail::d1::blocked_range2d<int, int>; Function = main::._anon_153]
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:47:11: note: the required expression 'func(range, value)' is invalid
   47 |     { func(range, value) } -> std::convertible_to<Value>;
      |       ~~~~^~~~~~~~~~~~~~
cc1plus: note: set '-fconcepts-diagnostics-depth=' to at least 2 for more detail
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:556:7: note: candidate: 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, tbb::detail::d1::affinity_partitioner&)'
  556 | Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
      |       ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:556:7: note:   template argument deduction/substitution failed:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:556:7: note: constraints not satisfied
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h: In substitution of 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, tbb::detail::d1::affinity_partitioner&) [with Range = tbb::detail::d1::blocked_range2d<int>; Value = double; RealBody = main(int, char**)::<lambda(tbb::detail::d1::blocked_range2d<int>&, double)>; Reduction = main(int, char**)::<lambda(double, double)>]':
stencil-tbb.cc:221:30:   required from here
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:44:9:   required for the satisfaction of 'parallel_reduce_function<RealBody, Range, Value>' [with RealBody = main::._anon_153; Range = tbb::detail::d1::blocked_range2d<int, int>; Value = double]
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:44:36:   in requirements with 'std::remove_reference_t<_Tp>& func', 'const Range& range', 'const Value& value' [with Value = double; Range = tbb::detail::d1::blocked_range2d<int, int>; Function = main::._anon_153]
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:47:11: note: the required expression 'func(range, value)' is invalid
   47 |     { func(range, value) } -> std::convertible_to<Value>;
      |       ~~~~^~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:543:7: note: candidate: 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, const tbb::detail::d1::static_partitioner&)'
  543 | Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
      |       ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:543:7: note:   template argument deduction/substitution failed:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:543:7: note: constraints not satisfied
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h: In substitution of 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, const tbb::detail::d1::static_partitioner&) [with Range = tbb::detail::d1::blocked_range2d<int>; Value = double; RealBody = main(int, char**)::<lambda(tbb::detail::d1::blocked_range2d<int>&, double)>; Reduction = main(int, char**)::<lambda(double, double)>]':
stencil-tbb.cc:221:30:   required from here
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:44:9:   required for the satisfaction of 'parallel_reduce_function<RealBody, Range, Value>' [with RealBody = main::._anon_153; Range = tbb::detail::d1::blocked_range2d<int, int>; Value = double]
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:44:36:   in requirements with 'std::remove_reference_t<_Tp>& func', 'const Range& range', 'const Value& value' [with Value = double; Range = tbb::detail::d1::blocked_range2d<int, int>; Function = main::._anon_153]
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:47:11: note: the required expression 'func(range, value)' is invalid
   47 |     { func(range, value) } -> std::convertible_to<Value>;
      |       ~~~~^~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:530:7: note: candidate: 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, const tbb::detail::d1::auto_partitioner&)'
  530 | Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
      |       ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:530:7: note:   template argument deduction/substitution failed:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:530:7: note: constraints not satisfied
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h: In substitution of 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, const tbb::detail::d1::auto_partitioner&) [with Range = tbb::detail::d1::blocked_range2d<int>; Value = double; RealBody = main(int, char**)::<lambda(tbb::detail::d1::blocked_range2d<int>&, double)>; Reduction = main(int, char**)::<lambda(double, double)>]':
stencil-tbb.cc:221:30:   required from here
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:44:9:   required for the satisfaction of 'parallel_reduce_function<RealBody, Range, Value>' [with RealBody = main::._anon_153; Range = tbb::detail::d1::blocked_range2d<int, int>; Value = double]
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:44:36:   in requirements with 'std::remove_reference_t<_Tp>& func', 'const Range& range', 'const Value& value' [with Value = double; Range = tbb::detail::d1::blocked_range2d<int, int>; Function = main::._anon_153]
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:47:11: note: the required expression 'func(range, value)' is invalid
   47 |     { func(range, value) } -> std::convertible_to<Value>;
      |       ~~~~^~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:517:7: note: candidate: 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, const tbb::detail::d1::simple_partitioner&)'
  517 | Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
      |       ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:517:7: note:   template argument deduction/substitution failed:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:517:7: note: constraints not satisfied
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h: In substitution of 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&, const tbb::detail::d1::simple_partitioner&) [with Range = tbb::detail::d1::blocked_range2d<int>; Value = double; RealBody = main(int, char**)::<lambda(tbb::detail::d1::blocked_range2d<int>&, double)>; Reduction = main(int, char**)::<lambda(double, double)>]':
stencil-tbb.cc:221:30:   required from here
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:44:9:   required for the satisfaction of 'parallel_reduce_function<RealBody, Range, Value>' [with RealBody = main::._anon_153; Range = tbb::detail::d1::blocked_range2d<int, int>; Value = double]
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:44:36:   in requirements with 'std::remove_reference_t<_Tp>& func', 'const Range& range', 'const Value& value' [with Value = double; Range = tbb::detail::d1::blocked_range2d<int, int>; Function = main::._anon_153]
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:47:11: note: the required expression 'func(range, value)' is invalid
   47 |     { func(range, value) } -> std::convertible_to<Value>;
      |       ~~~~^~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:505:7: note: candidate: 'template<class Range, class Value, class RealBody, class Reduction>  requires (tbb_range<Range>) && (parallel_reduce_function<RealBody, Range, Value>) && (parallel_reduce_combine<Reduction, Value>) Value tbb::detail::d1::parallel_reduce(const Range&, const Value&, const RealBody&, const Reduction&)'
  505 | Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction ) {
      |       ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:505:7: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 4 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:494:6: note: candidate: 'template<class Range, class Body>  requires (tbb_range<Range>) && (parallel_reduce_body<Body, Range>) void tbb::detail::d1::parallel_reduce(const Range&, Body&, tbb::detail::d1::affinity_partitioner&, tbb::detail::d1::task_group_context&)'
  494 | void parallel_reduce( const Range& range, Body& body, affinity_partitioner& partitioner, task_group_context& context ) {
      |      ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:494:6: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 4 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:486:6: note: candidate: 'template<class Range, class Body>  requires (tbb_range<Range>) && (parallel_reduce_body<Body, Range>) void tbb::detail::d1::parallel_reduce(const Range&, Body&, const tbb::detail::d1::static_partitioner&, tbb::detail::d1::task_group_context&)'
  486 | void parallel_reduce( const Range& range, Body& body, const static_partitioner& partitioner, task_group_context& context ) {
      |      ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:486:6: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 4 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:478:6: note: candidate: 'template<class Range, class Body>  requires (tbb_range<Range>) && (parallel_reduce_body<Body, Range>) void tbb::detail::d1::parallel_reduce(const Range&, Body&, const tbb::detail::d1::auto_partitioner&, tbb::detail::d1::task_group_context&)'
  478 | void parallel_reduce( const Range& range, Body& body, const auto_partitioner& partitioner, task_group_context& context ) {
      |      ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:478:6: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 4 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:470:6: note: candidate: 'template<class Range, class Body>  requires (tbb_range<Range>) && (parallel_reduce_body<Body, Range>) void tbb::detail::d1::parallel_reduce(const Range&, Body&, const tbb::detail::d1::simple_partitioner&, tbb::detail::d1::task_group_context&)'
  470 | void parallel_reduce( const Range& range, Body& body, const simple_partitioner& partitioner, task_group_context& context ) {
      |      ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:470:6: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 4 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:462:6: note: candidate: 'template<class Range, class Body>  requires (tbb_range<Range>) && (parallel_reduce_body<Body, Range>) void tbb::detail::d1::parallel_reduce(const Range&, Body&, tbb::detail::d1::task_group_context&)'
  462 | void parallel_reduce( const Range& range, Body& body, task_group_context& context ) {
      |      ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:462:6: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 3 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:454:6: note: candidate: 'template<class Range, class Body>  requires (tbb_range<Range>) && (parallel_reduce_body<Body, Range>) void tbb::detail::d1::parallel_reduce(const Range&, Body&, tbb::detail::d1::affinity_partitioner&)'
  454 | void parallel_reduce( const Range& range, Body& body, affinity_partitioner& partitioner ) {
      |      ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:454:6: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 3 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:446:6: note: candidate: 'template<class Range, class Body>  requires (tbb_range<Range>) && (parallel_reduce_body<Body, Range>) void tbb::detail::d1::parallel_reduce(const Range&, Body&, const tbb::detail::d1::static_partitioner&)'
  446 | void parallel_reduce( const Range& range, Body& body, const static_partitioner& partitioner ) {
      |      ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:446:6: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 3 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:438:6: note: candidate: 'template<class Range, class Body>  requires (tbb_range<Range>) && (parallel_reduce_body<Body, Range>) void tbb::detail::d1::parallel_reduce(const Range&, Body&, const tbb::detail::d1::auto_partitioner&)'
  438 | void parallel_reduce( const Range& range, Body& body, const auto_partitioner& partitioner ) {
      |      ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:438:6: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 3 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:430:6: note: candidate: 'template<class Range, class Body>  requires (tbb_range<Range>) && (parallel_reduce_body<Body, Range>) void tbb::detail::d1::parallel_reduce(const Range&, Body&, const tbb::detail::d1::simple_partitioner&)'
  430 | void parallel_reduce( const Range& range, Body& body, const simple_partitioner& partitioner ) {
      |      ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:430:6: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 3 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/parallel_reduce.h:17,
                 from prk_tbb.h:39,
                 from stencil-tbb.cc:64:
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:422:6: note: candidate: 'template<class Range, class Body>  requires (tbb_range<Range>) && (parallel_reduce_body<Body, Range>) void tbb::detail::d1::parallel_reduce(const Range&, Body&)'
  422 | void parallel_reduce( const Range& range, Body& body ) {
      |      ^~~~~~~~~~~~~~~
/opt/homebrew/Cellar/tbb/2021.7.0/include/tbb/../oneapi/tbb/parallel_reduce.h:422:6: note:   template argument deduction/substitution failed:
stencil-tbb.cc:221:30: note:   candidate expects 2 arguments, 5 provided
  221 |   norm = tbb::parallel_reduce( range, double(0),
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  222 |                                [&](decltype(range)& r, double temp) -> double {
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                    for (int i=r.rows().begin(); i!=r.rows().end(); ++i ) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224 |                                        for (int j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225 |                                            temp += prk::abs(out[i*n+j]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226 |                                        }
      |                                        ~
  227 |                                    }
      |                                    ~
  228 |                                    return temp;
      |                                    ~~~~~~~~~~~~
  229 |                                },
      |                                ~~
  230 |                                [] (const double x1, const double x2) { return x1+x2; },
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231 |                                tbb_partitioner );
      |                                ~~~~~~~~~~~~~~~~~
make: *** [stencil-tbb] Error 1
kboyarinov commented 1 year ago

@jeffhammond, error you sent is caused by adding C++20 constraints into oneTBB APIs to provide early diagnostics of named requirements violations. For your particular case, there is a violation of ParallelReduceFunc requirement. It should accept const Range&, while the function provided in your code accepts decltype(range)&.

As in your use-case, the code that violates named requirement could compile and work correctly until C++20, but it can stop working due to some internal changes in oneTBB implementation. That is why we made a decision to constraint these APIs and to enforce fixing the code that violates named requirement and prevent future errors caused by such violation. Our development guide contains a short caution about this.

kboyarinov commented 1 year ago

@jeffhammond, is this still an issue or it can be closed?

jeffhammond commented 1 year ago

Sure. Thanks for your help.