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

Biased RW implementation and test #4499

Closed
Closed
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
12af533
Biased RW implementation and test
Jun 24, 2024
fd7f7fc
Updated per specifications in PR
Jun 26, 2024
e44890e
Biased RW implementation and test
Jun 24, 2024
03eb26b
Merge branch 'branch-24.08' into branch-24.08_RandomWalks
G-Cornett Jul 1, 2024
171aef8
WIP Node2Vec and main branch merge
G-Cornett Jul 2, 2024
322f129
Merge branch 'branch-24.08' into branch-24.08_RandomWalks
G-Cornett Jul 2, 2024
24135b8
Update new files to take rng_state
G-Cornett Jul 2, 2024
ffa1219
removed old files
G-Cornett Jul 2, 2024
3b4716d
Merge branch 'branch-24.08' into branch-24.08_RandomWalks
G-Cornett Jul 8, 2024
a3592ff
Minor change to allow const iterator compatability
G-Cornett Jul 8, 2024
650c5dd
Merge branch 'branch-24.08' into branch-24.08_RandomWalks
G-Cornett Jul 9, 2024
4cd2d06
SG Node2Vec (pre-generic refactoring)
G-Cornett Jul 11, 2024
fe41bf1
Merge branch 'branch-24.08' into branch-24.08_RandomWalks
G-Cornett Jul 11, 2024
5672493
Merge branch 'branch-24.08' into branch-24.08_RandomWalks
G-Cornett Jul 16, 2024
57b83b9
Merge branch 'branch-24.08' into branch-24.08_RandomWalks
G-Cornett Jul 17, 2024
80be067
Generic RW refactor to allow node2vec correct shuffling. Biased RW S…
G-Cornett Jul 23, 2024
d13dd95
Merge branch 'branch-24.08' into branch-24.08_RandomWalks
G-Cornett Jul 23, 2024
a55d88c
Merge branch 'rapidsai:branch-24.08' into branch-24.08_RandomWalks
G-Cornett Jul 26, 2024
597530b
Bug fixes
G-Cornett Jul 31, 2024
941086e
Merge branch 'branch-24.10' into branch-24.08_RandomWalks
G-Cornett Aug 8, 2024
a7c6a22
Node2Vec MG retool and bug fixes
G-Cornett Aug 8, 2024
b57fcb7
rng_state repositioning and changes per PR review
G-Cornett Aug 9, 2024
c50165a
Merge branch 'branch-24.10' into branch-24.08_RandomWalks
G-Cornett Aug 13, 2024
3f300c2
PR review changes (full)
G-Cornett Aug 15, 2024
d791b95
Merge branch 'branch-24.10' into branch-24.08_RandomWalks
G-Cornett Aug 15, 2024
28ef4f2
Fixed SG/MG compatability issue
G-Cornett Aug 16, 2024
0a34c25
Merge branch 'branch-24.10' into branch-24.08_RandomWalks
G-Cornett Aug 21, 2024
30815d5
PR review changes, general polishing, SG uniform unblocked
G-Cornett Aug 29, 2024
35cd032
Merge branch 'branch-24.10' into branch-24.08_RandomWalks
G-Cornett Aug 29, 2024
c88144b
Merge branch 'branch-24.10' into branch-24.08_RandomWalks
G-Cornett Aug 30, 2024
c5eac6a
Merge branch 'rapidsai:branch-24.10' into branch-24.08_RandomWalks
G-Cornett Sep 3, 2024
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
6 changes: 3 additions & 3 deletions cpp/include/cugraph/algorithms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ uniform_random_walks(raft::handle_t const& handle,
std::optional<edge_property_view_t<edge_t, weight_t const*>> edge_weight_view,
raft::device_span<vertex_t const> start_vertices,
size_t max_length,
uint64_t seed = std::numeric_limits<uint64_t>::max());
raft::random::RngState& rng_state);
G-Cornett marked this conversation as resolved.
Show resolved Hide resolved

