Difference between revisions of "Matlab GUI Example"

From UFRC
Jump to navigation Jump to search
m (Israel.herrera moved page Matlab job scripts to Matlab GUI Example without leaving a redirect)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Category:Software]]
 
[[Matlab|back to the main Matlab page]]
 
[[Matlab|back to the main Matlab page]]
=GUI Session=
+
=GUI Sessions=
 +
Start a MATLAB GUI session by loading the GUI module:
  
 +
<pre>
 +
module load gui
 +
</pre>
 +
 +
Then you can launch a MATLAB GUI session using one of two main methods:
 +
 +
==Launch Wrapper==
 +
Use the MATLAB launch wrapper provided by UFRC 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==
 +
Sometimes your work-flow may require access more advanced SLURM options such as dependency scheduling or incorporating GUI MATLAB tasks into larger launch scripts.  In these cases you can use an advanced job script to start a MATLAB GUI session.  Please note that this is for advanced use and does not automatically list your port connection information like the earlier method does.  This port connection info can be found by running the xpra_list_sessions command after your MATLAB GUI section of your job has started.
 +
 +
===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 69:
 
#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>

Latest revision as of 21:32, 24 October 2022

back to the main Matlab page

GUI Sessions

Start a MATLAB GUI session by loading the GUI module:

module load gui

Then you can launch a MATLAB GUI session using one of two main methods:

Launch Wrapper

Use the MATLAB launch wrapper provided by UFRC 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

Sometimes your work-flow may require access more advanced SLURM options such as dependency scheduling or incorporating GUI MATLAB tasks into larger launch scripts. In these cases you can use an advanced job script to start a MATLAB GUI session. Please note that this is for advanced use and does not automatically list your port connection information like the earlier method does. This port connection info can be found by running the xpra_list_sessions command after your MATLAB GUI section of your job has started.

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