User`s guide
6 Programming Overview
6-34
C:\TEMP\MDCE\Checkpoint\nodeA52_worker22_mlworker_log\work
Writing to Files from Workers
When multiple workers attempt to write to the same file, you might end up with a race
condition, clash, or one worker might overwrite the data from another worker. This
might be likely to occur when:
• There is more than one worker per machine, and they attempt to write to the same
file.
• The workers have a shared file system, and use the same path to identify a file for
writing.
In some cases an error can result, but sometimes the overwriting can occur without error.
To avoid an issue, be sure that each worker or parfor iteration has unique access to any
files it writes or saves data to. There is no problem when multiple workers read from the
same file.
Saving or Sending Objects
Do not use the save or load function on Parallel Computing Toolbox objects. Some of
the information that these objects require is stored in the MATLAB session persistent
memory and would not be saved to a file.
Similarly, you cannot send a parallel computing object between parallel computing
processes by means of an object's properties. For example, you cannot pass an MJS, job,
task, or worker object to MATLAB workers as part of a job's JobData property.
Also, system objects (e.g., Java classes, .NET classes, shared libraries, etc.) that are
loaded, imported, or added to the Java search path in the MATLAB client, are not
available on the workers unless explicitly loaded, imported, or added on the workers,
respectively. Other than in the task function code, typical ways of loading these objects
might be in taskStartup, jobStartup, and in the case of workers in a parallel pool, in
poolStartup and using pctRunOnAll.
Using clear functions
Executing
clear functions