DistributeDefinitions
✖
DistributeDefinitions
distributes all definitions for the symbols si to all parallel kernels.
distributes definitions for all symbols in the specified context.
Details and Options

- DistributeDefinitions in effect applies ParallelEvaluate to all assignments for values and attributes with the symbols si, including not only ownvalues but also downvalues, upvalues, and other types of values.
- DistributeDefinitions applies itself recursively to any symbols appearing in the definitions of the symbols si.
- DistributeDefinitions has attribute HoldAll.
- DistributeDefinitions in effect "registers" the definitions for the symbols si so that they are automatically distributed to every new parallel kernel that may be launched.
- DistributeDefinitions[expr] for an arbitrary expression expr distributes definitions for all symbols appearing in expr.
- DistributeDefinitions returns the list of symbols actually distributed, wrapped in HoldForm.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Make sure parallel subkernels are launched:

https://wolfram.com/xid/0ywcyke13mvv-dg597x

Values used in subkernels need to be distributed first:

https://wolfram.com/xid/0ywcyke13mvv-togezt

https://wolfram.com/xid/0ywcyke13mvv-67rnpr


https://wolfram.com/xid/0ywcyke13mvv-8dlpvg


https://wolfram.com/xid/0ywcyke13mvv-34wzh1


https://wolfram.com/xid/0ywcyke13mvv-9nscsp


https://wolfram.com/xid/0ywcyke13mvv-bl79s8

Symbols in the default context are distributed automatically:

https://wolfram.com/xid/0ywcyke13mvv-4gcet2

https://wolfram.com/xid/0ywcyke13mvv-1kaiat


https://wolfram.com/xid/0ywcyke13mvv-psjh47

Scope (5)Survey of the scope of standard use cases

https://wolfram.com/xid/0ywcyke13mvv-df0g0b


https://wolfram.com/xid/0ywcyke13mvv-l3wsvc


https://wolfram.com/xid/0ywcyke13mvv-d7ue94


https://wolfram.com/xid/0ywcyke13mvv-h7us4d


https://wolfram.com/xid/0ywcyke13mvv-gr67vo


https://wolfram.com/xid/0ywcyke13mvv-e0r5ql


https://wolfram.com/xid/0ywcyke13mvv-koy3av



https://wolfram.com/xid/0ywcyke13mvv-b9ertw


Distribute definitions for all symbols in the current context:

https://wolfram.com/xid/0ywcyke13mvv-cqbsr0

https://wolfram.com/xid/0ywcyke13mvv-jb7xtb

https://wolfram.com/xid/0ywcyke13mvv-mmrsyr

Generalizations & Extensions (1)Generalized and extended use cases
Properties & Relations (7)Properties of the function, and connections to other functions
DistributeDefinitions overwrites any previous values and attributes present:

https://wolfram.com/xid/0ywcyke13mvv-if6w0j

https://wolfram.com/xid/0ywcyke13mvv-d7mtqa


https://wolfram.com/xid/0ywcyke13mvv-ij0v0o


https://wolfram.com/xid/0ywcyke13mvv-dnvnx5

Remove a distributed definition by clearing the function and distributing it again:

https://wolfram.com/xid/0ywcyke13mvv-c39pnn

https://wolfram.com/xid/0ywcyke13mvv-ic6pr4


https://wolfram.com/xid/0ywcyke13mvv-ck7l6p

https://wolfram.com/xid/0ywcyke13mvv-d7sjof

DistributeDefinitions uses ParallelEvaluate to transport definitions to all kernels:

https://wolfram.com/xid/0ywcyke13mvv-ihim4b

https://wolfram.com/xid/0ywcyke13mvv-fem2ri
An explicit ParallelEvaluate does the same:

https://wolfram.com/xid/0ywcyke13mvv-dsbeg3

https://wolfram.com/xid/0ywcyke13mvv-i058rf

Distributed definitions are remembered for new kernels; the effect of ParallelEvaluate is not:

https://wolfram.com/xid/0ywcyke13mvv-isia9p

https://wolfram.com/xid/0ywcyke13mvv-4qizn0

For higher-level parallel commands, functions defined interactively are automatically distributed:

https://wolfram.com/xid/0ywcyke13mvv-ysr612

https://wolfram.com/xid/0ywcyke13mvv-9aj3zp

Distribute definitions manually and disable automatic distribution:

https://wolfram.com/xid/0ywcyke13mvv-4luuf0

https://wolfram.com/xid/0ywcyke13mvv-x3m4oa

https://wolfram.com/xid/0ywcyke13mvv-psl1j3

Symbols that have values only on the subkernels are not distributed:

https://wolfram.com/xid/0ywcyke13mvv-xkmwfl


https://wolfram.com/xid/0ywcyke13mvv-rx629v

The values on the subkernels remain intact:

https://wolfram.com/xid/0ywcyke13mvv-rmii90

As soon as a symbol gets a local value, it will be distributed with the next parallel computation:

https://wolfram.com/xid/0ywcyke13mvv-3qxcj3

https://wolfram.com/xid/0ywcyke13mvv-jldjxw

Use ParallelNeeds to set up a package on all parallel kernels:

