Skip to Main Content Skip to Search
Product Documentation

dfevalasync - Evaluate function asynchronously using cluster

Syntax

Job = dfevalasync(F, numArgOut, x1,...,xn, 'P1',V1,'P2',V2,...)
Job = dfevalasync(F, numArgOut, x1,...,xn, ... 'configuration', 'ConfigurationName',...)

Arguments

Job

Job object created to evaluation the function.

F

Function name, function handle, or cell array of function names or handles.

numArgOut

Number of output arguments from each task's execution of function F.

x1, ..., xn

Cell arrays of input arguments to the functions.

'P1', V1, 'P2', V2,...

Property name/property value pairs for the created job object; can be name/value pairs or structures.

Description

Job = dfevalasync(F, numArgOut, x1,...,xn, 'P1',V1,'P2',V2,...) is equivalent to dfeval, except that it runs asynchronously (async), returning to the prompt immediately with a single output argument containing the job object that it has created and sent to the cluster. You have immediate access to the job object before the job is completed. You can use waitForState to determine when the job is completed, and getAllOutputArguments to retrieve your results.

Job = dfevalasync(F, numArgOut, x1,...,xn, ... 'configuration', 'ConfigurationName',...) evaluates the function F in a cluster by using all the properties defined in the configuration ConfigurationName. The configuration settings are used to find and initialize a scheduler, create a job, and create tasks. For details about defining and applying configurations, see Cluster Profiles. Configurations enable you to use dfevalasync with any type of scheduler.

For further discussion on the usage of dfevalasync, see Evaluate Functions Asynchronously.

Examples

Execute a sum function distributed in three tasks.

job = dfevalasync(@sum,1,{[1,2],[3,4],[5,6]}, ...
        'jobmanager','MyJobManager');

When the job is finished, you can obtain the results associated with the job.

waitForState(job);
data = getAllOutputArguments(job)
data = 
    [ 3]
    [ 7]
    [11]

data is an M-by-numArgOut cell array, where M is the number of tasks.

See Also

dfeval | feval | getAllOutputArguments | waitForState

  


Free Parallel Computing Interactive Kit

See how to solve large problems with minimal effort and reduce simulation time.

Get free kit

Trials Available

Try the latest versions of parallel computing products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS