Skip to content

Conversation

@chuckbruno
Copy link

提示:请在 PR 描述中说明使用的 CPU 有多少核、多少线程哦 :)
如果不希望写 PR 描述,也可以直接在代码注释里写,没问题的~

核心数是4,线程数也是4

跑的结果如图:

chuanxing

bingxing

应用的方法都是老师示例代码里扒过来的,fill,saxpy,minivalue,magicfilter都是直接用的parallel_for来实现的,sqrtdot用得是parallel_reduce。

没看懂pod.h是干啥的。

[&](tbb::blocked_range<size_t> r) {
for (size_t i = r.begin(); i < r.end(); i++) {
if (x[i] < ret)
ret = x[i];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

错了,应该用 parallel_reduce 和 std::min。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants