fdtd-cuda-openmp-backend
Table of Contents
OpenMP backend (2D FDTD)
The OpenMP backend distributes spatial field updates across CPU threads. Its first optimization level shares rows between threads while keeping the magnetic and electric phases ordered:
for (std::size_t n = 0; n < advance.nsteps; ++n) { #pragma omp for schedule(static) for (std::size_t j = 0; j < rows; ++j) { stepper.h_phase(j, n); } #pragma omp for schedule(static) for (std::size_t j = 0; j < rows; ++j) { stepper.e_phase(j, n); } }
This loop runs inside one parallel region. Each omp for ends with an implicit barrier, so the electric phase reads completed magnetic values.
v2 adds SIMD inside row updates. v3 reuses one coefficient tuple when the interior is uniform. v4 changes the sweep to thread-owned bands, bringing magnetic and electric work closer together. Compare these levels with the same grid and thread count; the versions change execution strategy while retaining the numerical model.
Source: fdtd_tmz_backend_omp_v1.cpp.
fdtd-cuda-openmp-backend.md · Last modified: by 127.0.0.1
