Skip to content
Prev 6296 / 15075 Next

Grand Central Dispatch (simple loop optimization)

Jan,

thanks for sharing this. This is really interesting. We have been  
contemplating using GCD for R (mainly pnmath) but at the time OMP was  
faster. However, GCD got apparently really good in the meantime:

 > system.time(threads(100000,1000,"omp_try"))
    user  system elapsed
   9.671   0.009   2.441
 > system.time(threads(100000,1000,"gcd_try"))
    user  system elapsed
   9.592   0.004   2.410
 > system.time(threads(100000,1000,"dcg_try"))
    user  system elapsed
   9.784   0.003   9.788

[This is on Harpertown 2.66GHz quad core]

So GCD is surprisingly just a hair faster than OMP (also surprising to  
me is that using more threads than cores make OMP faster - the above  
is with 16 threads).
On Sep 17, 2009, at 14:24 , Jan de Leeuw wrote:

            
I would not say - OMP takes just one #pragma - no need to change your  
code whereas GCD requires several special function calls... However,  
OMP is more limited in the kind of things you can do.

Cheers,
Simon