COLOR_REMOTE is a directory of MATLAB programs which illustrate how to submit a parallel MATLAB program to run on a remote machine.
Before remote submission of jobs is possible, you must have an account on the remote machine, and go through some steps to ensure that that machine and your desktop machine can communicate properly. If you have not carried out these steps, refer to the document "Notes on Enabling Remote Submission of MATLAB Jobs" listed in the references below.
The nonparallel program colorsegmentation.m reads an array of 4 colors and a PNG file containing an image, and sequentially calls the colorFilter.m function to filter each of the given colors.
The parallel program colorSegmentationSol.m uses an SPMD construct (Single Program Multiple Data) with four 'labs', one assigned to each color. Thus, we must first open a matlabpool with four labs. The current version of the procedure uses the imwrite function inside the SPMD construct.
This means that, when run with a 'local' configuration, the resulting filtered images are written on the client machine, but when run with the 'ithaca' configuration, the resulting files are created and left on the ITHACA cluster. The user can retrieve the results by using, for instance, the SFTP program (Secure File Transfer Protocol).
As an alternative, the program colorSegmentationSol2.m also uses an SPMD construct, but we assign the output of the function to a "composite variable". This means that if the program is run remotely, the 4 images are returned to the client machine, and can be accessed by examining the four components of the composite variable.
Be sure to close the matlabpool before exiting your MATLAB session. You can test to see if you have an open matlabpool by typing:
value = matlabpool ( 'size' )If value is returned as a positive number, you have an open matlabpool.
You might find it convenient to create a file to take care of this automically, called finish.m
%FINISH finish file
%
% FINISH finish file
% Change the name of this file to FINISH.M. The file
% is executed when MATLAB finishing
% Copyright 1984-2000 The MathWorks, Inc.
% $Revision: 1.4 $ $Date: 2000/06/01 16:19:26 $
sz = matlabpool('size');
if sz > 0
disp(['a Matlabpool of size ' int2str(sz) ' is open.'])
val = input('Do you want to close the matlabpool (y/n) ?','s');
if val == 'n' || val == 'N'
return
else
matlabpool close
end
end
To run the nonparallel version of the program:
colorSegmentation
To run the first parallel version of the program:
colorSegmentationSol ( 'configuration' )where
To run the second parallel version of the program:
image = colorSegmentationSol2 ( 'configuration' )where
BIRTHDAY_REMOTE, a MATLAB program which runs a Monte Carlo simulation of the birthday paradox, and includes instructions on how to run the job, via MATLAB's BATCH facility, on a remote system such as Virginia Tech's ITHACA cluster.
COLLATZ_PARALLEL is a MATLAB program which seeks the maximum Collatz sequence between 1 and N; it runs in parallel using MATLAB's "parfor" facility.
FDI_OPT, a MATLAB program which demonstrates the use of MATLAB's FMINCON constrained minimization function, taking advantage of MATLAB's Parallel Computing Toolbox for faster execution.
JTB_CODIST, a MATLAB program which demonstrates how the linear system associated with a finite element problem can be treated as a codistributed array whose entries are assigned to different MATLAB workers, so that the matrix is assembled in parallel.
KNAPSACK_REMOTE, a MATLAB program which runs in parallel, seeking solutions of the "subset sum" version of the knapsack problem. Instructions are available on how to run the job, via MATLAB's BATCH facility, on a remote system such as Virginia Tech's ITHACA cluster.
LINEAR_SOLVE_DISTRIBUTED is a MATLAB program which solves a linear system A*x=b using MATLAB's spmd facility, so that the matrix A is "distributed" across multiple MATLAB workers.
LYRICS_REMOTE, a MATLAB program which runs in parallel, using three workers which cooperate "systolically", that is, as through they were on an assembly line. The output from worker 1 is passed to worker 2 for further processing, and so on. This includes instructions on how to run the job, via MATLAB's BATCH facility, on a remote system such as Virginia Tech's ITHACA cluster.
MATLAB_COMMANDLINE, MATLAB programs which illustrate how MATLAB can be run from the UNIX command line, that is, not with the usual MATLAB command window.
MATLAB_PARALLEL, examples which illustrate "local" parallel programming on a single computer with MATLAB's Parallel Computing Toolbox.
MD_PARALLEL is a MATLAB program which carries out a molecular dynamics simulation in parallel, using MATLAB's "PARFOR" feature.
MD_REMOTE, a MATLAB program which carries out a molecular dynamics simulation; it runs in parallel using MATLAB's "parfor" facility, and includes instructions on how to run the job, via MATLAB's BATCH facility, on a remote system such as Virginia Tech's ITHACA cluster.
PRIME_NUMBER_PARALLEL is a MATLAB program which counts the number of primes between 1 and N; it runs in parallel using MATLAB's "parfor" facility.
PRIME_NUMBER_SPMD is a MATLAB program which counts the number of primes between 1 and N; running in parallel using MATLAB's "SPMD" feature.
QUAD_SPMD is a MATLAB program which estimates an integral using quadrature; running in parallel using MATLAB's "SPMD" feature.
SATISFIABILITY_PARALLEL is a MATLAB program which demonstrates, for a particular circuit, an exhaustive search for solutions of the circuit satisfiability problem, running in parallel using MATLAB's "PARFOR" feature.
TIMING_PARALLEL is a directory of MATLAB programs which illustrates how to time a parallel MATLAB program.
MathWorks documentation for the Parallel Computing Toolbox is available at http://www.mathworks.com/products/parallel-computing/.
You can go up one level to the MATLAB source codes.