From Jean-Michel.Perraud at csiro.au  Thu Nov 21 07:39:34 2013
From: Jean-Michel.Perraud at csiro.au (Jean-Michel.Perraud at csiro.au)
Date: Thu, 21 Nov 2013 06:39:34 +0000
Subject: [Rd] Running R embedded in an mpiexec spawned process - Fatal
 error: you must specify '--save', '--no-save' or '--vanilla'
Message-ID: <9657E5F32D0E5F4599B08172DA6CE8810C95F119@exmbx02-cdc.nexus.csiro.au>

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






[Rd] Running R embedded in an mpiexec spawned process - Fatal error: you must specify '--save', '--no-save' or '--vanilla'
Jean-Michel.Perraud at csiro.au