Jean-Michel.Perraud at csiro.au
2013-Nov-21 06:39 UTC
[Rd] Running R embedded in an mpiexec spawned process - Fatal error: you must specify '--save', '--no-save' or '--vanilla'
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
Prof Brian Ripley
2013-Nov-21 07:17 UTC
[Rd] Running R embedded in an mpiexec spawned process - Fatal error: you must specify '--save', '--no-save' or '--vanilla'
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
Gabriel Becker
2013-Nov-21 07:29 UTC
[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 issue though. I'm suprised that from your comment, and a very brief glance at 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.Perraud@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 mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Gabriel Becker Graduate Student Statistics Department University of California, Davis [[alternative HTML version deleted]]