transform_reduce_v.cuh#

namespace cugraph

Functions

template<typename GraphViewType, typename ReduceOp, typename VertexValueInputIterator, typename VertexOp, typename T>
T transform_reduce_v(
raft::handle_t const &handle,
GraphViewType const &graph_view,
VertexValueInputIterator vertex_value_input_first,
VertexOp v_op,
T init,
ReduceOp reduce_op,
bool do_expensive_check = false
)

Reduce the transformed input vertex property values.

This function is inspired by thrust::transform_reduce().

Template Parameters:
  • GraphViewType – Type of the passed non-owning graph object.

  • ReduceOp – Type of the binary reduction operator.

  • VertexValueInputIterator – Type of the iterator for vertex property values.

  • VertexOp – Type of the unary vertex operator.

  • T – Type of the initial value.

Parameters:
  • handle – RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator, and handles to various CUDA libraries) to run graph algorithms.

  • graph_view – Non-owning graph object.

  • vertex_value_input_first – Iterator pointing to the vertex property values for the first (inclusive) vertex (assigned to this process in multi-GPU). vertex_value_input_last (exclusive) is deduced as vertex_value_input_first + graph_view.local_vertex_partition_range_size().

  • v_op – Binary operator takes vertex ID and *(vertex_value_input_first + i) (where i is [0, graph_view.local_vertex_partition_range_size())) and returns a transformed value to be reduced.

  • init – Initial value to be reduced with the transform-reduced input vertex property values.

  • reduce_op – Binary operator that takes two input arguments and reduce the two values to one. There are pre-defined reduction operators in include/cugraph/prims/reduce_op.cuh. It is recommended to use the pre-defined reduction operators whenever possible as the current (and future) implementations of graph primitives may check whether ReduceOp is a known type (or has known member variables) to take a more optimized code path. See the documentation in the reduce_op.cuh file for instructions on writing custom reduction operators.

  • do_expensive_check – A flag to run expensive checks for input arguments (if set to true).

Returns:

T Transformed and reduced input vertex property values.

template<typename GraphViewType, typename VertexValueInputIterator, typename VertexOp, typename T>
T transform_reduce_v(
raft::handle_t const &handle,
GraphViewType const &graph_view,
VertexValueInputIterator vertex_value_input_first,
VertexOp v_op,
T init,
bool do_expensive_check = false
)

Reduce the transformed input vertex property values.

This function is inspired by thrust::transform_reduce().

Template Parameters:
  • GraphViewType – Type of the passed non-owning graph object.

  • VertexValueInputIterator – Type of the iterator for vertex property values.

  • VertexOp – Type of the unary vertex operator.

  • T – Type of the initial value.

Parameters:
  • handle – RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator, and handles to various CUDA libraries) to run graph algorithms.

  • graph_view – Non-owning graph object.

  • vertex_value_input_first – Iterator pointing to the vertex property values for the first (inclusive) vertex (assigned to this process in multi-GPU). vertex_value_input_last (exclusive) is deduced as vertex_value_input_first + graph_view.local_vertex_partition_range_size().

  • v_op – Binary operator takes vertex ID and *(vertex_value_input_first + i) (where i is [0, graph_view.local_vertex_partition_range_size())) and returns a transformed value to be reduced.

  • init – Initial value to be added to the transform-reduced input vertex property values.

  • do_expensive_check – A flag to run expensive checks for input arguments (if set to true).

Returns:

T Transformed and reduced input vertex property values.

template<typename GraphViewType, typename VertexValueInputIterator, typename VertexOp>
auto transform_reduce_v(
raft::handle_t const &handle,
GraphViewType const &graph_view,
VertexValueInputIterator vertex_value_input_first,
VertexOp v_op,
bool do_expensive_check = false
)

Reduce the transformed input vertex property values.

This function is inspired by thrust::transform_reduce().

Template Parameters:
  • GraphViewType – Type of the passed non-owning graph object.

  • VertexValueInputIterator – Type of the iterator for vertex property values.

  • VertexOp – Type of the unary vertex operator.

Parameters:
  • handle – RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator, and handles to various CUDA libraries) to run graph algorithms.

  • graph_view – Non-owning graph object.

  • vertex_value_input_first – Iterator pointing to the vertex property values for the first (inclusive) vertex (assigned to this process in multi-GPU). vertex_value_input_last (exclusive) is deduced as vertex_value_input_first + graph_view.local_vertex_partition_range_size().

  • v_op – Binary operator takes vertex ID and *(vertex_value_input_first + i) (where i is [0, graph_view.local_vertex_partition_range_size())) and returns a transformed value to be reduced.

  • do_expensive_check – A flag to run expensive checks for input arguments (if set to true).

Returns:

Transformed and reduced input vertex property values.

namespace detail
template<typename vertex_t, typename VertexValueInputIterator, typename VertexOp, typename T>
struct transform_reduce_call_v_op_t

Public Functions

inline __device__ T operator() (vertex_t i)

Public Members

vertex_t local_vertex_partition_range_first#
VertexValueInputIterator vertex_value_input_first#
VertexOp v_op#