ParallelTable,ParallelMap等の関数のDistributedContextsオプションのデフォルト値である.
$DistributedContexts
ParallelTable,ParallelMap等の関数のDistributedContextsオプションのデフォルト値である.
詳細
- 並列計算の前に,並列カーネルで評価されるシンボルの定義は,このシンボルがDistributedContextsオプション中のコンテキストに属している場合は,自動的にすべてのカーネルに分配される.
- 初期値は$DistributedContexts:=$Contextで,これは現行コンテキスト中の全シンボルの定義を分配するが,パッケージからのシンボルの定義は分配しない.
例題
すべて開く すべて閉じる例 (1)
スコープ (5)
remote[x_] := {$KernelID, x ^ 3}ParallelTable[remote[i], {i, 4}]$DistributedContexts = None;local[x_] := {$KernelID, x ^ 2}ParallelTable[local[i], {i, 4}]並列計算に現れるすべてのコンテキストの全シンボルの定義を配布する:
$DistributedContexts = Automatic;a`k := $KernelID
b`k := -$KernelIDParallelTable[{a`k, b`k}, {4}]$DistributedContexts = "a`";a`m := $KernelID
b`m := -$KernelIDParallelTable[{a`m, b`m}, {4}]$DistributedContexts := $Context特性と関係 (1)
$DistributedContextsを現在使用しているすべての並列関数を求める:
Select[Names["System`Parallel*"], MemberQ[Options[Symbol[#]], DistributedContexts :> $DistributedContexts]&]考えられる問題 (1)
$DistributedContextsの値はParallelizeでは使われない:
$DistributedContexts = None;local1[x_] := {$KernelID, x ^ 2}Parallelize[Table[local1[i], {i, 4}]]ParallelizeのDistributedContextsオプションの値を設定する:
SetOptions[Parallelize, DistributedContexts -> None]local2[x_] := {$KernelID, x ^ 3}Parallelize[Table[local2[i], {i, 4}]]$DistributedContexts := $ContextSetOptions[Parallelize, DistributedContexts :> $Context]関連するワークフロー
- 並列計算を実行する
テキスト
Wolfram Research (2010), $DistributedContexts, Wolfram言語関数, https://reference.wolfram.com/language/ref/$DistributedContexts.html.
CMS
Wolfram Language. 2010. "$DistributedContexts." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$DistributedContexts.html.
APA
Wolfram Language. (2010). $DistributedContexts. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$DistributedContexts.html
BibTeX
@misc{reference.wolfram_2026_$distributedcontexts, author="Wolfram Research", title="{$DistributedContexts}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/$DistributedContexts.html}", note=[Accessed: 13-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_$distributedcontexts, organization={Wolfram Research}, title={$DistributedContexts}, year={2010}, url={https://reference.wolfram.com/language/ref/$DistributedContexts.html}, note=[Accessed: 13-August-2026]}