Here are three simple scripts to submit and run MATLAB scripts
on a cluster via
Sun's Grid Engine (SGE).
We run this on our ROCKS Cluster, but it should work anywhere that SGE is used.
- submit_jobs.sh
- Run this script from the command line.
- It submits an array job to the SGE cluster queue which runs multiple
copies of the jobs.sh script.
- You need to modify this to change the number of jobs you want. (i.e.,
jobs 1:65 will produce 64 jobs numbered 1 to 64.)
- job.sh
- This script is run on the cluster nodes by the cluster queue.
- It runs MATLAB with the correct command line arguments to run it silently.
- It tells MATLAB to run the matlab_job.m file.
- You need to modify this to change the path to matlab and the path to
your stderr and stdout files.
- matlab_job.m
- This file tries to get the Task ID (SGE_TASK_ID) of the job.
- If it doesn't find a Task ID it sets it to -1.
- If the Task ID is not -1, this script exits MATLAB at the end. (If
you don't do this it will never quit.)
- You need to modify this file so that it starts the appropriate computation
based on the job ID.
All scripts are Copyright 2007 by David
Black-Schaffer. Permission to use
and/or modify them is freely given. I am not responsible for any errors or
problems associated with them!