From mtmorgan at fhcrc.org  Tue Jan  3 20:08:24 2006
From: mtmorgan at fhcrc.org (Martin Morgan)
Date: Tue, 03 Jan 2006 11:08:24 -0800
Subject: [Rd] can someone help me understand LAM/MPI and Rmpi for use on
 a cluster
In-Reply-To: <CE0E73903DB53F43B4B0938747F34F8A01242D08@nihexchange7.nih.gov>
	(Grant Izmirlian's message of "Fri, 23 Dec 2005 13:31:04 -0500")
References: <CE0E73903DB53F43B4B0938747F34F8A01242D08@nihexchange7.nih.gov>
Message-ID: <6ph3bk5yvrr.fsf@gopher3.fhcrc.org>

Here's my slow response; if there were other off-list replies it would
be great to have a summary.

Not exactly sure what you're looking for. You might adopt a parallel
program so that the 'master' node does something like

myprog.c:

  MPI_Init(...)

  /* parallel computations, e.g., of pi */
  
  if (myid == 0) {
    MPI_Comm_get_parent(&parent);
    MPI_Send( &pi, 1, MPI_DOUBLE, 0, 0, parent );
  }

  MPI_Finalize()

then in R

  library(Rmpi)
  mpi.comm.spawn("myprog", ...)
  mpi.recv(...)

This launches myprog as a child of the R process, and retrieves the
result via the send/receive exchange between the spawned program and
R. An extension of this would move the mpi.comm.spawn call into a C
function you'd invoked from R with .Call(...).

This could also be developed into a kind of 'shell' package
initializing MPI and then providing parallelized functions and a
light-weight mechanism for their dispatch.

Hope that's helpful and not too misleading.

Martin


"Izmirlian, Grant (NIH/NCI) [E]" <izmirlig at mail.nih.gov> writes:

> I'm fairly astute at C and R but new to parallelization. Would someone
> be willing to provide help in the form of a simple example that parallelizes
> an R function from the inside of a C routine?
>
> If so, write me back at izmirlig at mail.nih.gov
>
> Thanks!
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] can someone help me understand LAM/MPI and Rmpi for use on a cluster
Martin Morgan