Fix spurious "Nested loops over ThisThreadPool" error - #2557
Merged
Conversation
tapios
force-pushed
the
ts/race-fix
branch
2 times, most recently
from
July 28, 2026 22:01
ee71a71 to
15810d2
Compare
dennisYatunin
approved these changes
Jul 28, 2026
…s per launch; reduces launch latency 54x - Cache GPU reduction intermediate arrays in task-local storage to avoid allocations.
tapios
enabled auto-merge
July 29, 2026 06:18
Documenter deploys with `git push --force-with-lease`, so a run whose clone of `gh-pages` is stale by the time it pushes fails with "cannot lock ref 'refs/heads/gh-pages'". Two overlapping docbuilds of the same ref race each other this way. docs.yml was the only workflow without a concurrency group; add the one the other workflows use, so a new run supersedes an in-progress one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
jl_in_threaded_regionis a process-global flag, butparallelize_over(f, ::ThisThreadPool)read it twice. If an unrelated task entered a threaded region between the two reads, the first read said "not in a region" and the second said "in a region", leading to an error without actual nesting.This affects any code that broadcasts
Fields from several concurrent tasks. Theplane/inertial_gravity_waveexample does that viaThreadsX.mapreduce, and fails intermittently (PR #2556, build 7117).CPU Multithreading & Scope Fixes
resolved_scope, and thread rank comes from task-local storage (:climacore_pool_threads) rather than global state.ThisThreadPool()calls now resolve properly. Pool threads are spawned explicitly into:defaultwith@spawn :default(protecting against execution inside:interactivetasks), and parallel worker errors are collected and thrown viaCompositeException.GPU Performance Optimizations (
ClimaCoreCUDAExt)MAX_THREADS_PER_BLOCK,WARP_SIZE,SM_COUNT, etc.) to eliminate repeated C driver calls (cuDeviceGetAttribute) on every launch. Reduces host-side broadcast launch latency by ~54x (from ~477 μs down to ~8.8 μs per launch on an A100).CUDA.launch_configuration) in anIdDictto eliminate repeated C driver occupancy calculations (cuOccupancyMaxPotentialBlockSize) on every broadcast and reduction launch. Saves an additional ~2 μs of host CPU launch overhead per kernel call (~4.2% faster reductions).reduce_pointsare cached in task-local storage to avoid allocating device memory (similar) during repeated scalar reductions.32) to prevent warp divergence.CI & Workflow Improvements
concurrencygroup (documentation-deploy) to.github/workflows/docs.ymlto queue documentation preview deployments sequentially, preventing git--force-with-leaserejections (! [rejected] HEAD -> gh-pages (stale info)) when multiple CI jobs run concurrently.