Clinician's
corner

Back to main page

Programmer's
corner
So, you use WinBUGS a lot? Want more?
Patrick Blisle
Division of Clinical Epidemiology
McGill University Health Center
Montreal, Quebec CANADA
patrick.belisle@rimuhc.ca

Last modification: 21 sep 2017















Version 1.8 (September 2017)
RSimulationHelper
Using Parallel Computing in R Simulations
[ RSimulationHelper is a program to optimize R simulations by using multiple processors simultaneously (parallel computing) ]


Menu



Top
Introduction


Running extensive simulations in R can be computer intensive. Many computers have multiple processors, making it possible to split a simulation task in many smaller, and hence faster, sub-simulations. In theory, it is not difficult to copy your R simulation code into as many files as necessary to run parallel processing manually, but as the number of repetitions becomes larger, this task becomes increasingly tedious.

RSimulationHelper is a Perl-driven program that facilitates running R simulations in parallel. The program prompts the user for the number of processors to be used, R Code, the typically large number of simulations to be submitted, the list of R objects to be monitored, and then runs these requested simulations in parallel computing. RSimulationHelper monitors the evolution of the sub-simulations launched, and begins a sub-simulation every time a processor is free. Delays between completed sub-simulations are thus minimized.



Top
Guided tour





The first form of RSimulationHelper (see full image above) allows the user to enter or load the R simulation code to be run, as well as to pick the R objects to monitor and save (to .RData files). Technical settings (number of loops, number of processors, etc.) are also selected from this initial form.

Shall you need assistance in writing R code to bind simulation results, second form (below) will allow you to choose a binding function for each monitored R object.






Binding R code will be presented on a third form (below).







Top
Performance


We have not run a thorough performance assessment of RSimulationHelper, but rather a comparison of a rather simple but massive for-loop simulation with the same code ran on 3 processors via RSimulationHelper. Since R already does some kind of parallel computing, RSimulationHelper is not 3 times as fast as the for-loop — as one could have expected — but is still faster by a 2.2 factor, more or less. The more processors you will use in RSimulationHelper, of course, the greater the time improvement factor will be.



Top
Install instructions


RSimulationHelper is a free executable (.exe) file. Download it now.
It installs in a few clicks. Once you have downloaded RSimulationHelper.zip, unzip it, double-click the file RSimulationHelper.msi and follow the next few steps prompted on screen.

RSimulationHelper obviously requires R be installed on your computer; it also requires Active Perl, a free and easy-to-install package available.
Once Active Perl is installed, you need to install the Process Perl library, which also installs easily. At DOS-prompt, type ppm install process and wait a few seconds for the installation to complete.



Top
Instruction manual


Complete instructions can be read in Instruction manual, which is also available from Help menu on each RSimulationHelper's form.