ChiLin Chen
作業三 compute_pi 開發紀錄
Try
HackMD
ChiLin Chen
·
Follow
Last edited by
ChiLin Chen
on
Sep 30, 2016
Linked with GitHub
Edit
0
Comments
Feedback
Log in to edit or delete your comments and be notified of replies.
Sign up
Already have an account? Log in
There is no comment
Select some text and then click Comment, or simply add a comment to this page from below to start a discussion.
Discard
Send
作業三 compute_pi 開發紀錄
背景知識
時間
實驗結果
圓周率證明
背景知識
[時間的測量]
為何不要用gettimeofday()
使用clock_gettime
SIMD AVX
圓周率證明
實驗結果
撰寫runtime.gp的script後,直接編譯程式,使用make plot,得到結果如下圖:
可以發現最原始的baseline方法耗時最多,使用avx指令集加上loop unrolling技巧,結果最快。
實做Leibniz與搭配OpenMP的成果如下:
。我的CPU為 Core
™
i7-4710MQ有四個核心,推測是使用8個thread超過CPU本身的核心數,而CPU在做hyper-threading的時候,須花額外的時間做切換,因此大幅影響到系統的執行時間。
去掉8個thread的圖:
可以看到Leibniz,OpenMP使用4個thread的效果是最好的,N接近25000時仍 < 0.001。
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up
Comment