sham::distributed_data_kernel_call#
sham::distributed_data_kernel_call is the distributed counterpart to
sham::kernel_call. It runs the same functor once per patch,
using DDMultiRef instead of MultiRef and a DistributedData of per-patch
thread counts.
Header: shambackends/kernel_call_distrib.hpp.
Basic usage#
sham::distributed_data_kernel_call(
dev_sched,
sham::DDMultiRef{/* distributed inputs */},
sham::DDMultiRef{/* distributed outputs */},
thread_counts, // DistributedData<index_t> of per-patch sizes
[](u32 i, /* input ptrs */, /* output ptrs */) {
// ...
});
Minimal example:
sham::distributed_data_kernel_call(
dev_sched,
sham::DDMultiRef{bufs_in},
sham::DDMultiRef{bufs_out},
sizes,
[](u32 i, const T *in, T *out) {
out[i] = in[i];
});
First arg is
DeviceScheduler_ptr(not a queue) — queue is taken viadev_sched->get_queue()Inputs/outputs in
DDMultiRefare any objects that declareget(id); the result must be buffer-like (get_read_access/get_write_access/complete_event_state), e.g.DistributedData<DeviceBuffer<T>>or a custom accessor containerthread_countsisDistributedData<index_t>keyed by patch id; each value is that patch’snFunctor signature is the same as
kernel_call(index + pointers)
DDMultiRef#
DDMultiRef holds references to distributed containers. .get(id) builds a
MultiRef by calling .get(id) on each member. Those per-id objects are what
kernel_call then accesses — they must provide the same buffer interface as for
MultiRef (get_read_access, get_write_access, complete_event_state).
Under the hood#
For each patch id in
thread_counts, build per-patchMultiRefs viaDDMultiRef::get(id)Call
sham::kernel_call(queue, …, n, func)for that patch