ChiLin Chen
作業三 compute_pi 開發紀錄
Try
HackMD
ChiLin Chen
·
Follow
Last edited by
ChiLin Chen
on
Sep 30, 2016
Linked with GitHub
Edit
作業三 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。
作業三 compute_pi 開發紀錄
背景知識
圓周率證明
實驗結果
Expand all
Back to top
Go to bottom
作業三 compute_pi 開發紀錄
背景知識
圓周率證明
實驗結果
Expand all
Back to top
Go to bottom
×
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