Record `joblib.cpu_count()` in the Modal stage runner's CPU report
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start at _cpu_visibility() in tools/modal_us_stage.py and follow where its result is placed under runner in the stage receipt. Confirm whether that function executes inside the Modal container or on the host, since that decides whether joblib is importable there and what count it reports. Done means each stage receipt's runner block carries joblib.cpu_count(), verified by running one of the three build stages under a 4-CPU limit and reading the receipt.
Written by the indexing model from the issue text.
Description
_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.
- Dominant language
- Python
- Stars
- 0
- Forks
- 6
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 190
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PolicyEngine/microcosm
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
PolicyEngine/microcosm#1766 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
PolicyEngine/microcosm#1701 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PolicyEngine/microcosm#1638 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
PolicyEngine/microcosm#1431 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PolicyEngine/microcosm#1220 ·
Maintainers usually reply within 1 day
All issues in PolicyEngine/microcosm
Similar issues
-
claude-subscription-directsdk: tool calls with raw control characters in string values are droppedOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NousResearch/hermes-official-plugins#538 ·
Maintainers usually reply within 3 days
-
bug(qdiffusion): EnergyModel.score_visible_logits computes biased visible/hidden on-ratios when solver returns variable solution counts per candidatePossibly taken @houzhongyu claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
qboson/kaiwu-pytorch-plugin#2133 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MakazhanAlpamys/Soup#3415 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days