Scalability in std.parallelism

Ali Çehreli acehreli at yahoo.com
Sun Feb 23 22:55:46 PST 2014


On 02/22/2014 08:21 AM, "Nordlöw" wrote:

 > In the following test code given below of std.parallelism I get some
 > interesting results:
 >
 > when compiled as
 >
 > dmd -release -noboundscheck -O -inline -w -wi -wi
 > ~/Work/justd/t_parallelism.d -oft_parallelism
 >
 > My scalability measures says the following
 >
 > 3.14159 took 221[ms]
 > 3.14159 took 727[ms]
 > Speedup 3.28959
 > -5.80829e+09 took 33[ms]
 > -5.80829e+09 took 201[ms]
 > Speedup 6.09091

On my quad-core Intel I get the following (I have two actual cores, four 
hyperthreads):

3.14159 took 441[ms]
3.14159 took 878[ms]
Speedup 1.99093
-5.80829e+09 took 98[ms]
-5.80829e+09 took 328[ms]
Speedup 3.34694

I am not an expect at all but it looks like the first test cannot take 
advantage of hyperthreading but the second one can to some degree.

 >      auto piTerm(int i) {
 >          immutable x = (i - 0.5) * delta;
 >          return delta / (1.0 + x*x);
 >      }

 > auto square(T)(T i) @safe pure nothrow { return i*i; }

Ali



More information about the Digitalmars-d-learn mailing list