Main Content

Broadcast Variables

A broadcast variable is any variable, other than the loop variable or a sliced variable, that does not change inside the loop. At the start of a parfor-loop, the values of any broadcast variables are sent to all workers. This type of variable can be useful or even essential for particular tasks. However, large broadcast variables can cause significant communication between client and workers and increase parallel overhead. Sometimes it is more efficient to use temporary variables for this purpose, creating and assigning them inside the loop.

For more details, see Temporary Variables and Deciding When to Use parfor.

Related Topics