Parallel slowdown in Livermore Loops
-mt_pth results in serious slowdown!
This happens on a number of the Livermore Loops tests. This is typical:
sac@medusa:~/sac/benchmarks/LivermoreLoopsCtest/loop04$ sac2c loop04.sac -O3 -target seq -o out.seq
sac@medusa:~/sac/benchmarks/LivermoreLoopsCtest/loop04$ sac2c loop04.sac -O3 -target mt_pth -o out.mt
sac@medusa:~/sac/benchmarks/LivermoreLoopsCtest/loop04$ time out.seq < loop04.inp ;echo $?
Running Loop4_NAIVE
Number of repetitions: 20000000
Vector length : 1001
Upper limit (n) : 35
Element [5] of the result is: -0.073587732613706644, WANT is: -0.0735877326136999965
x[5] - WANT is -6.64746035994312479e-15
WANT - x[5] is 6.64746035994312479e-15
Wall Clock Time spent : 0.199 secs
Computer Performance achieved : 2.407 GFlops/s
real 0m0.201s
user 0m0.201s
sys 0m0.000s
0
sac@medusa:~/sac/benchmarks/LivermoreLoopsCtest/loop04$ time out.mt -mt 1 < loop04.inp ;echo $?
Running Loop4_NAIVE
Number of repetitions: 20000000
Vector length : 1001
Upper limit (n) : 35
Element [5] of the result is: -0.073587732613706644, WANT is: -0.0735877326136999965
x[5] - WANT is -6.64746035994312479e-15
WANT - x[5] is 6.64746035994312479e-15
Wall Clock Time spent : 1.322 secs
Computer Performance achieved : 0.363 GFlops/s
real 0m1.324s
user 0m1.324s
sys 0m0.000s
0
sac@medusa:~/sac/benchmarks/LivermoreLoopsCtest/loop04$ time out.mt -mt 2 < loop04.inp ;echo $?
Running Loop4_NAIVE
Number of repetitions: 20000000
Vector length : 1001
Upper limit (n) : 35
Element [5] of the result is: -0.073587732613706644, WANT is: -0.0735877326136999965
x[5] - WANT is -6.64746035994312479e-15
WANT - x[5] is 6.64746035994312479e-15
Wall Clock Time spent : 69.401 secs
Computer Performance achieved : 0.007 GFlops/s
real 1m9.403s
user 2m18.799s
sys 0m0.004s
0
sac@medusa:~/sac/benchmarks/LivermoreLoopsCtest/loop04$ sac2c -V
sac2c 1.3.3-MijasCosta-774-g4dc6e2
build-type: RELEASE
built-by: "sac" at 2022-02-24T15:43:37
Running -mt 2 shows two threads running at 100% (system monitor), so I am guessing that there is some kind of locking problem going on.