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

hw4 #42

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

hw4 #42

wants to merge 1 commit into from

Conversation

knowledgaction
Copy link

优化前:
Initial energy: -8.571526
Final energy: -8.511777
Time elapsed: 10723 ms
优化后:
Initial energy: -8.571524
Final energy: -8.562078
Time elapsed: 318 ms

  • 编译选项为:-std=c++17 -O3 -mavx -ffast-math。这里没具体看各个选项提升多少,以后类似的程序这几个编译选项都加上就对了。这个在.vscode中修改,没有改动Cmakelists.txt
  • 使用了SOA,效果不明显。
  • 把vector改为array,效果提升不明显。
  • 在两层循环中,加入临时变量保存计算结果,不断对临时变量叠加,计算结果保存到相应数组中。这个提升较明显,查看汇编语句,改动前基本都是ss指令,改动后变为ps指令,执行了向量化计算。

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.

1 participant