Commit 29d4f58
committed
Constrain native math library threading to fix XGBoost stalling in containers
Found the actual difference between "works locally, hangs on the
Space": locally numpy uses Apple's Accelerate framework, unaffected by
OMP_NUM_THREADS; on Linux it uses OpenBLAS, governed by its own
OPENBLAS_NUM_THREADS. Neither our env-var setup nor the fitted
XGBClassifier's n_jobs=None was actually constraining thread count on
Linux, so a single prediction could spawn as many native threads as
the *host* reports — potentially far more than a cgroup-limited
container's actual CPU quota, which starves/stalls the process.
- config.py now also sets OPENBLAS_NUM_THREADS, MKL_NUM_THREADS,
NUMEXPR_NUM_THREADS, VECLIB_MAXIMUM_THREADS, BLIS_NUM_THREADS.
- These only take effect if set before the native libraries are first
loaded, so reordered imports in protac_splitter.py and the app
script to import protac_splitter.config before pandas/rdkit/datasets
(and, in the app, before gradio, which pulls those in transitively).
- GraphEdgeClassifier.load() now forces the fitted classifier's
n_jobs to 1 explicitly, since that default is baked into the
pickled model at training time and env vars alone don't override
XGBoost's own internal thread pool.1 parent 4e8bf19 commit 29d4f58
4 files changed
Lines changed: 40 additions & 10 deletions
File tree
- protac_splitter
- graphs
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
12 | 23 | | |
13 | 24 | | |
14 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
141 | 150 | | |
142 | 151 | | |
143 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
8 | 15 | | |
9 | 16 | | |
10 | 17 | | |
11 | 18 | | |
12 | | - | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
0 commit comments