ParallelSubmit

ParallelSubmit[expr]

submits expr for evaluation on the next available parallel kernel and returns an EvaluationObject expression representing the submitted evaluation.

ParallelSubmit[{var1,var2, },expr]

builds a closure for the variables given before submitting expr.

Details and Options

Examples

open allclose all

Basic Examples  (3)

Schedule a range of evaluations concurrently:

Start the calculations and wait for all results:

Functions used need to be distributed first:

Scope  (3)

Use Table to submit evaluations:

Use a function to generate evaluations:

Schedule the same expression on each available kernel:

Applications  (4)

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

Watch the scheduling of the evaluations while they are running:

Stop all evaluations as soon as one result has been found using a shared variable:

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

Use ParallelCombine for the same purpose:

Submit evaluations for searching adjacent ranges:

Use Parallelize for the same purpose:

Properties & Relations  (2)

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

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

Scheduling larger evaluations first usually leads to better load balancing:

Possible Issues  (3)

ParallelSubmit does not evaluate its arguments on the master kernel:

Use a closure to insert the values of local variables into the expressions to be evaluated:

Use With to insert the values of local variables:

Side effects are local to each evaluation:

Use a shared variable to support global side effects:

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:

Neat Examples  (2)

Parallelize a functional operation by functional composition with ParallelSubmit:

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

Introduced in 2008
 (7.0)