请教,关于tbb

jiaocha 2010-08-04 02:37:33
我把下边这个类用parallel_reduce调用当tbb::task_scheduler_init init(1)时只执行一半,而不是按单线程方式全部执行,请问这是为什么呢?
class tbb_detection
{
public:
tbb_detection(){};
std::vector<cv::Mat> v_image;
std::vector<c_rect> v_crect;
void operator ()(tbb::blocked_range<int>& rang)
{
for(int i=rang.begin();i<rang.end();i++)
{
v_crect=detection(v_image[i]);
}
}
tbb_detection(tbb_detection& x,tbb::split):v_image(x.v_image),v_crect(0)
{}
void join(const tbb_detection& y)
{
v_crect.insert(v_crect.end(),y.v_crect.begin(),y.v_crect.end());
}
};
...全文
137 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jiaocha 2010-09-02
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 intel_zhenyuwang 的回复:]
可能是detection的工作量(数据)太小了?
tbb::task_scheduler_init 应该是首先全部完成的,再做并行工作。
把优化开关关掉试试。

建议去http://software.intel.com/en-us/forums/intel-threading-building-blocks/问问
[/Quote]
谢谢,原来问题出在for循环里
请问tbb源码在哪里下载呢?之前下载了,最近想用一下tbb找不到源码了
intel_zhenyuwang 2010-08-19
  • 打赏
  • 举报
回复
可能是detection的工作量(数据)太小了?
tbb::task_scheduler_init 应该是首先全部完成的,再做并行工作。
把优化开关关掉试试。

建议去http://software.intel.com/en-us/forums/intel-threading-building-blocks/问问
jiaocha 2010-08-16
  • 打赏
  • 举报
回复
难道tbb已经没有人用了么

567

社区成员

发帖
与我相关
我的任务
社区描述
英特尔® 边缘计算,聚焦于边缘计算、AI、IoT等领域,为开发者提供丰富的开发资源、创新技术、解决方案与行业活动。
社区管理员
  • 英特尔技术社区
  • shere_lin
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