ClearDistributedDefinitions[s1,s2,…]
clears all previously distributed definitions of symbols si on all parallel kernels.
clears all previously distributed definitions of all symbols.
ClearDistributedDefinitions
ClearDistributedDefinitions[s1,s2,…]
clears all previously distributed definitions of symbols si on all parallel kernels.
clears all previously distributed definitions of all symbols.
Details
- ClearDistributedDefinitions[{s1,s2,…}] is equivalent to ClearDistributedDefinitions[s1,s2,…].
- ClearDistributedDefinitions clears all definitions made on parallel subkernels as a result of DistributeDefinitions or automatic distribution of definitions.
- Definitions on the master kernel are not cleared.
- ClearDistributedDefinitions has attribute HoldAll.
Examples
open all close allBasic Examples (1)
Disable the automatic distribution of definitions:
$DistributedContexts = None;Distribute the definition of a function:
f[x_] := {x, $KernelID}DistributeDefinitions[f]Use the function on the parallel subkernels:
ParallelEvaluate[f[$KernelID]]The symbol f appears in the list of all distributed symbols:
$DistributedDefinitionsClear the distributed definitions:
ClearDistributedDefinitions[]The function is no longer known on the subkernels; it is evaluated only after being returned:
ParallelEvaluate[f[$KernelID]]The symbol f no longer appears in the list of all distributed symbols:
$DistributedDefinitionsScope (1)
Make various types of definitions for a set of symbols:
f[x_] := {x, $KernelID}
s := $KernelID
g/:h[_g] := {g}
SetAttributes[h, HoldFirst]Distribute the definitions to all parallel subkernels:
DistributeDefinitions[f, s, g, h]All symbols appear in the list of distributed symbols:
$DistributedDefinitionsClear the distributed definitions of the symbol f:
ClearDistributedDefinitions[f]//OutputFormf no longer appears in the list of distributed symbols:
$DistributedDefinitionsClear the distributed definitions of several symbols:
ClearDistributedDefinitions[g, h]Clear the distributed definitions of all remaining symbols:
ClearDistributedDefinitions[]There are no symbols with distributed definitions left:
$DistributedDefinitionsPossible Issues (3)
By default, symbols in the current context are automatically distributed:
mat = RandomInteger[{0, 9}, {2, 2}]ParallelEvaluate[Inverse[mat]]$DistributedDefinitionsClearing the distributed definitions may seem to work:
ClearDistributedDefinitions[mat]$DistributedDefinitionsAs soon as mat is used again in a parallel computation, its definition will be distributed automatically again:
ParallelEvaluate[Inverse[mat]]$DistributedDefinitionsDisable automatic distribution of definitions if you wish to control distribution of definitions manually:
$DistributedContexts = None;a = 42;The definition of a has not been distributed to parallel subkernels:
ParallelEvaluate[Head[a]]$DistributedDefinitionsDistribute the definition of a manually:
DistributeDefinitions[a]ParallelEvaluate[Head[a]]$DistributedDefinitionsHistory
Text
Wolfram Research (2024), ClearDistributedDefinitions, Wolfram Language function, https://reference.wolfram.com/language/ref/ClearDistributedDefinitions.html.
CMS
Wolfram Language. 2024. "ClearDistributedDefinitions." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ClearDistributedDefinitions.html.
APA
Wolfram Language. (2024). ClearDistributedDefinitions. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ClearDistributedDefinitions.html
BibTeX
@misc{reference.wolfram_2026_cleardistributeddefinitions, author="Wolfram Research", title="{ClearDistributedDefinitions}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/ClearDistributedDefinitions.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_cleardistributeddefinitions, organization={Wolfram Research}, title={ClearDistributedDefinitions}, year={2024}, url={https://reference.wolfram.com/language/ref/ClearDistributedDefinitions.html}, note=[Accessed: 12-June-2026]}