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

Enable MG support for small datasets #2216

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 16 additions & 2 deletions python/cugraph/cugraph/dask/common/part_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2021, NVIDIA CORPORATION.
# Copyright (c) 2019-2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -88,9 +88,23 @@ async def _extract_partitions(dask_obj, client=None, batch_enabled=False):
if batch_enabled:
persisted = client.persist(dask_obj, workers=worker_list[0])
else:
# Have the first n workers persisting the n partitions
# Ideally, there would be as many partitions as there are workers
persisted = [client.persist(
dask_obj.get_partition(p), workers=w) for p, w in enumerate(
worker_list)]
worker_list[:dask_obj.npartitions])]
# Persist empty dataframe with the remaining workers if there are
# less partitions than workers
if dask_obj.npartitions < len(worker_list):
# The empty df should have the same column names and dtypes as
# dask_obj
empty_df = cudf.DataFrame(columns=list(dask_obj.columns))
empty_df = empty_df.astype(dict(zip(
dask_obj.columns, dask_obj.dtypes)))
for p, w in enumerate(worker_list[dask_obj.npartitions:]):
empty_ddf = dask_cudf.from_cudf(empty_df, npartitions=1)
persisted.append(client.persist(empty_ddf, workers=w))

parts = futures_of(persisted)
# iterable of dask collections (need to colocate them)
elif isinstance(dask_obj, collections.abc.Sequence):
Expand Down
4 changes: 2 additions & 2 deletions python/cugraph/cugraph/structure/renumber_wrapper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ cdef renumber_helper(shuffled_vertices_t* ptr_maj_min_w, vertex_t, weights):
# vertex_t or weight_t. Failing to do that will create am empty column of type object
# which is not supported by '__cuda_array_interface__'
if shuffled_major_series is None:
shuffled_major_series = cudf.Series(dtype=vertex_t)
shuffled_df['major_vertices'] = cudf.Series(dtype=vertex_t)
else:
shuffled_df['major_vertices']= shuffled_major_series
if shuffled_minor_series is None:
shuffled_minor_series = cudf.Series(dtype=vertex_t)
shuffled_df['minor_vertices'] = cudf.Series(dtype=vertex_t)
else:
shuffled_df['minor_vertices']= shuffled_minor_series

Expand Down