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

Persist more in MGPropertyGraph #2805

Merged
merged 3 commits into from
Oct 24, 2022
Merged
Changes from 1 commit
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
37 changes: 18 additions & 19 deletions python/cugraph/cugraph/dask/structure/mg_property_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def add_vertex_data(
self.__vertex_prop_dtypes.update(new_col_info)

# Join on shared columns and the indices
tmp_df = tmp_df.set_index(self.vertex_col_name)
tmp_df = tmp_df.persist().set_index(self.vertex_col_name).persist()
cols = self.__vertex_prop_dataframe.columns.intersection(
tmp_df.columns
).to_list()
Expand All @@ -465,7 +465,9 @@ def add_vertex_data(
self.__vertex_prop_dataframe = (
self.__vertex_prop_dataframe.reset_index()
.merge(tmp_df.reset_index(), on=cols, how="outer")
.persist()
.set_index(self.vertex_col_name)
.persist()
)
# self.__vertex_prop_dataframe = \
# self.__vertex_prop_dataframe.merge(tmp_df, on=cols, how="outer")
Expand All @@ -479,8 +481,6 @@ def add_vertex_data(
self.__vertex_prop_eval_dict[
self.vertex_col_name
] = self.__vertex_prop_dataframe.index
# Should we persist?
# self.__vertex_prop_dataframe = self.__vertex_prop_dataframe.persist()

def get_vertex_data(self, vertex_ids=None, types=None, columns=None):
"""
Expand Down Expand Up @@ -666,16 +666,15 @@ def add_edge_data(
tmp_df[self.edge_id_col_name] = (
tmp_df[self.edge_id_col_name].cumsum() + starting_eid
)
tmp_df = tmp_df.persist()
tmp_df = tmp_df.set_index(self.edge_id_col_name)
tmp_df = tmp_df.persist()
tmp_df = tmp_df.persist().set_index(self.edge_id_col_name).persist()
self.__last_edge_id = starting_eid + len(tmp_df)
else:
tmp_df = tmp_df.persist()
tmp_df = tmp_df.rename(
columns={edge_id_col_name: self.edge_id_col_name}
).set_index(self.edge_id_col_name)
tmp_df = tmp_df.persist()
tmp_df = (
tmp_df.rename(columns={edge_id_col_name: self.edge_id_col_name})
.persist()
.set_index(self.edge_id_col_name)
.persist()
)

if property_columns:
# all columns
Expand All @@ -701,7 +700,9 @@ def add_edge_data(
self.__edge_prop_dataframe = (
self.__edge_prop_dataframe.reset_index()
.merge(tmp_df.reset_index(), on=cols, how="outer")
.persist()
.set_index(self.edge_id_col_name)
.persist()
)
# self.__edge_prop_dataframe = \
# self.__edge_prop_dataframe.merge(tmp_df, on=cols, how="outer")
Expand All @@ -717,8 +718,6 @@ def add_edge_data(
self.__edge_prop_eval_dict[
self.edge_id_col_name
] = self.__edge_prop_dataframe.index
# Should we persist?
# self.__edge_prop_dataframe = self.__edge_prop_dataframe.persist()

def get_edge_data(self, edge_ids=None, types=None, columns=None):
"""
Expand Down Expand Up @@ -1118,9 +1117,9 @@ def renumber_vertices_by_type(self):
df[self.vertex_col_name] = 1
df[self.vertex_col_name] = df[self.vertex_col_name].cumsum() - 1

self.__vertex_prop_dataframe = df.set_index(
self.vertex_col_name, sorted=True
).persist()
self.__vertex_prop_dataframe = (
df.persist().set_index(self.vertex_col_name, sorted=True).persist()
)

# FIXME DASK_CUDF: https://github.com/rapidsai/cudf/issues/11795
df = self._vertex_type_value_counts
Expand Down Expand Up @@ -1163,9 +1162,9 @@ def renumber_edges_by_type(self):

df[self.edge_id_col_name] = 1
df[self.edge_id_col_name] = df[self.edge_id_col_name].cumsum() - 1
self.__edge_prop_dataframe = df.set_index(
self.edge_id_col_name, sorted=True
).persist()
self.__edge_prop_dataframe = (
df.persist().set_index(self.edge_id_col_name, sorted=True).persist()
)

# FIXME DASK_CUDF: https://github.com/rapidsai/cudf/issues/11795
df = self._edge_type_value_counts
Expand Down