Commit 3775e64
committed
Cap pytest-xdist's auto worker count to the container CPU limit
`auto` prefers psutil.cpu_count(), which reports the machine's cores and sees
neither a cpuset nor a CFS quota, so on an 8 vCPU OSDC pod it created 64 workers
and got test-arm-backend-no-driver OOMKilled.
pytest-parallelism.sh exports PYTEST_XDIST_AUTO_NUM_WORKERS, which xdist checks
ahead of psutil, set to the smaller of the cgroup CPU quota and nproc. nproc is
what pytorch relies on for OMP_NUM_THREADS on the same fleet
(.ci/pytorch/test.sh, USE_ARC block), whose comment says ARC pods carry a real
cpuset; the quota covers the case where the limit is expressed that way
instead, as pytorch documents for their nested-container ROCm fleet. Taking the
smaller needs no assumption about which is in play, and both fall back to the
machine count off OSDC, so this is a no-op elsewhere.
Sourced from the three scripts that run pytest with `auto`. pytorch avoids the
problem differently, by never using `auto` -- NUM_PROCS in
tools/testing/test_selections.py is a hardcoded 1-3.
Authored with Claude Code.1 parent 6706cc5 commit 3775e64
4 files changed
Lines changed: 49 additions & 0 deletions
File tree
- .ci/scripts
- backends/arm/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
0 commit comments