Documentation

poolStartup

File for user-defined options to run on each worker when parallel pool starts

Syntax

poolStartup

Description

poolStartup runs automatically on a worker each time the worker forms part of a parallel pool. You do not call this function from the client session, nor explicitly as part of a task function.

You add MATLAB code to the poolStartup.m file to define pool initialization on the worker. The worker looks for poolStartup.m in the following order, executing the one it finds first:

  1. Included in the job's AttachedFiles property.

  2. In a folder included in the job's AdditionalPaths property.

  3. In the worker's MATLAB® installation at the location

    matlabroot/toolbox/distcomp/user/poolStartup.m
    

To create a version of poolStartup.m for AttachedFiles or AdditionalPaths, copy the provided file and modify it as required. .

poolStartup is the ideal location for startup code required for parallel execution on the parallel pool. For example, you might want to include code for using mpiSettings. Because jobStartup and taskStartup execute before poolStartup, they are not suited to pool-specific code. In other words, you should use taskStartup for setup code on your worker regardless of whether the task is from an independent job, communicating job, or using a parallel pool; while poolStartup is for setup code for pool usage only.

For further details on poolStartup and its implementation, see the text in the installed poolStartup.m file.

Was this topic helpful?