auto ps = generate(n, randpair); auto rs = map([](pair p){return p.x*p.x+p.y*p.y},ps); auto ios = map([](double r2){return r2 <= 1;}, rs); double pi = reduce(std::plus<double>(), ios) /size*4;
0
10
20
30
40
50
60
70
1 2 3 4 5 6 7 8
#processor
Exe
cution
Tim
e (s
)
naïve parallelsequentialoptimized parallel
On a workstation with two Intel®Xeon® X5550 (8 cores in total,
without hyper-threading), 12GB memory, and Linux 2.6.31.