12.34
matrix size and thread number
!INCLUDE "./code/12.34.h"
non concurrent version
!INCLUDE "./code/12.34.non.concurrent.c"
concurrent version
!INCLUDE "./code/12.34.concurrent.c"
measure performance
(cd chapter12/code; make clean && make && make measure)
output
(time ./12.34.non.concurrent)
0.90user 0.00system 0:00.90elapsed 99%CPU (0avgtext+0avgdata 3704maxresident)k
0inputs+0outputs (0major+756minor)pagefaults 0swaps
// single cpu run time 0.9s
(time ./12.34.concurrent)
2.20user 0.00system 0:00.64elapsed 341%CPU (0avgtext+0avgdata 3896maxresident)k
0inputs+0outputs (0major+1462minor)pagefaults 0swaps
// 4 cpu, total run time 2.2s(every cpu run 0.55s, concurrent!!)
more detialed
thread(t) | 1 | 2 | 4 | 8 | 16 |
---|---|---|---|---|---|
core(p) | 1 | 2 | 4 | 4 | 4 |
time(Tp) | 0.86 | 0.466 | 0.626 | 0.627 | 0.628 |
speedup(Sp) | 1 | 1.84 | 1.37 | 1.37 | 1.37 |
efficiency(Ep) | 100% | 92.2% | 34.3% | 34.3% | 34.3% |
当前内容版权归 DreamAndDead 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 DreamAndDead .