LCOV - code coverage report
Current view: top level - ext/amrex/3d-coverage-g++-24.08/include - AMReX_GpuLaunchFunctsC.H (source / functions) Hit Total Coverage
Test: coverage_merged.info Lines: 9 9 100.0 %
Date: 2024-11-18 05:28:54 Functions: 126 642 19.6 %

          Line data    Source code
       1             : #ifndef AMREX_GPU_LAUNCH_FUNCTS_C_H_
       2             : #define AMREX_GPU_LAUNCH_FUNCTS_C_H_
       3             : #include <AMReX_Config.H>
       4             : 
       5             : namespace amrex {
       6             : 
       7             : namespace detail {
       8             :     template <typename F, typename N>
       9             :     AMREX_GPU_DEVICE
      10             :     auto call_f (F const& f, N i)
      11             :         noexcept -> decltype(f(0))
      12             :     {
      13             :         f(i);
      14             :     }
      15             : 
      16             :     template <typename F, typename N>
      17             :     AMREX_GPU_DEVICE
      18             :     auto call_f (F const& f, N i)
      19             :         noexcept -> decltype(f(0,Gpu::Handler{}))
      20             :     {
      21             :         f(i,Gpu::Handler{});
      22             :     }
      23             : 
      24             :     template <typename F>
      25             :     AMREX_GPU_DEVICE
      26    37891502 :     auto call_f (F const& f, int i, int j, int k)
      27             :         noexcept -> decltype(f(0,0,0))
      28             :     {
      29    37891502 :         f(i,j,k);
      30    37891502 :     }
      31             : 
      32             :     template <typename F>
      33             :     AMREX_GPU_DEVICE
      34             :     auto call_f (F const& f, int i, int j, int k)
      35             :         noexcept -> decltype(f(0,0,0,Gpu::Handler{}))
      36             :     {
      37             :         f(i,j,k,Gpu::Handler{});
      38             :     }
      39             : 
      40             :     template <typename F, typename T>
      41             :     AMREX_GPU_DEVICE
      42             :     auto call_f (F const& f, int i, int j, int k, T n)
      43             :         noexcept -> decltype(f(0,0,0,0))
      44             :     {
      45             :         f(i,j,k,n);
      46             :     }
      47             : 
      48             :     template <typename F, typename T>
      49             :     AMREX_GPU_DEVICE
      50             :     auto call_f (F const& f, int i, int j, int k, T n)
      51             :         noexcept -> decltype(f(0,0,0,0,Gpu::Handler{}))
      52             :     {
      53             :         f(i,j,k,n,Gpu::Handler{});
      54             :     }
      55             : }
      56             : 
      57             : template<typename T, typename L>
      58             : void launch (T const& n, L&& f) noexcept
      59             : {
      60             :     std::forward<L>(f)(n);
      61             : }
      62             : 
      63             : template<int MT, typename T, typename L>
      64             : void launch (T const& n, L&& f) noexcept
      65             : {
      66             :     amrex::ignore_unused(MT);
      67             :     std::forward<L>(f)(n);
      68             : }
      69             : 
      70             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
      71             : AMREX_ATTRIBUTE_FLATTEN_FOR
      72             : void For (T n, L const& f) noexcept
      73             : {
      74             :     for (T i = 0; i < n; ++i) {
      75             :         detail::call_f(f,i);
      76             :     }
      77             : }
      78             : 
      79             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
      80             : void For (T n, L&& f) noexcept
      81             : {
      82             :     amrex::ignore_unused(MT);
      83             :     For(n, std::forward<L>(f));
      84             : }
      85             : 
      86             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
      87             : void For (Gpu::KernelInfo const&, T n, L&& f) noexcept
      88             : {
      89             :     For(n, std::forward<L>(f));
      90             : }
      91             : 
      92             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
      93             : void For (Gpu::KernelInfo const&, T n, L&& f) noexcept
      94             : {
      95             :     amrex::ignore_unused(MT);
      96             :     For(n, std::forward<L>(f));
      97             : }
      98             : 
      99             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     100             : AMREX_ATTRIBUTE_FLATTEN_FOR
     101             : void ParallelFor (T n, L const& f) noexcept
     102             : {
     103             :     AMREX_PRAGMA_SIMD
     104             :     for (T i = 0; i < n; ++i) {
     105             :         detail::call_f(f,i);
     106             :     }
     107             : }
     108             : 
     109             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     110             : void ParallelFor (T n, L&& f) noexcept
     111             : {
     112             :     amrex::ignore_unused(MT);
     113             :     ParallelFor(n, std::forward<L>(f));
     114             : }
     115             : 
     116             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     117             : void ParallelFor (Gpu::KernelInfo const&, T n, L&& f) noexcept
     118             : {
     119             :     ParallelFor(n, std::forward<L>(f));
     120             : }
     121             : 
     122             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     123             : void ParallelFor (Gpu::KernelInfo const&, T n, L&& f) noexcept
     124             : {
     125             :     amrex::ignore_unused(MT);
     126             :     ParallelFor(n, std::forward<L>(f));
     127             : }
     128             : 
     129             : template <typename L>
     130             : AMREX_ATTRIBUTE_FLATTEN_FOR
     131             : void For (Box const& box, L const& f) noexcept
     132             : {
     133             :     const auto lo = amrex::lbound(box);
     134             :     const auto hi = amrex::ubound(box);
     135             :     for (int k = lo.z; k <= hi.z; ++k) {
     136             :     for (int j = lo.y; j <= hi.y; ++j) {
     137             :     for (int i = lo.x; i <= hi.x; ++i) {
     138             :         detail::call_f(f,i,j,k);
     139             :     }}}
     140             : }
     141             : 
     142             : template <int MT, typename L>
     143             : void For (Box const& box, L&& f) noexcept
     144             : {
     145             :     amrex::ignore_unused(MT);
     146             :     For(box, std::forward<L>(f));
     147             : }
     148             : 
     149             : template <typename L>
     150             : void For (Gpu::KernelInfo const&, Box const& box, L&& f) noexcept
     151             : {
     152             :     For(box, std::forward<L>(f));
     153             : }
     154             : 
     155             : template <int MT, typename L>
     156             : void For (Gpu::KernelInfo const&, Box const& box, L&& f) noexcept
     157             : {
     158             :     amrex::ignore_unused(MT);
     159             :     For(box, std::forward<L>(f));
     160             : }
     161             : 
     162             : template <typename L>
     163             : AMREX_ATTRIBUTE_FLATTEN_FOR
     164      705801 : void ParallelFor (Box const& box, L const& f) noexcept
     165             : {
     166             :     const auto lo = amrex::lbound(box);
     167             :     const auto hi = amrex::ubound(box);
     168     3034923 :     for (int k = lo.z; k <= hi.z; ++k) {
     169    10698132 :     for (int j = lo.y; j <= hi.y; ++j) {
     170             :     AMREX_PRAGMA_SIMD
     171    46260470 :     for (int i = lo.x; i <= hi.x; ++i) {
     172    37891502 :         detail::call_f(f,i,j,k);
     173             :     }}}
     174      705801 : }
     175             : 
     176             : template <int MT, typename L>
     177             : void ParallelFor (Box const& box, L&& f) noexcept
     178             : {
     179             :     amrex::ignore_unused(MT);
     180             :     ParallelFor(box, std::forward<L>(f));
     181             : }
     182             : 
     183             : template <typename L>
     184             : void ParallelFor (Gpu::KernelInfo const&, Box const& box, L&& f) noexcept
     185             : {
     186             :     ParallelFor(box, std::forward<L>(f));
     187             : }
     188             : 
     189             : template <int MT, typename L>
     190             : void ParallelFor (Gpu::KernelInfo const&, Box const& box, L&& f) noexcept
     191             : {
     192             :     amrex::ignore_unused(MT);
     193             :     ParallelFor(box, std::forward<L>(f));
     194             : }
     195             : 
     196             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     197             : AMREX_ATTRIBUTE_FLATTEN_FOR
     198             : void For (Box const& box, T ncomp, L const& f) noexcept
     199             : {
     200             :     const auto lo = amrex::lbound(box);
     201             :     const auto hi = amrex::ubound(box);
     202             :     for (T n = 0; n < ncomp; ++n) {
     203             :         for (int k = lo.z; k <= hi.z; ++k) {
     204             :         for (int j = lo.y; j <= hi.y; ++j) {
     205             :         for (int i = lo.x; i <= hi.x; ++i) {
     206             :             detail::call_f(f,i,j,k,n);
     207             :         }}}
     208             :     }
     209             : }
     210             : 
     211             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     212             : void For (Box const& box, T ncomp, L&& f) noexcept
     213             : {
     214             :     amrex::ignore_unused(MT);
     215             :     For(box, ncomp, std::forward<L>(f));
     216             : }
     217             : 
     218             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     219             : void For (Gpu::KernelInfo const&, Box const& box, T ncomp, L&& f) noexcept
     220             : {
     221             :     For(box, ncomp, std::forward<L>(f));
     222             : }
     223             : 
     224             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     225             : void For (Gpu::KernelInfo const&, Box const& box, T ncomp, L&& f) noexcept
     226             : {
     227             :     amrex::ignore_unused(MT);
     228             :     For(box, ncomp, std::forward<L>(f));
     229             : }
     230             : 
     231             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     232             : AMREX_ATTRIBUTE_FLATTEN_FOR
     233             : void ParallelFor (Box const& box, T ncomp, L const& f) noexcept
     234             : {
     235             :     const auto lo = amrex::lbound(box);
     236             :     const auto hi = amrex::ubound(box);
     237             :     for (T n = 0; n < ncomp; ++n) {
     238             :         for (int k = lo.z; k <= hi.z; ++k) {
     239             :         for (int j = lo.y; j <= hi.y; ++j) {
     240             :         AMREX_PRAGMA_SIMD
     241             :         for (int i = lo.x; i <= hi.x; ++i) {
     242             :             detail::call_f(f,i,j,k,n);
     243             :         }}}
     244             :     }
     245             : }
     246             : 
     247             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     248             : void ParallelFor (Box const& box, T ncomp, L&& f) noexcept
     249             : {
     250             :     amrex::ignore_unused(MT);
     251             :     ParallelFor(box, ncomp, std::forward<L>(f));
     252             : }
     253             : 
     254             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     255             : void ParallelFor (Gpu::KernelInfo const&, Box const& box, T ncomp, L&& f) noexcept
     256             : {
     257             :     ParallelFor(box, ncomp, std::forward<L>(f));
     258             : }
     259             : 
     260             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     261             : void ParallelFor (Gpu::KernelInfo const&, Box const& box, T ncomp, L&& f) noexcept
     262             : {
     263             :     amrex::ignore_unused(MT);
     264             :     ParallelFor(box, ncomp, std::forward<L>(f));
     265             : }
     266             : 
     267             : template <typename L1, typename L2>
     268             : void For (Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     269             : {
     270             :     For(box1, std::forward<L1>(f1));
     271             :     For(box2, std::forward<L2>(f2));
     272             : }
     273             : 
     274             : template <int MT, typename L1, typename L2>
     275             : void For (Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     276             : {
     277             :     amrex::ignore_unused(MT);
     278             :     For(box1, std::forward<L1>(f1));
     279             :     For(box2, std::forward<L2>(f2));
     280             : }
     281             : 
     282             : template <typename L1, typename L2>
     283             : void For (Gpu::KernelInfo const&, Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     284             : {
     285             :     For (box1, box2, std::forward<L1>(f1), std::forward<L2>(f2));
     286             : }
     287             : 
     288             : template <int MT, typename L1, typename L2>
     289             : void For (Gpu::KernelInfo const&, Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     290             : {
     291             :     amrex::ignore_unused(MT);
     292             :     For (box1, box2, std::forward<L1>(f1), std::forward<L2>(f2));
     293             : }
     294             : 
     295             : template <typename L1, typename L2, typename L3>
     296             : void For (Box const& box1, Box const& box2, Box const& box3, L1&& f1, L2&& f2, L3&& f3) noexcept
     297             : {
     298             :     For(box1, std::forward<L1>(f1));
     299             :     For(box2, std::forward<L2>(f2));
     300             :     For(box3, std::forward<L3>(f3));
     301             : }
     302             : 
     303             : template <int MT, typename L1, typename L2, typename L3>
     304             : void For (Box const& box1, Box const& box2, Box const& box3, L1&& f1, L2&& f2, L3&& f3) noexcept
     305             : {
     306             :     amrex::ignore_unused(MT);
     307             :     For(box1, std::forward<L1>(f1));
     308             :     For(box2, std::forward<L2>(f2));
     309             :     For(box3, std::forward<L3>(f3));
     310             : }
     311             : 
     312             : template <typename L1, typename L2, typename L3>
     313             : void For (Gpu::KernelInfo const&, Box const& box1, Box const& box2, Box const& box3, L1&& f1, L2&& f2, L3&& f3) noexcept
     314             : {
     315             :     For(box1, box2, box3, std::forward<L1>(f1), std::forward<L2>(f2), std::forward<L3>(f3));
     316             : }
     317             : 
     318             : template <int MT, typename L1, typename L2, typename L3>
     319             : void For (Gpu::KernelInfo const&, Box const& box1, Box const& box2, Box const& box3, L1&& f1, L2&& f2, L3&& f3) noexcept
     320             : {
     321             :     amrex::ignore_unused(MT);
     322             :     For(box1, box2, box3, std::forward<L1>(f1), std::forward<L2>(f2), std::forward<L3>(f3));
     323             : }
     324             : 
     325             : template <typename T1, typename T2, typename L1, typename L2,
     326             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     327             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     328             : void For (Box const& box1, T1 ncomp1, L1&& f1,
     329             :           Box const& box2, T2 ncomp2, L2&& f2) noexcept
     330             : {
     331             :     For(box1, ncomp1, std::forward<L1>(f1));
     332             :     For(box2, ncomp2, std::forward<L2>(f2));
     333             : }
     334             : 
     335             : template <int MT, typename T1, typename T2, typename L1, typename L2,
     336             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     337             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     338             : void For (Box const& box1, T1 ncomp1, L1&& f1,
     339             :           Box const& box2, T2 ncomp2, L2&& f2) noexcept
     340             : {
     341             :     amrex::ignore_unused(MT);
     342             :     For(box1, ncomp1, std::forward<L1>(f1));
     343             :     For(box2, ncomp2, std::forward<L2>(f2));
     344             : }
     345             : 
     346             : template <typename T1, typename T2, typename L1, typename L2,
     347             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     348             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     349             : void For (Gpu::KernelInfo const&,
     350             :           Box const& box1, T1 ncomp1, L1&& f1,
     351             :           Box const& box2, T2 ncomp2, L2&& f2) noexcept
     352             : {
     353             :     For(box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
     354             : }
     355             : 
     356             : template <int MT, typename T1, typename T2, typename L1, typename L2,
     357             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     358             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     359             : void For (Gpu::KernelInfo const&,
     360             :           Box const& box1, T1 ncomp1, L1&& f1,
     361             :           Box const& box2, T2 ncomp2, L2&& f2) noexcept
     362             : {
     363             :     amrex::ignore_unused(MT);
     364             :     For(box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
     365             : }
     366             : 
     367             : template <typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     368             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     369             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     370             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     371             : void For (Box const& box1, T1 ncomp1, L1&& f1,
     372             :           Box const& box2, T2 ncomp2, L2&& f2,
     373             :           Box const& box3, T3 ncomp3, L3&& f3) noexcept
     374             : {
     375             :     For(box1, ncomp1, std::forward<L1>(f1));
     376             :     For(box2, ncomp2, std::forward<L2>(f2));
     377             :     For(box3, ncomp3, std::forward<L3>(f3));
     378             : }
     379             : 
     380             : template <int MT, typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     381             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     382             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     383             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     384             : void For (Box const& box1, T1 ncomp1, L1&& f1,
     385             :           Box const& box2, T2 ncomp2, L2&& f2,
     386             :           Box const& box3, T3 ncomp3, L3&& f3) noexcept
     387             : {
     388             :     amrex::ignore_unused(MT);
     389             :     For(box1, ncomp1, std::forward<L1>(f1));
     390             :     For(box2, ncomp2, std::forward<L2>(f2));
     391             :     For(box3, ncomp3, std::forward<L3>(f3));
     392             : }
     393             : 
     394             : template <typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     395             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     396             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     397             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     398             : void For (Gpu::KernelInfo const&,
     399             :           Box const& box1, T1 ncomp1, L1&& f1,
     400             :           Box const& box2, T2 ncomp2, L2&& f2,
     401             :           Box const& box3, T3 ncomp3, L3&& f3) noexcept
     402             : {
     403             :     For(box1,ncomp1,std::forward<L1>(f1),
     404             :         box2,ncomp2,std::forward<L2>(f2),
     405             :         box3,ncomp3,std::forward<L3>(f3));
     406             : }
     407             : 
     408             : template <int MT, typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     409             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     410             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     411             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     412             : void For (Gpu::KernelInfo const&,
     413             :           Box const& box1, T1 ncomp1, L1&& f1,
     414             :           Box const& box2, T2 ncomp2, L2&& f2,
     415             :           Box const& box3, T3 ncomp3, L3&& f3) noexcept
     416             : {
     417             :     amrex::ignore_unused(MT);
     418             :     For(box1,ncomp1,std::forward<L1>(f1),
     419             :         box2,ncomp2,std::forward<L2>(f2),
     420             :         box3,ncomp3,std::forward<L3>(f3));
     421             : }
     422             : 
     423             : template <typename L1, typename L2>
     424             : void ParallelFor (Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     425             : {
     426             :     ParallelFor(box1, std::forward<L1>(f1));
     427             :     ParallelFor(box2, std::forward<L2>(f2));
     428             : }
     429             : 
     430             : template <int MT, typename L1, typename L2>
     431             : void ParallelFor (Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     432             : {
     433             :     amrex::ignore_unused(MT);
     434             :     ParallelFor(box1, std::forward<L1>(f1));
     435             :     ParallelFor(box2, std::forward<L2>(f2));
     436             : }
     437             : 
     438             : template <typename L1, typename L2>
     439             : void ParallelFor (Gpu::KernelInfo const&, Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     440             : {
     441             :     ParallelFor(box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
     442             : }
     443             : 
     444             : template <int MT, typename L1, typename L2>
     445             : void ParallelFor (Gpu::KernelInfo const&, Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     446             : {
     447             :     amrex::ignore_unused(MT);
     448             :     ParallelFor(box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
     449             : }
     450             : 
     451             : template <typename L1, typename L2, typename L3>
     452             : void ParallelFor (Box const& box1, Box const& box2, Box const& box3, L1&& f1, L2&& f2, L3&& f3) noexcept
     453             : {
     454             :     ParallelFor(box1, std::forward<L1>(f1));
     455             :     ParallelFor(box2, std::forward<L2>(f2));
     456             :     ParallelFor(box3, std::forward<L3>(f3));
     457             : }
     458             : 
     459             : template <int MT, typename L1, typename L2, typename L3>
     460             : void ParallelFor (Box const& box1, Box const& box2, Box const& box3, L1&& f1, L2&& f2, L3&& f3) noexcept
     461             : {
     462             :     amrex::ignore_unused(MT);
     463             :     ParallelFor(box1, std::forward<L1>(f1));
     464             :     ParallelFor(box2, std::forward<L2>(f2));
     465             :     ParallelFor(box3, std::forward<L3>(f3));
     466             : }
     467             : 
     468             : template <typename L1, typename L2, typename L3>
     469             : void ParallelFor (Gpu::KernelInfo const&, Box const& box1, Box const& box2, Box const& box3, L1&& f1, L2&& f2, L3&& f3) noexcept
     470             : {
     471             :     ParallelFor(box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
     472             : }
     473             : 
     474             : template <int MT, typename L1, typename L2, typename L3>
     475             : void ParallelFor (Gpu::KernelInfo const&, Box const& box1, Box const& box2, Box const& box3, L1&& f1, L2&& f2, L3&& f3) noexcept
     476             : {
     477             :     amrex::ignore_unused(MT);
     478             :     ParallelFor(box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
     479             : }
     480             : 
     481             : template <typename T1, typename T2, typename L1, typename L2,
     482             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     483             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     484             : void ParallelFor (Box const& box1, T1 ncomp1, L1&& f1,
     485             :                   Box const& box2, T2 ncomp2, L2&& f2) noexcept
     486             : {
     487             :     ParallelFor(box1, ncomp1, std::forward<L1>(f1));
     488             :     ParallelFor(box2, ncomp2, std::forward<L2>(f2));
     489             : }
     490             : 
     491             : template <int MT, typename T1, typename T2, typename L1, typename L2,
     492             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     493             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     494             : void ParallelFor (Box const& box1, T1 ncomp1, L1&& f1,
     495             :                   Box const& box2, T2 ncomp2, L2&& f2) noexcept
     496             : {
     497             :     amrex::ignore_unused(MT);
     498             :     ParallelFor(box1, ncomp1, std::forward<L1>(f1));
     499             :     ParallelFor(box2, ncomp2, std::forward<L2>(f2));
     500             : }
     501             : 
     502             : template <typename T1, typename T2, typename L1, typename L2,
     503             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     504             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     505             : void ParallelFor (Gpu::KernelInfo const&,
     506             :                   Box const& box1, T1 ncomp1, L1&& f1,
     507             :                   Box const& box2, T2 ncomp2, L2&& f2) noexcept
     508             : {
     509             :     ParallelFor(box1,ncomp1,std::forward<L1>(f1),
     510             :                 box2,ncomp2,std::forward<L2>(f2));
     511             : }
     512             : 
     513             : template <int MT, typename T1, typename T2, typename L1, typename L2,
     514             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     515             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     516             : void ParallelFor (Gpu::KernelInfo const&,
     517             :                   Box const& box1, T1 ncomp1, L1&& f1,
     518             :                   Box const& box2, T2 ncomp2, L2&& f2) noexcept
     519             : {
     520             :     amrex::ignore_unused(MT);
     521             :     ParallelFor(box1,ncomp1,std::forward<L1>(f1),
     522             :                 box2,ncomp2,std::forward<L2>(f2));
     523             : }
     524             : 
     525             : template <typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     526             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     527             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     528             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     529             : void ParallelFor (Box const& box1, T1 ncomp1, L1&& f1,
     530             :                   Box const& box2, T2 ncomp2, L2&& f2,
     531             :                   Box const& box3, T3 ncomp3, L3&& f3) noexcept
     532             : {
     533             :     ParallelFor(box1, ncomp1, std::forward<L1>(f1));
     534             :     ParallelFor(box2, ncomp2, std::forward<L2>(f2));
     535             :     ParallelFor(box3, ncomp3, std::forward<L3>(f3));
     536             : }
     537             : 
     538             : template <int MT, typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     539             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     540             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     541             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     542             : void ParallelFor (Box const& box1, T1 ncomp1, L1&& f1,
     543             :                   Box const& box2, T2 ncomp2, L2&& f2,
     544             :                   Box const& box3, T3 ncomp3, L3&& f3) noexcept
     545             : {
     546             :     amrex::ignore_unused(MT);
     547             :     ParallelFor(box1, ncomp1, std::forward<L1>(f1));
     548             :     ParallelFor(box2, ncomp2, std::forward<L2>(f2));
     549             :     ParallelFor(box3, ncomp3, std::forward<L3>(f3));
     550             : }
     551             : 
     552             : template <typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     553             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     554             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     555             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     556             : void ParallelFor (Gpu::KernelInfo const&,
     557             :                   Box const& box1, T1 ncomp1, L1&& f1,
     558             :                   Box const& box2, T2 ncomp2, L2&& f2,
     559             :                   Box const& box3, T3 ncomp3, L3&& f3) noexcept
     560             : {
     561             :     ParallelFor(box1, ncomp1, std::forward<L1>(f1),
     562             :                 box2, ncomp2, std::forward<L2>(f2),
     563             :                 box3, ncomp3, std::forward<L3>(f3));
     564             : }
     565             : 
     566             : template <int MT, typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     567             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     568             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     569             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     570             : void ParallelFor (Gpu::KernelInfo const&,
     571             :                   Box const& box1, T1 ncomp1, L1&& f1,
     572             :                   Box const& box2, T2 ncomp2, L2&& f2,
     573             :                   Box const& box3, T3 ncomp3, L3&& f3) noexcept
     574             : {
     575             :     amrex::ignore_unused(MT);
     576             :     ParallelFor(box1, ncomp1, std::forward<L1>(f1),
     577             :                 box2, ncomp2, std::forward<L2>(f2),
     578             :                 box3, ncomp3, std::forward<L3>(f3));
     579             : }
     580             : 
     581             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     582             : void HostDeviceParallelFor (T n, L&& f) noexcept
     583             : {
     584             :     ParallelFor(n,std::forward<L>(f));
     585             : }
     586             : 
     587             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     588             : void HostDeviceParallelFor (T n, L&& f) noexcept
     589             : {
     590             :     amrex::ignore_unused(MT);
     591             :     ParallelFor(n,std::forward<L>(f));
     592             : }
     593             : 
     594             : template <typename L>
     595             : void HostDeviceParallelFor (Box const& box, L&& f) noexcept
     596             : {
     597             :     ParallelFor(box,std::forward<L>(f));
     598             : }
     599             : 
     600             : template <int MT, typename L>
     601             : void HostDeviceParallelFor (Box const& box, L&& f) noexcept
     602             : {
     603             :     amrex::ignore_unused(MT);
     604             :     ParallelFor(box,std::forward<L>(f));
     605             : }
     606             : 
     607             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     608             : void HostDeviceParallelFor (Box const& box, T ncomp, L&& f) noexcept
     609             : {
     610             :     ParallelFor(box,ncomp,std::forward<L>(f));
     611             : }
     612             : 
     613             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     614             : void HostDeviceParallelFor (Box const& box, T ncomp, L&& f) noexcept
     615             : {
     616             :     amrex::ignore_unused(MT);
     617             :     ParallelFor(box,ncomp,std::forward<L>(f));
     618             : }
     619             : 
     620             : template <typename L1, typename L2>
     621             : void HostDeviceParallelFor (Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     622             : {
     623             :     ParallelFor(box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
     624             : }
     625             : 
     626             : template <int MT, typename L1, typename L2>
     627             : void HostDeviceParallelFor (Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     628             : {
     629             :     amrex::ignore_unused(MT);
     630             :     ParallelFor(box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
     631             : }
     632             : 
     633             : template <typename L1, typename L2, typename L3>
     634             : void HostDeviceParallelFor (Box const& box1, Box const& box2, Box const& box3,
     635             :                             L1&& f1, L2&& f2, L3&& f3) noexcept
     636             : {
     637             :     ParallelFor(box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
     638             : }
     639             : 
     640             : template <int MT, typename L1, typename L2, typename L3>
     641             : void HostDeviceParallelFor (Box const& box1, Box const& box2, Box const& box3,
     642             :                             L1&& f1, L2&& f2, L3&& f3) noexcept
     643             : {
     644             :     amrex::ignore_unused(MT);
     645             :     ParallelFor(box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
     646             : }
     647             : 
     648             : template <typename T1, typename T2, typename L1, typename L2,
     649             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     650             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     651             : void HostDeviceParallelFor (Box const& box1, T1 ncomp1, L1&& f1,
     652             :                             Box const& box2, T2 ncomp2, L2&& f2) noexcept
     653             : {
     654             :     ParallelFor(box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
     655             : }
     656             : 
     657             : template <int MT, typename T1, typename T2, typename L1, typename L2,
     658             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     659             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     660             : void HostDeviceParallelFor (Box const& box1, T1 ncomp1, L1&& f1,
     661             :                             Box const& box2, T2 ncomp2, L2&& f2) noexcept
     662             : {
     663             :     amrex::ignore_unused(MT);
     664             :     ParallelFor(box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
     665             : }
     666             : 
     667             : template <typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     668             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     669             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     670             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     671             : void HostDeviceParallelFor (Box const& box1, T1 ncomp1, L1&& f1,
     672             :                             Box const& box2, T2 ncomp2, L2&& f2,
     673             :                             Box const& box3, T3 ncomp3, L3&& f3) noexcept
     674             : {
     675             :     ParallelFor(box1,ncomp1,std::forward<L1>(f1),
     676             :                 box2,ncomp2,std::forward<L2>(f2),
     677             :                 box3,ncomp3,std::forward<L3>(f3));
     678             : }
     679             : 
     680             : template <int MT, typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     681             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     682             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     683             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     684             : void HostDeviceParallelFor (Box const& box1, T1 ncomp1, L1&& f1,
     685             :                             Box const& box2, T2 ncomp2, L2&& f2,
     686             :                             Box const& box3, T3 ncomp3, L3&& f3) noexcept
     687             : {
     688             :     amrex::ignore_unused(MT);
     689             :     ParallelFor(box1,ncomp1,std::forward<L1>(f1),
     690             :                 box2,ncomp2,std::forward<L2>(f2),
     691             :                 box3,ncomp3,std::forward<L3>(f3));
     692             : }
     693             : 
     694             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     695             : void HostDeviceFor (T n, L&& f) noexcept
     696             : {
     697             :     For(n,std::forward<L>(f));
     698             : }
     699             : 
     700             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     701             : void HostDeviceFor (T n, L&& f) noexcept
     702             : {
     703             :     amrex::ignore_unused(MT);
     704             :     For(n,std::forward<L>(f));
     705             : }
     706             : 
     707             : template <typename L>
     708             : void HostDeviceFor (Box const& box, L&& f) noexcept
     709             : {
     710             :     For(box,std::forward<L>(f));
     711             : }
     712             : 
     713             : template <int MT, typename L>
     714             : void HostDeviceFor (Box const& box, L&& f) noexcept
     715             : {
     716             :     amrex::ignore_unused(MT);
     717             :     For(box,std::forward<L>(f));
     718             : }
     719             : 
     720             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     721             : void HostDeviceFor (Box const& box, T ncomp, L&& f) noexcept
     722             : {
     723             :     For(box,ncomp,std::forward<L>(f));
     724             : }
     725             : 
     726             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     727             : void HostDeviceFor (Box const& box, T ncomp, L&& f) noexcept
     728             : {
     729             :     amrex::ignore_unused(MT);
     730             :     For(box,ncomp,std::forward<L>(f));
     731             : }
     732             : 
     733             : template <typename L1, typename L2>
     734             : void HostDeviceFor (Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     735             : {
     736             :     For(box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
     737             : }
     738             : 
     739             : template <int MT, typename L1, typename L2>
     740             : void HostDeviceFor (Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     741             : {
     742             :     amrex::ignore_unused(MT);
     743             :     For(box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
     744             : }
     745             : 
     746             : template <typename L1, typename L2, typename L3>
     747             : void HostDeviceFor (Box const& box1, Box const& box2, Box const& box3,
     748             :                     L1&& f1, L2&& f2, L3&& f3) noexcept
     749             : {
     750             :     For(box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
     751             : }
     752             : 
     753             : template <int MT, typename L1, typename L2, typename L3>
     754             : void HostDeviceFor (Box const& box1, Box const& box2, Box const& box3,
     755             :                     L1&& f1, L2&& f2, L3&& f3) noexcept
     756             : {
     757             :     amrex::ignore_unused(MT);
     758             :     For(box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
     759             : }
     760             : 
     761             : template <typename T1, typename T2, typename L1, typename L2,
     762             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     763             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     764             : void HostDeviceFor (Box const& box1, T1 ncomp1, L1&& f1,
     765             :                     Box const& box2, T2 ncomp2, L2&& f2) noexcept
     766             : {
     767             :     For(box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
     768             : }
     769             : 
     770             : template <int MT, typename T1, typename T2, typename L1, typename L2,
     771             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     772             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     773             : void HostDeviceFor (Box const& box1, T1 ncomp1, L1&& f1,
     774             :                     Box const& box2, T2 ncomp2, L2&& f2) noexcept
     775             : {
     776             :     amrex::ignore_unused(MT);
     777             :     For(box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
     778             : }
     779             : 
     780             : template <typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     781             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     782             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     783             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     784             : void HostDeviceFor (Box const& box1, T1 ncomp1, L1&& f1,
     785             :                     Box const& box2, T2 ncomp2, L2&& f2,
     786             :                     Box const& box3, T3 ncomp3, L3&& f3) noexcept
     787             : {
     788             :     For(box1,ncomp1,std::forward<L1>(f1),
     789             :         box2,ncomp2,std::forward<L2>(f2),
     790             :         box3,ncomp3,std::forward<L3>(f3));
     791             : }
     792             : 
     793             : template <int MT, typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     794             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     795             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     796             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     797             : void HostDeviceFor (Box const& box1, T1 ncomp1, L1&& f1,
     798             :                     Box const& box2, T2 ncomp2, L2&& f2,
     799             :                     Box const& box3, T3 ncomp3, L3&& f3) noexcept
     800             : {
     801             :     amrex::ignore_unused(MT);
     802             :     For(box1,ncomp1,std::forward<L1>(f1),
     803             :         box2,ncomp2,std::forward<L2>(f2),
     804             :         box3,ncomp3,std::forward<L3>(f3));
     805             : }
     806             : 
     807             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     808             : void HostDeviceParallelFor (Gpu::KernelInfo const&, T n, L&& f) noexcept
     809             : {
     810             :     ParallelFor(n,std::forward<L>(f));
     811             : }
     812             : 
     813             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     814             : void HostDeviceParallelFor (Gpu::KernelInfo const&, T n, L&& f) noexcept
     815             : {
     816             :     amrex::ignore_unused(MT);
     817             :     ParallelFor(n,std::forward<L>(f));
     818             : }
     819             : 
     820             : template <typename L>
     821             : void HostDeviceParallelFor (Gpu::KernelInfo const&, Box const& box, L&& f) noexcept
     822             : {
     823             :     ParallelFor(box,std::forward<L>(f));
     824             : }
     825             : 
     826             : template <int MT, typename L>
     827             : void HostDeviceParallelFor (Gpu::KernelInfo const&, Box const& box, L&& f) noexcept
     828             : {
     829             :     amrex::ignore_unused(MT);
     830             :     ParallelFor(box,std::forward<L>(f));
     831             : }
     832             : 
     833             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     834             : void HostDeviceParallelFor (Gpu::KernelInfo const&, Box const& box, T ncomp, L&& f) noexcept
     835             : {
     836             :     ParallelFor(box,ncomp,std::forward<L>(f));
     837             : }
     838             : 
     839             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     840             : void HostDeviceParallelFor (Gpu::KernelInfo const&, Box const& box, T ncomp, L&& f) noexcept
     841             : {
     842             :     amrex::ignore_unused(MT);
     843             :     ParallelFor(box,ncomp,std::forward<L>(f));
     844             : }
     845             : 
     846             : template <typename L1, typename L2>
     847             : void HostDeviceParallelFor (Gpu::KernelInfo const&, Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     848             : {
     849             :     ParallelFor(box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
     850             : }
     851             : 
     852             : template <int MT, typename L1, typename L2>
     853             : void HostDeviceParallelFor (Gpu::KernelInfo const&, Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     854             : {
     855             :     amrex::ignore_unused(MT);
     856             :     ParallelFor(box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
     857             : }
     858             : 
     859             : template <typename L1, typename L2, typename L3>
     860             : void HostDeviceParallelFor (Gpu::KernelInfo const&,
     861             :                             Box const& box1, Box const& box2, Box const& box3,
     862             :                             L1&& f1, L2&& f2, L3&& f3) noexcept
     863             : {
     864             :     ParallelFor(box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
     865             : }
     866             : 
     867             : template <int MT, typename L1, typename L2, typename L3>
     868             : void HostDeviceParallelFor (Gpu::KernelInfo const&,
     869             :                             Box const& box1, Box const& box2, Box const& box3,
     870             :                             L1&& f1, L2&& f2, L3&& f3) noexcept
     871             : {
     872             :     amrex::ignore_unused(MT);
     873             :     ParallelFor(box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
     874             : }
     875             : 
     876             : template <typename T1, typename T2, typename L1, typename L2,
     877             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     878             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     879             : void HostDeviceParallelFor (Gpu::KernelInfo const&,
     880             :                             Box const& box1, T1 ncomp1, L1&& f1,
     881             :                             Box const& box2, T2 ncomp2, L2&& f2) noexcept
     882             : {
     883             :     ParallelFor(box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
     884             : }
     885             : 
     886             : template <int MT, typename T1, typename T2, typename L1, typename L2,
     887             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     888             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     889             : void HostDeviceParallelFor (Gpu::KernelInfo const&,
     890             :                             Box const& box1, T1 ncomp1, L1&& f1,
     891             :                             Box const& box2, T2 ncomp2, L2&& f2) noexcept
     892             : {
     893             :     amrex::ignore_unused(MT);
     894             :     ParallelFor(box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
     895             : }
     896             : 
     897             : template <typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     898             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     899             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     900             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     901             : void HostDeviceParallelFor (Gpu::KernelInfo const&,
     902             :                             Box const& box1, T1 ncomp1, L1&& f1,
     903             :                             Box const& box2, T2 ncomp2, L2&& f2,
     904             :                             Box const& box3, T3 ncomp3, L3&& f3) noexcept
     905             : {
     906             :     ParallelFor(box1,ncomp1,std::forward<L1>(f1),
     907             :                 box2,ncomp2,std::forward<L2>(f2),
     908             :                 box3,ncomp3,std::forward<L3>(f3));
     909             : }
     910             : 
     911             : template <int MT, typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
     912             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     913             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
     914             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
     915             : void HostDeviceParallelFor (Gpu::KernelInfo const&,
     916             :                             Box const& box1, T1 ncomp1, L1&& f1,
     917             :                             Box const& box2, T2 ncomp2, L2&& f2,
     918             :                             Box const& box3, T3 ncomp3, L3&& f3) noexcept
     919             : {
     920             :     amrex::ignore_unused(MT);
     921             :     ParallelFor(box1,ncomp1,std::forward<L1>(f1),
     922             :                 box2,ncomp2,std::forward<L2>(f2),
     923             :                 box3,ncomp3,std::forward<L3>(f3));
     924             : }
     925             : 
     926             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     927             : void HostDeviceFor (Gpu::KernelInfo const&, T n, L&& f) noexcept
     928             : {
     929             :     For(n,std::forward<L>(f));
     930             : }
     931             : 
     932             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     933             : void HostDeviceFor (Gpu::KernelInfo const&, T n, L&& f) noexcept
     934             : {
     935             :     amrex::ignore_unused(MT);
     936             :     For(n,std::forward<L>(f));
     937             : }
     938             : 
     939             : template <typename L>
     940             : void HostDeviceFor (Gpu::KernelInfo const&, Box const& box, L&& f) noexcept
     941             : {
     942             :     For(box,std::forward<L>(f));
     943             : }
     944             : 
     945             : template <int MT, typename L>
     946             : void HostDeviceFor (Gpu::KernelInfo const&, Box const& box, L&& f) noexcept
     947             : {
     948             :     amrex::ignore_unused(MT);
     949             :     For(box,std::forward<L>(f));
     950             : }
     951             : 
     952             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     953             : void HostDeviceFor (Gpu::KernelInfo const&, Box const& box, T ncomp, L&& f) noexcept
     954             : {
     955             :     For(box,ncomp,std::forward<L>(f));
     956             : }
     957             : 
     958             : template <int MT, typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
     959             : void HostDeviceFor (Gpu::KernelInfo const&, Box const& box, T ncomp, L&& f) noexcept
     960             : {
     961             :     amrex::ignore_unused(MT);
     962             :     For(box,ncomp,std::forward<L>(f));
     963             : }
     964             : 
     965             : template <typename L1, typename L2>
     966             : void HostDeviceFor (Gpu::KernelInfo const&, Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     967             : {
     968             :     For(box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
     969             : }
     970             : 
     971             : template <int MT, typename L1, typename L2>
     972             : void HostDeviceFor (Gpu::KernelInfo const&, Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept
     973             : {
     974             :     amrex::ignore_unused(MT);
     975             :     For(box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
     976             : }
     977             : 
     978             : template <typename L1, typename L2, typename L3>
     979             : void HostDeviceFor (Gpu::KernelInfo const&,
     980             :                     Box const& box1, Box const& box2, Box const& box3,
     981             :                     L1&& f1, L2&& f2, L3&& f3) noexcept
     982             : {
     983             :     For(box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
     984             : }
     985             : 
     986             : template <int MT, typename L1, typename L2, typename L3>
     987             : void HostDeviceFor (Gpu::KernelInfo const&,
     988             :                     Box const& box1, Box const& box2, Box const& box3,
     989             :                     L1&& f1, L2&& f2, L3&& f3) noexcept
     990             : {
     991             :     amrex::ignore_unused(MT);
     992             :     For(box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
     993             : }
     994             : 
     995             : template <typename T1, typename T2, typename L1, typename L2,
     996             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
     997             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
     998             : void HostDeviceFor (Gpu::KernelInfo const&,
     999             :                     Box const& box1, T1 ncomp1, L1&& f1,
    1000             :                     Box const& box2, T2 ncomp2, L2&& f2) noexcept
    1001             : {
    1002             :     For(box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
    1003             : }
    1004             : 
    1005             : template <int MT, typename T1, typename T2, typename L1, typename L2,
    1006             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
    1007             :           typename M2=std::enable_if_t<std::is_integral_v<T2>> >
    1008             : void HostDeviceFor (Gpu::KernelInfo const&,
    1009             :                     Box const& box1, T1 ncomp1, L1&& f1,
    1010             :                     Box const& box2, T2 ncomp2, L2&& f2) noexcept
    1011             : {
    1012             :     amrex::ignore_unused(MT);
    1013             :     For(box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
    1014             : }
    1015             : 
    1016             : template <typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
    1017             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
    1018             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
    1019             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
    1020             : void HostDeviceFor (Gpu::KernelInfo const&,
    1021             :                     Box const& box1, T1 ncomp1, L1&& f1,
    1022             :                     Box const& box2, T2 ncomp2, L2&& f2,
    1023             :                     Box const& box3, T3 ncomp3, L3&& f3) noexcept
    1024             : {
    1025             :     For(box1,ncomp1,std::forward<L1>(f1),
    1026             :         box2,ncomp2,std::forward<L2>(f2),
    1027             :         box3,ncomp3,std::forward<L3>(f3));
    1028             : }
    1029             : 
    1030             : template <int MT, typename T1, typename T2, typename T3, typename L1, typename L2, typename L3,
    1031             :           typename M1=std::enable_if_t<std::is_integral_v<T1>>,
    1032             :           typename M2=std::enable_if_t<std::is_integral_v<T2>>,
    1033             :           typename M3=std::enable_if_t<std::is_integral_v<T3>> >
    1034             : void HostDeviceFor (Gpu::KernelInfo const&,
    1035             :                     Box const& box1, T1 ncomp1, L1&& f1,
    1036             :                     Box const& box2, T2 ncomp2, L2&& f2,
    1037             :                     Box const& box3, T3 ncomp3, L3&& f3) noexcept
    1038             : {
    1039             :     amrex::ignore_unused(MT);
    1040             :     For(box1,ncomp1,std::forward<L1>(f1),
    1041             :         box2,ncomp2,std::forward<L2>(f2),
    1042             :         box3,ncomp3,std::forward<L3>(f3));
    1043             : }
    1044             : 
    1045             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
    1046             : AMREX_ATTRIBUTE_FLATTEN_FOR
    1047             : void ParallelForRNG (T n, L const& f) noexcept
    1048             : {
    1049             :     for (T i = 0; i < n; ++i) {
    1050             :         f(i,RandomEngine{});
    1051             :     }
    1052             : }
    1053             : 
    1054             : template <typename L>
    1055             : AMREX_ATTRIBUTE_FLATTEN_FOR
    1056             : void ParallelForRNG (Box const& box, L const& f) noexcept
    1057             : {
    1058             :     const auto lo = amrex::lbound(box);
    1059             :     const auto hi = amrex::ubound(box);
    1060             :     for (int k = lo.z; k <= hi.z; ++k) {
    1061             :     for (int j = lo.y; j <= hi.y; ++j) {
    1062             :     for (int i = lo.x; i <= hi.x; ++i) {
    1063             :         f(i,j,k,RandomEngine{});
    1064             :     }}}
    1065             : }
    1066             : 
    1067             : template <typename T, typename L, typename M=std::enable_if_t<std::is_integral_v<T>> >
    1068             : AMREX_ATTRIBUTE_FLATTEN_FOR
    1069             : void ParallelForRNG (Box const& box, T ncomp, L const& f) noexcept
    1070             : {
    1071             :     const auto lo = amrex::lbound(box);
    1072             :     const auto hi = amrex::ubound(box);
    1073             :     for (T n = 0; n < ncomp; ++n) {
    1074             :         for (int k = lo.z; k <= hi.z; ++k) {
    1075             :         for (int j = lo.y; j <= hi.y; ++j) {
    1076             :         for (int i = lo.x; i <= hi.x; ++i) {
    1077             :             f(i,j,k,n,RandomEngine{});
    1078             :         }}}
    1079             :     }
    1080             : }
    1081             : 
    1082             : template <typename L>
    1083             : void single_task (L&& f) noexcept
    1084             : {
    1085             :     std::forward<L>(f)();
    1086             : }
    1087             : 
    1088             : }
    1089             : 
    1090             : #endif

Generated by: LCOV version 1.14