Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shuffle comm operators with no default constructors #4869

Open
wants to merge 2 commits into
base: branch-25.02
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions cpp/include/cugraph/utilities/shuffle_comm.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -145,43 +145,58 @@ compute_tx_rx_counts_offsets_ranks(raft::comms::comms_t const& comm,

template <typename key_type, typename KeyToGroupIdOp>
struct key_group_id_less_t {
KeyToGroupIdOp key_to_group_id_op{};
int pivot{};
key_group_id_less_t(KeyToGroupIdOp op, int pivot_) : key_to_group_id_op(::std::move(op)), pivot(pivot_) {}
__device__ bool operator()(key_type k) const { return key_to_group_id_op(k) < pivot; }

private:
KeyToGroupIdOp key_to_group_id_op;
int pivot;
};

template <typename value_type, typename ValueToGroupIdOp>
struct value_group_id_less_t {
ValueToGroupIdOp value_to_group_id_op{};
int pivot{};
value_group_id_less_t(ValueToGroupIdOp op, int pivot_) : value_to_group_id_op(::std::move(op)), pivot(pivot_) {}
__device__ bool operator()(value_type v) const { return value_to_group_id_op(v) < pivot; }

private:
ValueToGroupIdOp value_to_group_id_op;
int pivot;
};

template <typename key_type, typename value_type, typename KeyToGroupIdOp>
struct kv_pair_group_id_less_t {
KeyToGroupIdOp key_to_group_id_op{};
int pivot{};
kv_pair_group_id_less_t(KeyToGroupIdOp op, int pivot_) : key_to_group_id_op(::std::move(op)), pivot(pivot_) {}
__device__ bool operator()(thrust::tuple<key_type, value_type> t) const
{
return key_to_group_id_op(thrust::get<0>(t)) < pivot;
}

private:
KeyToGroupIdOp key_to_group_id_op;
int pivot;
};

template <typename value_type, typename ValueToGroupIdOp>
struct value_group_id_greater_equal_t {
ValueToGroupIdOp value_to_group_id_op{};
int pivot{};
value_group_id_greater_equal_t(ValueToGroupIdOp op, int pivot_) : value_to_group_id_op(::std::move(op)), pivot(pivot_) {}
__device__ bool operator()(value_type v) const { return value_to_group_id_op(v) >= pivot; }

private:
ValueToGroupIdOp value_to_group_id_op;
int pivot;
};

template <typename key_type, typename value_type, typename KeyToGroupIdOp>
struct kv_pair_group_id_greater_equal_t {
KeyToGroupIdOp key_to_group_id_op{};
int pivot{};
kv_pair_group_id_greater_equal_t(KeyToGroupIdOp op, int pivot_) : key_to_group_id_op(::std::move(op)), pivot(pivot_) {}
__device__ bool operator()(thrust::tuple<key_type, value_type> t) const
{
return key_to_group_id_op(thrust::get<0>(t)) >= pivot;
}

private:
KeyToGroupIdOp key_to_group_id_op;
int pivot;
};

template <typename ValueIterator, typename ValueToGroupIdOp>
Expand Down
Loading