Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    $\begingroup$ +1. Also note from the documentation: "DistributeDefinitions applies itself recursively to any symbols appearing in the definitions of the symbols s_i." $\endgroup$ Commented Dec 20, 2013 at 21:21
  • $\begingroup$ I'm not sure the opening sentence is correct, or DistributeDefinitions would be of very-corner-case usefulness only. As a simple counterexample, try BeginPackage["Test`"]; Test`f = Function[x, $KernelID]; EndPackage[]; ParallelTable[f[x], {x, 8}], where the table is obviously returning the f[x] unevaluated for the master kernel to rework. Adding DistributeDefinitions["Test`"] makes the table return a correct list of nonzero IDs. $\endgroup$ Commented Apr 24, 2016 at 18:58
  • $\begingroup$ @EmilioPisanty You know why that is. Describing every corner case is not always the most useful answer to a question. $\endgroup$ Commented Apr 24, 2016 at 19:14
  • 1
    $\begingroup$ @Szabolcs Apologies, I didn't mean to come across anywhere near aggressive. My point was that it would be helpful to add '(excluding functions in packages)', or something similar, just as a note to new users that there are special considerations in place if packages or other contexts are in use. To be frank, though, I still don't fully understand what does and does not get distributed by default by ParallelTable, so I didn't want to jump into the wiki and write something that's wrong. If you feel that it's too much load on an introductory answer, though, that's still fine =). $\endgroup$ Commented Apr 24, 2016 at 19:23