Hoffman2:MATLAB: Difference between revisions

From Center for Cognitive Neuroscience
Jump to navigation Jump to search
No edit summary
(→‎Software Versions: update matlab versions available after centos7 upgrade)
 
(32 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Hoffman2|Back to all things Hoffman2]]
[[Hoffman2|Back to all things Hoffman2]]


MATLAB is not a small program and it can handle some fairly complex graphics.  As such, this is not something suitable to be used on a login node of Hoffman2.  But that's already been thought of by the great people at ATS.
MATLAB is not a small program, and it can handle some fairly complex graphics.  As such, this is not something suitable to be used on a login node of Hoffman2.  But that's already been thought of by the great people at ATS.


==GUI==
To run a full GUI session of MATLAB, execute
To run a full GUI session of MATLAB, execute
  $ matlab
  $ matlab
That's it, no flags, no frills, nothing else.  Hoffman2 will automatically check out an appropriate interactive node for you to run MATLAB on.  All you have to do is provide a time limit (in hours) when they ask you
That's it, no flags, no frills, nothing else.  Hoffman2 will automatically check out an appropriate interactive node for you to run MATLAB on.  All you have to do is provide a time limit (in hours) when they ask you
  Enter a time limit for your session, in hours (default 2)
  Enter a time limit for your session in hours (default 2)
  <or quit>:  
  <or quit>:  


If you don't need the fancy GUI and just want the command line, execute
 
==Command Line==
If you don't need the fancy GUI and want the command line, execute
  $ matlab -nodesktop
  $ matlab -nodesktop
and then supply a time limit when asked.
and then supply a time limit when asked.


Since this uses interactive nodes, the maximum time limit you can request is 24 hours.
'''Since this uses interactive nodes, the maximum time limit you can request is 24 hours.'''
 
 
==License Check==
With so many people using Hoffman2 and MATLAB, sometimes licenses run out.  Using this helpful script will give you some insight as to the license situation.
 
[[Hoffman2:Scripts:matlab_license_check.sh|matlab_license_check.sh]]
 
 
 
==Large Computations==
If you are doing a larger computation, '''running MATLAB normally will probably not work well.'''
 
Using the default method of launching MATLAB on Hoffman2 checks out an [[Hoffman2:Interactive_Sessions | interactive node]] with only 1GB of RAM.  This is woefully small if you are working with ten minutes of dense array EEG.  Use the following steps to launch a more capable MATLAB session.
 
<pre>
# Request an interactive node with time and memory required. In this case, 10 hours and 4GB RAM
<!--$ qrsh -l i,h_rt=10:00:00,h_data=4G-->
$ qrsh -l h_rt=10:00:00,h_data=4G
 
# Load the module MATLAB
$ module load matlab
 
# You can also load different versions of MATLAB:
#  module load matlab/8.6
#  or
#  module load matlab/R2020b
# Try using "module help" for more information
 
# Launch MATLAB
$ matlab
</pre>
 
