is the default value of the DistributedContexts option of functions such as ParallelTable and ParallelMap.
$DistributedContexts
is the default value of the DistributedContexts option of functions such as ParallelTable and ParallelMap.
Details
- Before a parallel computation, definitions of symbols to be evaluated in a parallel kernel will automatically be distributed to all kernels, provided these symbols belong to a context given in the DistributedContexts option.
- The initial value is $DistributedContexts:=$Context, which distributes definitions of all symbols in the current context, but does not distribute definitions of symbols from packages.
Examples
open all close allBasic Examples (1)
Scope (5)
By default, definitions in the current context are distributed automatically:
remote[x_] := {$KernelID, x ^ 3}ParallelTable[remote[i], {i, 4}]Do not distribute any definitions:
$DistributedContexts = None;local[x_] := {$KernelID, x ^ 2}ParallelTable[local[i], {i, 4}]Distribute definitions for all symbols in all contexts appearing in a parallel computation:
$DistributedContexts = Automatic;a`k := $KernelID
b`k := -$KernelIDParallelTable[{a`k, b`k}, {4}]Distribute only definitions in the given contexts:
$DistributedContexts = "a`";a`m := $KernelID
b`m := -$KernelIDParallelTable[{a`m, b`m}, {4}]$DistributedContexts := $ContextProperties & Relations (1)
Find all parallel functions that currently use $DistributedContexts:
Select[Names["System`Parallel*"], MemberQ[Options[Symbol[#]], DistributedContexts :> $DistributedContexts]&]Possible Issues (1)
The value of $DistributedContexts is not used in Parallelize:
$DistributedContexts = None;local1[x_] := {$KernelID, x ^ 2}Parallelize[Table[local1[i], {i, 4}]]Set the value of the DistributedContexts option of Parallelize:
SetOptions[Parallelize, DistributedContexts -> None]local2[x_] := {$KernelID, x ^ 3}Parallelize[Table[local2[i], {i, 4}]]Restore all settings to their default values:
$DistributedContexts := $ContextSetOptions[Parallelize, DistributedContexts :> $Context]Related Workflows
- Run a Parallel Computation
History
Text
Wolfram Research (2010), $DistributedContexts, Wolfram Language function, https://reference.wolfram.com/language/ref/$DistributedContexts.html.
CMS
Wolfram Language. 2010. "$DistributedContexts." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$DistributedContexts.html.
APA
Wolfram Language. (2010). $DistributedContexts. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$DistributedContexts.html
BibTeX
@misc{reference.wolfram_2026_$distributedcontexts, author="Wolfram Research", title="{$DistributedContexts}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/$DistributedContexts.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_$distributedcontexts, organization={Wolfram Research}, title={$DistributedContexts}, year={2010}, url={https://reference.wolfram.com/language/ref/$DistributedContexts.html}, note=[Accessed: 13-June-2026]}