From Center for Cognitive Neuroscience
Revision as of 22:50, 21 March 2014 by Elau (talk | contribs) (Make MATLAB jobs.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Back to all things Hoffman2

Back to all things MATLAB

If you have a very large M-file script that needs to run for a long time and doesn't need you to:

  • click things
  • type inputs
  • observe pictures

or generally interact with the script, you can run that M-file as a job on Hoffman2 leveraging the full computational power of the system.

An example would be if you had created an EEGLAB script for processing lots of subjects' EEG data.

If you are trying to do lots of SPM work, follow the guidelines here.

Running the script

Once you have an M-file to run, you will now need to create a BASH command script to submit as a job. This script will setup MATLAB and tell it to run your M-file.

Something like the following will do

# run_eeglab_example_job.sh
# Edward Lau
# eplau[at]ucla[dot]edu
# 2014.03.06
# Runs the example EEGLAB script in a headless job.

# Setup the environment to have modules like MATLAB
source /u/local/Modules/default/init/modules.sh

# Load the MATLAB module
module load matlab

# Run MATLAB and your script
matlab -nosplash -nojvm -nodesktop -singleCompThread -r eeglab_example_job

Submit the Job

All that remains is to submit the job based on what you've already learned about submitting jobs.

Be mindful of the time and memory that you request and then wait patiently as your job is queued and run on the cluster.

In our example case, you would SSH into Hoffman2 and execute the following commands:

 $ cd /u/home/FMRI/apps/examples/eeglab
 $ ./q.sh ./run_eeglab_example_job.sh

Wait for the Job to Run

Remember how to check on job status?

Look at the Outputs

Make sure that was all worthwhile and look at the outputs. If you are still on Hoffman2, go ahead and launch MATLAB and run the following commands

 >> addpath(genpath('/u/home/FMRI/apps/eeglab/current/')); % Make sure EEGLAB is in the MATLAB PATH
 >> eeglab; % Launch EEGLAB

And then using the GUI, load up the resulting processed file. If you followed along with our example, this output file will be in your SCRATCH directory.