Skip to content

Commit

Permalink
rename 'd_value' to 'd_span'
Browse files Browse the repository at this point in the history
  • Loading branch information
jnke2016 committed Nov 1, 2024
1 parent 9b4683a commit 8cb0c94
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 33 deletions.
18 changes: 9 additions & 9 deletions cpp/include/cugraph/detail/utility_wrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,46 +66,46 @@ template <typename value_t>
void scalar_fill(raft::handle_t const& handle, value_t* d_value, size_t size, value_t value);

/**
* @brief Sort a buffer
* @brief Sort a device span
*
* @tparam value_t type of the value to operate on
*
* @param [in] handle RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator,
* and handles to various CUDA libraries) to run graph algorithms.
* @param[out] d_value device array to sort
* @param[out] d_span device span to sort
*
*/
template <typename value_t>
void sort(raft::handle_t const& handle, raft::device_span<value_t> d_value);
void sort(raft::handle_t const& handle, raft::device_span<value_t> d_span);

/**
* @brief Keep unique element from a buffer
* @brief Keep unique element from a device span
*
* @tparam value_t type of the value to operate on
*
* @param [in] handle RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator,
* and handles to various CUDA libraries) to run graph algorithms.
* @param[in] d_value device array of unique elements.
* @param[in] d_span device span of unique elements.
* @return the number of unique elements.
*
*/
template <typename value_t>
size_t unique(raft::handle_t const& handle, raft::device_span<value_t> d_value);
size_t unique(raft::handle_t const& handle, raft::device_span<value_t> d_span);

/**
* @brief Increment the values of a buffer by a constant value
* @brief Increment the values of a device span by a constant value
*
* @tparam value_t type of the value to operate on
*
* @param [in] handle RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator,
* and handles to various CUDA libraries) to run graph algorithms.
* @param[out] d_value device array to update
* @param[out] d_span device span to update
* @param[in] value value to be added to each element of the buffer
*
*/
template <typename value_t>
void transform_increment(rmm::cuda_stream_view const& stream_view,
raft::device_span<value_t> d_value,
raft::device_span<value_t> d_span,
value_t value);

/**
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/detail/utility_wrappers_32.cu
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ template void scalar_fill(raft::handle_t const& handle, size_t* d_value, size_t

template void scalar_fill(raft::handle_t const& handle, float* d_value, size_t size, float value);

template void sort(raft::handle_t const& handle, raft::device_span<int32_t> d_value);
template void sort(raft::handle_t const& handle, raft::device_span<int32_t> d_span);

template size_t unique(raft::handle_t const& handle, raft::device_span<int32_t> d_value);
template size_t unique(raft::handle_t const& handle, raft::device_span<uint32_t> d_value);
template size_t unique(raft::handle_t const& handle, raft::device_span<int32_t> d_span);
template size_t unique(raft::handle_t const& handle, raft::device_span<uint32_t> d_span);

template void sequence_fill(rmm::cuda_stream_view const& stream_view,
int32_t* d_value,
Expand All @@ -79,11 +79,11 @@ template void sequence_fill(rmm::cuda_stream_view const& stream_view,
uint32_t start_value);

template void transform_increment(rmm::cuda_stream_view const& stream_view,
raft::device_span<int32_t> d_value,
raft::device_span<int32_t> d_span,
int32_t value);

template void transform_increment(rmm::cuda_stream_view const& stream_view,
raft::device_span<uint32_t> d_value,
raft::device_span<uint32_t> d_span,
uint32_t value);

template void stride_fill(rmm::cuda_stream_view const& stream_view,
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/detail/utility_wrappers_64.cu
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ template void scalar_fill(raft::handle_t const& handle,

template void scalar_fill(raft::handle_t const& handle, double* d_value, size_t size, double value);

template void sort(raft::handle_t const& handle, raft::device_span<int64_t> d_value);
template void sort(raft::handle_t const& handle, raft::device_span<int64_t> d_span);

template size_t unique(raft::handle_t const& handle, raft::device_span<int64_t> d_value);
template size_t unique(raft::handle_t const& handle, raft::device_span<uint64_t> d_value);
template size_t unique(raft::handle_t const& handle, raft::device_span<int64_t> d_span);
template size_t unique(raft::handle_t const& handle, raft::device_span<uint64_t> d_span);

template void sequence_fill(rmm::cuda_stream_view const& stream_view,
int64_t* d_value,
Expand All @@ -77,11 +77,11 @@ template void sequence_fill(rmm::cuda_stream_view const& stream_view,
uint64_t start_value);

template void transform_increment(rmm::cuda_stream_view const& stream_view,
raft::device_span<int64_t> d_value,
raft::device_span<int64_t> d_span,
int64_t value);

template void transform_increment(rmm::cuda_stream_view const& stream_view,
raft::device_span<uint64_t> d_value,
raft::device_span<uint64_t> d_span,
uint64_t value);

template void stride_fill(rmm::cuda_stream_view const& stream_view,
Expand Down
23 changes: 9 additions & 14 deletions cpp/src/detail/utility_wrappers_impl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ void scalar_fill(raft::handle_t const& handle, value_t* d_value, size_t size, va
}

template <typename value_t>
void sort(raft::handle_t const& handle, raft::device_span<value_t> d_value)
void sort(raft::handle_t const& handle, raft::device_span<value_t> d_span)
{
thrust::sort(handle.get_thrust_policy(), d_value.begin(), d_value.end());
thrust::sort(handle.get_thrust_policy(), d_span.begin(), d_span.end());
}

template <typename value_t>
size_t unique(raft::handle_t const& handle, raft::device_span<value_t> d_value)
size_t unique(raft::handle_t const& handle, raft::device_span<value_t> d_span)
{
auto unique_element_last =
thrust::unique(handle.get_thrust_policy(), d_value.begin(), d_value.end());
return thrust::distance(d_value.begin(), unique_element_last);
thrust::unique(handle.get_thrust_policy(), d_span.begin(), d_span.end());
return thrust::distance(d_span.begin(), unique_element_last);
}

template <typename value_t>
Expand All @@ -89,23 +89,18 @@ void sequence_fill(rmm::cuda_stream_view const& stream_view,

template <typename value_t>
void transform_increment(rmm::cuda_stream_view const& stream_view,
raft::device_span<value_t> d_value,
raft::device_span<value_t> d_span,
value_t incr)
{
thrust::transform(rmm::exec_policy(stream_view),
d_value.begin(),
d_value.end(),
d_value.begin(),
d_span.begin(),
d_span.end(),
d_span.begin(),
cuda::proclaim_return_type<value_t>([incr] __device__(value_t value) {
return static_cast<value_t>(value + incr);
}));
}

template <typename value_t>
void transform_increment_(rmm::cuda_stream_view const& stream_view, value_t d_value)
{
}

template <typename value_t>
void stride_fill(rmm::cuda_stream_view const& stream_view,
value_t* d_value,
Expand Down

0 comments on commit 8cb0c94

Please sign in to comment.