Skip to content

Prevent accidental increase of the thread count inside a parallel region - #5949

Open
martin-frbg wants to merge 1 commit into
OpenMathLib:developfrom
martin-frbg:issue5947
Open

Prevent accidental increase of the thread count inside a parallel region#5949
martin-frbg wants to merge 1 commit into
OpenMathLib:developfrom
martin-frbg:issue5947

Conversation

@martin-frbg

Copy link
Copy Markdown
Collaborator

fixes #5947

@martin-frbg martin-frbg added this to the 0.3.35 milestone Jul 28, 2026
@lindsayad lindsayad mentioned this pull request Jul 28, 2026
@lindsayad

Copy link
Copy Markdown
Contributor

I added a test case in #5950 that would hopefully catch a future regression in case you wanted to port something like it over to this PR

@martin-frbg

Copy link
Copy Markdown
Collaborator Author

Thanks - now you've got me worrying if my patch could be too simple. But as far as I'm aware, trying to run more than one thread when already inside a parallel region is invoking undefined behavior at least with older OpenMP versions (and I think even with the latest one). And the openblas_num_threads_local is unfinished and unrelated to OpenMP.

@lindsayad

lindsayad commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

I don't think nested parallel regions (at least with the current standard) is undefined behavior. If it was then the omp_set_max_active_levels API doesn't make much sense https://www.openmp.org/spec-html/5.0/openmpsu125.html

@lindsayad

Copy link
Copy Markdown
Contributor

This is a pretty important issue for us. We can't update to PETSc main in MOOSE right now because both MUMPS and strumpack call dgemm in threaded regions and so in our threaded testing we just get hangs. I could revert the OpenBLAS version update in PETSc, but I'd prefer not to do that if we think we can get movement on this in not too much time

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.

OpenMP build deadlocks when an explicit OpenBLAS thread count is used inside a non-nested OpenMP region

2 participants