Hoffman2:MATLAB:Jobs: Difference between revisions

From Center for Cognitive Neuroscience
Jump to navigation Jump to search
(Make MATLAB jobs.)
 
No edit summary
 
Line 53: Line 53:
In our example case, you would [[Hoffman2:Accessing_the_Cluster#SSH_-_Command_Line | SSH into Hoffman2]] and execute the following commands:
In our example case, you would [[Hoffman2:Accessing_the_Cluster#SSH_-_Command_Line | SSH into Hoffman2]] and execute the following commands:
<pre>
<pre>
  $ cd /u/home/FMRI/apps/examples/eeglab
  $ cd /u/home/FMRI/apps/examples/matlab
  $ ./q.sh ./run_eeglab_example_job.sh
  $ ./q.sh ./run_exampleMatlabScript.sh
</pre>
</pre>


Line 61: Line 61:
==Wait for the Job to Run==
==Wait for the Job to Run==
Remember how to [[Hoffman2:Monitoring_Jobs | check on job status?]]
Remember how to [[Hoffman2:Monitoring_Jobs | check on job status?]]






==Look at the Outputs==
==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
Fire up MATLAB afterward and look at the results.
<pre>
>> addpath(genpath('/u/home/FMRI/apps/eeglab/current/')); % Make sure EEGLAB is in the MATLAB PATH
>> eeglab; % Launch EEGLAB
</pre>
 
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 [[Hoffman2:Introduction#scratch | SCRATCH directory]].

Latest revision as of 00:59, 22 March 2014

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.