/usr/lib/R/site-library/snow/RMPISNOW is in r-cran-snow 1:0.3.9-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #! /bin/sh
# if defined, prepend R_SNOW_LIB to $_LIBS
if test ! -z "${R_SNOW_LIB}" ; then
R_LIBS=${R_SNOW_LIB}:${R_LIBS}; export R_LIBS
fi
# find the library containing the snow package; should eventually use Rscript
snowdir=`echo 'invisible(cat(tryCatch(dirname(.find.package("snow")), error = function(e) ""),"\n",sep=""))' | R --slave`
# for now this hijacks the R_PROFILE mechanism to start up the R
# sessions and load snow and Rmpi into them
R_PROFILE=${snowdir}/snow/RMPISNOWprofile; export R_PROFILE
if test ! -z "${LAMRANK}" ; then
# use the LAMRANK environment variable set by LAM-MPI's mpirun to
# run R with appropriate arguments for master and workers.
if test "${LAMRANK}" -eq 0 ; then
exec R $*
else
exec R --slave > /dev/null 2>&1
fi
elif test ! -z "${OMPI_MCA_ns_nds_vpid}" ; then
# Similar approach for OpenMPI using the OMPI_MCA_ns_nds_vpid
# variable. Don't know if it might be better to use
# OMPI_MCA_ns_nds_vpid_start instead. The master R process thinks
# it is non-interactive so for now --no-save or something like
# that is needed.
if test "${OMPI_MCA_ns_nds_vpid}" -eq 0 ; then
exec R --no-save $*
else
exec R --slave > /dev/null 2>&1
fi
else
# The fallback is to use the same arguments on master and workers,
# with --no-save for cases where workers don't have a terminal.
# This means that things like CMD batch won't work. It seems to be
# important NOT to use exec here, at least when this code runs under LAM.
R --no-save $*
fi
|