[Gate-users] Using Multicore Computers to Run GATE Simulations Simultaneously

Geron Bindseil geron9 at gmail.com
Mon Jul 18 18:34:55 CEST 2011


Dear Gate Users:

A couple days ago I mentioned I had written a script for running multiple
Gate simulations simultaneously on multicore computers. Many people have
written asking for this script, so I decided to send it over the list in
case anyone else could benefit from it.

I have attached an example Perl script and README file that explains how to
run multiple GATE simulations simultaneously on one computer with more than
one logical CPU. This method runs a set of Gate simulations with different
parameters and if the number of simulations to be run are greater than the
number of logical CPUs, the script will wait until a CPU is available before
starting the next Gate simulation.

N.B. In my response to a question on July 16, I accidentally gave the
incorrect syntax for the terminal command ("<" should have been ">"). The
correct syntax for storing the output in a file (rather than printing it in
the terminal is): "Gate -a ParameterName ParameterValue my_macro.mac >
terminal_output.out". If you just want to run a bunch of macros
simultaneously in the background manually, you can do so by inserting an
ampersand "&" at the end of each command.

Kind Regards,
Geron

---

Geron Bindseil
PhD Candidate, Physics
University of Western Ontario
London, Ontario, Canada
-------------- next part --------------
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

\f0\fs24 \cf0 Using Multicore Computers to Run GATE Simulations Simultaneously\
Geron Bindseil\
gbindsei at uwo.ca\
July 18 2011\
\
Summary: This is a small tutorial that explains how to run multiple GATE simulations simultaneously on one computer with more than one logical CPU. This method runs a set of Gate simulations and if the number of simulations to be run are greater than the number of logical CPUs, the script will wait until a CPU is available before starting the next Gate simulation.\
\
Requirements: This method requires GATE to be installed and the env_gate.sh or env_gate.csh shell script to have been sourced. Perl and several perl modules are required.\
\
[[Configuring Perl to Install Modules]]\
\
Make sure you have perl installed on your computer. After that, install the cpanm module installer which is a tool that automatically configures and installs perl modules. Install cpanm by typing the following on the terminal (use 'sudo' if your local account doesn't have write privileges to system directories):\
\
sudo cpan App::cpanminus\
\
After that, any modules can be installed by typing the following:\
\
sudo cpanm Module::Name\
\
The instructions for doing this and installing CPAN modules can be found here:\
http://www.cpan.org/modules/INSTALL.html\
\
[[Installing Required Perl Modules]]\
\
The script requires a couple modules to be installed. Install them by typing the following into a terminal window:\
\
sudo cpanm Forks::Super (required: for managing the queue of GATE jobs)\
sudo cpanm File::Path (optional: to make creating directories easier)\
\
[[Running GATE script.]]\
\
Make a Gate macro and put the gate_batch.pl perl script into the same directory. Modify gate_batch.pl to set the number of logical CPUs your computer has (double the number of physical cores if your computer has hyper-threading). You may also wish to modify the default path for storage of the output root data files.\
\
To run the code, in a terminal window with the env_gate shell script already sourced, execute the following command:\
\
perl gate_batch.pl\
\
The words "End of perl batch script." will be printed when all the macros have completed.\
\
[[Notes]]\
\
- Originally, my script included a step to automatically determine the number of CPUs but it did not treat hyper-threaded CPUs properly.\
- Originally, my script called a print statement when any particular macro had finished running, but this was not working as indented.}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gate_batch.pl
Type: application/octet-stream
Size: 1913 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20110718/24c88491/attachment.obj>


More information about the Gate-users mailing list