fdtd-cuda-thread-affinity
Table of Contents
Thread affinity (2D FDTD)
Thread affinity controls where OpenMP threads run. FDTD CUDA's team helper selects explicit binding when the variant requests it:
if (bind == OmpBind::Close) { #pragma omp parallel num_threads(threads) proc_bind(close) { body(); } } else if (bind == OmpBind::Spread) { #pragma omp parallel num_threads(threads) proc_bind(spread) { body(); } }
The +close and +spread variant suffixes select these branches. For example:
$ OMP_PLACES=cores build/out/debug/fdtd \ --nx 512 --ny 512 --steps 400 \ --backend openmp --variant v4+spread
OMP_PLACES defines the available processor locations. Close binding favors nearby places; spread partitions them more widely. Without a suffix, the backend leaves binding to runtime configuration. Compare policies under the same workload: placement can affect shared caches and memory access, but neither policy guarantees a speedup.
Source: fdtd_tmz_backend_omp_team.h.
fdtd-cuda-thread-affinity.md · Last modified: by 127.0.0.1
