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

[REVIEW] Add indirection and replace algorithms with new renumbering #1484

Merged
merged 10 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from 6 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
3 changes: 2 additions & 1 deletion python/cugraph/community/egonet_wrapper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def egonet(input_graph, vertices, radius=1):
np.dtype("float32") : <int>numberTypeEnum.floatType,
np.dtype("double") : <int>numberTypeEnum.doubleType}

[src, dst] = [input_graph.edgelist.edgelist_df['src'], input_graph.edgelist.edgelist_df['dst']]
[src, dst] = graph_primtypes_wrapper.datatype_cast([input_graph.edgelist.edgelist_df['src'], input_graph.edgelist.edgelist_df['dst']], [np.int32])
vertex_t = src.dtype
edge_t = np.dtype("int32")
weights = None
Expand All @@ -54,6 +54,7 @@ def egonet(input_graph, vertices, radius=1):
weight_t = np.dtype("float32")

# Pointers for egonet
vertices = vertices.astype('int32')
cdef uintptr_t c_source_vertex_ptr = vertices.__cuda_array_interface__['data'][0]
n_subgraphs = vertices.size
n_streams = 1
Expand Down
4 changes: 4 additions & 0 deletions python/cugraph/community/ktruss_subgraph_wrapper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def ktruss_subgraph_double(input_graph, k, use_weights):


def ktruss_subgraph(input_graph, k, use_weights):
[input_graph.edgelist.edgelist_df['src'],
input_graph.edgelist.edgelist_df['dst']] = graph_primtypes_wrapper.datatype_cast([input_graph.edgelist.edgelist_df['src'],
input_graph.edgelist.edgelist_df['dst']],
[np.int32])
if graph_primtypes_wrapper.weight_type(input_graph) == np.float64 and use_weights:
return ktruss_subgraph_double(input_graph, k, use_weights)
else:
Expand Down
1 change: 1 addition & 0 deletions python/cugraph/community/subgraph_extraction_wrapper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def subgraph(input_graph, vertices):
if weights is not None:
c_weights = weights.__cuda_array_interface__['data'][0]

[vertices] = graph_primtypes_wrapper.datatype_cast([vertices], [np.int32])
cdef uintptr_t c_vertices = vertices.__cuda_array_interface__['data'][0]

if use_float:
Expand Down
4 changes: 4 additions & 0 deletions python/cugraph/cores/k_core_wrapper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def k_core(input_graph, k, core_number):
"""
Call k_core
"""
[input_graph.edgelist.edgelist_df['src'],
input_graph.edgelist.edgelist_df['dst']] = graph_primtypes_wrapper.datatype_cast([input_graph.edgelist.edgelist_df['src'],
input_graph.edgelist.edgelist_df['dst']],
[np.int32])
if graph_primtypes_wrapper.weight_type(input_graph) == np.float64:
return k_core_double(input_graph, k, core_number)
else:
Expand Down
21 changes: 19 additions & 2 deletions python/cugraph/dask/link_analysis/pagerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

from dask.distributed import wait, default_client
from cugraph.dask.common.input_utils import get_distributed_data
from cugraph.structure.shuffle import shuffle
from cugraph.dask.link_analysis import mg_pagerank_wrapper as mg_pagerank
import cugraph.comms.comms as Comms
import dask_cudf
import cudf


def call_pagerank(sID,
Expand All @@ -32,6 +32,10 @@ def call_pagerank(sID,
personalization,
nstart):
wid = Comms.get_worker_id(sID)
print("RANK: ", wid)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want these print statements left here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Will remove them , thanks for catching

if wid == 1:
for i in range(len(data[0])):
print(data[0]['src'].iloc[i], data[0]['dst'].iloc[i])
handle = Comms.get_handle(sID)
return mg_pagerank.mg_pagerank(data[0],
num_verts,
Expand Down Expand Up @@ -124,11 +128,24 @@ def pagerank(input_graph,
client = default_client()

input_graph.compute_renumber_edge_list(transposed=True)
(ddf,

"""(ddf,
num_verts,
partition_row_size,
partition_col_size,
vertex_partition_offsets) = shuffle(input_graph, transposed=True)
"""
ddf = input_graph.edgelist.edgelist_df

renumber_vertex_count = input_graph.renumber_map.implementation.ddf.\
map_partitions(len).compute()
renumber_vertex_cumsum = renumber_vertex_count.cumsum()
vertex_dtype = ddf['dst'].dtype
vertex_partition_offsets = cudf.Series([0], dtype=vertex_dtype)
vertex_partition_offsets = vertex_partition_offsets.append(cudf.Series(
renumber_vertex_cumsum, dtype=vertex_dtype))
num_verts = vertex_partition_offsets.iloc[-1]

num_edges = len(ddf)
data = get_distributed_data(ddf)

Expand Down
Loading