User`s guide
Share Code with the Workers
7-19
manually attached files to determine which code files are necessary for the workers,
and to automatically send those files to the workers. You can set this property value
in a cluster profile using the Profile Manager, or you can set it programmatically on a
job object at the command line.
c = parcluster();
j = createJob(c);
j.AutoAttachFiles = true;
The supported code file formats for automatic attachment are MATLAB files (.m
extension), P-code files (.p), and MEX-files (.mex). Note that AutoAttachFiles
does not include data files for your job; use the AttachedFiles property to explicitly
transfer these files to the workers.
Use listAutoAttachedFiles to get a listing of the code files that are automatically
attached to a job.
If the AutoAttachFiles setting is true for the cluster profile used when starting a
parallel pool, MATLAB performs an analysis on spmd blocks, parfor-loops, and other
attached files to determine what other code files are necessary for execution, then
automatically attaches those files to the parallel pool so that the code is available to
the workers.
Note There is a default maximum amount of data that can be sent in a single call for
setting properties. This limit applies to the OutputArguments property as well as to
data passed into a job as input arguments or AttachedFiles. If the limit is exceeded,
you get an error message. For more information about this data transfer size limit, see
“Object Data Size Limitations” on page 6-52.
Pass MATLAB Code for Startup and Finish
As a session of MATLAB, a worker session executes its startup.m file each time it
starts. You can place the startup.m file in any folder on the worker’s MATLAB search
path, such as toolbox/distcomp/user.
These additional files can initialize and clean up a worker session as it begins or
completes evaluations of tasks for a job:
• jobStartup.m automatically executes on a worker when the worker runs its first
task of a job.