Thanks for that. It does confirm what I was starting to suspect: that the R 
engine initialization in R.NET needs a change to use the R embedding API 
functions, though mindful that the R.NET author did settle on the current 
arrangement for a pragmatic reason.
I also shamefully missed a recent post on this list, albeit not mentioning MPI, 
 https://stat.ethz.ch/pipermail/r-devel/2013-November/067951.html, by Nigel 
Delaney, which reports similar and likely related issues.

Thanks for your and Professor Ripley's feedback.
J-M
________________________________
From: Gabriel Becker [gmbec...@ucdavis.edu]
Sent: Thursday, November 21, 2013 6:29 PM
To: Perraud, Jean-Michel (CLW, Black Mountain)
Cc: r-devel
Subject: Re: [Rd] Running R embedded in an mpiexec spawned process - Fatal 
error: you must specify '--save', '--no-save' or '--vanilla'

I don't have any real answers for you. Perhaps someone with more experience 
will.

This may be an R.NET<http://R.NET> issue though. I'm suprised that from your 
comment, and a very brief glance at R.NET<http://R.NET>'s sourcecode,  it is 
calling setup_Rmainloop. I've successfully embedded R in C programs and the 
entrypoint I always used was Rf_initEmbeddedR. My understanding is that 
setup_Rmainloop is for the non-embedded case (R running itself).

Perhaps I'm wrong and using setup_Rmainloop is supported in the embedded case 
as well as Rf_initEmbeddedR. If not I can't offer any insight to why it usually 
works anyway other than Dr. Ripleys suggestion about stdin and mpiexec.

Sorry I can't be of more help.
~G


On Wed, Nov 20, 2013 at 10:39 PM, 
<jean-michel.perr...@csiro.au<mailto:jean-michel.perr...@csiro.au>> wrote:
I'd like someone familiar with the R options initialization to comment on a 
difference of behavior within/without mpiexec

I have a (.NET) application with embedded R that is proven to run in a single 
process:

    ./Sample1.exe

on a Debian Linux with R 3.0.2

Running the same code with mpiexec, it fails at the R engine initialization:

    mpiexec -n 1 ./Sample1.exe
    Fatal error: you must specify '--save', '--no-save' or '--vanilla'
    -------------------------------------------------------------------------

The behavior is actually reproducible with the straight R
    mpiexec -n 1 R
    Fatal error: you must specify '--save', '--no-save' or '--vanilla'
    -------------------------------------------------------------------------
The following is working:
    mpiexec -n 1 R --no-save

However in my Sample1 application, I do set up R init options that should be 
suitable AFAIK:

            rEngine = REngine.CreateInstance("RDotNet");
            StartupParameter rStartParams = new StartupParameter
            {
                Quiet = true,
                SaveAction = StartupSaveAction.NoSave,
                Slave = false,
                Interactive = true,
                Verbose = false,
                LoadInitFile = true,
                LoadSiteFile = true,
                RestoreAction = StartupRestoreAction.NoRestore,
                NoRenviron = false
            };
            rEngine.Initialize(rStartParams); // calls the R API R_SetParams, 
then setup_Rmainloop


I gather that the following is hit in src/R-3.0.2/src/unix/system.c, in the 
function Rf_initialize_R:

    if (!R_Interactive && Rp->SaveAction != SA_SAVE &&
        Rp->SaveAction != SA_NOSAVE)
        R_Suicide(_("you must specify '--save', '--no-save' or '--vanilla'"));

I don't understand why it would complain if spawned by mpiexec and fine 
otherwise.

I do not have a suitable debugging environment to step through a R with debug 
symbols, and no stack trace is given as console output.
As an aside, the same code (barring platform specifics) works on Windows.

Thanks




______________________________________________
R-devel@r-project.org<mailto:R-devel@r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Gabriel Becker
Graduate Student
Statistics Department
University of California, Davis

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to