diff options
author | 2020-04-03 14:11:26 -0700 | |
---|---|---|
committer | 2020-04-03 14:11:26 -0700 | |
commit | 91207e475660b4d88700d932d7334b18e5397804 (patch) | |
tree | 83ba709697956a257d3a56401ff7e6f68c4c8c38 /Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp | |
parent | de2071e04be17ea47e46a0a1e7c1f28b308b43e5 (diff) | |
download | WarpX-91207e475660b4d88700d932d7334b18e5397804.tar.gz WarpX-91207e475660b4d88700d932d7334b18e5397804.tar.zst WarpX-91207e475660b4d88700d932d7334b18e5397804.zip |
Avoid i%1 in a lambda, gives compiler segfault (#892)
* avoid i%1 in a lambda, gives compiler segfault
* add 1 comment
* Update Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp
* explicit capture by value
* Update Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp
Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja>
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to '')
-rw-r--r-- | Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp index caa352b42..68bc95f53 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp @@ -406,13 +406,18 @@ SpectralFieldData::BackwardTransform( MultiFab& mf, #if (AMREX_SPACEDIM == 3) int const nz = realspace_bx.length(2); #else - int const nz = 1; + int constexpr nz = 1; #endif - ParallelFor( mfi.validbox(), - [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - // Copy and normalize field - mf_arr(i,j,k,i_comp) = inv_N*tmp_arr(i%nx,j%ny,k%nz); - }); + ParallelFor( + mfi.validbox(), + /* GCC 8.1-8.2 work-around (ICE): + * named capture in nonexcept lambda needed for modulo operands + * https://godbolt.org/z/ppbAzd + */ + [mf_arr, i_comp, inv_N, tmp_arr, nx, ny, nz] + AMREX_GPU_DEVICE (int i, int j, int k) noexcept { + mf_arr(i,j,k,i_comp) = inv_N*tmp_arr(i%nx, j%ny, k%nz); + }); } else { ParallelFor( mfi.validbox(), [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { |