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

#!/bin/csh -f
# script name: single_node_batch
# Purpose:
# This script is written specifically for running MATLAB PCT batch jobs via qsub
# ***** on a single, 12- or 16-core, node on the SCC Cluster *****
# ***** MATLAB PCT licensing allows up to 12 workers
# ***** For more workers, Distributed Computing Engine license will be required
# Your m-file is responsible for opening (and closing) matlabpool with
# matlabpool open local     %  "local" must be used
# The number of workers for the matlabpool is determined by the number of
# processors specified with -pe switch.
#
# Usage:
# scc1% qsub -pe <queue-name> <workers> single_node_batch $1  $2
# <queue-name> -- omp
# <workers>    -- number of workers (<= 12 processors) 
# $1 -- name of m-file to be executed, DONOT include .m
# $2 -- output file name; may include path if other than current directory
# By default, the job can run for up to 12 hours walltime.
# Optionally, you can add ** -l h_rt=24:00:00 ** after the -pe queue-name workers
# to run for up to 700 hours.
#
# Example 1: submit job requesting an entire 8-processor node
# scc1% qsub -pe omp 8 single_node_batch "n=3000;m=3000;runLocal" myOutput
# runLocal is an wrapper script m-file that opens matlabpool and run your application. Quotes must be used.
# Example 2: submit job requesting 4 workers
# scc1% qsub -pe omp 4 single_node_batch "n=3000;m=3000;runLocal" myOutput

# Date created:
# February 11, 2011
# Kadin Tseng, RCS, Boston University

matlab -nodisplay -nosplash -r "$1; exit"  >! $2

Example user code: matmulExample.m

function matmulExample(n, m)
% function matmulExample(n, m)
% Purpose:
% Computes and collects timings data for a matrix-matrix multiply
% on a single shared-memory node (4 or 8 cores on SCC)
% 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

runLocal.m

% runLocal.m is a script m-file to open matlabpool and run user app
% n and m are set at runtime as input to single_node_batch script
matlabpool open local        % use local configuration
matmulExample(n, m)          % example user app
matlabpool close