0

显然,在 tbb::flow 中,source_node 已被弃用,从 2021.1 版本开始,我们只应该使用 input_node。不过,简单地替换类似乎不起作用。我在 2020.3 版本中有一个使用 source_node 的工作代码。如果我尝试使用 input_node 我会收到一条神秘的消息。

似乎 input_node 期望 Body 实现一个采用 flow_control 对象的函数。是这样吗?否则这里有什么问题?

我似乎无法使用 input_body 运行任何示例代码。

====================[ Build | capybara | Debug-System ]==========================
/home/nicolau/bin/clion-2020.1.1/bin/cmake/linux/bin/cmake --build /home/nicolau/src/capybara/cmake-build-debug-system --target capybara -- -j 9
Scanning dependencies of target capybara
[ 50%] Building CXX object CMakeFiles/capybara.dir/main.cpp.o
In file included from /home/nicolau/src/oneapi-tbb-2021.1-beta08/include/tbb/flow_graph.h:345:0,
                 from /home/nicolau/src/capybara/main.cpp:9:
/home/nicolau/src/oneapi-tbb-2021.1-beta08/include/tbb/detail/_flow_graph_body_impl.h: In instantiation of ‘Output tbb::detail::d1::input_body_leaf<Output, Body>::operator()(tbb::detail::d1::flow_control&) [with Output = std::tuple<cv::Mat, std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > > >; Body = main(int, char**)::<lambda(imgtv&)>]’:
/home/nicolau/src/capybara/main.cpp:424:1:   required from here
/home/nicolau/src/oneapi-tbb-2021.1-beta08/include/tbb/detail/_flow_graph_body_impl.h:88:66: error: no match for call to ‘(main(int, char**)::<lambda(imgtv&)>) (tbb::detail::d1::flow_control&)’
     Output operator()(flow_control& fc) override { return body(fc); }
                                                                  ^
/home/nicolau/src/capybara/main.cpp:350:58: note: candidate: main(int, char**)::<lambda(imgtv&)>
     tbb::flow::input_node<imgtv> src(g, [&](imgtv &v) -> bool {
                                                          ^~~~
/home/nicolau/src/capybara/main.cpp:350:58: note:   no known conversion for argument 1 from ‘tbb::detail::d1::flow_control’ to ‘imgtv& {aka std::tuple<cv::Mat, std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > > >&}’
CMakeFiles/capybara.dir/build.make:82: recipe for target 'CMakeFiles/capybara.dir/main.cpp.o' failed
make[3]: *** [CMakeFiles/capybara.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/capybara.dir/all' failed
make[2]: *** [CMakeFiles/capybara.dir/all] Error 2
CMakeFiles/Makefile2:102: recipe for target 'CMakeFiles/capybara.dir/rule' failed
make[1]: *** [CMakeFiles/capybara.dir/rule] Error 2
Makefile:138: recipe for target 'capybara' failed
make: *** [capybara] Error 2
4

1 回答 1

1

显然,与 source_node 相比,接口发生了变化,该函数现在应该采用 flow_control 引用并将新的输入对象作为输出返回。

https://github.com/oneapi-src/oneTBB/issues/270#issuecomment-683645172

于 2020-08-31T12:39:38.830 回答