Skip to content

Add the Base/SharedMemory tutorial - #184

Merged
WeiqunZhang merged 1 commit into
AMReX-Codes:mainfrom
WeiqunZhang:shared-memory
Nov 4, 2026
Merged

WeiqunZhang merged 1 commit into
AMReX-Codes:mainfrom
WeiqunZhang:shared-memory

Conversation

@WeiqunZhang

Copy link
Copy Markdown
Member

Bin the cells by one field and sum a signed integer field over each bin, with ParallelFor and global Long atomics, and with a hand-written kernel launched by amrex::launch that keeps private int sums per thread block in shared memory (CUDA/HIP and SYCL bodies), with a separate CPU path using private sums per OpenMP thread. Long atomics are compare-and-swap loops on CUDA and HIP, which makes the contended global version slow. The results are compared and timed with BL_PROFILE.

Bin the cells by one field and sum a signed integer field over each
bin, with ParallelFor and global Long atomics, and with a hand-written
kernel launched by amrex::launch that keeps private int sums per
thread block in shared memory (CUDA/HIP and SYCL bodies), with a
separate CPU path using private sums per OpenMP thread. Atomic adds
to the same global address are serialized, so the global version slows
down as the bins get fewer. The results are compared and timed with
BL_PROFILE.
@WeiqunZhang
WeiqunZhang merged commit adb6a5f into AMReX-Codes:main Nov 4, 2026
19 checks passed
@WeiqunZhang
WeiqunZhang deleted the shared-memory branch November 4, 2026 21:19
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.

1 participant