1#ifndef AMREX_GPU_LAUNCH_FUNCTS_G_H_
2#define AMREX_GPU_LAUNCH_FUNCTS_G_H_
3#include <AMReX_Config.H>
12 template <
typename F,
typename N>
14 auto call_f_scalar_handler (
F const& f, N i, Gpu::Handler
const&)
15 noexcept ->
decltype(f(0))
20 template <
typename F,
typename N>
22 auto call_f_scalar_handler (
F const& f, N i, Gpu::Handler
const& handler)
23 noexcept ->
decltype(f(0,Gpu::Handler{}))
30 template <
typename F, std::size_t...Ns,
class...Args>
32 auto call_f_intvect_inner (std::index_sequence<Ns...>,
F const& f, IntVectND<1> iv, Args...args)
33 noexcept -> decltype(f(0, 0, 0, args...))
35 return f(iv[0], 0, 0, args...);
38 template <
typename F, std::size_t...Ns,
class...Args>
40 auto call_f_intvect_inner (std::index_sequence<Ns...>,
F const& f, IntVectND<2> iv, Args...args)
41 noexcept -> decltype(f(0, 0, 0, args...))
43 return f(iv[0], iv[1], 0, args...);
46 template <
typename F,
int dim, std::size_t...Ns,
class...Args>
48 auto call_f_intvect_inner (std::index_sequence<Ns...>,
F const& f, IntVectND<dim> iv, Args...args)
49 noexcept -> decltype(f(iv, args...))
51 return f(iv, args...);
54 template <
typename F,
int dim, std::size_t...Ns,
class...Args>
56 auto call_f_intvect_inner (std::index_sequence<Ns...>,
F const& f, IntVectND<dim> iv, Args...args)
57 noexcept -> decltype(f(iv[Ns]..., args...))
59 return f(iv[Ns]..., args...);
64 template <
typename F,
int dim>
66 auto call_f_intvect (
F const& f, IntVectND<dim> iv)
67 noexcept ->
decltype(call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv))
69 return call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv);
74 template <
typename F,
int dim>
76 auto call_f_intvect_engine (
F const& f, IntVectND<dim> iv, RandomEngine engine)
77 noexcept ->
decltype(call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, engine))
79 return call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, engine);
84 template <
typename F,
int dim>
86 auto call_f_intvect_handler (
F const& f, IntVectND<dim> iv, Gpu::Handler
const&)
87 noexcept ->
decltype(call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv))
89 return call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv);
92 template <
typename F,
int dim>
94 auto call_f_intvect_handler (
F const& f, IntVectND<dim> iv, Gpu::Handler
const& handler)
95 noexcept ->
decltype(call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, Gpu::Handler{}))
97 return call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, handler);
102 template <
typename F,
typename T,
int dim>
104 auto call_f_intvect_ncomp (
F const& f, IntVectND<dim> iv, T ncomp)
105 noexcept ->
decltype(call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, 0))
107 for (T n = 0; n < ncomp; ++n) {
108 call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, n);
114 template <
typename F,
typename T,
int dim>
116 auto call_f_intvect_ncomp_engine (
F const& f, IntVectND<dim> iv, T ncomp, RandomEngine engine)
117 noexcept ->
decltype(call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, 0, engine))
119 for (T n = 0; n < ncomp; ++n) {
120 call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, n, engine);
126 template <
typename F,
typename T,
int dim>
128 auto call_f_intvect_ncomp_handler (
F const& f, IntVectND<dim> iv, T ncomp, Gpu::Handler
const&)
129 noexcept ->
decltype(call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, 0))
131 for (T n = 0; n < ncomp; ++n) {
132 call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, n);
136 template <
typename F,
typename T,
int dim>
138 auto call_f_intvect_ncomp_handler (
F const& f, IntVectND<dim> iv, T ncomp, Gpu::Handler
const& handler)
139 noexcept ->
decltype(call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, 0, Gpu::Handler{}))
141 for (T n = 0; n < ncomp; ++n) {
142 call_f_intvect_inner(std::make_index_sequence<dim>(), f, iv, n, handler);
154 detail::SyclKernelDevPtr<L> skdp(f, stream);
155 L
const* pf = skdp.template get<0>();
158 auto& q = *(stream.queue);
160 q.submit([&] (sycl::handler& h) {
161 if constexpr (detail::is_big_kernel<L>()) {
162 h.single_task([=] () { (*pf)(); });
167 }
catch (sycl::exception
const& ex) {
168 amrex::Abort(std::string(
"single_task: ")+ex.what()+
"!!!!!");
173void launch (
int nblocks,
int nthreads_per_block, std::size_t shared_mem_bytes,
176 detail::SyclKernelDevPtr<L> skdp(f, stream);
177 L
const* pf = skdp.template get<0>();
180 const auto nthreads_total = std::size_t(nthreads_per_block) * nblocks;
181 const std::size_t shared_mem_numull = (shared_mem_bytes+
sizeof(
unsigned long long)-1)
182 /
sizeof(
unsigned long long);
183 auto& q = *(stream.queue);
185 q.submit([&] (sycl::handler& h) {
186 sycl::local_accessor<unsigned long long>
187 shared_data(sycl::range<1>(shared_mem_numull), h);
188 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
189 sycl::range<1>(nthreads_per_block)),
190 [=] (sycl::nd_item<1> item)
193 if constexpr (detail::is_big_kernel<L>()) {
194 (*pf)(Gpu::Handler{&item,shared_data.get_multi_ptr<sycl::access::decorated::yes>().
get()});
196 f(Gpu::Handler{&item,shared_data.get_multi_ptr<sycl::access::decorated::yes>().
get()});
200 }
catch (sycl::exception
const& ex) {
201 amrex::Abort(std::string(
"launch: ")+ex.what()+
"!!!!!");
208 detail::SyclKernelDevPtr<L> skdp(f, stream);
209 L
const* pf = skdp.template get<0>();
212 const auto nthreads_total = std::size_t(nthreads_per_block) * nblocks;
213 auto& q = *(stream.queue);
215 q.submit([&] (sycl::handler& h) {
216 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
217 sycl::range<1>(nthreads_per_block)),
218 [=] (sycl::nd_item<1> item)
221 if constexpr (detail::is_big_kernel<L>()) {
228 }
catch (sycl::exception
const& ex) {
229 amrex::Abort(std::string(
"launch: ")+ex.what()+
"!!!!!");
233template <
int MT,
typename L>
237 detail::SyclKernelDevPtr<L> skdp(f, stream);
238 L
const* pf = skdp.template get<0>();
241 const auto nthreads_total = MT * std::size_t(nblocks);
242 const std::size_t shared_mem_numull = (shared_mem_bytes+
sizeof(
unsigned long long)-1)
243 /
sizeof(
unsigned long long);
244 auto& q = *(stream.queue);
246 q.submit([&] (sycl::handler& h) {
247 sycl::local_accessor<unsigned long long>
248 shared_data(sycl::range<1>(shared_mem_numull), h);
249 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
251 [=] (sycl::nd_item<1> item)
252 [[sycl::reqd_work_group_size(MT)]]
255 if constexpr (detail::is_big_kernel<L>()) {
256 (*pf)(Gpu::Handler{&item,shared_data.get_multi_ptr<sycl::access::decorated::yes>().
get()});
258 f(Gpu::Handler{&item,shared_data.get_multi_ptr<sycl::access::decorated::yes>().
get()});
262 }
catch (sycl::exception
const& ex) {
263 amrex::Abort(std::string(
"launch: ")+ex.what()+
"!!!!!");
267template <
int MT,
typename L>
270 detail::SyclKernelDevPtr<L> skdp(f, stream);
271 L
const* pf = skdp.template get<0>();
274 const auto nthreads_total = MT * std::size_t(nblocks);
275 auto& q = *(stream.queue);
277 q.submit([&] (sycl::handler& h) {
278 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
280 [=] (sycl::nd_item<1> item)
281 [[sycl::reqd_work_group_size(MT)]]
284 if constexpr (detail::is_big_kernel<L>()) {
291 }
catch (sycl::exception
const& ex) {
292 amrex::Abort(std::string(
"launch: ")+ex.what()+
"!!!!!");
296template<
int MT,
typename T,
typename L>
297void launch (T
const& n, L
const& f)
302 L
const* pf = skdp.template get<0>();
305 const auto ec = Gpu::makeExecutionConfig<MT>(n);
306 const auto nthreads_per_block = ec.numThreads.x;
307 const auto nthreads_total = std::size_t(nthreads_per_block) * ec.numBlocks.x;
308 auto& q = Gpu::Device::streamQueue();
310 q.submit([&] (sycl::handler& h) {
311 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
312 sycl::range<1>(nthreads_per_block)),
313 [=] (sycl::nd_item<1> item)
314 [[sycl::reqd_work_group_size(MT)]]
317 for (
auto const i :
Gpu::
Range(n,item.get_global_id(0),item.get_global_range(0))) {
318 if constexpr (detail::is_big_kernel<L>()) {
326 }
catch (sycl::exception
const& ex) {
327 amrex::Abort(std::string(
"launch: ")+ex.what()+
"!!!!!");
331template <
int MT, std::
integral T,
typename L>
332void ParallelFor (Gpu::KernelInfo
const& info, T n, L
const& f)
337 L
const* pf = skdp.template get<0>();
340 const auto ec = Gpu::makeExecutionConfig<MT>(n);
341 const auto nthreads_per_block = ec.numThreads.x;
342 const auto nthreads_total = std::size_t(nthreads_per_block) * ec.numBlocks.x;
343 auto& q = Gpu::Device::streamQueue();
345 if (info.hasReduction()) {
346 q.submit([&] (sycl::handler& h) {
347 sycl::local_accessor<unsigned long long>
350 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
351 sycl::range<1>(nthreads_per_block)),
352 [=] (sycl::nd_item<1> item)
353 [[sycl::reqd_work_group_size(MT)]]
356 for (std::size_t i = item.get_global_id(0), stride = item.get_global_range(0);
357 i < std::size_t(n); i += stride) {
358 int n_active_threads =
amrex::min(std::size_t(n)-i+item.get_local_id(0),
359 item.get_local_range(0));
360 if constexpr (detail::is_big_kernel<L>()) {
361 detail::call_f_scalar_handler(*pf, T(i),
362 Gpu::Handler{&item, shared_data.get_multi_ptr<sycl::access::decorated::yes>().
get(),
365 detail::call_f_scalar_handler(f, T(i),
366 Gpu::Handler{&item, shared_data.get_multi_ptr<sycl::access::decorated::yes>().
get(),
373 q.submit([&] (sycl::handler& h) {
374 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
375 sycl::range<1>(nthreads_per_block)),
376 [=] (sycl::nd_item<1> item)
377 [[sycl::reqd_work_group_size(MT)]]
380 for (std::size_t i = item.get_global_id(0), stride = item.get_global_range(0);
381 i < std::size_t(n); i += stride) {
382 if constexpr (detail::is_big_kernel<L>()) {
383 detail::call_f_scalar_handler(*pf, T(i), Gpu::Handler{&item});
385 detail::call_f_scalar_handler(f, T(i), Gpu::Handler{&item});
391 }
catch (sycl::exception
const& ex) {
392 amrex::Abort(std::string(
"ParallelFor: ")+ex.what()+
"!!!!!");
396template <
int MT,
typename L,
int dim>
397void ParallelFor (Gpu::KernelInfo
const& info, BoxND<dim>
const& box, L
const& f)
402 L
const* pf = skdp.template get<0>();
405 const BoxIndexerND<dim> indexer(box);
406 const auto ec = Gpu::makeExecutionConfig<MT>(box.numPts());
407 const auto nthreads_per_block = ec.numThreads.x;
408 const auto nthreads_total = std::size_t(nthreads_per_block) * ec.numBlocks.x;
409 auto& q = Gpu::Device::streamQueue();
411 if (info.hasReduction()) {
412 q.submit([&] (sycl::handler& h) {
413 sycl::local_accessor<unsigned long long>
416 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
417 sycl::range<1>(nthreads_per_block)),
418 [=] (sycl::nd_item<1> item)
419 [[sycl::reqd_work_group_size(MT)]]
422 for (std::uint64_t icell = item.get_global_id(0), stride = item.get_global_range(0);
423 icell < indexer.numPts(); icell += stride) {
424 auto iv = indexer.intVect(icell);
425 int n_active_threads =
amrex::min(indexer.numPts()-icell+std::uint64_t(item.get_local_id(0)),
426 std::uint64_t(item.get_local_range(0)));
427 if constexpr (detail::is_big_kernel<L>()) {
428 detail::call_f_intvect_handler(*pf,
429 iv, Gpu::Handler{&item,
430 shared_data.get_multi_ptr<sycl::access::decorated::yes>().
get(),
433 detail::call_f_intvect_handler(f,
434 iv, Gpu::Handler{&item,
435 shared_data.get_multi_ptr<sycl::access::decorated::yes>().
get(),
442 q.submit([&] (sycl::handler& h) {
443 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
444 sycl::range<1>(nthreads_per_block)),
445 [=] (sycl::nd_item<1> item)
446 [[sycl::reqd_work_group_size(MT)]]
449 for (std::uint64_t icell = item.get_global_id(0), stride = item.get_global_range(0);
450 icell < indexer.numPts(); icell += stride) {
451 auto iv = indexer.intVect(icell);
452 if constexpr (detail::is_big_kernel<L>()) {
453 detail::call_f_intvect_handler(*pf,iv,Gpu::Handler{&item});
455 detail::call_f_intvect_handler(f,iv,Gpu::Handler{&item});
461 }
catch (sycl::exception
const& ex) {
462 amrex::Abort(std::string(
"ParallelFor: ")+ex.what()+
"!!!!!");
466template <
int MT, std::
integral T,
typename L,
int dim>
467void ParallelFor (Gpu::KernelInfo
const& info, BoxND<dim>
const& box, T ncomp, L
const& f)
472 L
const* pf = skdp.template get<0>();
475 const BoxIndexerND<dim> indexer(box);
476 const auto ec = Gpu::makeExecutionConfig<MT>(box.numPts());
477 const auto nthreads_per_block = ec.numThreads.x;
478 const auto nthreads_total = std::size_t(nthreads_per_block) * ec.numBlocks.x;
479 auto& q = Gpu::Device::streamQueue();
481 if (info.hasReduction()) {
482 q.submit([&] (sycl::handler& h) {
483 sycl::local_accessor<unsigned long long>
486 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
487 sycl::range<1>(nthreads_per_block)),
488 [=] (sycl::nd_item<1> item)
489 [[sycl::reqd_work_group_size(MT)]]
492 for (std::uint64_t icell = item.get_global_id(0), stride = item.get_global_range(0);
493 icell < indexer.numPts(); icell += stride) {
494 auto iv = indexer.intVect(icell);
495 int n_active_threads =
amrex::min(indexer.numPts()-icell+std::uint64_t(item.get_local_id(0)),
496 std::uint64_t(item.get_local_range(0)));
497 if constexpr (detail::is_big_kernel<L>()) {
498 detail::call_f_intvect_ncomp_handler(*pf, iv, ncomp,
499 Gpu::Handler{&item, shared_data.get_multi_ptr<sycl::access::decorated::yes>().
get(),
502 detail::call_f_intvect_ncomp_handler(f, iv, ncomp,
503 Gpu::Handler{&item, shared_data.get_multi_ptr<sycl::access::decorated::yes>().
get(),
510 q.submit([&] (sycl::handler& h) {
511 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
512 sycl::range<1>(nthreads_per_block)),
513 [=] (sycl::nd_item<1> item)
514 [[sycl::reqd_work_group_size(MT)]]
517 for (std::uint64_t icell = item.get_global_id(0), stride = item.get_global_range(0);
518 icell < indexer.numPts(); icell += stride) {
519 auto iv = indexer.intVect(icell);
520 if constexpr (detail::is_big_kernel<L>()) {
521 detail::call_f_intvect_ncomp_handler(*pf,iv,ncomp,Gpu::Handler{&item});
523 detail::call_f_intvect_ncomp_handler(f,iv,ncomp,Gpu::Handler{&item});
529 }
catch (sycl::exception
const& ex) {
530 amrex::Abort(std::string(
"ParallelFor: ")+ex.what()+
"!!!!!");
534template <std::
integral T,
typename L>
540 L
const* pf = skdp.template get<0>();
543 const auto ec = Gpu::ExecutionConfig(n);
544 const auto nthreads_per_block = ec.numThreads.x;
546 auto& q = Gpu::Device::streamQueue();
547 auto& engdescr = *(getRandEngineDescriptor());
549 q.submit([&] (sycl::handler& h) {
550 auto engine_acc = engdescr.get_access(h);
551 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
552 sycl::range<1>(nthreads_per_block)),
553 [=] (sycl::nd_item<1> item)
554 [[sycl::reqd_work_group_size(AMREX_GPU_MAX_THREADS)]]
557 auto const tid = item.get_global_id(0);
558 auto engine = engine_acc.load(tid);
559 RandomEngine rand_eng{&engine};
560 for (std::size_t i = tid, stride = item.get_global_range(0); i < std::size_t(n); i += stride) {
561 if constexpr (detail::is_big_kernel<L>()) {
562 (*pf)(T(i),rand_eng);
567 engine_acc.store(engine, tid);
571 }
catch (sycl::exception
const& ex) {
572 amrex::Abort(std::string(
"ParallelFor: ")+ex.what()+
"!!!!!");
576template <
typename L,
int dim>
582 L
const* pf = skdp.template get<0>();
585 const BoxIndexerND<dim> indexer(box);
586 const auto ec = Gpu::ExecutionConfig(box.numPts());
587 const auto nthreads_per_block = ec.numThreads.x;
589 auto& q = Gpu::Device::streamQueue();
590 auto& engdescr = *(getRandEngineDescriptor());
592 q.submit([&] (sycl::handler& h) {
593 auto engine_acc = engdescr.get_access(h);
594 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
595 sycl::range<1>(nthreads_per_block)),
596 [=] (sycl::nd_item<1> item)
597 [[sycl::reqd_work_group_size(AMREX_GPU_MAX_THREADS)]]
600 auto const tid = item.get_global_id(0);
601 auto engine = engine_acc.load(tid);
602 RandomEngine rand_eng{&engine};
603 for (std::uint64_t icell = tid, stride = item.get_global_range(0);
604 icell < indexer.numPts(); icell += stride) {
605 auto iv = indexer.intVect(icell);
606 if constexpr (detail::is_big_kernel<L>()) {
607 detail::call_f_intvect_engine(*pf,iv,rand_eng);
609 detail::call_f_intvect_engine(f,iv,rand_eng);
612 engine_acc.store(engine, tid);
616 }
catch (sycl::exception
const& ex) {
617 amrex::Abort(std::string(
"ParallelFor: ")+ex.what()+
"!!!!!");
621template <std::
integral T,
typename L,
int dim>
627 L
const* pf = skdp.template get<0>();
630 const BoxIndexerND<dim> indexer(box);
631 const auto ec = Gpu::ExecutionConfig(box.numPts());
632 const auto nthreads_per_block = ec.numThreads.x;
634 auto& q = Gpu::Device::streamQueue();
635 auto& engdescr = *(getRandEngineDescriptor());
637 q.submit([&] (sycl::handler& h) {
638 auto engine_acc = engdescr.get_access(h);
639 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
640 sycl::range<1>(nthreads_per_block)),
641 [=] (sycl::nd_item<1> item)
642 [[sycl::reqd_work_group_size(AMREX_GPU_MAX_THREADS)]]
645 auto const tid = item.get_global_id(0);
646 auto engine = engine_acc.load(tid);
647 RandomEngine rand_eng{&engine};
648 for (std::uint64_t icell = tid, stride = item.get_global_range(0);
649 icell < indexer.numPts(); icell += stride) {
650 auto iv = indexer.intVect(icell);
651 if constexpr (detail::is_big_kernel<L>()) {
652 detail::call_f_intvect_ncomp_engine(*pf,iv,ncomp,rand_eng);
654 detail::call_f_intvect_ncomp_engine(f,iv,ncomp,rand_eng);
657 engine_acc.store(engine, tid);
661 }
catch (sycl::exception
const& ex) {
662 amrex::Abort(std::string(
"ParallelFor: ")+ex.what()+
"!!!!!");
666template <
int MT,
typename L1,
typename L2,
int dim>
667void ParallelFor (Gpu::KernelInfo
const& , BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1
const& f1, L2
const& f2)
672 L1
const* pf1 = skdp.template get<0>();
673 L2
const* pf2 = skdp.template get<1>();
676 const BoxIndexerND<dim> indexer1(box1);
677 const BoxIndexerND<dim> indexer2(box2);
678 const auto ec = Gpu::makeExecutionConfig<MT>(std::max(box1.numPts(), box2.numPts()));
679 const auto nthreads_per_block = ec.numThreads.x;
680 const auto nthreads_total = std::size_t(nthreads_per_block) * ec.numBlocks.x;
681 auto& q = Gpu::Device::streamQueue();
683 q.submit([&] (sycl::handler& h) {
684 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
685 sycl::range<1>(nthreads_per_block)),
686 [=] (sycl::nd_item<1> item)
687 [[sycl::reqd_work_group_size(MT)]]
690 auto const ncells = std::max(indexer1.numPts(), indexer2.numPts());
691 for (std::uint64_t icell = item.get_global_id(0), stride = item.get_global_range(0);
692 icell < ncells; icell += stride) {
693 if (icell < indexer1.numPts()) {
694 auto iv = indexer1.intVect(icell);
695 if constexpr (detail::is_big_kernel<L1,L2>()) {
696 detail::call_f_intvect(*pf1,iv);
698 detail::call_f_intvect(f1,iv);
701 if (icell < indexer2.numPts()) {
702 auto iv = indexer2.intVect(icell);
703 if constexpr (detail::is_big_kernel<L1,L2>()) {
704 detail::call_f_intvect(*pf2,iv);
706 detail::call_f_intvect(f2,iv);
712 }
catch (sycl::exception
const& ex) {
713 amrex::Abort(std::string(
"ParallelFor: ")+ex.what()+
"!!!!!");
717template <
int MT,
typename L1,
typename L2,
typename L3,
int dim>
719 BoxND<dim>
const& box1, BoxND<dim>
const& box2, BoxND<dim>
const& box3,
720 L1
const& f1, L2
const& f2, L3
const& f3)
724 detail::SyclKernelDevPtr<L1,L2,L3> skdp(f1, f2, f3,
Gpu::gpuStream());
725 L1
const* pf1 = skdp.template get<0>();
726 L2
const* pf2 = skdp.template get<1>();
727 L3
const* pf3 = skdp.template get<2>();
730 const BoxIndexerND<dim> indexer1(box1);
731 const BoxIndexerND<dim> indexer2(box2);
732 const BoxIndexerND<dim> indexer3(box3);
733 const auto ec = Gpu::makeExecutionConfig<MT>(std::max({box1.numPts(),box2.numPts(),box3.numPts()}));
734 const auto nthreads_per_block = ec.numThreads.x;
735 const auto nthreads_total = std::size_t(nthreads_per_block) * ec.numBlocks.x;
736 auto& q = Gpu::Device::streamQueue();
738 q.submit([&] (sycl::handler& h) {
739 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
740 sycl::range<1>(nthreads_per_block)),
741 [=] (sycl::nd_item<1> item)
742 [[sycl::reqd_work_group_size(MT)]]
745 auto const ncells =
amrex::max(indexer1.numPts(), indexer2.numPts(), indexer3.numPts());
746 for (std::uint64_t icell = item.get_global_id(0), stride = item.get_global_range(0);
747 icell < ncells; icell += stride) {
748 if (icell < indexer1.numPts()) {
749 auto iv = indexer1.intVect(icell);
750 if constexpr (detail::is_big_kernel<L1,L2,L3>()) {
751 detail::call_f_intvect(*pf1,iv);
753 detail::call_f_intvect(f1,iv);
756 if (icell < indexer2.numPts()) {
757 auto iv = indexer2.intVect(icell);
758 if constexpr (detail::is_big_kernel<L1,L2,L3>()) {
759 detail::call_f_intvect(*pf2,iv);
761 detail::call_f_intvect(f2,iv);
764 if (icell < indexer3.numPts()) {
765 auto iv = indexer3.intVect(icell);
766 if constexpr (detail::is_big_kernel<L1,L2,L3>()) {
767 detail::call_f_intvect(*pf3,iv);
769 detail::call_f_intvect(f3,iv);
775 }
catch (sycl::exception
const& ex) {
776 amrex::Abort(std::string(
"ParallelFor: ")+ex.what()+
"!!!!!");
780template <
int MT, std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
782 BoxND<dim>
const& box1, T1 ncomp1, L1
const& f1,
783 BoxND<dim>
const& box2, T2 ncomp2, L2
const& f2)
788 L1
const* pf1 = skdp.template get<0>();
789 L2
const* pf2 = skdp.template get<1>();
792 const BoxIndexerND<dim> indexer1(box1);
793 const BoxIndexerND<dim> indexer2(box2);
794 const auto ec = Gpu::makeExecutionConfig<MT>(std::max(box1.numPts(),box2.numPts()));
795 const auto nthreads_per_block = ec.numThreads.x;
796 const auto nthreads_total = std::size_t(nthreads_per_block) * ec.numBlocks.x;
797 auto& q = Gpu::Device::streamQueue();
799 q.submit([&] (sycl::handler& h) {
800 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
801 sycl::range<1>(nthreads_per_block)),
802 [=] (sycl::nd_item<1> item)
803 [[sycl::reqd_work_group_size(MT)]]
806 auto const ncells = std::max(indexer1.numPts(), indexer2.numPts());
807 for (std::uint64_t icell = item.get_global_id(0), stride = item.get_global_range(0);
808 icell < ncells; icell += stride) {
809 if (icell < indexer1.numPts()) {
810 auto iv = indexer1.intVect(icell);
811 if constexpr (detail::is_big_kernel<L1,L2>()) {
812 detail::call_f_intvect_ncomp(*pf1,iv,ncomp1);
814 detail::call_f_intvect_ncomp(f1,iv,ncomp1);
817 if (icell < indexer2.numPts()) {
818 auto iv = indexer2.intVect(icell);
819 if constexpr (detail::is_big_kernel<L1,L2>()) {
820 detail::call_f_intvect_ncomp(*pf2,iv,ncomp2);
822 detail::call_f_intvect_ncomp(f2,iv,ncomp2);
828 }
catch (sycl::exception
const& ex) {
829 amrex::Abort(std::string(
"ParallelFor: ")+ex.what()+
"!!!!!");
833template <
int MT, std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
835 BoxND<dim>
const& box1, T1 ncomp1, L1
const& f1,
836 BoxND<dim>
const& box2, T2 ncomp2, L2
const& f2,
837 BoxND<dim>
const& box3, T3 ncomp3, L3
const& f3)
841 detail::SyclKernelDevPtr<L1,L2,L3> skdp(f1, f2, f3,
Gpu::gpuStream());
842 L1
const* pf1 = skdp.template get<0>();
843 L2
const* pf2 = skdp.template get<1>();
844 L3
const* pf3 = skdp.template get<2>();
847 const BoxIndexerND<dim> indexer1(box1);
848 const BoxIndexerND<dim> indexer2(box2);
849 const BoxIndexerND<dim> indexer3(box3);
850 const auto ec = Gpu::makeExecutionConfig<MT>(std::max({box1.numPts(),box2.numPts(),box3.numPts()}));
851 const auto nthreads_per_block = ec.numThreads.x;
852 const auto nthreads_total = std::size_t(nthreads_per_block) * ec.numBlocks.x;
853 auto& q = Gpu::Device::streamQueue();
855 q.submit([&] (sycl::handler& h) {
856 h.parallel_for(sycl::nd_range<1>(sycl::range<1>(nthreads_total),
857 sycl::range<1>(nthreads_per_block)),
858 [=] (sycl::nd_item<1> item)
859 [[sycl::reqd_work_group_size(MT)]]
862 auto const ncells =
amrex::max(indexer1.numPts(), indexer2.numPts(), indexer3.numPts());
863 for (std::uint64_t icell = item.get_global_id(0), stride = item.get_global_range(0);
864 icell < ncells; icell += stride) {
865 if (icell < indexer1.numPts()) {
866 auto iv = indexer1.intVect(icell);
867 if constexpr (detail::is_big_kernel<L1,L2,L3>()) {
868 detail::call_f_intvect_ncomp(*pf1,iv,ncomp1);
870 detail::call_f_intvect_ncomp(f1,iv,ncomp1);
873 if (icell < indexer2.numPts()) {
874 auto iv = indexer2.intVect(icell);
875 if constexpr (detail::is_big_kernel<L1,L2,L3>()) {
876 detail::call_f_intvect_ncomp(*pf2,iv,ncomp2);
878 detail::call_f_intvect_ncomp(f2,iv,ncomp2);
881 if (icell < indexer3.numPts()) {
882 auto iv = indexer3.intVect(icell);
883 if constexpr (detail::is_big_kernel<L1,L2,L3>()) {
884 detail::call_f_intvect_ncomp(*pf3,iv,ncomp3);
886 detail::call_f_intvect_ncomp(f3,iv,ncomp3);
892 }
catch (sycl::exception
const& ex) {
893 amrex::Abort(std::string(
"ParallelFor: ")+ex.what()+
"!!!!!");
907template <
int MT,
typename L>
915template <
int MT,
typename L>
923void launch (
int nblocks,
int nthreads_per_block, std::size_t shared_mem_bytes,
933 launch(nblocks, nthreads_per_block, 0, stream, std::forward<L>(f));
936template<
int MT, std::
integral T,
typename L>
937void launch (T
const& n, L
const& f)
939 static_assert(
sizeof(T) >= 2);
941 const auto& nec = Gpu::makeNExecutionConfigs<MT>(n);
942 for (
auto const& ec : nec) {
943 const T start_idx = T(ec.start_idx);
944 const T nleft = n - start_idx;
948 auto tid = T(MT)*T(blockIdx.x)+T(threadIdx.x);
957template<
int MT,
int dim,
typename L>
961 const auto& nec = Gpu::makeNExecutionConfigs<MT>(box);
963 const auto type = box.
ixType();
964 for (
auto const& ec : nec) {
965 const auto start_idx = std::uint64_t(ec.start_idx);
968 auto icell = std::uint64_t(MT)*blockIdx.x+threadIdx.x + start_idx;
969 if (icell < indexer.
numPts()) {
970 auto iv = indexer.
intVect(icell);
982template <
int MT, std::
integral T,
typename L>
983requires (MaybeDeviceRunnable<L>::value)
987 static_assert(
sizeof(T) >= 2);
989 const auto& nec = Gpu::makeNExecutionConfigs<MT>(n);
990 for (
auto const& ec : nec) {
991 const T start_idx = T(ec.start_idx);
992 const T nleft = n - start_idx;
996 auto tid = T(MT)*T(blockIdx.x)+T(threadIdx.x);
998 detail::call_f_scalar_handler(f, tid+start_idx,
1000 (std::uint64_t)MT)));
1011template <
int MT,
typename L,
int dim>
1012requires (MaybeDeviceRunnable<L>::value)
1018 const auto& nec = Gpu::makeNExecutionConfigs<MT>(box);
1019 for (
auto const& ec : nec) {
1020 const auto start_idx = std::uint64_t(ec.start_idx);
1023 auto icell = std::uint64_t(MT)*blockIdx.x+threadIdx.x + start_idx;
1024 if (icell < indexer.
numPts()) {
1025 auto iv = indexer.
intVect(icell);
1026 detail::call_f_intvect_handler(f, iv,
1028 (std::uint64_t)MT)));
1039template <
int MT, std::
integral T,
typename L,
int dim>
1040requires (MaybeDeviceRunnable<L>::value)
1046 const auto& nec = Gpu::makeNExecutionConfigs<MT>(box);
1047 for (
auto const& ec : nec) {
1048 const auto start_idx = std::uint64_t(ec.start_idx);
1051 auto icell = std::uint64_t(MT)*blockIdx.x+threadIdx.x + start_idx;
1052 if (icell < indexer.
numPts()) {
1053 auto iv = indexer.
intVect(icell);
1054 detail::call_f_intvect_ncomp_handler(f, iv, ncomp,
1056 (std::uint64_t)MT)));
1068template <std::
integral T,
typename L>
1069requires (MaybeDeviceRunnable<L>::value)
1080 Long tid =
Long(AMREX_GPU_MAX_THREADS)*blockIdx.x+threadIdx.x;
1082 for (
Long i = tid, stride =
Long(AMREX_GPU_MAX_THREADS)*gridDim.x; i <
Long(n); i += stride) {
1095template <
typename L,
int dim>
1096requires (MaybeDeviceRunnable<L>::value)
1108 auto const tid = std::uint64_t(AMREX_GPU_MAX_THREADS)*blockIdx.x+threadIdx.x;
1110 for (std::uint64_t icell = tid, stride = std::uint64_t(AMREX_GPU_MAX_THREADS)*gridDim.x; icell < indexer.
numPts(); icell += stride) {
1111 auto iv = indexer.
intVect(icell);
1112 detail::call_f_intvect_engine(f, iv, engine);
1124template <std::
integral T,
typename L,
int dim>
1125requires (MaybeDeviceRunnable<L>::value)
1137 auto const tid = std::uint64_t(AMREX_GPU_MAX_THREADS)*blockIdx.x+threadIdx.x;
1139 for (std::uint64_t icell = tid, stride = std::uint64_t(AMREX_GPU_MAX_THREADS)*gridDim.x; icell < indexer.
numPts(); icell += stride) {
1140 auto iv = indexer.
intVect(icell);
1141 detail::call_f_intvect_ncomp_engine(f, iv, ncomp, engine);
1152template <
int MT,
typename L1,
typename L2,
int dim>
1153requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
1161 const auto ec = Gpu::makeExecutionConfig<MT>(std::max(box1.
numPts(),box2.
numPts()));
1164 auto const ncells = std::max(indexer1.
numPts(), indexer2.
numPts());
1165 for (std::uint64_t icell = std::uint64_t(MT)*blockIdx.x+threadIdx.x, stride = std::uint64_t(MT)*gridDim.x;
1166 icell < ncells; icell += stride) {
1167 if (icell < indexer1.
numPts()) {
1168 auto iv = indexer1.
intVect(icell);
1169 detail::call_f_intvect(f1, iv);
1171 if (icell < indexer2.
numPts()) {
1172 auto iv = indexer2.
intVect(icell);
1173 detail::call_f_intvect(f2, iv);
1184template <
int MT,
typename L1,
typename L2,
typename L3,
int dim>
1185requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value &&
1186 MaybeDeviceRunnable<L3>::value)
1190 L1&& f1, L2&& f2, L3&& f3)
1196 const auto ec = Gpu::makeExecutionConfig<MT>(std::max({box1.
numPts(),box2.
numPts(),box3.
numPts()}));
1199 auto const ncells = std::max({indexer1.
numPts(), indexer2.
numPts(), indexer3.
numPts()});
1200 for (std::uint64_t icell = std::uint64_t(MT)*blockIdx.x+threadIdx.x, stride = std::uint64_t(MT)*gridDim.x;
1201 icell < ncells; icell += stride) {
1202 if (icell < indexer1.
numPts()) {
1203 auto iv = indexer1.
intVect(icell);
1204 detail::call_f_intvect(f1, iv);
1206 if (icell < indexer2.
numPts()) {
1207 auto iv = indexer2.
intVect(icell);
1208 detail::call_f_intvect(f2, iv);
1210 if (icell < indexer3.
numPts()) {
1211 auto iv = indexer3.
intVect(icell);
1212 detail::call_f_intvect(f3, iv);
1223template <
int MT, std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
1224requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
1233 const auto ec = Gpu::makeExecutionConfig<MT>(std::max(box1.
numPts(),box2.
numPts()));
1236 auto const ncells = std::max(indexer1.
numPts(), indexer2.
numPts());
1237 for (std::uint64_t icell = std::uint64_t(MT)*blockIdx.x+threadIdx.x, stride = std::uint64_t(MT)*gridDim.x;
1238 icell < ncells; icell += stride) {
1239 if (icell < indexer1.
numPts()) {
1240 auto iv = indexer1.
intVect(icell);
1241 detail::call_f_intvect_ncomp(f1, iv, ncomp1);
1243 if (icell < indexer2.
numPts()) {
1244 auto iv = indexer2.
intVect(icell);
1245 detail::call_f_intvect_ncomp(f2, iv, ncomp2);
1256template <
int MT, std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
1257requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value &&
1258 MaybeDeviceRunnable<L3>::value)
1269 const auto ec = Gpu::makeExecutionConfig<MT>(std::max({box1.
numPts(),box2.
numPts(),box3.
numPts()}));
1272 auto const ncells = std::max({indexer1.
numPts(), indexer2.
numPts(), indexer3.
numPts()});
1273 for (std::uint64_t icell = std::uint64_t(MT)*blockIdx.x+threadIdx.x, stride = std::uint64_t(MT)*gridDim.x;
1274 icell < ncells; icell += stride) {
1275 if (icell < indexer1.
numPts()) {
1276 auto iv = indexer1.
intVect(icell);
1277 detail::call_f_intvect_ncomp(f1, iv, ncomp1);
1279 if (icell < indexer2.
numPts()) {
1280 auto iv = indexer2.
intVect(icell);
1281 detail::call_f_intvect_ncomp(f2, iv, ncomp2);
1283 if (icell < indexer3.
numPts()) {
1284 auto iv = indexer3.
intVect(icell);
1285 detail::call_f_intvect_ncomp(f3, iv, ncomp3);
1294template <
typename L>
1300template<
typename T,
typename L>
1303 launch<AMREX_GPU_MAX_THREADS>(n, std::forward<L>(f));
1310template <std::
integral T,
typename L>
1311requires (MaybeDeviceRunnable<L>::value)
1315 ParallelFor<AMREX_GPU_MAX_THREADS>(info, n, std::forward<L>(f));
1322template <
typename L,
int dim>
1323requires (MaybeDeviceRunnable<L>::value)
1327 ParallelFor<AMREX_GPU_MAX_THREADS>(info, box, std::forward<L>(f));
1334template <std::
integral T,
typename L,
int dim>
1335requires (MaybeDeviceRunnable<L>::value)
1339 ParallelFor<AMREX_GPU_MAX_THREADS>(info, box, ncomp, std::forward<L>(f));
1346template <
typename L1,
typename L2,
int dim>
1347requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
1352 ParallelFor<AMREX_GPU_MAX_THREADS>(info, box1, box2, std::forward<L1>(f1),
1353 std::forward<L2>(f2));
1360template <
typename L1,
typename L2,
typename L3,
int dim>
1361requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value &&
1362 MaybeDeviceRunnable<L3>::value)
1366 L1&& f1, L2&& f2, L3&& f3)
noexcept
1368 ParallelFor<AMREX_GPU_MAX_THREADS>(info, box1, box2, box3, std::forward<L1>(f1),
1369 std::forward<L2>(f2), std::forward<L3>(f3));
1376template <std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
1377requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
1381 BoxND<dim> const& box2, T2 ncomp2, L2&& f2)
noexcept
1383 ParallelFor<AMREX_GPU_MAX_THREADS>(info, box1, ncomp1, std::forward<L1>(f1),
1384 box2, ncomp2, std::forward<L2>(f2));
1391template <std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
1392requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value &&
1393 MaybeDeviceRunnable<L3>::value)
1398 BoxND<dim> const& box3, T3 ncomp3, L3&& f3)
noexcept
1400 ParallelFor<AMREX_GPU_MAX_THREADS>(info, box1, ncomp1, std::forward<L1>(f1),
1401 box2, ncomp2, std::forward<L2>(f2),
1402 box3, ncomp3, std::forward<L3>(f3));
1405template <std::
integral T,
typename L>
1406void For (Gpu::KernelInfo
const& info, T n, L&& f)
noexcept
1408 ParallelFor<AMREX_GPU_MAX_THREADS>(info, n,std::forward<L>(f));
1411template <
int MT, std::
integral T,
typename L>
1412void For (Gpu::KernelInfo
const& info, T n, L&& f)
noexcept
1414 ParallelFor<MT>(info, n,std::forward<L>(f));
1417template <
typename L,
int dim>
1418void For (Gpu::KernelInfo
const& info, BoxND<dim>
const& box, L&& f)
noexcept
1420 ParallelFor<AMREX_GPU_MAX_THREADS>(info, box,std::forward<L>(f));
1423template <
int MT,
typename L,
int dim>
1424void For (Gpu::KernelInfo
const& info, BoxND<dim>
const& box, L&& f)
noexcept
1426 ParallelFor<MT>(info, box,std::forward<L>(f));
1429template <std::
integral T,
typename L,
int dim>
1430void For (Gpu::KernelInfo
const& info, BoxND<dim>
const& box, T ncomp, L&& f)
noexcept
1432 ParallelFor<AMREX_GPU_MAX_THREADS>(info,box,ncomp,std::forward<L>(f));
1435template <
int MT, std::
integral T,
typename L,
int dim>
1436void For (Gpu::KernelInfo
const& info, BoxND<dim>
const& box, T ncomp, L&& f)
noexcept
1438 ParallelFor<MT>(info,box,ncomp,std::forward<L>(f));
1441template <
typename L1,
typename L2,
int dim>
1442void For (Gpu::KernelInfo
const& info,
1443 BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1&& f1, L2&& f2)
noexcept
1445 ParallelFor<AMREX_GPU_MAX_THREADS>(info,box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
1448template <
int MT,
typename L1,
typename L2,
int dim>
1449void For (Gpu::KernelInfo
const& info,
1450 BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1&& f1, L2&& f2)
noexcept
1452 ParallelFor<MT>(info,box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
1455template <
typename L1,
typename L2,
typename L3,
int dim>
1456void For (Gpu::KernelInfo
const& info,
1457 BoxND<dim>
const& box1, BoxND<dim>
const& box2, BoxND<dim>
const& box3,
1458 L1&& f1, L2&& f2, L3&& f3)
noexcept
1460 ParallelFor<AMREX_GPU_MAX_THREADS>(info,box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
1463template <
int MT,
typename L1,
typename L2,
typename L3,
int dim>
1464void For (Gpu::KernelInfo
const& info,
1465 BoxND<dim>
const& box1, BoxND<dim>
const& box2, BoxND<dim>
const& box3,
1466 L1&& f1, L2&& f2, L3&& f3)
noexcept
1468 ParallelFor<MT>(info,box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
1471template <std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
1472void For (Gpu::KernelInfo
const& info,
1473 BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1474 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2)
noexcept
1476 ParallelFor<AMREX_GPU_MAX_THREADS>(info,box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
1479template <
int MT, std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
1480void For (Gpu::KernelInfo
const& info,
1481 BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1482 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2)
noexcept
1484 ParallelFor<MT>(info,box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
1487template <std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
1488void For (Gpu::KernelInfo
const& info,
1489 BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1490 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2,
1491 BoxND<dim>
const& box3, T3 ncomp3, L3&& f3)
noexcept
1493 ParallelFor<AMREX_GPU_MAX_THREADS>(info,
1494 box1,ncomp1,std::forward<L1>(f1),
1495 box2,ncomp2,std::forward<L2>(f2),
1496 box3,ncomp3,std::forward<L3>(f3));
1499template <
int MT, std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
1500void For (Gpu::KernelInfo
const& info,
1501 BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1502 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2,
1503 BoxND<dim>
const& box3, T3 ncomp3, L3&& f3)
noexcept
1505 ParallelFor<MT>(info,
1506 box1,ncomp1,std::forward<L1>(f1),
1507 box2,ncomp2,std::forward<L2>(f2),
1508 box3,ncomp3,std::forward<L3>(f3));
1515template <std::
integral T,
typename L>
1518 ParallelFor<AMREX_GPU_MAX_THREADS>(
Gpu::KernelInfo{}, n, std::forward<L>(f));
1525template <
int MT, std::
integral T,
typename L>
1528 ParallelFor<MT>(Gpu::KernelInfo{}, n, std::forward<L>(f));
1535template <
typename L,
int dim>
1538 ParallelFor<AMREX_GPU_MAX_THREADS>(
Gpu::KernelInfo{}, box, std::forward<L>(f));
1545template <
int MT,
typename L,
int dim>
1546void ParallelFor (BoxND<dim>
const& box, L&& f)
noexcept
1548 ParallelFor<MT>(Gpu::KernelInfo{}, box, std::forward<L>(f));
1555template <std::
integral T,
typename L,
int dim>
1558 ParallelFor<AMREX_GPU_MAX_THREADS>(
Gpu::KernelInfo{},box,ncomp,std::forward<L>(f));
1565template <
int MT, std::
integral T,
typename L,
int dim>
1566void ParallelFor (BoxND<dim>
const& box, T ncomp, L&& f)
noexcept
1568 ParallelFor<MT>(Gpu::KernelInfo{},box,ncomp,std::forward<L>(f));
1575template <
typename L1,
typename L2,
int dim>
1576void ParallelFor (BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1&& f1, L2&& f2)
noexcept
1578 ParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
1585template <
int MT,
typename L1,
typename L2,
int dim>
1586void ParallelFor (BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1&& f1, L2&& f2)
noexcept
1588 ParallelFor<MT>(Gpu::KernelInfo{},box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
1595template <
typename L1,
typename L2,
typename L3,
int dim>
1596void ParallelFor (BoxND<dim>
const& box1, BoxND<dim>
const& box2, BoxND<dim>
const& box3,
1597 L1&& f1, L2&& f2, L3&& f3)
noexcept
1599 ParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
1606template <
int MT,
typename L1,
typename L2,
typename L3,
int dim>
1607void ParallelFor (BoxND<dim>
const& box1, BoxND<dim>
const& box2, BoxND<dim>
const& box3,
1608 L1&& f1, L2&& f2, L3&& f3)
noexcept
1610 ParallelFor<MT>(Gpu::KernelInfo{},box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
1617template <std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
1618void ParallelFor (BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1619 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2)
noexcept
1621 ParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
1628template <
int MT, std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
1629void ParallelFor (BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1630 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2)
noexcept
1632 ParallelFor<MT>(Gpu::KernelInfo{},box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
1639template <std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
1640void ParallelFor (BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1641 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2,
1642 BoxND<dim>
const& box3, T3 ncomp3, L3&& f3)
noexcept
1644 ParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},
1645 box1,ncomp1,std::forward<L1>(f1),
1646 box2,ncomp2,std::forward<L2>(f2),
1647 box3,ncomp3,std::forward<L3>(f3));
1654template <
int MT, std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
1655void ParallelFor (BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1656 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2,
1657 BoxND<dim>
const& box3, T3 ncomp3, L3&& f3)
noexcept
1659 ParallelFor<MT>(Gpu::KernelInfo{},
1660 box1,ncomp1,std::forward<L1>(f1),
1661 box2,ncomp2,std::forward<L2>(f2),
1662 box3,ncomp3,std::forward<L3>(f3));
1665template <std::
integral T,
typename L>
1668 ParallelFor<AMREX_GPU_MAX_THREADS>(
Gpu::KernelInfo{}, n,std::forward<L>(f));
1671template <
int MT, std::
integral T,
typename L>
1672void For (T n, L&& f)
noexcept
1674 ParallelFor<MT>(Gpu::KernelInfo{}, n,std::forward<L>(f));
1677template <
typename L,
int dim>
1680 ParallelFor<AMREX_GPU_MAX_THREADS>(
Gpu::KernelInfo{}, box,std::forward<L>(f));
1683template <
int MT,
typename L,
int dim>
1684void For (BoxND<dim>
const& box, L&& f)
noexcept
1686 ParallelFor<MT>(Gpu::KernelInfo{}, box,std::forward<L>(f));
1689template <std::
integral T,
typename L,
int dim>
1692 ParallelFor<AMREX_GPU_MAX_THREADS>(
Gpu::KernelInfo{},box,ncomp,std::forward<L>(f));
1695template <
int MT, std::
integral T,
typename L,
int dim>
1696void For (BoxND<dim>
const& box, T ncomp, L&& f)
noexcept
1698 ParallelFor<MT>(Gpu::KernelInfo{},box,ncomp,std::forward<L>(f));
1701template <
typename L1,
typename L2,
int dim>
1702void For (BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1&& f1, L2&& f2)
noexcept
1704 ParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
1707template <
int MT,
typename L1,
typename L2,
int dim>
1708void For (BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1&& f1, L2&& f2)
noexcept
1710 ParallelFor<MT>(Gpu::KernelInfo{},box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
1713template <
typename L1,
typename L2,
typename L3,
int dim>
1714void For (BoxND<dim>
const& box1, BoxND<dim>
const& box2, BoxND<dim>
const& box3,
1715 L1&& f1, L2&& f2, L3&& f3)
noexcept
1717 ParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
1720template <
int MT,
typename L1,
typename L2,
typename L3,
int dim>
1721void For (BoxND<dim>
const& box1, BoxND<dim>
const& box2, BoxND<dim>
const& box3,
1722 L1&& f1, L2&& f2, L3&& f3)
noexcept
1724 ParallelFor<MT>(Gpu::KernelInfo{},box1,box2,box3,std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
1727template <std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
1728void For (BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1729 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2)
noexcept
1731 ParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
1734template <
int MT, std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
1735void For (BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1736 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2)
noexcept
1738 ParallelFor<MT>(Gpu::KernelInfo{},box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
1741template <std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
1742void For (BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1743 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2,
1744 BoxND<dim>
const& box3, T3 ncomp3, L3&& f3)
noexcept
1746 ParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},
1747 box1,ncomp1,std::forward<L1>(f1),
1748 box2,ncomp2,std::forward<L2>(f2),
1749 box3,ncomp3,std::forward<L3>(f3));
1752template <
int MT, std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
1753void For (BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
1754 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2,
1755 BoxND<dim>
const& box3, T3 ncomp3, L3&& f3)
noexcept
1757 ParallelFor<MT>(Gpu::KernelInfo{},
1758 box1,ncomp1,std::forward<L1>(f1),
1759 box2,ncomp2,std::forward<L2>(f2),
1760 box3,ncomp3,std::forward<L3>(f3));
1763template <std::
integral T,
typename L>
1764requires (MaybeHostDeviceRunnable<L>::value)
1769 ParallelFor<AMREX_GPU_MAX_THREADS>(info,n,std::forward<L>(f));
1771#ifdef AMREX_USE_SYCL
1772 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1775 for (T i = 0; i < n; ++i) { f(i); }
1780template <
int MT, std::
integral T,
typename L>
1781requires (MaybeHostDeviceRunnable<L>::value)
1786 ParallelFor<MT>(info,n,std::forward<L>(f));
1788#ifdef AMREX_USE_SYCL
1789 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1792 for (T i = 0; i < n; ++i) { f(i); }
1797template <std::
integral T,
typename L>
1798requires (MaybeHostDeviceRunnable<L>::value)
1802 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(
Gpu::KernelInfo{}, n, std::forward<L>(f));
1805template <
int MT, std::
integral T,
typename L>
1806requires (MaybeHostDeviceRunnable<L>::value)
1813template <
typename L,
int dim>
1814requires (MaybeHostDeviceRunnable<L>::value)
1819 ParallelFor<AMREX_GPU_MAX_THREADS>(info, box,std::forward<L>(f));
1821#ifdef AMREX_USE_SYCL
1822 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1829template <
int MT,
typename L,
int dim>
1830requires (MaybeHostDeviceRunnable<L>::value)
1835 ParallelFor<MT>(info, box,std::forward<L>(f));
1837#ifdef AMREX_USE_SYCL
1838 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1845template <std::
integral T,
typename L,
int dim>
1846requires (MaybeHostDeviceRunnable<L>::value)
1851 ParallelFor<AMREX_GPU_MAX_THREADS>(info, box,ncomp,std::forward<L>(f));
1853#ifdef AMREX_USE_SYCL
1854 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1861template <
int MT, std::
integral T,
typename L,
int dim>
1862requires (MaybeHostDeviceRunnable<L>::value)
1867 ParallelFor<MT>(info, box,ncomp,std::forward<L>(f));
1869#ifdef AMREX_USE_SYCL
1870 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1877template <
typename L1,
typename L2,
int dim>
1878requires (MaybeHostDeviceRunnable<L1>::value && MaybeHostDeviceRunnable<L2>::value)
1884 ParallelFor<AMREX_GPU_MAX_THREADS>(info,box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
1886#ifdef AMREX_USE_SYCL
1887 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1895template <
int MT,
typename L1,
typename L2,
int dim>
1896requires (MaybeHostDeviceRunnable<L1>::value && MaybeHostDeviceRunnable<L2>::value)
1902 ParallelFor<MT>(info,box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
1904#ifdef AMREX_USE_SYCL
1905 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1913template <
typename L1,
typename L2,
typename L3,
int dim>
1914requires (MaybeHostDeviceRunnable<L1>::value && MaybeHostDeviceRunnable<L2>::value &&
1915 MaybeHostDeviceRunnable<L3>::value)
1919 L1&& f1, L2&& f2, L3&& f3)
1922 ParallelFor<AMREX_GPU_MAX_THREADS>(info,box1,box2,box3,
1923 std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
1925#ifdef AMREX_USE_SYCL
1926 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1935template <
int MT,
typename L1,
typename L2,
typename L3,
int dim>
1936requires (MaybeHostDeviceRunnable<L1>::value && MaybeHostDeviceRunnable<L2>::value &&
1937 MaybeHostDeviceRunnable<L3>::value)
1941 L1&& f1, L2&& f2, L3&& f3)
1944 ParallelFor<MT>(info,box1,box2,box3,
1945 std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
1947#ifdef AMREX_USE_SYCL
1948 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1957template <std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
1958requires (MaybeHostDeviceRunnable<L1>::value && MaybeHostDeviceRunnable<L2>::value)
1965 ParallelFor<AMREX_GPU_MAX_THREADS>(info,box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
1967#ifdef AMREX_USE_SYCL
1968 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1976template <
int MT, std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
1977requires (MaybeHostDeviceRunnable<L1>::value && MaybeHostDeviceRunnable<L2>::value)
1984 ParallelFor<MT>(info,box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
1986#ifdef AMREX_USE_SYCL
1987 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
1995template <std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
1996requires (MaybeHostDeviceRunnable<L1>::value && MaybeHostDeviceRunnable<L2>::value &&
1997 MaybeHostDeviceRunnable<L3>::value)
2005 ParallelFor<AMREX_GPU_MAX_THREADS>(info,
2006 box1,ncomp1,std::forward<L1>(f1),
2007 box2,ncomp2,std::forward<L2>(f2),
2008 box3,ncomp3,std::forward<L3>(f3));
2010#ifdef AMREX_USE_SYCL
2011 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
2020template <
int MT, std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
2021requires (MaybeHostDeviceRunnable<L1>::value && MaybeHostDeviceRunnable<L2>::value &&
2022 MaybeHostDeviceRunnable<L3>::value)
2030 ParallelFor<MT>(info,
2031 box1,ncomp1,std::forward<L1>(f1),
2032 box2,ncomp2,std::forward<L2>(f2),
2033 box3,ncomp3,std::forward<L3>(f3));
2035#ifdef AMREX_USE_SYCL
2036 amrex::Abort(
"amrex:: HOST_DEVICE disabled for Intel. It takes too long to compile");
2045template <std::
integral T,
typename L>
2046void HostDeviceFor (Gpu::KernelInfo
const& info, T n, L&& f)
noexcept
2048 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(info,n,std::forward<L>(f));
2051template <
int MT, std::
integral T,
typename L>
2052void HostDeviceFor (Gpu::KernelInfo
const& info, T n, L&& f)
noexcept
2054 HostDeviceParallelFor<MT>(info,n,std::forward<L>(f));
2057template <
typename L,
int dim>
2058void HostDeviceFor (Gpu::KernelInfo
const& info, BoxND<dim>
const& box, L&& f)
noexcept
2060 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(info,box,std::forward<L>(f));
2063template <
int MT,
typename L,
int dim>
2064void HostDeviceFor (Gpu::KernelInfo
const& info, BoxND<dim>
const& box, L&& f)
noexcept
2066 HostDeviceParallelFor<MT>(info,box,std::forward<L>(f));
2069template <std::
integral T,
typename L,
int dim>
2070void HostDeviceFor (Gpu::KernelInfo
const& info, BoxND<dim>
const& box, T ncomp, L&& f)
noexcept
2072 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(info,box,ncomp,std::forward<L>(f));
2075template <
int MT, std::
integral T,
typename L,
int dim>
2076void HostDeviceFor (Gpu::KernelInfo
const& info, BoxND<dim>
const& box, T ncomp, L&& f)
noexcept
2078 HostDeviceParallelFor<MT>(info,box,ncomp,std::forward<L>(f));
2081template <
typename L1,
typename L2,
int dim>
2083 BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1&& f1, L2&& f2)
noexcept
2085 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(info,box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
2088template <
int MT,
typename L1,
typename L2,
int dim>
2090 BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1&& f1, L2&& f2)
noexcept
2092 HostDeviceParallelFor<MT>(info,box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
2095template <
typename L1,
typename L2,
typename L3,
int dim>
2097 BoxND<dim>
const& box1, BoxND<dim>
const& box2, BoxND<dim>
const& box3,
2098 L1&& f1, L2&& f2, L3&& f3)
noexcept
2100 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(info, box1,box2,box3,
2101 std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
2104template <
int MT,
typename L1,
typename L2,
typename L3,
int dim>
2106 BoxND<dim>
const& box1, BoxND<dim>
const& box2, BoxND<dim>
const& box3,
2107 L1&& f1, L2&& f2, L3&& f3)
noexcept
2109 HostDeviceParallelFor<MT>(info, box1,box2,box3,
2110 std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
2113template <std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
2115 BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
2116 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2)
noexcept
2118 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(info,box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
2121template <
int MT, std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
2123 BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
2124 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2)
noexcept
2126 HostDeviceParallelFor<MT>(info,box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
2129template <std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
2131 BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
2132 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2,
2133 BoxND<dim>
const& box3, T3 ncomp3, L3&& f3)
noexcept
2135 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(info,
2136 box1,ncomp1,std::forward<L1>(f1),
2137 box2,ncomp2,std::forward<L2>(f2),
2138 box3,ncomp3,std::forward<L3>(f3));
2141template <
int MT, std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
2143 BoxND<dim>
const& box1, T1 ncomp1, L1&& f1,
2144 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2,
2145 BoxND<dim>
const& box3, T3 ncomp3, L3&& f3)
noexcept
2147 HostDeviceParallelFor<MT>(info,
2148 box1,ncomp1,std::forward<L1>(f1),
2149 box2,ncomp2,std::forward<L2>(f2),
2150 box3,ncomp3,std::forward<L3>(f3));
2153template <std::
integral T,
typename L>
2156 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},n,std::forward<L>(f));
2159template <
int MT, std::
integral T,
typename L>
2162 HostDeviceParallelFor<MT>(Gpu::KernelInfo{},n,std::forward<L>(f));
2165template <
typename L,
int dim>
2168 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},box,std::forward<L>(f));
2171template <
int MT,
typename L,
int dim>
2174 HostDeviceParallelFor<MT>(Gpu::KernelInfo{},box,std::forward<L>(f));
2177template <std::
integral T,
typename L,
int dim>
2180 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},box,ncomp,std::forward<L>(f));
2183template <
int MT, std::
integral T,
typename L,
int dim>
2186 HostDeviceParallelFor<MT>(Gpu::KernelInfo{},box,ncomp,std::forward<L>(f));
2189template <
typename L1,
typename L2,
int dim>
2190void HostDeviceParallelFor (BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1&& f1, L2&& f2)
noexcept
2192 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
2195template <
int MT,
typename L1,
typename L2,
int dim>
2196void HostDeviceParallelFor (BoxND<dim>
const& box1, BoxND<dim>
const& box2, L1&& f1, L2&& f2)
noexcept
2198 HostDeviceParallelFor<MT>(Gpu::KernelInfo{},box1,box2,std::forward<L1>(f1),std::forward<L2>(f2));
2201template <
typename L1,
typename L2,
typename L3,
int dim>
2203 L1&& f1, L2&& f2, L3&& f3)
noexcept
2205 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{}, box1,box2,box3,
2206 std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
2209template <
int MT,
typename L1,
typename L2,
typename L3,
int dim>
2211 L1&& f1, L2&& f2, L3&& f3)
noexcept
2213 HostDeviceParallelFor<MT>(Gpu::KernelInfo{}, box1,box2,box3,
2214 std::forward<L1>(f1),std::forward<L2>(f2),std::forward<L3>(f3));
2217template <std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
2219 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2)
noexcept
2221 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
2224template <
int MT, std::
integral T1, std::
integral T2,
typename L1,
typename L2,
int dim>
2226 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2)
noexcept
2228 HostDeviceParallelFor<MT>(Gpu::KernelInfo{},box1,ncomp1,std::forward<L1>(f1),box2,ncomp2,std::forward<L2>(f2));
2231template <std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
2233 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2,
2234 BoxND<dim>
const& box3, T3 ncomp3, L3&& f3)
noexcept
2236 HostDeviceParallelFor<AMREX_GPU_MAX_THREADS>(Gpu::KernelInfo{},
2237 box1,ncomp1,std::forward<L1>(f1),
2238 box2,ncomp2,std::forward<L2>(f2),
2239 box3,ncomp3,std::forward<L3>(f3));
2242template <
int MT, std::
integral T1, std::
integral T2, std::
integral T3,
typename L1,
typename L2,
typename L3,
int dim>
2244 BoxND<dim>
const& box2, T2 ncomp2, L2&& f2,
2245 BoxND<dim>
const& box3, T3 ncomp3, L3&& f3)
noexcept
2247 HostDeviceParallelFor<MT>(Gpu::KernelInfo{},
2248 box1,ncomp1,std::forward<L1>(f1),
2249 box2,ncomp2,std::forward<L2>(f2),
2250 box3,ncomp3,std::forward<L3>(f3));
#define AMREX_PRAGMA_SIMD
Definition AMReX_Extension.H:85
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:124
#define AMREX_GPU_ERROR_CHECK()
Definition AMReX_GpuError.H:151
#define AMREX_LAUNCH_KERNEL(MT, blocks, threads, sharedMem, stream,...)
Definition AMReX_GpuLaunch.H:37
#define AMREX_LAUNCH_KERNEL_NOBOUND(blocks, threads, sharedMem, stream,...)
Definition AMReX_GpuLaunch.H:39
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
A Rectangular Domain on an Integer Lattice.
Definition AMReX_Box.H:54
__host__ __device__ bool isEmpty() const noexcept
Checks if it is an empty BoxND.
Definition AMReX_Box.H:223
__host__ __device__ Long numPts() const noexcept
Return the number of points contained in the BoxND.
Definition AMReX_Box.H:385
__host__ __device__ IndexTypeND< dim > ixType() const noexcept
Return the indexing type.
Definition AMReX_Box.H:148
static unsigned int maxBlocksPerLaunch() noexcept
Definition AMReX_GpuDevice.H:239
static constexpr int warp_size
Definition AMReX_GpuDevice.H:236
Definition AMReX_GpuKernelInfo.H:8
amrex_long Long
Definition AMReX_INT.H:30
__host__ __device__ constexpr const T & min(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:31
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:53
__host__ __device__ range_detail::range_impl< T > Range(T const &b) noexcept
Definition AMReX_GpuRange.H:128
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:310
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:88
gpuStream_t gpuStream() noexcept
Definition AMReX_GpuDevice.H:291
Definition AMReX_Amr.cpp:50
__host__ __device__ void ignore_unused(const Ts &...)
No-op helper that marks variables as intentionally unused.
Definition AMReX.H:259
void HostDeviceParallelFor(T n, L &&f) noexcept
Definition AMReX_GpuLaunchFunctsC.H:732
void For(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:400
cudaStream_t gpuStream_t
Definition AMReX_GpuControl.H:79
randState_t * getRandState()
Definition AMReX_RandomEngine.H:65
void launch(T const &n, L const &f) noexcept
Definition AMReX_GpuLaunchFunctsC.H:122
void ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:202
void HostDeviceFor(T n, L &&f) noexcept
Definition AMReX_GpuLaunchFunctsC.H:835
bool isEmpty(T n) noexcept
Definition AMReX_GpuRange.H:15
void single_task(L &&f) noexcept
Definition AMReX_GpuLaunchFunctsC.H:1245
AMREX_ATTRIBUTE_FLATTEN_FOR void ParallelForRNG(T n, L const &f) noexcept
Definition AMReX_GpuLaunchFunctsC.H:1157
curandState_t randState_t
Definition AMReX_RandomEngine.H:58
void LoopConcurrentOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition AMReX_Loop.H:388
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:242
__host__ __device__ constexpr int get(IntVectND< dim > const &iv) noexcept
Get I'th element of IntVectND<dim>
Definition AMReX_IntVect.H:1338
Utility that maps flattened point indices back to IntVectND coordinates.
Definition AMReX_Box.H:2494
__host__ __device__ IntVectND< dim > intVect(std::uint64_t icell) const
Convert flattened point index icell to its IntVectND coordinate.
Definition AMReX_Box.H:2517
__host__ __device__ std::uint64_t numPts() const
Return the number of points covered by the indexed box.
Definition AMReX_Box.H:2552
Definition AMReX_GpuLaunch.H:121
Definition AMReX_GpuTypes.H:88
Definition AMReX_RandomEngine.H:72