Repository navigation
Intro Example
This example will show the basic functionality of GridR, especially the integration with Bosco, which together form the BoscoR solution.
The requirements to complete this example are:
- Installation of Bosco
- Connecting at least 1 cluster to Bosco
- Installation of GridR
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.
Check out the Parameter Sweep example for a more advanced use of GridR and Bosco.
For help, email the bosco mailing list. Or visit Bosco Contact