From 27a3dc310723acda54d70c42b493a808e4c27199 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Fri, 30 Jun 2023 19:52:43 -0400 Subject: [PATCH] CarpetX: Split all boundary template instantiations --- CarpetX/src/boundaries_impl.hxx | 17 +++++++++-- CarpetX/src/boundaries_impl_int_int_neg.cxx | 7 +++++ CarpetX/src/boundaries_impl_int_int_pos.cxx | 7 +++++ CarpetX/src/boundaries_impl_int_neg_int.cxx | 7 +++++ CarpetX/src/boundaries_impl_int_neg_pos.cxx | 7 +++++ CarpetX/src/boundaries_impl_int_pos_int.cxx | 7 +++++ CarpetX/src/boundaries_impl_int_pos_neg.cxx | 7 +++++ CarpetX/src/boundaries_impl_int_pos_pos.cxx | 7 +++++ CarpetX/src/boundaries_impl_neg_int_int.cxx | 7 +++++ CarpetX/src/boundaries_impl_neg_int_neg.cxx | 7 +++++ CarpetX/src/boundaries_impl_neg_int_pos.cxx | 7 +++++ CarpetX/src/boundaries_impl_neg_neg_int.cxx | 7 +++++ CarpetX/src/boundaries_impl_neg_neg_pos.cxx | 7 +++++ CarpetX/src/boundaries_impl_neg_pos_int.cxx | 7 +++++ CarpetX/src/boundaries_impl_neg_pos_neg.cxx | 7 +++++ CarpetX/src/boundaries_impl_neg_pos_pos.cxx | 7 +++++ CarpetX/src/boundaries_impl_pos_int_int.cxx | 7 +++++ CarpetX/src/boundaries_impl_pos_int_neg.cxx | 7 +++++ CarpetX/src/boundaries_impl_pos_int_pos.cxx | 7 +++++ CarpetX/src/boundaries_impl_pos_neg_int.cxx | 7 +++++ CarpetX/src/boundaries_impl_pos_neg_pos.cxx | 7 +++++ CarpetX/src/boundaries_impl_pos_pos_int.cxx | 7 +++++ CarpetX/src/boundaries_impl_pos_pos_neg.cxx | 7 +++++ CarpetX/src/boundaries_impl_pos_pos_pos.cxx | 7 +++++ CarpetX/src/make.code.defn | 31 +++++++++++++++------ 25 files changed, 199 insertions(+), 10 deletions(-) create mode 100644 CarpetX/src/boundaries_impl_int_int_neg.cxx create mode 100644 CarpetX/src/boundaries_impl_int_int_pos.cxx create mode 100644 CarpetX/src/boundaries_impl_int_neg_int.cxx create mode 100644 CarpetX/src/boundaries_impl_int_neg_pos.cxx create mode 100644 CarpetX/src/boundaries_impl_int_pos_int.cxx create mode 100644 CarpetX/src/boundaries_impl_int_pos_neg.cxx create mode 100644 CarpetX/src/boundaries_impl_int_pos_pos.cxx create mode 100644 CarpetX/src/boundaries_impl_neg_int_int.cxx create mode 100644 CarpetX/src/boundaries_impl_neg_int_neg.cxx create mode 100644 CarpetX/src/boundaries_impl_neg_int_pos.cxx create mode 100644 CarpetX/src/boundaries_impl_neg_neg_int.cxx create mode 100644 CarpetX/src/boundaries_impl_neg_neg_pos.cxx create mode 100644 CarpetX/src/boundaries_impl_neg_pos_int.cxx create mode 100644 CarpetX/src/boundaries_impl_neg_pos_neg.cxx create mode 100644 CarpetX/src/boundaries_impl_neg_pos_pos.cxx create mode 100644 CarpetX/src/boundaries_impl_pos_int_int.cxx create mode 100644 CarpetX/src/boundaries_impl_pos_int_neg.cxx create mode 100644 CarpetX/src/boundaries_impl_pos_int_pos.cxx create mode 100644 CarpetX/src/boundaries_impl_pos_neg_int.cxx create mode 100644 CarpetX/src/boundaries_impl_pos_neg_pos.cxx create mode 100644 CarpetX/src/boundaries_impl_pos_pos_int.cxx create mode 100644 CarpetX/src/boundaries_impl_pos_pos_neg.cxx create mode 100644 CarpetX/src/boundaries_impl_pos_pos_pos.cxx diff --git a/CarpetX/src/boundaries_impl.hxx b/CarpetX/src/boundaries_impl.hxx index 9ebece707..a87344143 100644 --- a/CarpetX/src/boundaries_impl.hxx +++ b/CarpetX/src/boundaries_impl.hxx @@ -75,6 +75,16 @@ task_t make_task(F &&kernel, const Arith::vect &imin, return {std::forward(kernel), imin, imax, cmin, cmax}; } +template void loop_task(const task_t &task) { + amrex::ParallelFor( + task.box(), + [kernel = task.kernel, cmin = task.cmin, cmax = task.cmax] CCTK_DEVICE( + const int i, const int j, const int k) CCTK_ATTRIBUTE_ALWAYS_INLINE { + const Arith::vect p{i, j, k}; + kernel(p, cmin, cmax); + }); +} + template void loop_tasks(const amrex::Vector > &tasks) { #ifdef AMREX_USE_GPU amrex::ParallelFor(tasks, [=] CCTK_DEVICE(const int i, const int j, @@ -561,8 +571,11 @@ void BoundaryCondition::apply_on_face_symbcxyz( } }; const auto task = make_task(std::move(kernel), bmin, bmax, cmin, cmax); - const amrex::Vector tasks{task}; - loop_tasks(tasks); + // Note: collecting single kernels slows things down. We probably + // need to collect all kernels together. + loop_task(task); + // const amrex::Vector tasks{task}; + // loop_tasks(tasks); } } diff --git a/CarpetX/src/boundaries_impl_int_int_neg.cxx b/CarpetX/src/boundaries_impl_int_int_neg.cxx new file mode 100644 index 000000000..2b748a9db --- /dev/null +++ b/CarpetX/src/boundaries_impl_int_int_neg.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_int_int_pos.cxx b/CarpetX/src/boundaries_impl_int_int_pos.cxx new file mode 100644 index 000000000..9077a91f2 --- /dev/null +++ b/CarpetX/src/boundaries_impl_int_int_pos.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_int_neg_int.cxx b/CarpetX/src/boundaries_impl_int_neg_int.cxx new file mode 100644 index 000000000..db415df2f --- /dev/null +++ b/CarpetX/src/boundaries_impl_int_neg_int.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_int_neg_pos.cxx b/CarpetX/src/boundaries_impl_int_neg_pos.cxx new file mode 100644 index 000000000..6acf27d25 --- /dev/null +++ b/CarpetX/src/boundaries_impl_int_neg_pos.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_int_pos_int.cxx b/CarpetX/src/boundaries_impl_int_pos_int.cxx new file mode 100644 index 000000000..ae0972251 --- /dev/null +++ b/CarpetX/src/boundaries_impl_int_pos_int.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_int_pos_neg.cxx b/CarpetX/src/boundaries_impl_int_pos_neg.cxx new file mode 100644 index 000000000..b0baf34f5 --- /dev/null +++ b/CarpetX/src/boundaries_impl_int_pos_neg.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_int_pos_pos.cxx b/CarpetX/src/boundaries_impl_int_pos_pos.cxx new file mode 100644 index 000000000..9124c81c9 --- /dev/null +++ b/CarpetX/src/boundaries_impl_int_pos_pos.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_neg_int_int.cxx b/CarpetX/src/boundaries_impl_neg_int_int.cxx new file mode 100644 index 000000000..c723d93fc --- /dev/null +++ b/CarpetX/src/boundaries_impl_neg_int_int.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_neg_int_neg.cxx b/CarpetX/src/boundaries_impl_neg_int_neg.cxx new file mode 100644 index 000000000..9b157e192 --- /dev/null +++ b/CarpetX/src/boundaries_impl_neg_int_neg.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_neg_int_pos.cxx b/CarpetX/src/boundaries_impl_neg_int_pos.cxx new file mode 100644 index 000000000..dbef7771e --- /dev/null +++ b/CarpetX/src/boundaries_impl_neg_int_pos.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_neg_neg_int.cxx b/CarpetX/src/boundaries_impl_neg_neg_int.cxx new file mode 100644 index 000000000..81cbc6e2d --- /dev/null +++ b/CarpetX/src/boundaries_impl_neg_neg_int.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_neg_neg_pos.cxx b/CarpetX/src/boundaries_impl_neg_neg_pos.cxx new file mode 100644 index 000000000..13ba26636 --- /dev/null +++ b/CarpetX/src/boundaries_impl_neg_neg_pos.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_neg_pos_int.cxx b/CarpetX/src/boundaries_impl_neg_pos_int.cxx new file mode 100644 index 000000000..ac197f908 --- /dev/null +++ b/CarpetX/src/boundaries_impl_neg_pos_int.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_neg_pos_neg.cxx b/CarpetX/src/boundaries_impl_neg_pos_neg.cxx new file mode 100644 index 000000000..46b496ec1 --- /dev/null +++ b/CarpetX/src/boundaries_impl_neg_pos_neg.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_neg_pos_pos.cxx b/CarpetX/src/boundaries_impl_neg_pos_pos.cxx new file mode 100644 index 000000000..e589d3016 --- /dev/null +++ b/CarpetX/src/boundaries_impl_neg_pos_pos.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_pos_int_int.cxx b/CarpetX/src/boundaries_impl_pos_int_int.cxx new file mode 100644 index 000000000..7a34705ba --- /dev/null +++ b/CarpetX/src/boundaries_impl_pos_int_int.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_pos_int_neg.cxx b/CarpetX/src/boundaries_impl_pos_int_neg.cxx new file mode 100644 index 000000000..5f84e9c41 --- /dev/null +++ b/CarpetX/src/boundaries_impl_pos_int_neg.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_pos_int_pos.cxx b/CarpetX/src/boundaries_impl_pos_int_pos.cxx new file mode 100644 index 000000000..c31a1aa14 --- /dev/null +++ b/CarpetX/src/boundaries_impl_pos_int_pos.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_pos_neg_int.cxx b/CarpetX/src/boundaries_impl_pos_neg_int.cxx new file mode 100644 index 000000000..461914f65 --- /dev/null +++ b/CarpetX/src/boundaries_impl_pos_neg_int.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_pos_neg_pos.cxx b/CarpetX/src/boundaries_impl_pos_neg_pos.cxx new file mode 100644 index 000000000..e786f23d2 --- /dev/null +++ b/CarpetX/src/boundaries_impl_pos_neg_pos.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_pos_pos_int.cxx b/CarpetX/src/boundaries_impl_pos_pos_int.cxx new file mode 100644 index 000000000..3ed5c462a --- /dev/null +++ b/CarpetX/src/boundaries_impl_pos_pos_int.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_pos_pos_neg.cxx b/CarpetX/src/boundaries_impl_pos_pos_neg.cxx new file mode 100644 index 000000000..ea0f0cd73 --- /dev/null +++ b/CarpetX/src/boundaries_impl_pos_pos_neg.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/boundaries_impl_pos_pos_pos.cxx b/CarpetX/src/boundaries_impl_pos_pos_pos.cxx new file mode 100644 index 000000000..17fb38137 --- /dev/null +++ b/CarpetX/src/boundaries_impl_pos_pos_pos.cxx @@ -0,0 +1,7 @@ +#include "boundaries_impl.hxx" + +namespace CarpetX { + +template void BoundaryCondition::apply_on_face() const; + +} // namespace CarpetX diff --git a/CarpetX/src/make.code.defn b/CarpetX/src/make.code.defn index 16d69cf5e..c2bb098a3 100644 --- a/CarpetX/src/make.code.defn +++ b/CarpetX/src/make.code.defn @@ -3,17 +3,32 @@ # Source files in this directory SRCS = \ boundaries.cxx \ - boundaries_impl_int_int.cxx \ - boundaries_impl_int_neg.cxx \ - boundaries_impl_int_pos.cxx \ - boundaries_impl_neg_int.cxx \ - boundaries_impl_neg_pos.cxx \ - boundaries_impl_pos_int.cxx \ - boundaries_impl_pos_neg.cxx \ - boundaries_impl_pos_pos.cxx \ + boundaries_impl_int_int_neg.cxx \ + boundaries_impl_int_int_pos.cxx \ + boundaries_impl_int_neg_int.cxx \ boundaries_impl_int_neg_neg.cxx \ + boundaries_impl_int_neg_pos.cxx \ + boundaries_impl_int_pos_int.cxx \ + boundaries_impl_int_pos_neg.cxx \ + boundaries_impl_int_pos_pos.cxx \ + boundaries_impl_neg_int_int.cxx \ + boundaries_impl_neg_int_neg.cxx \ + boundaries_impl_neg_int_pos.cxx \ + boundaries_impl_neg_neg_int.cxx \ boundaries_impl_neg_neg_neg.cxx \ + boundaries_impl_neg_neg_pos.cxx \ + boundaries_impl_neg_pos_int.cxx \ + boundaries_impl_neg_pos_neg.cxx \ + boundaries_impl_neg_pos_pos.cxx \ + boundaries_impl_pos_int_int.cxx \ + boundaries_impl_pos_int_neg.cxx \ + boundaries_impl_pos_int_pos.cxx \ + boundaries_impl_pos_neg_int.cxx \ boundaries_impl_pos_neg_neg.cxx \ + boundaries_impl_pos_neg_pos.cxx \ + boundaries_impl_pos_pos_int.cxx \ + boundaries_impl_pos_pos_neg.cxx \ + boundaries_impl_pos_pos_pos.cxx \ driver.cxx \ fillpatch.cxx \ interpolate.cxx \