Skip to content

Commit

Permalink
[BUG] Fix namesapce to default_hash and hash_functions (#3711)
Browse files Browse the repository at this point in the history
Fix namesapce to default_hash and  hash_functions

Authors:
  - Naim (https://github.com/naimnv)
  - Seunghwa Kang (https://github.com/seunghwak)

Approvers:
  - Seunghwa Kang (https://github.com/seunghwak)
  - Chuck Hastings (https://github.com/ChuckHastings)

URL: #3711
  • Loading branch information
naimnv authored Jul 18, 2023
1 parent c33d4bb commit 32e6e51
Show file tree
Hide file tree
Showing 10 changed files with 568 additions and 128 deletions.
16 changes: 14 additions & 2 deletions cpp/include/cugraph/utilities/device_functors.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,28 @@ struct pack_bool_t {
}
};

template <typename Iterator>
template <typename index_t, typename Iterator>
struct indirection_t {
Iterator first{};

__device__ typename thrust::iterator_traits<Iterator>::value_type operator()(size_t i) const
__device__ typename thrust::iterator_traits<Iterator>::value_type operator()(index_t i) const
{
return *(first + i);
}
};

template <typename index_t, typename Iterator>
struct indirection_if_idx_valid_t {
Iterator first{};
index_t invalid_idx{};
typename thrust::iterator_traits<Iterator>::value_type invalid_value{};

__device__ typename thrust::iterator_traits<Iterator>::value_type operator()(index_t i) const
{
return (i != invalid_idx) ? *(first + i) : invalid_value;
}
};

template <typename T>
struct not_equal_t {
T compare{};
Expand Down
5 changes: 3 additions & 2 deletions cpp/libcugraph_etl/include/hash/concurrent_unordered_map.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

#include <cudf/detail/nvtx/ranges.hpp>
#include <cudf/detail/utilities/device_atomics.cuh>
#include <cudf/detail/utilities/hash_functions.cuh>
#include <cudf/hashing/detail/default_hash.cuh>
#include <cudf/hashing/detail/hash_functions.cuh>
#include <cudf/utilities/error.hpp>

#include <rmm/cuda_stream_view.hpp>
Expand Down Expand Up @@ -118,7 +119,7 @@ union pair_packer<pair_type, std::enable_if_t<is_packable<pair_type>()>> {
*/
template <typename Key,
typename Element,
typename Hasher = cudf::detail::default_hash<Key>,
typename Hasher = cudf::hashing::detail::default_hash<Key>,
typename Equality = equal_to<Key>,
typename Allocator = default_allocator<thrust::pair<Key, Element>>>
class concurrent_unordered_map {
Expand Down
6 changes: 6 additions & 0 deletions cpp/src/community/detail/common_methods.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <community/detail/common_methods.hpp>

#include <detail/graph_partition_utils.cuh>
#include <prims/kv_store.cuh>
#include <prims/per_v_transform_reduce_dst_key_aggregated_outgoing_e.cuh>
#include <prims/per_v_transform_reduce_incoming_outgoing_e.cuh>
#include <prims/reduce_op.cuh>
Expand All @@ -42,6 +43,11 @@

CUCO_DECLARE_BITWISE_COMPARABLE(float)
CUCO_DECLARE_BITWISE_COMPARABLE(double)
// FIXME: a temporary workaround for a compiler error, should be deleted once cuco gets patched.
namespace cuco {
template <>
struct is_bitwise_comparable<cuco::pair<int32_t, float>> : std::true_type {};
} // namespace cuco

namespace cugraph {
namespace detail {
Expand Down
5 changes: 5 additions & 0 deletions cpp/src/community/detail/refine_impl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@

CUCO_DECLARE_BITWISE_COMPARABLE(float)
CUCO_DECLARE_BITWISE_COMPARABLE(double)
// FIXME: a temporary workaround for a compiler error, should be deleted once cuco gets patched.
namespace cuco {
template <>
struct is_bitwise_comparable<cuco::pair<int32_t, float>> : std::true_type {};
} // namespace cuco

namespace cugraph {
namespace detail {
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/prims/detail/nbr_intersection.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ nbr_intersection(raft::handle_t const& handle,
.get_stream()); // initially store minimum degrees (upper bound for intersection sizes)
if (intersect_minor_nbr[0] && intersect_minor_nbr[1]) {
auto second_element_to_idx_map =
detail::kv_cuco_store_device_view_t((*major_to_idx_map_ptr)->view());
detail::kv_cuco_store_find_device_view_t((*major_to_idx_map_ptr)->view());
thrust::transform(
handle.get_thrust_policy(),
get_dataframe_buffer_begin(vertex_pair_buffer),
Expand Down Expand Up @@ -1005,7 +1005,7 @@ nbr_intersection(raft::handle_t const& handle,
handle.get_stream());
if (intersect_minor_nbr[0] && intersect_minor_nbr[1]) {
auto second_element_to_idx_map =
detail::kv_cuco_store_device_view_t((*major_to_idx_map_ptr)->view());
detail::kv_cuco_store_find_device_view_t((*major_to_idx_map_ptr)->view());
thrust::tabulate(
handle.get_thrust_policy(),
rx_v_pair_nbr_intersection_sizes.begin(),
Expand Down
Loading

0 comments on commit 32e6e51

Please sign in to comment.