Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update codes #8

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

update codes #8

wants to merge 3 commits into from

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