19template<
class Tvec,
class Tgr
idVec>
24 using namespace shamrock::patch;
27 using Block =
typename Config::AMRBlock;
36 MergedPDat &mpdat = storage.merged_patchdata_ghost.get().get(p.id_patch);
42 PatchDataLayer &patch_dest = scheduler().patch_data.get_pdat(p.id_patch);
51 auto acc_eint_src = eint_merged.get_read_access(depends_list);
52 auto acc_vel_src = vel_merged.get_read_access(depends_list);
55 auto acc_eint_dest = eint_dest.get_write_access(depends_list);
56 auto acc_vel_dest = vel_dest.get_write_access(depends_list);
58 auto e = q.submit(depends_list, [&](sycl::handler &cgh) {
59 shambase::parallel_for(
60 cgh, mpdat.original_elements * Block::block_size,
"copy_back", [=](
u32 id) {
61 acc_rho_dest[id] = acc_rho_src[id];
62 acc_eint_dest[id] = acc_eint_src[id];
63 acc_vel_dest[id] = acc_vel_src[id];
68 eint_merged.complete_event_state(e);
69 vel_merged.complete_event_state(e);
72 eint_dest.complete_event_state(e);
73 vel_dest.complete_event_state(e);
75 if (mpdat.pdat.has_nan()) {
76 logger::err_ln(
"[Zeus]",
"nan detected in write back");
std::uint32_t u32
32 bit unsigned integer
A buffer allocated in USM (Unified Shared Memory)
void complete_event_state(sycl::event e) const
Complete the event state of the buffer.
T * get_write_access(sham::EventList &depends_list, SourceLocation src_loc=SourceLocation{})
Get a read-write pointer to the buffer's data.
const T * get_read_access(sham::EventList &depends_list, SourceLocation src_loc=SourceLocation{}) const
Get a read-only pointer to the buffer's data.
A SYCL queue associated with a device and a context.
DeviceQueue & get_queue(u32 id=0)
Get a reference to a DeviceQueue.
Class to manage a list of SYCL events.
u32 get_field_idx(const std::string &field_name) const
Get the field id if matching name & type.
PatchDataLayer container class, the layout is described in patchdata_layout.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
T & get_check_ref(const std::unique_ptr< T > &ptr, SourceLocation loc=SourceLocation())
Takes a std::unique_ptr and returns a reference to the object it holds. It throws a std::runtime_erro...
namespace for the main framework
Patch object that contain generic patch information.