Graph Utility Wrappers#
- template<typename new_type_t>
void copy_or_transform()#
- raft::device_span<new_type_t> output,
- cugraph_type_erased_device_array_view_t const *input,
- rmm::cuda_stream_view const &stream_view
Cast the values of a cugraph_type_erased_device_array_view_t to the new type.
- Template Parameters:
new_type_t – type of the value to operate on. Must be either int32_t or int64_t.
- Parameters:
output – [out] device span to update with new data type
input – [in] cugraph_type_erased_device_array_view_t with initial data type
stream_view – [in] stream view
- template<typename value_t>
void uniform_random_fill()#
- rmm::cuda_stream_view const &stream_view,
- value_t *d_value,
- size_t size,
- value_t min_value,
- value_t max_value,
- raft::random::RngState &rng_state
Fill a buffer with uniformly distributed random values.
Fills a buffer with uniformly distributed random values between the specified minimum and maximum values.
- Template Parameters:
value_t – type of the value to operate on (currently supports int32_t, int64_t, float and double)
- Parameters:
stream_view – [in] stream view
d_value – [out] device array to fill
size – [in] number of elements in array
min_value – [in] minimum value (inclusive)
max_value – [in] maximum value (exclusive)
rng_state – [in] The RngState instance holding pseudo-random number generator state.
- template<typename value_t>
)#
void transform_increment_ints(
Increment the values of a device span by a constant value.
- Template Parameters:
value_t – type of the value to operate on. Must be either int32_t or int64_t.
- Parameters:
values – [out] device span to update
value – [in] value to be added to each element of the buffer
stream_view – [in] stream view
- template<typename value_t>
void transform_not_equal()#
- raft::device_span<value_t> values,
- raft::device_span<bool> result,
- value_t compare,
- rmm::cuda_stream_view const &stream_view
Update the values of device span to 0 if it matches the compare value or 1.
- Template Parameters:
value_t – type of the value to operate on. Must be either int32_t or int64_t.
- Parameters:
values – [out] device span with the values to compare
result – [out] device span with the result of the comparison
compare – [in] value to be querriedm in the values array
stream_view – [in] stream view
- template<typename vertex_t>
vertex_t compute_maximum_vertex_id()#
- rmm::cuda_stream_view const &stream_view,
- vertex_t const *d_edgelist_srcs,
- vertex_t const *d_edgelist_dsts,
- size_t num_edges
Compute the maximum vertex id of an edge list.
max(d_edgelist_srcs.max(), d_edgelist_dsts.max())
- Template Parameters:
vertex_t – vertex type
- Parameters:
stream_view – [in] stream view
d_edgelist_srcs – [in] device array storing edge source IDs
d_edgelist_dsts – [in] device array storing edge destination IDs
num_edges – [in] number of edges in the input source & destination arrays
the – maximum value occurring in the edge list
- template<typename vertex_t>
vertex_t compute_maximum_vertex_id()#
- rmm::cuda_stream_view const &stream_view,
- rmm::device_uvector<vertex_t> const &d_edgelist_srcs,
- rmm::device_uvector<vertex_t> const &d_edgelist_dsts
Compute the maximum vertex id of an edge list.
max(d_edgelist_srcs.max(), d_edgelist_dsts.max())
- Template Parameters:
vertex_t – vertex type
- Parameters:
stream_view – [in] stream view
d_edgelist_srcs – [in] device array storing source IDs
d_edgelist_dsts – [in] device array storing destination IDs
the – maximum value occurring in the edge list
- template<typename data_t>
bool is_sorted()#
- raft::handle_t const &handle,
- raft::device_span<data_t> span
Check if device span is sorted.
- Template Parameters:
data_t – type of data in span
- Parameters:
handle – RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator, and handles to various CUDA libraries) to run graph algorithms.
span – The span of data to check
- Returns:
true if sorted, false if not sorted
- template<typename data_t>
)#
bool is_equal(
Check if two device spans are equal. Returns true if every element in the spans are equal.
- Template Parameters:
data_t – type of data in span
- Parameters:
handle – RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator, and handles to various CUDA libraries) to run graph algorithms.
span1 – The span of data to compare
span2 – The span of data to compare
- Returns:
true if equal, false if not equal
- template<typename data_t>
)#
size_t count_values(
Count the number of times a value appears in a span.
- Template Parameters:
data_t – type of data in span
- Parameters:
handle – RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator, and handles to various CUDA libraries) to run graph algorithms.
span – The span of data to compare
value – The value to count
- Returns:
The count of how many instances of that value occur
- template<typename InputIterator, typename OutputIterator>
OutputIterator inclusive_scan_impl()#
- rmm::exec_policy const &policy,
- InputIterator first,
- InputIterator last,
- OutputIterator result
Inclusive prefix sum on [first, last) (out-of-line; default
plus).
- template<typename InputIterator, typename OutputIterator>
OutputIterator exclusive_scan_impl()#
- rmm::exec_policy const &policy,
- InputIterator first,
- InputIterator last,
- OutputIterator result
Exclusive prefix sum on [first, last) (out-of-line; default
plusand zero init).
- template<typename InputIterator, typename OutputIterator, typename T>
OutputIterator exclusive_scan_impl()#
- rmm::exec_policy const &policy,
- InputIterator first,
- InputIterator last,
- OutputIterator result,
- T init
Exclusive prefix sum on [first, last) with initial value (out-of-line; default
plus).
- template<typename ExecutionPolicy, typename InputIterator, typename OutputIterator, typename BinaryFunction>
inline OutputIterator operator()() const#
- ExecutionPolicy const &policy,
- InputIterator first,
- InputIterator last,
- OutputIterator result,
- BinaryFunction binary_op
Inclusive prefix sum on [first, last) with a custom associative operator.
Similar to
thrust::inclusive_scan.
- template<typename ExecutionPolicy, typename InputIterator, typename OutputIterator, typename T, typename BinaryFunction>
inline OutputIterator operator()() const#
- ExecutionPolicy const &policy,
- InputIterator first,
- InputIterator last,
- OutputIterator result,
- T init,
- BinaryFunction binary_op
Inclusive prefix sum on [first, last) with initial value and associative operator.
Similar to
thrust::inclusive_scan.
- template<typename ExecutionPolicy, typename InputIterator, typename OutputIterator, typename T>
inline OutputIterator operator()() const#
- ExecutionPolicy const &policy,
- InputIterator first,
- InputIterator last,
- OutputIterator result,
- T init
Exclusive prefix sum on [first, last) with initial value.
Similar to
thrust::exclusive_scan.
- template<typename ExecutionPolicy, typename InputIterator, typename OutputIterator, typename T, typename BinaryFunction>
inline OutputIterator operator()() const
- ExecutionPolicy const &policy,
- InputIterator first,
- InputIterator last,
- OutputIterator result,
- T init,
- BinaryFunction binary_op
Exclusive prefix sum on [first, last) with initial value and associative operator.
Similar to
thrust::exclusive_scan.
- template<typename InputIterator, typename OutputIterator, typename MapType>
void scatter_impl()#
- rmm::exec_policy const &policy,
- InputIterator input_first,
- InputIterator input_last,
- MapType const *map_first,
- OutputIterator output_first
Scatter [input_first, input_last) to
output_firstusingmap_first(out-of-line implementation).
- template<typename InputIterator, typename OutputIterator, typename MapIterator>
void scatter_shift_left_impl()#
- rmm::exec_policy const &policy,
- InputIterator input_first,
- InputIterator input_last,
- MapIterator map_first,
- OutputIterator output_first
Scatter using a
cuda::transform_iteratormap with shift_left_t (out-of-line implementation).
- template<typename ExecutionPolicy, typename ForwardIterator, typename T>
inline void operator()() const#
- ExecutionPolicy const &policy,
- ForwardIterator first,
- ForwardIterator last,
- T init
Fill [first, last) with consecutive integers starting at
init.Similar to
thrust::sequence.
- template<typename ExecutionPolicy, typename ForwardIterator, typename T>
inline void operator()() const#
- ExecutionPolicy const &policy,
- ForwardIterator first,
- ForwardIterator last,
- T init,
- T step
Fill [first, last) with consecutive integers starting at
initwith stepstep.Similar to
thrust::sequence.
- template<typename RandomAccessIterator>
void sort_impl()#
- rmm::exec_policy const &policy,
- RandomAccessIterator first,
- RandomAccessIterator last
Sort elements in [first, last) on the given CUDA stream (out-of-line implementation).
- template<typename ExecutionPolicy, typename RandomAccessIterator, typename Compare>
inline void operator()() const#
- ExecutionPolicy const &policy,
- RandomAccessIterator first,
- RandomAccessIterator last,
- Compare compare
Sort elements in [first, last) with a custom comparison.
Similar to
thrust::sort.
- template<typename RandomAccessIterator>
RandomAccessIterator unique_impl()#
- rmm::exec_policy const &policy,
- RandomAccessIterator first,
- RandomAccessIterator last
Keep unique elements in [first, last) on the given CUDA stream (out-of-line implementation).
- template<typename ExecutionPolicy, typename ForwardIterator, typename BinaryPredicate>
inline ForwardIterator operator()() const#
- ExecutionPolicy const &policy,
- ForwardIterator first,
- ForwardIterator last,
- BinaryPredicate pred
Keep unique elements in [first, last) with a custom equivalence predicate.
Similar to
thrust::unique.
- struct fill_t
#include <fill.hpp>Assign
valueto every element in [first, last).Similar to
thrust::fill; dispatches to an explicitly instantiated backend for supported scalar ranges onrmm::exec_policyandrmm::exec_policy_nosync.
- struct gather_t
#include <gather.hpp>Gather from
input_firstintooutput_firstusingmap_first.Similar to
thrust::gather; dispatches to an explicitly instantiated backend whenpolicyisrmm::exec_policyorrmm::exec_policy_nosync,map_firstis a pointer tosize_t,int32_t, orint64_t, acuda::transform_iteratorover shift_left_t, or the input/output ranges are supported scalar or zip iterators.
- struct inclusive_scan_t
#include <scan.hpp>Inclusive prefix sum on [first, last).
Similar to
thrust::inclusive_scan; dispatches to an explicitly instantiated backend whenpolicyisrmm::exec_policyorrmm::exec_policy_nosyncandfirst,last, andresultare pointers to the same supported scalar type (size_t,int32_t, orint64_t).
- struct exclusive_scan_t
#include <scan.hpp>Exclusive prefix sum on [first, last).
Similar to
thrust::exclusive_scan; dispatches to an explicitly instantiated backend whenpolicyisrmm::exec_policyorrmm::exec_policy_nosyncandfirst,last, andresultare pointers to the same supported scalar type (size_t,int32_t, orint64_t).
- struct scatter_t
#include <scatter.hpp>Scatter [input_first, input_last) to
output_firstusingmap_first.Similar to
thrust::scatter; dispatches to an explicitly instantiated backend whenpolicyisrmm::exec_policyorrmm::exec_policy_nosync,map_firstis a pointer tosize_t,int32_t, orint64_t, acuda::transform_iteratorover shift_left_t, or the input/output ranges are supported scalar or zip iterators.
- struct sequence_t
#include <sequence.hpp>Fill [first, last) with consecutive integers starting at 0.
Similar to
thrust::sequence; dispatches to an explicitly instantiated backend for supported scalar ranges onrmm::exec_policyandrmm::exec_policy_nosync.
- struct sort_t
#include <sort.hpp>Sort elements in [first, last).
Similar to
thrust::sort; dispatches to an explicitly instantiated backend for supported scalar and zip-iterator ranges.
- struct unique_t
#include <unique.hpp>Keep unique elements in [first, last).
Similar to
thrust::unique; dispatches to an explicitly instantiated backend for supported scalar and zip-iterator ranges.