[Core] zero-copy serializer for pytorch (#12344)

* zero-copy serializer for pytorch

* address possible bottleneck

* add tests & device support
This commit is contained in:
Siyuan (Ryans) Zhuang
2020-11-26 16:09:54 -08:00
committed by GitHub
parent e0573df337
commit 0a505ca83d
3 changed files with 99 additions and 1 deletions
+2
View File
@@ -26,6 +26,7 @@ from ray._raylet import (
MessagePackSerializedObject,
RawSerializedObject,
)
from ray import serialization_addons
logger = logging.getLogger(__name__)
@@ -155,6 +156,7 @@ class SerializationContext:
# Because objects have default __reduce__ method, we only need to
# treat ObjectRef specifically.
self._register_cloudpickle_reducer(ray.ObjectRef, object_ref_reducer)
serialization_addons.apply(self)
def _register_cloudpickle_reducer(self, cls, reducer):
pickle.CloudPickler.dispatch[cls] = reducer