MATLAB on Orca: Difference between revisions

From Fluids Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
There are two ways to run MATLAB live on Sharcnet. The first is through orca's development nodes, and the second is through the visualization machines. Before continuing you must have a valid Matlab account and have set-up Matlab on sharcnet ([https://ece.uwaterloo.ca/~nnikvand/Coderep/Sharcnet%20Codes/uw_matlab.pdf Directions]). As described in the directions link, Matlab scripts may also be submitted as jobs but this will not allow any interaction with the code.
There is currently only a single way to run MATLAB live on Sharcnet through orca's development nodes. A second method that will soon be available is through the visualization machines. Before continuing you must have a valid Matlab account and have set-up Matlab on sharcnet ([https://ece.uwaterloo.ca/~nnikvand/Coderep/Sharcnet%20Codes/uw_matlab.pdf Directions]). As described in the directions link, Matlab scripts may also be submitted as jobs but this will not allow any interaction with the code.


=== Development Nodes ===
=== Development Nodes ===
Line 27: Line 27:
::''pdsh -w orc-dev[1-4] uptime | awk '{print $1,$NF}' | sort -n -k 2''
::''pdsh -w orc-dev[1-4] uptime | awk '{print $1,$NF}' | sort -n -k 2''


which shows the number of processors being used on each node over the last 15 minutes. A value less than 4 will allow commands in Matlab to run at a reasasonable pace, anything over 10 is unbearably slow. See [https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB8QFjAA&url=https%3A%2F%2Fwww.sharcnet.ca%2Fhelp%2Findex.php%2FOrca&ei=uR8PVNPdHceKsQS3yIKoDQ&usg=AFQjCNHr8JWbktLeKZF6YNe3KO6F_7LN6Q&bvm=bv.74649129,d.cWc Documentation] for more information. Instead of typing this in at every login, you can put this in a bash script by creating the file '''freedevnode.sh''' containing
which shows the number of processors being used on each node over the last 15 minutes. A value less than 4 will allow commands in Matlab to run at a reasasonable pace, anything over 10 is unbearably slow. See [https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB8QFjAA&url=https%3A%2F%2Fwww.sharcnet.ca%2Fhelp%2Findex.php%2FOrca&ei=uR8PVNPdHceKsQS3yIKoDQ&usg=AFQjCNHr8JWbktLeKZF6YNe3KO6F_7LN6Q&bvm=bv.74649129,d.cWc Documentation] for more information. Instead of typing this in at every login, you should make an alias.
 
{|
|
#!/bin/bash
echo
pdsh -w orc-dev[1-4] uptime | awk '{print $1,$NF}' | sort -n -k 2
echo
|}

Revision as of 15:39, 21 January 2015

There is currently only a single way to run MATLAB live on Sharcnet through orca's development nodes. A second method that will soon be available is through the visualization machines. Before continuing you must have a valid Matlab account and have set-up Matlab on sharcnet (Directions). As described in the directions link, Matlab scripts may also be submitted as jobs but this will not allow any interaction with the code.

Development Nodes

Set-up

A few modifications need to be made to the uwmatlab file before running Matlab live.

  • Remove the -nojvm and -singleCompThread arguments from the first line so that you are left with
/opt/sharcnet/local/matlab/R2014a/bin/matlab -nosplash -nodesktop

That is enough to get Matlab working, but it is also a good idea to run a start-up folder to add paths to your workspace when you open Matlab.

  • add -r "oldpath=cd('/home/$USER'); matlabstartup; cd(oldpath)" at the end of the first line of uwmatlab so that you have
/opt/sharcnet/local/matlab/R2014a/bin/matlab -nosplash -nodesktop -r "oldpath=cd('/home/$USER'); matlabstartup; cd(oldpath)"
  • create matlabstartup.m in /home/$USER

If using SPINS, a good command to have in the start-up file is

addpath('/work/$USER/spins/matlab')

or whatever directory the Spins matlab files are in. This will allow you to use the built in SPINS commands from any directory. This functionality will also apply to jobs submitted to the Sharcnet queue.

To run Matlab

  • log into orca with X-forwarding (ssh -X orca.sharcnet.ca)
  • log into one of the four development nodes with X-forwarding (ssh -X orca-dev1)
  • run Matlab (./uwmatlab)

Some of the development nodes can get quite busy so it is a good idea to check the usage before logging in. One way to do this is to use the command

pdsh -w orc-dev[1-4] uptime | awk '{print $1,$NF}' | sort -n -k 2

which shows the number of processors being used on each node over the last 15 minutes. A value less than 4 will allow commands in Matlab to run at a reasasonable pace, anything over 10 is unbearably slow. See Documentation for more information. Instead of typing this in at every login, you should make an alias.