Skip to content

Commit

Permalink
CarpetX: Split all boundary template instantiations
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett committed Jun 30, 2023
1 parent 9a2b472 commit 27a3dc3
Show file tree
Hide file tree
Showing 25 changed files with 199 additions and 10 deletions.
17 changes: 15 additions & 2 deletions CarpetX/src/boundaries_impl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ task_t<K> make_task(F &&kernel, const Arith::vect<int, dim> &imin,
return {std::forward<F>(kernel), imin, imax, cmin, cmax};
}

template <typename F> void loop_task(const task_t<F> &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<int, dim> p{i, j, k};
kernel(p, cmin, cmax);
});
}

template <typename F> void loop_tasks(const amrex::Vector<task_t<F> > &tasks) {
#ifdef AMREX_USE_GPU
amrex::ParallelFor(tasks, [=] CCTK_DEVICE(const int i, const int j,
Expand Down Expand Up @@ -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<typename decltype(task)::type> 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<typename decltype(task)::type> tasks{task};
// loop_tasks(tasks);
}
}

Expand Down
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_int_int_neg.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<INT, INT, NEG>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_int_int_pos.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<INT, INT, POS>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_int_neg_int.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<INT, NEG, INT>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_int_neg_pos.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<INT, NEG, POS>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_int_pos_int.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<INT, POS, INT>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_int_pos_neg.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<INT, POS, NEG>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_int_pos_pos.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<INT, POS, POS>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_neg_int_int.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<NEG, INT, INT>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_neg_int_neg.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<NEG, INT, NEG>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_neg_int_pos.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<NEG, INT, POS>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_neg_neg_int.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<NEG, NEG, INT>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_neg_neg_pos.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<NEG, NEG, POS>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_neg_pos_int.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<NEG, POS, INT>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_neg_pos_neg.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<NEG, POS, NEG>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_neg_pos_pos.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<NEG, POS, POS>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_pos_int_int.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<POS, INT, INT>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_pos_int_neg.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<POS, INT, NEG>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_pos_int_pos.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<POS, INT, POS>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_pos_neg_int.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<POS, NEG, INT>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_pos_neg_pos.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<POS, NEG, POS>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_pos_pos_int.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<POS, POS, INT>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_pos_pos_neg.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<POS, POS, NEG>() const;

} // namespace CarpetX
7 changes: 7 additions & 0 deletions CarpetX/src/boundaries_impl_pos_pos_pos.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "boundaries_impl.hxx"

namespace CarpetX {

template void BoundaryCondition::apply_on_face<POS, POS, POS>() const;

} // namespace CarpetX
31 changes: 23 additions & 8 deletions CarpetX/src/make.code.defn
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 27a3dc3

Please sign in to comment.