https://wolfram.com/xid/0ywcyke13mvv-2kei3n

https://wolfram.com/xid/0ywcyke13mvv-7d45ja

Use DistributeDefinitions to set up your own definitions:

https://wolfram.com/xid/0ywcyke13mvv-k8c35n

https://wolfram.com/xid/0ywcyke13mvv-nja01t

https://wolfram.com/xid/0ywcyke13mvv-smlbwz

$DistributedDefinitions gives the list of all symbols whose definitions have been distributed:

https://wolfram.com/xid/0ywcyke13mvv-xvu3y0

https://wolfram.com/xid/0ywcyke13mvv-5528z8


https://wolfram.com/xid/0ywcyke13mvv-46p9qk

The list also includes symbols that were distributed automatically:

https://wolfram.com/xid/0ywcyke13mvv-ye6uwv


https://wolfram.com/xid/0ywcyke13mvv-58y2rg

Possible Issues (5)Common pitfalls and unexpected behavior
A function used that is not known on the parallel kernels may lead to sequential evaluation:

https://wolfram.com/xid/0ywcyke13mvv-dodxy4

https://wolfram.com/xid/0ywcyke13mvv-phgfup

Define the function on all parallel kernels:

https://wolfram.com/xid/0ywcyke13mvv-m3hzn
The function is now evaluated on the parallel kernels:

https://wolfram.com/xid/0ywcyke13mvv-yvw9xg

The use of DistributeDefinitions does not suppress automatic distribution of definitions:

https://wolfram.com/xid/0ywcyke13mvv-o49jku

https://wolfram.com/xid/0ywcyke13mvv-075yth
The modified definition is automatically distributed:

https://wolfram.com/xid/0ywcyke13mvv-0ourt9

Suppress the automatic distribution of definitions:

https://wolfram.com/xid/0ywcyke13mvv-m9tayr

https://wolfram.com/xid/0ywcyke13mvv-btegrb

https://wolfram.com/xid/0ywcyke13mvv-i4ig5d

Symbols defined only on the subkernels are not distributed automatically:

https://wolfram.com/xid/0ywcyke13mvv-84gy2v

https://wolfram.com/xid/0ywcyke13mvv-079c11

Certain objects with an internal state may not work efficiently when distributed:

https://wolfram.com/xid/0ywcyke13mvv-7epxav


https://wolfram.com/xid/0ywcyke13mvv-po8o2v


https://wolfram.com/xid/0ywcyke13mvv-o6fkpd

https://wolfram.com/xid/0ywcyke13mvv-9dajxy

Recompute such objects on all subkernels for better performance:

https://wolfram.com/xid/0ywcyke13mvv-0rht5y


https://wolfram.com/xid/0ywcyke13mvv-myuyx7

https://wolfram.com/xid/0ywcyke13mvv-26mfae

Alternatively, reevaluate the data on all subkernels:

https://wolfram.com/xid/0ywcyke13mvv-tsex7q


https://wolfram.com/xid/0ywcyke13mvv-x97zbf

https://wolfram.com/xid/0ywcyke13mvv-4boyvy

Definitions of symbols with the ReadProtected attribute cannot be distributed:

https://wolfram.com/xid/0ywcyke13mvv-09l9t7

https://wolfram.com/xid/0ywcyke13mvv-8eiid0


https://wolfram.com/xid/0ywcyke13mvv-8vjjg7

Definitions are only distributed as needed; if a definition has not changed, it is not distributed again:

https://wolfram.com/xid/0ywcyke13mvv-i0oz96

https://wolfram.com/xid/0ywcyke13mvv-11odgj


https://wolfram.com/xid/0ywcyke13mvv-d8xkxd

https://wolfram.com/xid/0ywcyke13mvv-gad3z

Both symbols are still distributed:

https://wolfram.com/xid/0ywcyke13mvv-q2xd0l

Wolfram Research (2008), DistributeDefinitions, Wolfram Language function, https://reference.wolfram.com/language/ref/DistributeDefinitions.html (updated 2010).
Text
Wolfram Research (2008), DistributeDefinitions, Wolfram Language function, https://reference.wolfram.com/language/ref/DistributeDefinitions.html (updated 2010).
Wolfram Research (2008), DistributeDefinitions, Wolfram Language function, https://reference.wolfram.com/language/ref/DistributeDefinitions.html (updated 2010).
CMS
Wolfram Language. 2008. "DistributeDefinitions." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2010. https://reference.wolfram.com/language/ref/DistributeDefinitions.html.
Wolfram Language. 2008. "DistributeDefinitions." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2010. https://reference.wolfram.com/language/ref/DistributeDefinitions.html.
APA
Wolfram Language. (2008). DistributeDefinitions. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DistributeDefinitions.html
Wolfram Language. (2008). DistributeDefinitions. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DistributeDefinitions.html
BibTeX
@misc{reference.wolfram_2025_distributedefinitions, author="Wolfram Research", title="{DistributeDefinitions}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/DistributeDefinitions.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_distributedefinitions, organization={Wolfram Research}, title={DistributeDefinitions}, year={2010}, url={https://reference.wolfram.com/language/ref/DistributeDefinitions.html}, note=[Accessed: 29-March-2025
]}