Skip to main content

class handler

Declaration

class handler { /* full declaration omitted */ };

Member Variables

detail::task_id m_tid
detail::buffer_access_map m_access_map
detail::side_effect_map m_side_effects
size_t m_non_void_side_effects_count = 0
detail::reduction_set m_reductions
std::unique_ptr<detail::task> m_task = nullptr
size_t m_num_collective_nodes
detail::hydration_id m_next_accessor_hydration_id = 1
std::optional<std::string> m_usr_def_task_name
range<3> m_split_constraint = detail::ones
std::vector<std::unique_ptr<detail::hint_base>> m_hints

Member Function Overview

  • template <int Dims, typename Functor>
    host_task(range<Dims> global_range, Functor && kernel) → void
  • template <int Dims, typename Functor>
    host_task(range<Dims> global_range, id<Dims> global_offset, Functor && kernel) → void
  • template <typename Functor>
    host_task(experimental::collective_tag tag, Functor && kernel) → void
  • template <typename Functor>
    host_task(on_master_node_tag, Functor && kernel) → void
  • template <typename KernelName = detail::unnamed_kernel, int Dims, typename... ReductionsAndKernel>
    parallel_for(celerity::nd_range<Dims> execution_range, ReductionsAndKernel &&... reductions_and_kernel) → void
  • template <typename KernelName = detail::unnamed_kernel, int Dims, typename... ReductionsAndKernel>
    parallel_for(range<Dims> global_range, id<Dims> global_offset, ReductionsAndKernel &&... reductions_and_kernel) → void
  • template <typename KernelName = detail::unnamed_kernel, int Dims, typename... ReductionsAndKernel>
    parallel_for(range<Dims> global_range, ReductionsAndKernel &&... reductions_and_kernel) → void
  • add_reduction(const detail::reduction_info & rinfo) → void
  • add_requirement(detail::buffer_id bid, std::unique_ptr<detail::range_mapper_base> rm) → [[nodiscard]] detail::hydration_id
  • add_requirement(detail::host_object_id hoid, experimental::side_effect_order order, bool is_void) → void
  • create_collective_task(detail::collective_group_id cgid, detail::host_task_launcher launcher) → void
  • create_device_compute_task(const detail::task_geometry & geometry, const std::string & debug_name, detail::device_kernel_launcher launcher) → void
  • create_host_compute_task(const detail::task_geometry & geometry, detail::host_task_launcher launcher) → void
  • create_master_node_task(detail::host_task_launcher launcher) → void
  • template <int Dims>
    experimental_constrain_split(const range<Dims> & constraint) → void
  • template <typename Hint>
    experimental_hint(Hint && hint) → void
  • template <int Dims>
    get_constrained_granularity(const range<Dims> & global_size, const range<Dims> & granularity) const → range<3>
  • handler(detail::task_id tid, size_t num_collective_nodes)
  • into_task() && → std::unique_ptr<detail::task>
  • template <typename KernelFlavor, typename KernelName, int Dims, typename Kernel, size_t... ReductionIndices, typename... Reductions>
    make_device_kernel_launcher(const range<Dims> & global_range, const id<Dims> & global_offset, typename detail::kernel_flavor_traits<KernelFlavor, Dims>::local_size_type local_range, Kernel && kernel, std::index_sequence<ReductionIndices...>, Reductions... reductions) → detail::device_kernel_launcher
  • template <int Dims, bool Collective, typename Kernel>
    make_host_task_launcher(const range<3> & global_range, detail::collective_group_id cgid, Kernel && kernel) → detail::host_task_launcher
  • template <typename KernelFlavor, typename KernelName, int Dims, typename Kernel, typename... Reductions>
    parallel_for_kernel_and_reductions(range<Dims> global_range, id<Dims> global_offset, typename detail::kernel_flavor_traits<KernelFlavor, Dims>::local_size_type local_range, Kernel && kernel, Reductions &... reductions) → void
  • template <typename KernelFlavor, typename KernelName, int Dims, typename... ReductionsAndKernel, size_t... ReductionIndices>
    parallel_for_reductions_and_kernel(range<Dims> global_range, id<Dims> global_offset, typename detail::kernel_flavor_traits<KernelFlavor, Dims>::local_size_type local_size, std::index_sequence<ReductionIndices...> indices, ReductionsAndKernel &&... kernel_and_reductions) → void

Member Functions

template <int Dims, typename Functor>
void host_task(range<Dims> global_range,
               Functor&& kernel)

Description