'''***Please note, launching the Matlab GUI requires ~15-20GB of virtual memory.
<br>Memory can be allocated by requesting the appropriate amount for a single node <code>h_data=20G</code>
or requesting it across several processors <code>h_data=4G -pe shared 5</code> (total 5 * 4G = 20GB memory).
<br>If the GUI is not necessary for running your scripts, then consider launching matlab via text-based interface by issuing the command <code>matlab -nojvm -nodisplay -nosplash</code>.
 
==Running Parallel Jobs==
IDRE team provided the following solution to use parallel pool in Matlab version 9.7.
Please copy the sample file "myparpooltest_batch.m" first from the path shown below in Hoffman.
* Make sure to not run the myparpooltest_batch.m in MATLAB
 
1)  Request an interactive session with for example:
#*  $qrsh -l h_data=4G -pe shared 2
2)  When the interactive session is awarded issue:
#*  $module load matlab/9.7
#*  $matlab &
3) When the matlab desktop opens, issue at the matlab command prompt:
  >> rehash toolboxcache
  >> configCluster
4) Close matlab
5) To familiarize with the submission procedure you could copy the content of the directory:
#*  $cp /u/local/apps/submit_scripts/MATLAB_PARALLEL_BATCH_SUBMISSION/* ./
7) In a local test directory and issue:
#*  $./matlab_batch_parallel_job_submit.sh -t 3 -s 20 -m 4 -v 9.7 -f ./myparpooltest_batch.m
    (Path: /u/local/apps/submit_scripts/MATLAB_PARALLEL_BATCH_SUBMISSION/myparpooltest_batch.m)
   
8) Look into the file:
#*  /u/local/apps/submit_scripts/MATLAB_PARALLEL_BATCH_SUBMISSION/README.HOWTO
9) and/or issues:
#* ./matlab_batch_parallel_job_submit.sh --help
 
For additional information about MATLAB batch submissions using either a remote or local client, visit the [https://www.hoffman2.idre.ucla.edu/Using-H2/Software/Software.html#matlab MATLAB on Hoffman2] page.
 
For older versions of Matlab, the [https://www.fieldtriptoolbox.org/faq/how_to_get_started_with_distributed_computing_using_qsub/ Fieldtrip qsub toolbox] can be used to facilitate batch submissions. Please see [[Hoffman2:MATLAB:qsubjobarray.m | qsubjobarray.m]] for an example.
 
==Software Versions==
The current default version of MATLAB on Hoffman2 is R2020a, but other versions are also available for use:


R2015b  or  matlab/8.6
R2020b  or  matlab/R2020b


==External Links==
==External Links==
*[http://www.ats.ucla.edu/clusters/common/software/engineering/matlab.htm MATLAB on Hoffman2]
*[https://www.hoffman2.idre.ucla.edu/Using-H2/Software/Software.html#matlab MATLAB on Hoffman2]

Latest revision as of 19:07, 11 November 2021

Back to all things Hoffman2

MATLAB is not a small program, and it can handle some fairly complex graphics. As such, this is not something suitable to be used on a login node of Hoffman2. But that's already been thought of by the great people at ATS.


GUI

To run a full GUI session of MATLAB, execute

$ matlab

That's it, no flags, no frills, nothing else. Hoffman2 will automatically check out an appropriate interactive node for you to run MATLAB on. All you have to do is provide a time limit (in hours) when they ask you

Enter a time limit for your session in hours (default 2)
<or quit>: 


Command Line

If you don't need the fancy GUI and want the command line, execute

$ matlab -nodesktop

and then supply a time limit when asked.

Since this uses interactive nodes, the maximum time limit you can request is 24 hours.


License Check

With so many people using Hoffman2 and MATLAB, sometimes licenses run out. Using this helpful script will give you some insight as to the license situation.

matlab_license_check.sh


Large Computations

If you are doing a larger computation, running MATLAB normally will probably not work well.

Using the default method of launching MATLAB on Hoffman2 checks out an interactive node with only 1GB of RAM. This is woefully small if you are working with ten minutes of dense array EEG. Use the following steps to launch a more capable MATLAB session.

 # Request an interactive node with time and memory required. In this case, 10 hours and 4GB RAM
 <!--$ qrsh -l i,h_rt=10:00:00,h_data=4G-->
 $ qrsh -l h_rt=10:00:00,h_data=4G

 # Load the module MATLAB
 $ module load matlab

 # You can also load different versions of MATLAB:
 #   module load matlab/8.6
 #  or
 #   module load matlab/R2020b
 # Try using "module help" for more information

 # Launch MATLAB
 $ matlab

***Please note, launching the Matlab GUI requires ~15-20GB of virtual memory.
Memory can be allocated by requesting the appropriate amount for a single node h_data=20G or requesting it across several processors h_data=4G -pe shared 5 (total 5 * 4G = 20GB memory).
If the GUI is not necessary for running your scripts, then consider launching matlab via text-based interface by issuing the command matlab -nojvm -nodisplay -nosplash.

Running Parallel Jobs

IDRE team provided the following solution to use parallel pool in Matlab version 9.7. Please copy the sample file "myparpooltest_batch.m" first from the path shown below in Hoffman.

  • Make sure to not run the myparpooltest_batch.m in MATLAB
1)  Request an interactive session with for example: 
#*  $qrsh -l h_data=4G -pe shared 2

2)  When the interactive session is awarded issue:
#*  $module load matlab/9.7
#*  $matlab &


3) When the matlab desktop opens, issue at the matlab command prompt:
 >> rehash toolboxcache
 >> configCluster

4) Close matlab

5) To familiarize with the submission procedure you could copy the content of the directory:
#*  $cp /u/local/apps/submit_scripts/MATLAB_PARALLEL_BATCH_SUBMISSION/* ./

7) In a local test directory and issue:
#*  $./matlab_batch_parallel_job_submit.sh -t 3 -s 20 -m 4 -v 9.7 -f ./myparpooltest_batch.m
   (Path: /u/local/apps/submit_scripts/MATLAB_PARALLEL_BATCH_SUBMISSION/myparpooltest_batch.m)
   

8) Look into the file:
#*  /u/local/apps/submit_scripts/MATLAB_PARALLEL_BATCH_SUBMISSION/README.HOWTO

9) and/or issues:
#* ./matlab_batch_parallel_job_submit.sh --help

For additional information about MATLAB batch submissions using either a remote or local client, visit the MATLAB on Hoffman2 page.

For older versions of Matlab, the Fieldtrip qsub toolbox can be used to facilitate batch submissions. Please see qsubjobarray.m for an example.

Software Versions

The current default version of MATLAB on Hoffman2 is R2020a, but other versions are also available for use:


R2015b  or  matlab/8.6
R2020b  or  matlab/R2020b

External Links