Hoffman2:MATLAB:Jobs

From Center for Cognitive Neuroscience
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

/u/home/FMRI/apps/examples/eeglab/run_eeglab_example_job.sh
#!/bin/bash
#
# 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/matlab
 $ ./q.sh ./run_exampleMatlabScript.sh


Wait for the Job to Run

Remember how to check on job status?



Look at the Outputs

Fire up MATLAB afterward and look at the results.