[R] Rmpi and C Code, where to get the communicator

From: Markus Schmidberger <schmidb_at_ibe.med.uni-muenchen.de>
Date: Thu, 20 Mar 2008 14:05:48 +0100


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:



erg <- .Call("test", ....)

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)



Dipl.-Tech. Math. Markus Schmidberger

Ludwig-Maximilians-Universität München
IBE - Institut für medizinische Informationsverarbeitung,
Biometrie und Epidemiologie
Marchioninistr. 15, D-81377 Muenchen
URL: http://ibe.web.med.uni-muenchen.de 
Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de
Tel: +49 (089) 7095 - 4599

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 20 Mar 2008 - 13:09:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 20 Mar 2008 - 13:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive