# Thread affinity (2D FDTD) **Thread affinity** controls where OpenMP threads run. FDTD CUDA's team helper selects explicit binding when the variant requests it: ```cpp 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: ```bash $ 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](https://github.com/yanevskiv/fdtd-cuda/blob/main/include/fdtd/TMz/backends/omp/fdtd_tmz_backend_omp_team.h).