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

Riga finished hw4! #32

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

Riga finished hw4! #32

wants to merge 1 commit into from

Conversation

Riga27527
Copy link

尽力优化了hw4!

优化前:
Initial energy: -13.414000
Final energy: -13.356842
Time elapsed : 2261 ms

优化后:
Initial energy: -13.414016
Final energy: -13.356915
Time elapsed : 263 ms

主要优化点(主要针对step函数):

  1. 结构体 AOS 改成 SOA
  2. sqrt 改成了std::sqrt
  3. 常量的运算尽量提出来了
  4. 采用-O3 -ffast-math -march=native编译选项(提升最大,此时查看main.S后发现大部分实现了矢量化)
  5. 数组采用size_t下标访问

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