Working with R in a multi-processor machine.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Working with R in a multi-processor machine.

Aitor Mata Conde
Hi everyone!!

This is my first message to the list, so I hope not to disturb anyone if the
subject of my message has been already treated.

The question is that I have a tool, a GUI made with Java, connected to R
using Rserve, and I'd like to get R and Rserve in a multi-processor machine.
Now, when I'm going to start the migration I wonder whether R is prepared,
'itself' to optimize the use of multiple processors or if I should change the
code so that it could be a real multi-processor tool.

In other words... Will the R code adapt itself to the new machine (Unix with
al least 4 processors)? Or shall I change the code to have multiple real
threads and transform the algorithms into parallel computing strategies?

Thanks in advance,
Aitor.


               
---------------------------------

LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y moviles desde 1 centimo por minuto.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Working with R in a multi-processor machine.

Seth Falcon-2
On 10 Jan 2006, [hidden email] wrote:

> Hi everyone!!
>
> This is my first message to the list, so I hope not to disturb
> anyone if the subject of my message has been already treated.
>
> The question is that I have a tool, a GUI made with Java, connected
> to R using Rserve, and I'd like to get R and Rserve in a
> multi-processor machine.  Now, when I'm going to start the migration
> I wonder whether R is prepared, 'itself' to optimize the use of
> multiple processors or if I should change the code so that it could
> be a real multi-processor tool.
>
> In other words... Will the R code adapt itself to the new machine
> (Unix with al least 4 processors)? Or shall I change the code to
> have multiple real threads and transform the algorithms into
> parallel computing strategies?

R is not multi-threaded and will not be able to automagically make use
of a SMP machine.  I'm pretty sure what you want to do is configure
your app to launch 4 R instances and manage of queue of some sort.

--
+ seth

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Working with R in a multi-processor machine.

Martin Morgan
In reply to this post by Aitor Mata Conde
R is not thread safe, so you must not use it in a
re-entrant way.

If you want to exploit multiple processors, you can write code (e.g.,
in C) called from R (e.g., through .Call or .C) that performs
parallel/threaded computations in a thread-safe way (e.g., without
calling back into R).

Another possibility is to replace the BLAS/LAPACK library with a
thread-safe version. This provides a boost to those R algorithms
exploiting these libraries. Haven't done this myself, but there is
some info in this post

https://stat.ethz.ch/pipermail/r-devel/2005-December/035695.html

Hope that helps,

Martin


Aitor Mata Conde <[hidden email]> writes:

> Hi everyone!!
>
> This is my first message to the list, so I hope not to disturb anyone if the
> subject of my message has been already treated.
>
> The question is that I have a tool, a GUI made with Java, connected to R
> using Rserve, and I'd like to get R and Rserve in a multi-processor machine.
> Now, when I'm going to start the migration I wonder whether R is prepared,
> 'itself' to optimize the use of multiple processors or if I should change the
> code so that it could be a real multi-processor tool.
>
> In other words... Will the R code adapt itself to the new machine (Unix with
> al least 4 processors)? Or shall I change the code to have multiple real
> threads and transform the algorithms into parallel computing strategies?
>
> Thanks in advance,
> Aitor.
>
>
>
> ---------------------------------
>
> LLama Gratis a cualquier PC del Mundo.
> Llamadas a fijos y moviles desde 1 centimo por minuto.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Working with R in a multi-processor machine.

Sean Davis
In reply to this post by Seth Falcon-2



On 1/10/06 11:41 AM, "Seth Falcon" <[hidden email]> wrote:

> On 10 Jan 2006, [hidden email] wrote:
>
>> Hi everyone!!
>>
>> This is my first message to the list, so I hope not to disturb
>> anyone if the subject of my message has been already treated.
>>
>> The question is that I have a tool, a GUI made with Java, connected
>> to R using Rserve, and I'd like to get R and Rserve in a
>> multi-processor machine.  Now, when I'm going to start the migration
>> I wonder whether R is prepared, 'itself' to optimize the use of
>> multiple processors or if I should change the code so that it could
>> be a real multi-processor tool.
>>
>> In other words... Will the R code adapt itself to the new machine
>> (Unix with al least 4 processors)? Or shall I change the code to
>> have multiple real threads and transform the algorithms into
>> parallel computing strategies?
>
> R is not multi-threaded and will not be able to automagically make use
> of a SMP machine.  I'm pretty sure what you want to do is configure
> your app to launch 4 R instances and manage of queue of some sort.

An alternative is to do all of the parallelization within R using nice tools
like the snow package combined with Rmpi.  If your task is computationally
intensive on the R side, but not on the client, then parallelizing R code
may be the better way to go.  All depends on your application, I think.

Sean

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html