Difference between revisions of "Matlab GUI Example"

From UFRC
Jump to navigation Jump to search
Line 1: Line 1:
 
[[Matlab|back to the main Matlab page]]
 
[[Matlab|back to the main Matlab page]]
 
=GUI Session=
 
=GUI Session=
 +
Start a MATLAB GUI session by loading the GUI module:
  
 +
<pre>
 +
module load gui
 +
</pre>
 +
 +
==Launch Wrapper==
 +
Use the MATLAB launch wrapper to start your MATLAB GUI session:
 +
 +
<pre>
 +
launch_matlab_gui
 +
</pre>
 +
 +
If you would like to pass custom parameters to the job script, these parameters can be listed using the -h parameter:
 +
 +
<pre>
 +
[$USERNAME@gator3 ~]$ launch_matlab_gui -h
 +
 +
Usage:
 +
 +
        launch_xpra_gui_$application [options]
 +
                                                                                                     
 +
Options:                                                                                             
 +
 +
        -h - show this help message
 +
 +
        -e <executable> - program to run (REQUIRED)
 +
 +
        -m <memory> - memory, gb (default is 4gb)
 +
 +
        -p <procs> - processor cores, (default is a single core)
 +
 +
        -t <time> - SLURM time limit, hrs (default is 4hrs)
 +
 +
        -a <account> - SLURM account (default is your main account)
 +
 +
        -b - Use burst SLURM qos (default is main qos)
 +
 +
        -n - Do not wait until the job starts. I will run xpra_list_sessions later
 +
 +
        -j - Set up environment for a Java program
 +
 +
        -f <jobfile> - Job script to use for the gui session
 +
 +
        -l - List application presets
 +
 +
        -v - Verbose output to show the submission information
 +
 +
 +
Defaults will be used for missing values
 +
</pre>
 +
 +
==Advanced Launch==
 +
If you would like to access more advanced SLURM options or incorporate MATLAB into larger scripts, you can use an advanced job script to start a MATLAB GUI session.
 +
 +
===Example===
 
;Note: this script is also available as '$HPC_GUI_JOB/launch_matlab.sh' after loading the gui environment module. Please feel free to change the parameters as needed for your work.
 
;Note: this script is also available as '$HPC_GUI_JOB/launch_matlab.sh' after loading the gui environment module. Please feel free to change the parameters as needed for your work.
  
Line 11: Line 66:
 
#SBATCH --ntasks=1
 
#SBATCH --ntasks=1
 
#SBATCH --mem-per-cpu=2gb
 
#SBATCH --mem-per-cpu=2gb
#SBATCH --time=02:00:00
+
#SBATCH --time=04:00:00
 
##SBATCH --account=<optional>
 
##SBATCH --account=<optional>
 
##SBATCH --qos=<optional>
 
##SBATCH --qos=<optional>

Revision as of 13:27, 13 October 2016

back to the main Matlab page

GUI Session

Start a MATLAB GUI session by loading the GUI module:

module load gui

Launch Wrapper

Use the MATLAB launch wrapper to start your MATLAB GUI session:

launch_matlab_gui

If you would like to pass custom parameters to the job script, these parameters can be listed using the -h parameter:

[$USERNAME@gator3 ~]$ launch_matlab_gui -h

Usage:

        launch_xpra_gui_$application [options]
                                                                                                      
Options:                                                                                              

        -h - show this help message

        -e <executable> - program to run (REQUIRED)

        -m <memory> - memory, gb (default is 4gb)

        -p <procs> - processor cores, (default is a single core)

        -t <time> - SLURM time limit, hrs (default is 4hrs)

        -a <account> - SLURM account (default is your main account)

        -b - Use burst SLURM qos (default is main qos)

        -n - Do not wait until the job starts. I will run xpra_list_sessions later

        -j - Set up environment for a Java program

        -f <jobfile> - Job script to use for the gui session

        -l - List application presets

        -v - Verbose output to show the submission information


Defaults will be used for missing values

Advanced Launch

If you would like to access more advanced SLURM options or incorporate MATLAB into larger scripts, you can use an advanced job script to start a MATLAB GUI session.

Example

Note
this script is also available as '$HPC_GUI_JOB/launch_matlab.sh' after loading the gui environment module. Please feel free to change the parameters as needed for your work.
#!/bin/bash
#SBATCH --job-name="Matlab"
#SBATCH --output matlab_gui-%j.out
#SBATCH --partition=gui
#SBATCH --ntasks=1
#SBATCH --mem-per-cpu=2gb
#SBATCH --time=04:00:00
##SBATCH --account=<optional>
##SBATCH --qos=<optional>
hostname;pwd;date

module load gui matlab

xpra_start_matlab

date