[R-SIG-Mac] [R-sig-hpc] Grand Central Dispatch (simple loop optimization)

Jan de Leeuw deleeuw at stat.ucla.edu
Thu Sep 17 20:24:05 CEST 2009

a) Obviously OpenMP is more portable. Even on a Mac I had to use  
Apple's gcc in this case
    (I normally use the GNU gcc-trunk).

b) GCD does not require specifying the number of threads -- it  
determines it at runtime.

c) Coding is simpler.

d) Since GCD is at a lower OS level than OpenMP, it will probably  
handle resource allocation
    better. But my small example, on an otherwise idle Mac Pro (16  
cores, 32 GB of RAM), does
    not really highlight that.

e) For more info, and some OpenMP comparisons, see


To quote Syracuse

"Write your application as usual, but if there's any part of its  
operation that can
reasonably be expected to take more than a few seconds to complete,  
then for the love of Zarzycki,
get it off the main thread!"

On Sep 17, 2009, at 11:03 , Saptarshi Guha wrote:

> Nice, how does this compare when using OpenMP?
> How does it compare when several other core hungry processes are  
> running?( GC is supposed to nicely handle resource allocation, does  
> OpenMP compete with the other processes?).
> Regards
> Saptarshi

Jan de Leeuw; Distinguished Professor and Chair, UCLA Department of  
Director: UCLA Center for Environmental Statistics (CES);
Editor: Journal of Multivariate Analysis, Journal of Statistical  
US mail: 8125 Math Sciences Bldg, Box 951554, Los Angeles, CA 90095-1554
phone (310)-825-9550;  fax (310)-206-5658;  email: deleeuw at stat.ucla.edu
.mac: jdeleeuw ++++++  aim: deleeuwjan ++++++ skype: j_deleeuw
homepages: http://gifi.stat.ucla.edu ++++++ http://www.cuddyvalley.org
           No matter where you go, there you are. --- Buckaroo Banzai

More information about the R-SIG-Mac mailing list