[Rd] Running R embedded in an mpiexec spawned process - Fatal error: you must specify '--save', '--no-save' or '--vanilla'

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Nov 21 08:17:19 CET 2013


On 21/11/2013 06:39, Jean-Michel.Perraud at 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.

Most likely because the way you are running R is considered to be batch 
use, and R_Interactive is false.  You've mixed up two scenarios here: 
one an embedded use where we don't have all the code, and mpiexec.  In 
the mpiexec case, it is likely that stdin is not a ptty.

> 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.

Deciding if Rterm is interactive is clearly done differently on an OS 
without pttys.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list