Step-by-step guide to compiling matlab projects into executables and running them on the queue

1. Upload Files

1.1. Log in at If you don't have an account, you can register for one.

1.2. Go to the Data Manager tab. Here you can either choose the Data Managerheading or the HTML Data Manager heading – either of these should work. The former opens a “Grid Virtual Desktop”, which is a little bit faster and more high-tech, whereas the HTML Data Manager is simpler. In either case, the goal here is to first create a directory, and then uploading the files you need to it. That is, upload whatever matlab script you intend to run, plus any user-defined functions that it needs to work.

1.3. Note that, at the end of the script you want to run, you should have a line which saves your workspace, so that you can view it later and collect your data. For example:

save jazzworkspace

It doesn't matter what you call it. If you like, you can also add a command like this in the body of the program, so that you will be able to check on the progress of your job.

2. Compiles your program into an executable

2.1. Still on the UCSB Grid Portal, go to the Interactive tab, and then click on qsr-Matlab. This should open a java version of matlab in a separate window. This java matlab uses the directories and files that you have uploaded using the Data Manager process.

2.2. Choose the directory that you want to use for your project.

2.3. In order to use the java matlab to compile your executable, enter the following text in the command window:

mcc -m jazzprogram.m

That is, write the mcc -m command, followed by the name of the script you want to run, including the .m extension. You will most likely see a bunch of error messages, which may seem to indicate fairly convincingly that what you just tried to do didn't work. In many cases, however, you can safely ignore these. The important thing is that a few new files should have appeared in your directory. (You should be able to see these in the java matlab interface, and/or by using the data manager.) The most important of these new files is a file that should be called jazzprogram, i.e. the same name as your program, but with no file extension. This should be your executable.

3. Run your program on the queue

3.1. From the UCSB Grid Portal, choose the Job Services tab. If this is your first job from a new directory, choose the Generic Jobs heading. (Otherwise, you can save a bit of time in accessing previously-created jobs by choosing the User Applications heading.)

3.2. Give your job a name. It doesn't matter what you choose.

3.3. Use the folder icon to select the executable that you created in the previous section.

3.4. Use the folder icon to select your directory. (It should be the directory that contains your executable.)

3.5. In the Environmental Variables field, enter the following text:

LD_LIBRARY_PATH /usr/local/ucsb/MatLabR2009a/bin/glnxa64:/usr/local/ucsb/MatLabR2009a/sys/java/jre/glnxa64/jre1.4.2/lib/amd64/server

Make sure that there are no hidden paragraph breaks in the text as you have entered it.

3.6. If your job requires more than an hour to run, or more then 1024MB, adjust these fields accordingly.

Note: The current maximum time limit for each job is 72 hours.

3.7. Click the “Save as your application” box, and submit your job.

4. Check the status of your job

4.1. To check the status of your job, click the Job Services tab, and the Job Status heading.

5. Collect your workspace data

5.1. When your job is complete, a workspace file should appear in your directory. In our example, it would be called jazzworkspace.mat.

5.2. Since this is in your directory, you can view it using the java matlab interface.

5.3. If you would like to download the data, go to the Data Manager tab. Whether you use the html version or the Grid Virtual Desktop, your goal is simply to select the jazzworkspace.mat file, and then choose the “download” option.