Basic Examples (2)
Run an evaluation in a separate kernel:
Compare to the current kernel:
Supply a head to be applied to the results of a local evaluation:
Options (14)
IncludeDefinitions (2)
By default, definitions are included:
Do not include any definitions in the evaluation:
ReturnDefinitions (3)
By default, definitions created on the subkernel are not returned to the current kernel session:
Return dependent definitions to the parent kernel for the output expression:
Now the definition of g is returned from the subkernel:
Only the definitions that the output depends on will be returned:
Since the output does not depend on f, its definition is not returned to the current session:
Compare to g, which appears in the output literally:
Initialization (2)
Specify an initialization that should evaluate first:
The initialization only runs on the other kernel; the current kernel is not affected:
Create a temporary init.m file and back up the original:
Using Automatic for Initialization is equivalent to using Get[FindFile["init.m"]]:
The symbol h is undefined otherwise:
Restore the original init.m file:
Method (5)
Create a large packed array of integers:
Pass a Method specification to the WXF serialization when sending expressions between kernels:
Use a smaller type to reduce transfer time:
By default, the smallest type that fits the data will be used:
Compare the size difference by using BinarySerialize:
Asynchronous (2)
By default, LocalEvaluate waits for results to be returned:
Set Asynchronous to True if you don't need to wait for results:
This is effectively equivalent to LocalSubmit when no definitions or initialization specifications are involved:
Applications (3)
Discover symbols in a package without loading it in the current kernel:
The current kernel is unaffected:
Check how many symbols have been created in your current session that are not created by default:
Manipulate notebooks with a hidden front end:
Properties and Relations (3)
Each evaluation of LocalEvaluate runs in a new kernel:
Compare to the current kernel:
Similar behavior to LocalEvaluate can be obtained by using TaskWait with LocalSubmit:
LocalEvaluate can often have better performance than LocalSubmit when sending/receiving large amounts of data: