MATLAB on Orca: Difference between revisions

From Fluids Wiki
Jump to navigation Jump to search
No edit summary
Line 37: Line 37:
  echo  
  echo  
|}
|}
=== Visualization Machines ===
* log into a visualization machine with X-forwarding (''ssh -X viz2-uwaterloo.sharcnet.ca'')
:Only machines 2 and 3 have Matlab available.
* run Matlab by entering ''/opt/sharcnet/testing/matlab/R2014a/bin/matlab''
:It is suggested to put this command in a file in your home directory just like the uwmatlab file.
If your data is not in your home or work directory you can mount scratch from other clusters onto the workstation.  For example, to mount your /scratch directory from orca you should execute
::''mkdir /scratch/$USER/orca''<br />
::''sshfs $USER@orca.sharcnet.ca:/scratch/$USER /scratch/$USER/orca''
See [https://www.sharcnet.ca/help/index.php/Visualization_Workstations visualization workstations] for more information.

Revision as of 16:36, 21 January 2015

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 (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 can put this in a bash script by creating the file freedevnode.sh containing

#!/bin/bash

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