...
Using MATLAB Desktop (GUI) in O2
When running interactive MATLAB jobs it It is possible to display the graphical version of MATLAB back to your desktop using X11 forwarding, however this is not recommended, since it is known to crash frequently when heavy graphics need to be displayed.
A more resilient and better performing option is to run MATLAB as part of a Jupyter notebook/ lab. To set up the MATLAB-Jupyter interface you can follow the instruction described in Jupyter on O2 making sure to load the MATLAB module and install the additional package jupyter-matlab-proxy after installing Jupyter.
Code Block |
---|
module load gcc/6.2.0 python/3.7.4 matlab/2021b
virtualenv jupytervenv
source jupytervenv/bin/activate
pip3 install jupyter
pip3 install jupyter-matlab-proxy |
...
or
...
after selecting the MATLAB option now possible to run MATLAB in O2 with its GUI interface using PORT forwarding and a standard web browser. To start your MATLAB web-GUI instance you first need connect to O2 forwarding a PORT:
Code Block | ||
---|---|---|
| ||
~ % ssh -L PORT:127.0.0.1:PORT hms_id@o2.hms.harvard.edu |
where PORT is a number you choose randomly between 50000 and 60000 and hms_id is your username (formerly known as Ecommons).
Once you logged in the next step is to load the MATLAB module (2021b or later) and submit the MATLAB GUI job with the Slurm --tunnel option and executing the script MATLAB_launcher.sh PORT,
for example:
Code Block | ||
---|---|---|
| ||
@login05:~ module load matlab/2021b
@login05:~ srun -t 6:00:00 --pty -p interactive -c 1 --mem=4G --tunnel PORT:PORT MATLAB_launcher.sh PORT |
where PORT is the same number you used above.
Once the job is dispatched you should see a printout similar to:
Code Block | ||
---|---|---|
| ||
INFO:MATLABProxyApp:MLM_LICENSE_FILE with value: /n/app/matlab/2021b/licenses/network.lic is a path to a file. MATLAB will attempt to use it.
INFO:MATLABProxyApp:Deleting any cached licensing files!
INFO:MATLABProxyApp:
==============================================================================================================================================================================================================================================
MATLAB can be accessed at:
http://localhost:54122/matlab/JFSBwbThf4Y0wwZgBtdYRQ==/index.html
==============================================================================================================================================================================================================================================
MATLAB is selecting SOFTWARE OPENGL rendering. |
and you will also see a standard MATLAB command line shell.
At this point you can copy the web address displayed under MATLAB can be accessed at:
in your local web browser and you should see a screen like:
...
which can last for a few minutes and will eventually start the MATLAB Desktop interface:
...
up to several minutes, followed by the informative message:
...
which you can close and eventually arrive to the familiar MATLAB GUI interface
...
In the rare case you selected a PORT number that is already been used you might see an error message like “port PORT is in use or unavailable”, if this happen start this process over selecting a different PORT number.
MATLAB web-GUI is only available for version 2021b or later