2017q1 Homework1(compute-pi)
contributed by<yanang
>
Reviewed by Cayonliow
- 圖的顯現方式不容易讓人一眼看出各種實作方式的分別
- 可以改成線狀圖, 分辨線與線之間的高低
- 可以透過增加執行的次數,拉高線的斜率, 拉開線之間的距離
- openmp_4 因爲不穩定所以圖會有波動, 可以透過將執行的次數調高然後取平均來消除, 可以看看我的共筆
Reviewed by ryanwang522
- 可以嘗試不同計算圓周率 (e.g. Leibniz, Monte Carlo) 的方法,並觀察差異。
- OpenMP 之所以會有波動也有可能是執行序之前的執行速度不同所造成的 overhead。
初步測試
- $make gencsv
打開 result_clock_gettime.csv
100 0.000008 0.000073 0.016455 0.000008 0.000005
5100 0.000402 0.000288 0.000276 0.000345 0.00021
10100 0.001102 0.001289 0.002242 0.000682 0.000414
15100 0.001837 0.001743 0.001108 0.001024 0.000618
20100 0.001602 0.000949 0.000966 0.001355 0.000832
- 先試著將資料建表,libre office 插入圖表
( 因為還不確定資料名稱,先以欄B..F代稱 )
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
實驗
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 經過數次改動,發現 openmp_4 的波動仍然無法消除
( openmp_2 也有些微波動 )
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 時間優劣上 avx > openmp > baseline
- 穩定性優劣上 avx > baseline > openmp
error rate
#define M_PI acos(-1.0)
double pi = compute_pi(n);
double diff = pi - M_PI > 0 ? pi - M_PI : M_PI - pi;
double error = diff / M_PI;