Oliver Range
Oliver Range

Reputation: 365

Running Matlab code on a cluster

I have a university account for the university's cluster, but I don't know how can I use it to run my Matlab code. Could anyone help? I connect to the cluster by typing below code in the terminal of my laptop:

ssh [email protected] 

Then it asks me to type my password.After that, below text appears:

Welcome to gav 9.1.1 (3.12.60-ql-generic-9.1-74) based on Ubuntu     14.04.5 LTS
Last login: Sun Apr 16 10:45:49 2017 from 192.168.41.213
gav:~ >

How can I run my code after these processes? Could anyone help me?

Upvotes: 2

Views: 3033

Answers (2)

akraf
akraf

Reputation: 3235

As far as I know, there are two possibilities:

  • Conventional Matlab is installed on the Cluster
  • The Matlab Distributed Computing server is installed on the cluster

Conventional Matlab is installed on the Cluster

You execute Matlab on the cluster as you would on your local computer. I guess that you work on Windows on your local computer, given that you quote a simple shell prompt in your question ;) All right, all right, bad psychic skillz ;) see edit below.

What you see is the cluster awaiting a program name to execute. This is called the "Shell". Google "Linux shell tutorial" or start with this tutorial to get information about how to operate a Linux system without a graphical desktop.

Try to start matlab by simply typing matlab after the text you've seen. If it works, you see Matlab's welcome message and the Matlab prompt as you would see it in Matlab's command window on your local PC.

Bonus: you can try to execute Matlab on the cluster but see a graphical interface by replacing your ssh call by ssh -X [email protected], so add an additional -X.

Upload your Matlab scripts to the cluster, for example by using WinSCP (tutorial)

Execute your Matlab functions like you would locally by navigating into the correct folder and typing the function name.

EDIT: As you use Linux, you may use gio mount ssh://[email protected] to access your home folder on the cluster via your file manager. If that fails, try gvfs-mount ssh://[email protected] (the old name of the tool). The packages gvfs-backends and gvfs-fuse (I assume that you use ubuntu, other distributions may have different package names) must be installed for this; use your Package manager to install them if you get an error like "command not found".

Distributed Computing Server

This provides a set of Matlab "Workers" which are sent tasks from your local Computer. You use your local Matlab installation to connect to the Distributed computing server. Start with the Matlab Help Pages for the Distributed Computing Server

Upvotes: 2

user2314737
user2314737

Reputation: 29317

It looks like you have a Linux shell, so you can run your script (for instance yourScript.m)

> matlab -nojvm -nodisplay -nosplash < yourScript.m

(see also https://uk.mathworks.com/help/matlab/ref/matlablinux.html)

Upvotes: 2

Related Questions