All files appearing on this page are available as a zipped file for download.

#!/bin/csh -f # Script name: pctBatch # Purpose: # MATLAB script for running MATLAB PCT batch jobs on the Katana Cluster # DONOT include any matlabpool statement i your m-file # matlabpool('SGE', N) % SGE must have already been created by you # % N is the number of labs (workers) # Which batch queue will be used is determined entirely by N # Batch jobs submitted via this script have a 24-hour wallclock limit. # Usage: pctBatch $1 $2 # $1 -- name of m-file to be executed, DONOT include .m # $2 -- output file name; may include path # Example: # katana% pctBatch "n=3,m=3,N=16,runSGE" myOutput # Date created: # February 11, 2011 nohup matlab -nodisplay -nosplash -r "$1; exit" >! $2 &

### matmulExample.m

function matmulExample(n, m)

% function matmulExample(n, m)

% Purpose:

% Computes and collects timings data for a matrix-matrix multiply

% n — (input) row size

% m — (input) column size

tic

spmd

a = codistributed.rand(n,m); % distribute a random matrix by column

b = codistributed.rand(n,m); % distribute a random matrix by column

c = a*b; % distributed matrix multiply

end

Tp = toc;

disp([‘Parallel job walltime is ‘ num2str(Tp)])

end

### runSGE.m

% script m-file to open matlabpool and run user app % N, n, and m are set at run time thru pctBatch matlabpool('SGE', N) % use SGE configuration matmulExample(n, m) % example user app matlabpool close