Skip to content

hw04 #15

New issue

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

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

Already on GitHub? # to your account

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

hw04 #15

wants to merge 1 commit into from

Conversation

adelacvg
Copy link

@adelacvg adelacvg commented Jan 9, 2022

试了各种方法,从godbolt.org边看汇编出来的代码边调试,把数组下标从int改成size_t以后有一点的提升,加了-ffast-math和-march=native以后提升明显,把star的结构体从AOS改成了SOA,提升了很多,把一些临时变量变成了数组,空间换时间,alignas试了8,16,32,64,128,32和64差不多都比较好,128会有所下降,还有就是把一些比较复杂的循环拆成了一些小循环,有一点点提升,#prama omp simd在所有循环之前都加了,但测试好像只要在最外层循环外面加就行,里面加不加都不影响,看汇编发现三个及以上的连乘好像会比两个数乘法更复杂的样子,不知道会不会降低速度。
baseline的结果是:
Initial energy: -8.571528
Final energy: -8.511633
Time elapsed: 1546 ms
优化以后:
simd optimized
Initial energy: -9.936085
Final energy: -9.926659
Time elapsed: 198 ms
大概提升了7.8倍

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant