Repository navigation
feat: add opt-in numerical CPU thread budgets for submissions - #1
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sherlock flagged jobs whose Boltz workers started far more compute threads than the job's CPUs (one report: 52 threads on a small CPU request). This adds an opt-in, per-task numerical thread default to
shk submit:--cpu-thread-budget [N](N defaults to 1 and must be 1 through--cpus) or the project keycpu_thread_budget; an explicit CLI value overrides the configured one.env NAME=VALUE ... sbatch ..., so the values are set on the sbatch process and reach the job through the existing--export=ALL. The job script stays byte-identical; the remotesubmit.shandpreflight.shalready run"$@", so no remote program changes.OMP_NUM_THREADS,OMP_THREAD_LIMIT,MKL_NUM_THREADS,OPENBLAS_NUM_THREADS,BLIS_NUM_THREADS,VECLIB_MAXIMUM_THREADS,NUMEXPR_NUM_THREADS,NUMEXPR_MAX_THREADSset to N, plusOMP_MAX_ACTIVE_LEVELS=1,OMP_DYNAMIC=FALSE,MKL_DYNAMIC=FALSE, each also asAPPTAINERENV_andSINGULARITYENV_for clean-environment containers. Apptainer only warns when the two prefixed forms differ, so identical values stay silent.cpu_thread_policy(mode, budget per task, environment, enforcement scope).This is a launch-environment default, not an OS-thread limit or a cgroup guarantee;
docs/cpu-threads.mdstates the limits (PyTorch inter-op threads, DataLoader workers and runtime setters remain the application's job).Commits:
feat: add opt-in numerical CPU thread budgets for submissions(the original change, rebased onto78bb33b; it was already running from the dotfiles submodule checkout on lab-ubuntu).fix: name both sources in the CPU thread budget error: a configured budget above--cpusused to blame the flag the user did not pass.docs: list the CPU thread budget in the README: config table row (unknown keys are errors, so the key must be documented), submit synopsis and docs list.test: refuse a configured budget above --cpus: covers the config-only path the review found untested.Review notes
src/orbin/assumesargv[0] == "sbatch"; argv is only forwarded (submit.sh,preflight.sh,control.py) or printed (dry-run). No code reads the staged spec JSON back.argv[0] == "sbatch"must accept theenvprefix before enabling the option; the doc says so.--cpuis no longer an unambiguous abbreviation of--cpus(argparseallow_abbrev); there is no CLI switch to turn a configured budget off, only an explicit lower N.__version__stays 0.5.0 and CHANGELOG is untouched:test_release_metadata.test_one_versionpins the first CHANGELOG heading to__version__, so the entry belongs to the release commit that bumps the version.Test plan
pre-commit run --all-filesSHK_REQUIRE_ALL=1 python3 -B tests/run_suite.pywithSHK_BUILD_PYTHONon Python 3.14 and 3.11, in a temporary HOME. Onlytest_executor.RealOpenSshTests.test_inaccessible_control_path_is_local_denialfails, and it fails the same way onmainon this workstation (environment-specific, OpenSSH 9.6p1).