Instructions on Using Matlab on the UCSB CSC Cluster from Windows
Please note that this is for running a small number of MatLab jobs, as each will check out a license from the campus server. If you want to run 10's of MatLab jobs at one time you can avoid exhausting the usable licenses for other members of campus by using a 'compiled matlab' job.
- You need an account at CSC. You also need appropriate software for accessing the cluster. See your tech guru.
- Matlab runs on a machine in the cluster just like it runs on your desktop, except that the machine doesn’t have a keyboard or monitor attached. You supply a Matlab script, “wrapper.m,” that contains whatever commands you would normally enter into the Matlab command window. You want to be sure that your program saves any figures (using the Matlab print command) and sends text output to a file (using fprintf, for example). Text written to “standard out,” either using a fileID==1 or disp() will end up in a file with extension “.o”. Sometimes the latter is easier than using fprintf.
- The cluster supports the parallel toolbox, used with the parfor command. You will want to use the configuration named “local.” So the appropriate way to open a Matlab pool is with the command “matlabpool open local”. Here is a little Matlab script (say named 'CalculateIt.m') which adds up the numbers from 1 to 1,000 25 times, printing the answer each time.
- You need a Torque script to submit your Matlab script to the queue. Your job is going to run on a single node on the cluster, but if you are using the parallel toolbox you’ll want it to run on a node with 12 cores (as of February 2012.) Here's an example named cnsi_Matlab_example.job
The “walltime” argument is optional. If you are not using the parallel toolbox, omit the “ppn” argument. Submit your job with the command “qsub cnsi_Matlab_example.job” or, if your job takes under an hour you’ll get faster execution using the “short” queue with “qsub –q short cnsi_Matlab_example.job”