/**
* @brief returns biased random walks from starting sources, where each path is of given
Expand Down Expand Up @@ -1627,7 +1627,7 @@ biased_random_walks(raft::handle_t const& handle,
edge_property_view_t<edge_t, weight_t const*> edge_weight_view,
raft::device_span<vertex_t const> start_vertices,
size_t max_length,
uint64_t seed = std::numeric_limits<uint64_t>::max());
raft::random::RngState& rng_state);
G-Cornett marked this conversation as resolved.
Show resolved Hide resolved

/**
* @brief returns biased random walks with node2vec biases from starting sources,
Expand Down Expand Up @@ -1676,7 +1676,7 @@ node2vec_random_walks(raft::handle_t const& handle,
size_t max_length,
weight_t p,
weight_t q,
uint64_t seed = std::numeric_limits<uint64_t>::max());
raft::random::RngState& rng_state);
G-Cornett marked this conversation as resolved.
Show resolved Hide resolved

#ifndef NO_CUGRAPH_OPS
/**
Expand Down
13 changes: 7 additions & 6 deletions cpp/src/c_api/random_walks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "c_api/abstract_functor.hpp"
#include "c_api/graph.hpp"
#include "c_api/resource_handle.hpp"
#include "c_api/random.hpp"
#include "c_api/utils.hpp"

#include <cugraph_c/algorithms.h>
Expand Down Expand Up @@ -156,7 +157,7 @@ struct uniform_random_walks_functor : public cugraph::c_api::abstract_functor {
cugraph::c_api::cugraph_graph_t* graph_{nullptr};
cugraph::c_api::cugraph_type_erased_device_array_view_t const* start_vertices_{nullptr};
size_t max_length_{0};
size_t seed_{0};
cugraph::c_api::cugraph_rng_state_t* rng_state_{nullptr};
G-Cornett marked this conversation as resolved.
Show resolved Hide resolved
cugraph::c_api::cugraph_random_walk_result_t* result_{nullptr};

uniform_random_walks_functor(cugraph_resource_handle_t const* handle,
Expand Down Expand Up @@ -228,7 +229,7 @@ struct uniform_random_walks_functor : public cugraph::c_api::abstract_functor {
(edge_weights != nullptr) ? std::make_optional(edge_weights->view()) : std::nullopt,
raft::device_span<vertex_t const>{start_vertices.data(), start_vertices.size()},
max_length_,
seed_);
rng_state_->rng_state_);
G-Cornett marked this conversation as resolved.
Show resolved Hide resolved

//
// Need to unrenumber the vertices in the resulting paths
Expand Down Expand Up @@ -259,7 +260,7 @@ struct biased_random_walks_functor : public cugraph::c_api::abstract_functor {
cugraph::c_api::cugraph_type_erased_device_array_view_t const* start_vertices_{nullptr};
size_t max_length_{0};
cugraph::c_api::cugraph_random_walk_result_t* result_{nullptr};
uint64_t seed_{0};
cugraph::c_api::cugraph_rng_state_t* rng_state_{nullptr};

biased_random_walks_functor(cugraph_resource_handle_t const* handle,
cugraph_graph_t* graph,
Expand Down Expand Up @@ -332,7 +333,7 @@ struct biased_random_walks_functor : public cugraph::c_api::abstract_functor {
edge_weights->view(),
raft::device_span<vertex_t const>{start_vertices.data(), start_vertices.size()},
max_length_,
seed_);
rng_state_->rng_state_);
G-Cornett marked this conversation as resolved.
Show resolved Hide resolved

//
// Need to unrenumber the vertices in the resulting paths
Expand All @@ -359,7 +360,7 @@ struct node2vec_random_walks_functor : public cugraph::c_api::abstract_functor {
size_t max_length_{0};
double p_{0};
double q_{0};
uint64_t seed_{0};
cugraph::c_api::cugraph_rng_state_t* rng_state_{nullptr};
cugraph::c_api::cugraph_random_walk_result_t* result_{nullptr};

node2vec_random_walks_functor(cugraph_resource_handle_t const* handle,
Expand Down Expand Up @@ -439,7 +440,7 @@ struct node2vec_random_walks_functor : public cugraph::c_api::abstract_functor {
max_length_,
static_cast<weight_t>(p_),
static_cast<weight_t>(q_),
seed_);
rng_state_->rng_state_);
G-Cornett marked this conversation as resolved.
Show resolved Hide resolved

// FIXME: Need to fix invalid_vtx issue here. We can't unrenumber max_vertex_id+1
// properly...
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/prims/per_v_random_select_transform_outgoing_e.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ per_v_random_select_transform_e(raft::handle_t const& handle,
uniform_sample_and_compute_local_nbr_indices(
handle,
graph_view,
(minor_comm_size > 1) ? get_dataframe_buffer_begin(*aggregate_local_frontier)
(minor_comm_size > 1) ? get_dataframe_buffer_cbegin(*aggregate_local_frontier)
: frontier.begin(),
local_frontier_displacements,
local_frontier_sizes,
Expand All @@ -365,7 +365,7 @@ per_v_random_select_transform_e(raft::handle_t const& handle,
biased_sample_and_compute_local_nbr_indices(
handle,
graph_view,
(minor_comm_size > 1) ? get_dataframe_buffer_begin(*aggregate_local_frontier)
(minor_comm_size > 1) ? get_dataframe_buffer_cbegin(*aggregate_local_frontier)
: frontier.begin(),
edge_bias_src_value_input,
edge_bias_dst_value_input,
Expand Down Expand Up @@ -394,7 +394,7 @@ per_v_random_select_transform_e(raft::handle_t const& handle,
graph_view.local_edge_partition_view(i));

auto edge_partition_frontier_key_first =
((minor_comm_size > 1) ? get_dataframe_buffer_begin(*aggregate_local_frontier)
((minor_comm_size > 1) ? get_dataframe_buffer_cbegin(*aggregate_local_frontier)
: frontier.begin()) +
local_frontier_displacements[i];
auto edge_partition_sample_local_nbr_index_first =
Expand Down
Loading
Loading