-
Notifications
You must be signed in to change notification settings - Fork 309
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
Replace graph_view.hpp::number_of_edges with compute_number_of_edges #4026
Replace graph_view.hpp::number_of_edges with compute_number_of_edges #4026
Conversation
…to fea_transform_e_mask
…to fea_transform_e_mask
…nto fea_transform_e_mask
…to fea_transform_e_mask
…h_view_t's constructors
…ompute_number_of_edges
…to fea_number_of_edges_with_mask
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
…to fea_number_of_edges_with_mask
template <typename vertex_t, typename edge_t, bool store_transposed, bool multi_gpu> | ||
edge_t graph_view_t<vertex_t, edge_t, store_transposed, multi_gpu, std::enable_if_t<!multi_gpu>>:: | ||
compute_number_of_edges(raft::handle_t const& handle) const | ||
{ | ||
if (this->has_edge_mask()) { | ||
auto value_firsts = (*(this->edge_mask_view())).value_firsts(); | ||
auto edge_counts = (*(this->edge_mask_view())).edge_counts(); | ||
assert(value_firsts.size() == 0); | ||
assert(edge_counts.size() == 0); | ||
return static_cast<edge_t>(detail::count_set_bits(handle, value_firsts[0], edge_counts[0])); | ||
} else { | ||
return this->number_of_edges_; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need two specialization based on multi_gpu
?
value_firsts.size() == 1
and isn't first one with for loop is good enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, let me experiment.
We have two specializations of graph_view_t based on multi_gpu. I am not sure we have two specializations of graph_view_t but have just one common member function definition.
This function no longer can't be in graph_base_t which is a parent class of graph_t & graph_view_t as masking is applied to graph_view_t but not on graph_t.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it does not compile. graph_view_t<..., multi_gpu=true> & graph_view_t<..., multi_gpu=false> have different sets of member variables, and they are two different classes. We cannot merge two member functions of two different classes (even though the member function has the same name & code).
But thanks to your comment, I just realized that why I initially placed edge_mask_view_ in graph_view_t instead of graph_base_t. graph_base_t is for both graph_t & graph_view_t... and as graph_t cannot have a mask, I'd better move the edge_mask_view_ back to graph_view_t.
Let me make this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes a lot of sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…r both graph_t & graph_view_t, graph_t can't have a mask)
…to fea_number_of_edges_with_mask
/merge |
Replace graph_view.hpp::number_of_edges (deprecated, throws an exception if an edge mask is attached to the graph view object) with compute_number_of_edges (this function works with or without edge mask)