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

finish hw06 #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

finish hw06 #15

wants to merge 1 commit into from

Conversation

miyanyan
Copy link

@miyanyan miyanyan commented Feb 5, 2022

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

4核8线程,msvc

函数 串行 并行 加速比
fill 1.5099s 0.299056s 5.05
fill 1.09852s 0.291229s 3.77
saxpy 0.0523404s 0.0303599s 1.72
sqrtdot 0.0771749s 0.0187253s 4.12
minvalue 0.07292s 0.0144617s 5.04
magicfilter 0.310065s 0.127285s 2.44
scanner 0.075117s 0.0418926s 1.79
  • fill 使用 parallel_for
  • saxpy 使用 parallel_for
  • sqrtdot 使用 parallel_reduce,这里计算结果前后有偏差,是浮点数运算精度的问题
  • minvalue 使用 parallel_reduce
  • magicfilter 使用 parallel_for,并行筛选,restmp都提前reverse分配好内存,这时再push_back就不会有动态扩容了
  • scanner 使用 parallel_scan

Copy link
Contributor

@archibate archibate left a comment

Choose a reason for hiding this comment

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

lgtm 👍

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.

None yet

2 participants