Some spelunking of DistributeDefinitions shows that all contexts listed in Parallel`Protected`$ExcludedContexts are by default excluded from being distributed. In particular, Parallel`Protected`DistDefs has the line
updates = ExtendedFullDefinition[expr, "ExcludedContexts"->$ExcludedContexts]
So to make sure that new definitions of symbols in System` are also distributed you can use something like
CircleDot[___]:=1;
Block[
{ParallelProtected$ExcludedContexts=
DeleteCases[ParallelProtected$ExcludedContexts,"System`*"]},
DistributeDefinitions[CircleDot];
];
ParallelEvaluate[Print @ DownValues @ CircleDot];
{HoldPattern[CircleDot[___]]:>1}
{HoldPattern[CircleDot[___]]:>1}
{HoldPattern[CircleDot[___]]:>1}
{HoldPattern[CircleDot[___]]:>1}
This way we also only distribute new definitions for CircleDot and nothing else in System`.
Regarding the comment of @thorimur: you do not get the full definition of CircleDot from
Language`ExtendedFullDefinition, as the default option "ExcludedContexts"->Automatic seems to filter System` as well.
So by setting this option yourself you can also see the full definition
Language`ExtendedFullDefinition[CircleDot, "ExcludedContexts" -> {}]
LanguageDefinitionList[HoldForm[CircleDot] -> {OwnValues -> {}, SubValues -> {}, UpValues -> {}, DownValues -> {HoldPattern[CircleDot[___]] :> 1}, NValues -> {}, FormatValues -> {}, DefaultValues -> {}, Messages -> {}, Attributes -> {}}, HoldForm[BlankNullSequence] -> {OwnValues -> {}, SubValues -> {}, UpValues -> {}, DownValues -> {}, NValues -> {}, FormatValues -> {}, DefaultValues -> {}, Messages -> {}, Attributes -> {Protected}}, HoldForm[Rule] -> {OwnValues -> {}, SubValues -> {}, UpValues -> {}, DownValues -> {}, NValues -> {}, FormatValues -> {}, DefaultValues -> {}, Messages -> {HoldPattern[Rule::rhs] -> "Pattern1appears on the right-hand side of rule2`."},
Attributes -> {Protected, SequenceHold}}, HoldForm[List] -> {OwnValues -> {}, SubValues -> {}, UpValues -> {}, DownValues -> {},
NValues -> {}, FormatValues -> {}, DefaultValues -> {}, Messages -> {}, Attributes -> {Locked, Protected}}]
$DistributedContexts. This is however in this case not desirable, as far as I can tell, as we don't want to let the whole ofSystem`distribute. Is there a way to haveDistributeDefinitionswork on a specific function inSystem`? The solution given in the linked post,DistributeDefinitions[const`precisionRate], doesn't seem to work in this case:DistributeDefinitions[System`CircleDot]doesn't do what it should – glS Sep 14 '21 at 19:41$DistributedContextsglobally, but to change theDistributedContextsoption of value in a singleDistributeDefinitionscall when distributingCircleDot. However, I just tried this and it does not work. It seems there is a hard limitation on System symbols. I am not surprised, as distributing the wrong ones could cause trouble, andDistributeDefinitionsdoes indeed distribute dependent symbols recursively. – Szabolcs Sep 14 '21 at 19:58ParallelEvaluate:ParallelEvaluate[CircleDot[___]:=1]. A better solution is to put theCircleDotdefinition into a package (eventually you'll end up doing this anyway) and load that package usingParallelNeeds. – Szabolcs Sep 14 '21 at 19:59Language\ExtendedFullDefinition[System`CircleDot]is an empty definition list, even after being defined. In contrast,Definition[CircleDot]andInformation[CircleDot, "Definitions"]` shows the user definition. Thought i'd mention it. – thorimur Sep 14 '21 at 22:24Language`ExtendedFullDefinition[CircleDot, "ExcludedContexts" -> {}](see my answer below) – Hausdorff Nov 26 '21 at 14:30