Record `joblib.cpu_count()` in the Modal stage runner's CPU report

オープン 初心者向け
#1,721 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
tooling

調査の方向性

_cpu_visibility() を tools/modal_us_stage.py で確認するところから始め、その結果がステージのレシートの runner 配下のどこに配置されるかを追ってください。この関数が Modal コンテナ内で実行されるのか、ホスト上で実行されるのかを確認してください。それによって joblib がそこでインポート可能か、またどの数を報告するかが決まります。完了の条件は、各ステージのレシートの runner ブロックに joblib.cpu_count() が含まれていることです。これは、3つのビルドステージのいずれかを4 CPU の制限下で実行し、レシートを読んで検証します。

索引モデルが issue の本文から書いたものです。

説明

_cpu_visibility() in tools/modal_us_stage.py records the CPUs a container shows to tools that size their thread pools: os.cpu_count(), the CPU affinity mask and the *_NUM_THREADS variables. Each stage receipt stores these under runner. Neither os.cpu_count() nor the affinity mask reflects a cgroup CPU quota.

Since #1684, when POPULACE_FIT_PREDICT_WORKERS is unset, QRF prediction threads default to joblib.cpu_count(), and fit jobs (n_jobs=-1) resolve to the same count. That count is the smallest of the CPU count, the affinity mask, the cgroup quota (cpu.max or cpu.cfs_quota_us) and LOKY_MAX_CPU_COUNT. No Modal stage records it. The stages run tools/build_us_puf_support_base.py, tools/build_us_acs_multispine_base.py and tools/build_us_acs_local_release.py, and none of them writes the pool builder's audit_thread_controls. So it isn't known what joblib.cpu_count() returns inside a Modal container with a 4-CPU limit.

Proposed change: add joblib.cpu_count() to _cpu_visibility(), so each stage receipt records the thread count QRF fitting and prediction will use. Check that joblib can be imported where _cpu_visibility() runs.

Raised in review of #1684.

主要言語
Python
スター
0
フォーク
6
平均マージ
1日 17時間
マージ済み PR(30日)
190

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PolicyEngine/microcosm のほかの issue

PolicyEngine/microcosm の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。