Like host_task(range <Dims > global_range, id <Dims > global_offset, Functor kernel), but with a global_offset of zero.

Template Parameters

int Dims
Functor

Parameters

range<Dims> global_range
Functor&& kernel

template <int Dims, typename Functor>
void host_task(range<Dims> global_range,
               id<Dims> global_offset,
               Functor&& kernel)

Description

Schedules a distributed execution of kernel by splitting the iteration space in a runtime-defined manner. The kernel is assumed to be invocable with the signature void(const celerity::partition <Dims > & ). The kernel is executed in a background thread pool with multiple host tasks being run concurrently if they are independent in the task graph, so proper synchronization must be ensured. The partition passed into the kernel describes the split each host receives. It may be used with accessors to obtain the per-node portion of a buffer en-bloc, see celerity::accessor::get_allocation_window for details. There are no guarantees with respect to the split size and the order in which host tasks are re-orered between nodes other than the restrictions imposed by dependencies in the task graph. Also, the kernel may be invoked multiple times on one node and not be scheduled on another node. If you need guarantees about execution order

Template Parameters

int Dims
Functor

Parameters

range<Dims> global_range
id<Dims> global_offset
Functor&& kernel

template <typename Functor>
void host_task(experimental::collective_tag tag,
               Functor&& kernel)

Description

Schedules kernel to be executed collectively on all nodes participating in the specified collective group. Call via cgh.host_task(celerity::experimental::collective, []...) or cgh.host_task(celerity::experimental::collective(group), []...). The kernel is assumed to be invocable with the signature void(const celerity::experimental::collective_partition & ) or void(const celerity::partition < 1> & ). This provides framework to use arbitrary collective MPI operations in a host task, such as performing collective I/O with parallel HDF5. The local node id,t the number of participating nodes as well as the group MPI communicator can be obtained from the collective_partition passed into the kernel. All collective tasks within a collective group are guaranteed to be executed in the same order on all nodes, additionally, all internal MPI operations and all host kernel invocations are executed in a single thread on each host.

Template Parameters

Functor

Parameters

experimental::collective_tag tag
Functor&& kernel

template <typename Functor>
void host_task(on_master_node_tag,
               Functor&& kernel)

Description

Schedules kernel to execute on the master node only. Call via cgh.host_task(celerity::on_master_node, []...). The kernel is assumed to be invocable with the signature void(const celerity::partition < 0> & ) or void(). The kernel is executed in a background thread pool and multiple master node tasks may be executed concurrently if they are independent in the task graph, so proper synchronization must be ensured. Compatibility note: This replaces master-access tasks from Celerity 0.1 which were executed on the master node's main thread, so this implementation may require different lifetimes for captures. See celerity::allow_by_ref for more information on this topic.

Template Parameters

Functor

Parameters

on_master_node_tag
Functor&& kernel

template <
    typename KernelName = detail::unnamed_kernel,
    int Dims,
    typename... ReductionsAndKernel>
void parallel_for(
    celerity::nd_range<Dims> execution_range,
    ReductionsAndKernel&&... reductions_and_kernel)

Template Parameters

KernelName = detail::unnamed_kernel
int Dims
ReductionsAndKernel

Parameters

celerity::nd_range<Dims> execution_range
ReductionsAndKernel&&... reductions_and_kernel

template <
    typename KernelName = detail::unnamed_kernel,
    int Dims,
    typename... ReductionsAndKernel>
void parallel_for(
    range<Dims> global_range,
    id<Dims> global_offset,
    ReductionsAndKernel&&... reductions_and_kernel)

Template Parameters

KernelName = detail::unnamed_kernel
int Dims
ReductionsAndKernel

Parameters

range<Dims> global_range
id<Dims> global_offset
ReductionsAndKernel&&... reductions_and_kernel

template <
    typename KernelName = detail::unnamed_kernel,
    int Dims,
    typename... ReductionsAndKernel>
void parallel_for(
    range<Dims> global_range,
    ReductionsAndKernel&&... reductions_and_kernel)

Template Parameters

KernelName = detail::unnamed_kernel
int Dims
ReductionsAndKernel

Parameters

range<Dims> global_range
ReductionsAndKernel&&... reductions_and_kernel

void add_reduction(
    const detail::reduction_info& rinfo)

Parameters

const detail::reduction_info& rinfo

[[nodiscard]] detail::hydration_id
add_requirement(
    detail::buffer_id bid,
    std::unique_ptr<detail::range_mapper_base> rm)

Parameters

detail::buffer_id bid
std::unique_ptr<detail::range_mapper_base> rm

