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

[IMP] Decrease Merge Peak Memory Usage of ConnectedComponents #375

Open
VibhuJawa opened this issue Nov 15, 2024 · 0 comments
Open

[IMP] Decrease Merge Peak Memory Usage of ConnectedComponents #375

VibhuJawa opened this issue Nov 15, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@VibhuJawa
Copy link
Collaborator

Describe the bug

On smaller GPU skews we are running into memory issues in the broadcast merge in Connected Components. We have to decrease that memory footprint without hurting performance too much.

def _write_encoded_jaccard_pair(self, dedup_parsed_id_path):
output_path = f"{self.cache_dir}/encoded_jaccard_pair/"
t0 = time.time()
with performance_report_if_with_ts_suffix(
self.profile_dir, "connected-components-encoded-jaccard-pair"
):
ddf_id = dask_cudf.read_parquet(
dedup_parsed_id_path, blocksize="2GB", aggregate_files=True
)
ddf = dask_cudf.read_parquet(
self.jaccard_pairs_path,
blocksize="1GB",
aggregate_files=True,
)
self._merge_and_write(
ddf=ddf,
ddf_id=ddf_id,
output_path=output_path,
id_column=self.id_column,
)
self._logger.info(
f"Time taken for Encoding Jaccard Pairs = {time.time() - t0}s and output written at {output_path}"
)
return output_path
def _merge_and_write(
self,
ddf: dask_cudf.DataFrame,
ddf_id: dask_cudf.DataFrame,
output_path: str,
id_column: str,
) -> None:
st = time.time()
# Ensure 'id_columns' is a list
ddf_id = ddf_id.set_index(id_column)
for tag in ["x", "y"]:
pair_id = f"{id_column}_{tag}"
# Merge 'ddf' with 'ddf_id' to map ids to uids
ddf = ddf.merge(
ddf_id,
left_on=pair_id,
right_index=True,
how="inner",
broadcast=True,
)
ddf = ddf.drop(columns=pair_id)
ddf = ddf.rename(columns={"uid": f"{self.id_column}_{tag}"})
ddf = ddf[[self.left_id, self.right_id, "jaccard"]]
ddf.to_parquet(output_path, write_index=False, overwrite=True)

CC: @ayushdg

@VibhuJawa VibhuJawa added the bug Something isn't working label Nov 15, 2024
@VibhuJawa VibhuJawa self-assigned this Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant