[R] Multiple CPU HowTo in Linux?

Christian Raschke crasch2 at tigers.lsu.edu
Tue Sep 14 17:36:54 CEST 2010


Edwin,

I'm not sure what you mean by "adapting"; other than installing 
multicore, there is nothing else to set up. How and whether you could 
then parallelise your code strongly depends on the specific problem you 
are facing.

What have done in the past was to look at the source of the functions 
from whatever package I was using that produced the bottleneck. If what 
is taking the longest time is actually embarrassingly parallel, 
mclapply() from package multicore can help. In the simplest case you 
could simply replace lapply() in the with an appropriate mclapply(). 
Check out ?mclapply. But then again you might have to get a little more 
creative, depending on exactly what in the code is taking so long to 
run. If your problem is inherently sequential then even multicore won't 
help.

Christian

On 09/14/2010 09:35 AM, Edwin Groot wrote:
> Hello Cedrick,
> Ah, yes, that looks like it would apply to my situation. I was
> previously reading on snow, which is tailored for clusters, rather than
> a single desktop computer.
> Anyone with experience adapting multicore to an R-script?
> I have to admit I know little about parallel processing,
> multiprocessing and cluster processing.
>
> Edwin
>
> On Tue, 14 Sep 2010 10:15:42 -0400
>   "Johnson, Cedrick W."<cedrick at cedrickjohnson.com>  wrote:
>    
>>    ?multicore perhaps
>>
>> On 09/14/2010 10:01 AM, Edwin Groot wrote:
>>      
>>> Hello all,
>>> I upgraded my R workstation, and to my dismay, only one core
>>>        
>> appears to
>>      
>>> be used during intensive computation of a bioconductor function.
>>> What I have now is two dual-core Xeon 5160 CPUs and 10 GB RAM. When
>>>        
>> I
>>      
>>> fully load it, top reports about 25% user, 75% idle and 0.98
>>>        
>> short-term
>>      
>>> load.
>>> The archives gave nothing helpful besides mention of snow. I
>>>        
>> thought of
>>      
>>> posting to HPC, but this system is fairly modest WRT processing
>>>        
>> power.
>>      
>>> Any pointers of where to start?
>>> ---
>>> #Not running anything at the moment
>>>        
>>>> sessionInfo()
>>>>          
>>> R version 2.11.1 (2010-05-31)
>>> x86_64-pc-linux-gnu
>>>
>>> locale:
>>>    [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
>>>    [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
>>>    [5] LC_MONETARY=C              LC_MESSAGES=en_GB.UTF-8
>>>    [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C
>>>    [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices utils     datasets  methods
>>>        
>>    base
>>      
>>>
>>> loaded via a namespace (and not attached):
>>> [1] tools_2.11.1
>>> ---
>>> $ uname -a
>>> Linux laux29 2.6.26-2-amd64 #1 SMP Sun Jun 20 20:16:30 UTC 2010
>>>        
>> x86_64
>>      
>>> GNU/Linux
>>> ---
>>> Thanks for your help,
>>> Edwin
>>>        
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>      
> Dr. Edwin Groot, postdoctoral associate
> AG Laux
> Institut fuer Biologie III
> Schaenzlestr. 1
> 79104 Freiburg, Deutschland
> +49 761-2032945
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>    


-- 
Christian Raschke
Department of Economics
and
ISDS Research Lab (HSRG)
Louisiana State University
Patrick Taylor Hall, Rm 2128
Baton Rouge, LA 70803
crasch2 at lsu.edu



More information about the R-help mailing list