void add_requirement(
    detail::host_object_id hoid,
    experimental::side_effect_order order,
    bool is_void)

Parameters

detail::host_object_id hoid
experimental::side_effect_order order
bool is_void

void create_collective_task(
    detail::collective_group_id cgid,
    detail::host_task_launcher launcher)

Parameters

detail::collective_group_id cgid
detail::host_task_launcher launcher

void create_device_compute_task(
    const detail::task_geometry& geometry,
    const std::string& debug_name,
    detail::device_kernel_launcher launcher)

Parameters

const detail::task_geometry& geometry
const std::string& debug_name
detail::device_kernel_launcher launcher

void create_host_compute_task(
    const detail::task_geometry& geometry,
    detail::host_task_launcher launcher)

Parameters

const detail::task_geometry& geometry
detail::host_task_launcher launcher

void create_master_node_task(
    detail::host_task_launcher launcher)

Parameters

detail::host_task_launcher launcher

template <int Dims>
void experimental_constrain_split(
    const range<Dims>& constraint)

Template Parameters

int Dims

Parameters

const range<Dims>& constraint

template <typename Hint>
void experimental_hint(Hint&& hint)

Template Parameters

Hint

Parameters

Hint&& hint

template <int Dims>
range<3> get_constrained_granularity(
    const range<Dims>& global_size,
    const range<Dims>& granularity) const

Template Parameters

int Dims

Parameters

const range<Dims>& global_size
const range<Dims>& granularity

handler(detail::task_id tid,
        size_t num_collective_nodes)

Parameters

detail::task_id tid
size_t num_collective_nodes

std::unique_ptr<detail::task> into_task() &&


template <typename KernelFlavor,
          typename KernelName,
          int Dims,
          typename Kernel,
          size_t... ReductionIndices,
          typename... Reductions>
detail::device_kernel_launcher
make_device_kernel_launcher(
    const range<Dims>& global_range,
    const id<Dims>& global_offset,
    typename detail::kernel_flavor_traits<
        KernelFlavor,
        Dims>::local_size_type local_range,
    Kernel&& kernel,
    std::index_sequence<ReductionIndices...>,
    Reductions... reductions)

Template Parameters

KernelFlavor
KernelName
int Dims
Kernel
size_t ReductionIndices
Reductions

Parameters

const range<Dims>& global_range
const id<Dims>& global_offset
typename detail::kernel_flavor_traits< KernelFlavor, Dims>::local_size_type local_range
Kernel&& kernel
std::index_sequence<ReductionIndices...>
Reductions... reductions

template <int Dims,
          bool Collective,
          typename Kernel>
detail::host_task_launcher
make_host_task_launcher(
    const range<3>& global_range,
    detail::collective_group_id cgid,
    Kernel&& kernel)

Template Parameters

int Dims
bool Collective
Kernel

Parameters

const range<3>& global_range
detail::collective_group_id cgid
Kernel&& kernel

template <typename KernelFlavor,
          typename KernelName,
          int Dims,
          typename Kernel,
          typename... Reductions>
void parallel_for_kernel_and_reductions(
    range<Dims> global_range,
    id<Dims> global_offset,
    typename detail::kernel_flavor_traits<
        KernelFlavor,
        Dims>::local_size_type local_range,
    Kernel&& kernel,
    Reductions&... reductions)

Template Parameters

KernelFlavor
KernelName
int Dims
Kernel
Reductions

Parameters

range<Dims> global_range
id<Dims> global_offset
typename detail::kernel_flavor_traits< KernelFlavor, Dims>::local_size_type local_range
Kernel&& kernel
Reductions&... reductions

template <typename KernelFlavor,
          typename KernelName,
          int Dims,
          typename... ReductionsAndKernel,
          size_t... ReductionIndices>
void parallel_for_reductions_and_kernel(
    range<Dims> global_range,
    id<Dims> global_offset,
    typename detail::kernel_flavor_traits<
        KernelFlavor,
        Dims>::local_size_type local_size,
    std::index_sequence<ReductionIndices...>
        indices,
    ReductionsAndKernel&&... kernel_and_reductions)

Template Parameters

KernelFlavor
KernelName
int Dims
ReductionsAndKernel
size_t ReductionIndices

Parameters

range<Dims> global_range
id<Dims> global_offset
typename detail::kernel_flavor_traits< KernelFlavor, Dims>::local_size_type local_size
std::index_sequence<ReductionIndices...> indices
ReductionsAndKernel&&... kernel_and_reductions