WaitAll

WaitAll[expr]

waits for all concurrent evaluations represented by EvaluationObject expressions in expr to finish, then returns the resulting expression obtained.

Details

Examples

open allclose all

Basic Examples  (4)

Wait for a single evaluation:

Waiting evaluations are scheduled concurrently on any available parallel kernel:

Wait for all evaluations contained in a sum:

Functions used need to be distributed first:

Scope  (4)

Wait for a single evaluation:

Wait for a number of evaluations in a list:

Wait for evaluations contained in an arbitrarily nested structure:

Wait for evaluations contained in an arbitrary arithmetic expression:

Applications  (4)

Run a search for a random prime on each parallel kernel:

Watch the scheduling of the evaluations while they are running:

Write a command that evaluates the arguments of a list in parallel:

Watch the scheduling of evaluations taking vastly varying amounts of time:

Find such that is prime, scheduling one search loop for each kernel:

Run them until manually aborted:

Properties & Relations  (4)

Evaluate an expression on any parallel kernel:

ParallelEvaluate does the same:

The "FinestGrained" Method setting schedules each item as a single evaluation:

Internally it works similarly to WaitAll[ParallelSubmit[]]:

Parallelize at the innermost level of a multidimensional table:

Scheduled evaluations no longer needed can be aborted with AbortKernels:

Define a number of tasks with varying runtimes:

Measure the time for parallel execution:

Scheduling larger tasks first improves load balancing:

Possible Issues  (2)

Each evaluation should be waited for exactly once:

The evaluation object has already been completed:

There is a considerable overhead for scheduling trivial calculations:

The overhead is smaller for generating fewer, but larger, evaluation units:

A sequential evaluation avoids all communication overhead:

Introduced in 2008
 (7.0)