-
Notifications
You must be signed in to change notification settings - Fork 917
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from rapidsai/branch-0.10
Changes
- Loading branch information
Showing
20 changed files
with
373 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,44 @@ | ||
import functools | ||
import pickle | ||
|
||
import cudf | ||
import cudf.core.groupby.groupby | ||
|
||
def register_distributed_serializer(cls): | ||
try: | ||
from distributed.protocol.cuda import cuda_serialize, cuda_deserialize | ||
from distributed.protocol import serialize, deserialize | ||
try: | ||
from distributed.protocol.cuda import cuda_deserialize, cuda_serialize | ||
from distributed.utils import log_errors | ||
|
||
serialize_part = functools.partial( | ||
serialize, serializers=["cuda", "dask", "pickle"] | ||
) | ||
deserialize_part = functools.partial( | ||
deserialize, deserializers=["cuda", "dask", "pickle"] | ||
# all (de-)serializtion are attached to cudf Objects: | ||
# Series/DataFrame/Index/Column/Buffer/etc | ||
@cuda_serialize.register( | ||
( | ||
cudf.DataFrame, | ||
cudf.Series, | ||
cudf.core.series.Series, | ||
cudf.core.groupby.groupby._Groupby, | ||
cudf.core.column.column.Column, | ||
) | ||
) | ||
def serialize_cudf_dataframe(x): | ||
with log_errors(): | ||
header, frames = x.serialize() | ||
return header, frames | ||
|
||
cuda_serialize.register(cls)( | ||
functools.partial(cls.serialize, serialize=serialize_part) | ||
) | ||
cuda_deserialize.register(cls)( | ||
functools.partial(cls.deserialize, deserialize_part) | ||
@cuda_deserialize.register( | ||
( | ||
cudf.DataFrame, | ||
cudf.Series, | ||
cudf.core.series.Series, | ||
cudf.core.groupby.groupby._Groupby, | ||
cudf.core.column.column.Column, | ||
) | ||
except ImportError: | ||
pass | ||
) | ||
def deserialize_cudf_dataframe(header, frames): | ||
with log_errors(): | ||
cudf_typ = pickle.loads(header["type"]) | ||
cudf_obj = cudf_typ.deserialize(header, frames) | ||
return cudf_obj | ||
|
||
|
||
except ImportError: | ||
# distributed is probably not installed on the system | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.