Skip to content

How to speed up my program

2 messages · Ragia ., rsherry8

#
Dear group
I had a R ? program that was to slow, I mad it multi core prog..to speed up, its a simulation when the runs are 100 its very fast..raising the runs to 10k mad it in the first fast then it slow down
I checked the HW usafe and here is the top command results


%Cpu0 ?:100.0 us, ?0.0 sy, ?0.0 ni, ?0.0 id, ?0.0 wa, ?0.0 hi, ?0.0 si, ?0.0 st
%Cpu1 ?:100.0 us, ?0.0 sy, ?0.0 ni, ?0.0 id, ?0.0 wa, ?0.0 hi, ?0.0 si, ?0.0 st
%Cpu2 ?:100.0 us, ?0.0 sy, ?0.0 ni, ?0.0 id, ?0.0 wa, ?0.0 hi, ?0.0 si, ?0.0 st
%Cpu3 ?:100.0 us, ?0.0 sy, ?0.0 ni, ?0.0 id, ?0.0 wa, ?0.0 hi, ?0.0 si, ?0.0 st
%Cpu4 ?:100.0 us, ?0.0 sy, ?0.0 ni, ?0.0 id, ?0.0 wa, ?0.0 hi, ?0.0 si, ?0.0 st
%Cpu5 ?:100.0 us, ?0.0 sy, ?0.0 ni, ?0.0 id, ?0.0 wa, ?0.0 hi, ?0.0 si, ?0.0 st
%Cpu6 ?:100.0 us, ?0.0 sy, ?0.0 ni, ?0.0 id, ?0.0 wa, ?0.0 hi, ?0.0 si, ?0.0 st
%Cpu7 ?:100.0 us, ?0.0 sy, ?0.0 ni, ?0.0 id, ?0.0 wa, ?0.0 hi, ?0.0 si, ?0.0 st
KiB Mem: ?65863948 total, 13940104 used, 51923844 free, ? 231084 buffers
KiB Swap: ?1046520 total, ? ? ? ?0 used, ?1046520 free. ?4418180 cached Mem

what should I do to speed it up?
thanks in advance
#
Hi Ragia,

First, when you wrote mad, I assume you mean made.  Also, when you say 
it is a multi core prog, does that mean it is using threads? running two 
or more items in parallel? By any chance are you using this package?
https://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf
If not, maybe you should. There is also a new version of R called pqR. 
It is multi thread and that maybe exactly what you need.

Also R is interpreted not compiled. Therefore if speed is important 
rewriting it in a compiled language like C or C++ could be a whole lot 
faster. I suspect that this would also be a lot of work and probably not 
worth it.

Bob
On 4/1/2016 4:01 AM, Ragia . wrote: