mantognini/scala-vs-gpu

Monte Carlo

Closed this issue · 2 comments

Implement Monte Carlo simulation to approximate π/4.

Benchmark the time needed to approximate π with 2^7 .. 2^22 random points in the unit square.

First implementation

  • C++
  • Thrust
  • Scala
  • Scala.par
  • Scala.par2

Alternative implementation

  • C++ : Remove array, do a loop and measure π directly
  • Thrust : perform an approximation on each thread
  • Scala.par : create a par col with N element and dispatch the approximation on each thread, where N is the number of core.

Scala V2

  • Reduce contention + use aggregate

The current impls for Scala looks not optimal : par col have zero gain...

V2 fixes that !