Hi Markus -- Usually comm is an argument with default value in the mpi.* functions, so implicitly the user is managing these, e.g., by default, using comm 1. Presumably you'll have an R wrapper to .Call that has a default argument comm=1, and will passs this to the C level.
Martin Markus Schmidberger wrote: > Hello, > > I try to write parts of my code in C to accelerate the for-loops. But > basic operations I want to do in R (e.g. start cluster). My R code looks > something like this: > > library(Rmpi) > mpi.spawn.Rslaves() > mpi.remote.exec(....) > dyn.load("test.so") > erg <- .Call("test", ....) > .... > mpi.close.Rslaves() > mpi.quit() > > And my C function looks something like this: > > #include <mpi.h> > #include <R.h> > #include <Rdefines.h> > #include <Rinternals.h> > SEXP test (SEXP a, ..){ > int rank; > comm ?????? > MPI_Comm_rank (comm, &rank); > ...... > } > > For all MPI functions I need the right communicator (MPI_Comm *comm;) to > communicate with the existing slaves. This variable will be generated by > spawning the Rslaves (mpi.spawn.Rslaves). But how to get to this > variable in my C function? > Is the communicator variable somewhere stored in a R variable? > > ( I use R 2.6.2 and Rmpi 0.5-5) > > Thanks > Markus > -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M2 B169 Phone: (206) 667-2793 ______________________________________________ R-help@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.