Matlab licenses are a finite resource, and we have no control over how many are available at any given time. Fortunately, there are some strategies you can employ to help get your work done.
Matlab Licenses are Per-Machine
Luckily, the gridengine scheduler prefers to fill each machine's slots before moving onto the next, so by default, we make the most efficient use of the licenses available.
Restart Tasks
When your job fails due to an unavailable matlab license, you can catch that error and tell gridengine to try again later.
matlab -nodisplay < $1 RETVAL=$? if [ $RETVAL == 1 ]; then echo no matlab license available sleep 60 exit 99 fi exit $RETVAL
Exiting with a return value of 99 tells gridengine that it should rerun the task later. This job will stay queued, and periodically run, until it gets a license.
Compile and Avoid Licenses
Compiled matlab programs do not require licenses. This is the best way to ensure that your jobs run, especially if you wish to run many of them. Unfortunately, compiling is not always so easy.
At it's simplest, compiling looks something like this.
% mkdir myproj % cd myproj % cp ../helloWorld.m . % mcc -m helloWorld.m % ls helloWorld helloWorld_main.c readme.txt helloWorld.m helloWorld_mcc_component_data.c run_helloWorld.sh helloWorld.prj mccExcludedFiles.log % ./run_helloWorld.sh /local/projects/matlab/current Hello World
MathWorks provides some howto documentation for using the mcc compiler, and also compiling from the gui interface. These also contain trivial program examples.
For more complicated matlab programs, things get complicated. A Brown CS student wrote a detailed tutorial that is worth looking at.