Skip to content

Add max_default_jobs to bound the default number of jobs - #210

Open
maleadt wants to merge 2 commits into
mainfrom
tb/max-default-jobs
Open

maleadt wants to merge 2 commits into
mainfrom
tb/max-default-jobs

Conversation

@maleadt

@maleadt maleadt commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Adds a max_default_jobs keyword to runtests that bounds the default number of jobs, for resources PTR doesn't account for itself, such as GPU memory shared by all workers.

Precedence is --jobs > PTR_NUM_JOBS > min(default_njobs(; memory_per_worker), max_default_jobs), so explicit settings still bypass it, like memory_per_worker. Invalid values (non-integer, Bool, < 1) throw an ArgumentError.

CUDA.jl currently caps the job count by free GPU memory by rebuilding ParsedArgs with the positional constructor, which broke in 2.9.2 when skippassed was added. With this keyword it can pass the cap directly and stop depending on the struct layout.

The default job count only accounts for CPU threads and host memory.
Callers whose workers share another limited resource, such as GPU
memory, had no way to express it short of forcing the count with
--jobs, which bypasses the memory check, or rebuilding ParsedArgs.

max_default_jobs caps the automatic default and, like memory_per_worker,
is ignored when --jobs or PTR_NUM_JOBS is set.
@giordano

giordano commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

CUDA.jl currently caps the job count by free GPU memory by rebuilding ParsedArgs with the positional constructor, which broke in 2.9.2 when skippassed was added. With this keyword it can pass the cap directly and stop depending on the struct layout.

Just realised this broke Oceananigans too...

@christiangnrd

christiangnrd commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

I think this should be in default_njobs. I opened #212 on this branch to show what I mean

@christiangnrd
christiangnrd added this pull request to stack #213 October 7, 2026 17:34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants