Skip to content
Derek Weitzel edited this page Aug 21, 2013 · 8 revisions

This example will show the basic functionality of GridR, especially the integration with Bosco, which together form the BoscoR solution.

Requirements

The requirements to complete this example are:

  1. Installation of Bosco
  2. Connecting at least 1 cluster to Bosco
  3. Installation of GridR

First Example

The first example sends a very simple function to a remote cluster to be executed.

First, load the GridR library:

> library(GridR)

Then, initialize GridR to tell it to use Bosco for job submissions:

> grid.init(service="bosco.direct", localTmpDir="tmp")

Now you are ready to create a function and send it to the connected cluster. Below is a very simple function that will double the input value:

> a <- function(s) { return (2*s) }

Now, you can send it to the remote cluster.

> grid.apply("x", a, 13)
starting bosco.direct mode

You can check on the status of the job with the command grid.printJobs():

> grid.printJobs()

Once the job has completed, the output value from the function a will be assigned the the variable x.

> x
[1] 26

The code generating this example is available as a gist.

What's Next

Check out the Parameter Sweep example for a more advanced use of GridR and Bosco.