Understanding `CmdStanModel` Behavior with `os.fork`
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
まず、CmdStanModel.sample、cpp_options={"STAN_THREADS": True}、およびレポートに示されている os.fork パスの相互作用から始めます。最小限の実行可能な例で2つのケースを再現し、その後 fork 後のチェーンのスケジューリングを比較します。差異が説明され、必要な動作またはドキュメントの変更が回帰テストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I've run into a somewhat odd (and likely edge-case) situation where CmdStanModel.sample behaves unexpectedly after a call to os.fork. I'm providing pseudocode now in the hopes that there is a fairly simple explanation, but happy to make a minimum working example if need be.
Say I run something structured like the following:
import os
from cmdstanpy import CmdStanModel
def run_job():
# Compile the model
mod = CmdStanModel(stanfile, cpp_options={"STAN_THREADS": True})
# Run sampling on a detached child process
pid = os.fork()
if pid == 0:
os.setsid()
mod.sample(data = data, chains=4)
os._exit()
else:
return pid
Even though my CPU has 32 cores, this will only run two chains at once--specifically, Chains 1 and 3 run, then Chains 2 and 4 run. If, however, I remove the cpp_options={"STAN_THREADS": True} kwarg, then everything behaves as expected: all chains sample in parallel.
Is there any immediate explanation for this discrepancy in behavior?
- 主要言語
- Python
- スター
- 198
- フォーク
- 82
- 平均マージ
- 6日 15時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stan-dev/cmdstanpy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
laplace_sample: expose CmdStan's diagnostic_file (the Hessian at the mode)対応中かも @atarutin が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
-
log_prob leaves a temporary output directory per call until interpreter exit対応中かも @atarutin が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 22/100
-
Release 2.0オープン
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
stan-dev/cmdstanpy の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
awslabs/visual-asset-management-system#414 ·
メンテナーはふだん 1 日以内に返信
-
bug v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
modelcontextprotocol/python-sdk#3670 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aicell-lab/bioengine#232 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
modelscope/evalscope#1836 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100