Learn R Programming

Rdsm (version 1.1.0)

alinit: alinit

Description

Initiate and manage an Rdsm session.

Usage

alinit(nclnt=NULL,nds=NULL,bigmem=F)
cmdtoclnts(cmd)
cmdtosrvr(cmd)
cmdtoall(cmd)
go(ncon=2)
loadrdsm(nclnt,bigmem=F)

Arguments

nclnt
Number of clients/threads.
nds
A character vector specifying the names of the client nodes.
bigmem
Load bigmemory.
cmd
A one-element character vector specifying a command to run on the clients and/or server.
ncon
Number of clients/threads.

Details

These functions automate the creation and management of an Rdsm session. They must be run on a Unix-family system (Linux, Mac OS, or Cygwin on Windows).

Calling alinit() creates terminal windows for the server and clients, runs Rin each of them, loads Rdsm and optionally bigmemory. Exactly one of nclnt and nds must be NULL, so there are two possibilities:

  • nclntspecifies the number of clients, all of which run on the local machine, i.e.localhost
  • ndsspecifies the client nodes

One initializes the client/server connections by calling go().

The core of automated Rdsm session lies in the use of the functions cmdtclnts(), cmdtosrvr(), cmdtoall(), which send the given command to the clients and/or the server.

Here is a sample session, to run a function x() contained in the source code file y.R.:

alinit(2) # create 2 clients cmdtoclnts('source("y.R")') # have clients source the app code go() # set up server/client connections cmdtoclnts('x(3,100)') # first run of app cmdtoclnts('x(12,5000)') # second run of app ...

Note: Autolaunch uses the Unix screen program. If your application crashes, you may need to wipe out leftover screens, both by running screen -wipe and killing the associated processes.