Print this article Edit this article

Running Matlab on Servers

Running jobs on a server

  1. ssh into a server.
  2. Start a screen session:
    1. something like "screen -S matlab-program_name"
  3. Run your job
    • Decide where you want to run the program. For this example I will have it in my home directory (U: or W: drive on windows)
    • run the job: ml matlab; matlab -nodisplay < program_name.m
  4. Once the job is running you can do "ctrl-a d" to detach from the session
  5. check on it periodically to see if it is done:
    1. ssh into server
    2. reattach to the screen session: "screen -r" or "screen -r name-you-gave-the-session"
    3. if it's done type "exit" to end your session
    4. or "ctrl-a d" to detach and check on it later

Using the GUI

Here's how to access Matlab with a graphical user interface (GUI). Please note that performance might be slow unless you have a fast Internet connection.

  1. Start an X server (such as VcXsrv or Cygwin, you would have to download and install one of these packages on a "self-supported" system).
    1. ssh with X11 packet forwarding into a host using an application like SecureCRT. (If you are using a "self-supported" or personally-owned computer, you may download SecureCRT.)
  2. Start the GUI by typing the following commands:
    1. module load matlab -> more information can be found here
    2. matlab
    3. This should get around the lack of proper video drivers.
  3. If you get a display that is just black using XQuartz you can try the following:
    via : Matlab GUI displays black with XQuartz
    1. create a file "java.opts" in the home folder
    2. edit to contain:
      -Dsun.java2d.xrender=false
      -Dsun.java2d.pmoffscreen=false
    3. restart matlab from home
    4. see if this solves the issue

Last Modified: Oct 28, 2025 10:06 am GMT-4
Created: May 1, 2019 3:04 pm GMT-4 by admin
JumpURL: