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
COLOR_REMOTE is available in a MATLAB version.
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.
CG_DISTRIBUTED, a MATLAB program which implements a version of the NAS CG conjugate gradient benchmark, using distributed memory.
FMINCON_PARALLEL, 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.
LINEAR_SOLVE_DISTRIBUTED, 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_DISTCOMP, a MATLAB program which remotely runs a set of 5 jobs on the Ithaca cluster. These jobs are equivalent to the BIRTHDAY_REMOTE, COLOR_REMOTE, KNAPSACK_REMOTE, LYRICS_REMOTE and MD_REMOTE jobs.
MATLAB_PARALLEL, examples which illustrate "local" parallel programming on a single computer with MATLAB's Parallel Computing Toolbox.
MATLAB_REMOTE, examples which illustrate the use of remote job execution, in which a desktop copy of MATLAB sends programs and data to a remote machine for execution. Included is information needed to properly configure the local machine.
The User's Guide for the Parallel Computing Toolbox is available at http://www.mathworks.com/access/helpdesk/help/pdf_doc/distcomp/distcomp.pdf
You can go up one level to the MATLAB source codes.