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

Pip install numbuf. #8

Merged
merged 1 commit into from
Oct 28, 2016
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
Pip install numbuf.
  • Loading branch information
robertnishihara committed Oct 28, 2016
commit d8646d8aed58d84e4e043a7b5b681499d7c94a2c
2 changes: 2 additions & 0 deletions install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ elif [[ $platform == "macosx" ]]; then
sudo pip install numpy funcsigs subprocess32 protobuf colorama graphviz --ignore-installed six
sudo pip install --upgrade git+git://github.com/cloudpipe/cloudpickle.git@0d225a4695f1f65ae1cbb2e0bbc145e10167cce4 # We use the latest version of cloudpickle because it can serialize named tuples.
fi

sudo pip install --upgrade git+git://github.com/ray-project/numbuf.git@d1974afbab9f0f1bcf8af15a8c476d868ad31aff
4 changes: 2 additions & 2 deletions lib/python/ray/serialization.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pickling
import libraylib as raylib
import libnumbuf
import numbuf

def is_argument_serializable(value):
"""Checks if value is a composition of primitive types.
Expand Down Expand Up @@ -216,4 +216,4 @@ def deserialize(serialized_obj):
return obj

# Register the callbacks with numbuf.
libnumbuf.register_callbacks(serialize, deserialize)
numbuf.register_callbacks(serialize, deserialize)
16 changes: 8 additions & 8 deletions lib/python/ray/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import internal.graph_pb2
import graph
import services
import libnumbuf
import numbuf
import libraylib as raylib

contained_objectids = []
Expand All @@ -38,7 +38,7 @@ def numbuf_serialize(value):
The serialized object.
"""
assert len(contained_objectids) == 0, "This should be unreachable."
return libnumbuf.serialize_list([value])
return numbuf.serialize_list([value])

class RayTaskError(Exception):
"""An object used internally to represent a task that threw an exception.
Expand Down Expand Up @@ -419,7 +419,7 @@ def put_object(self, objectid, value):
# write the metadata
metadata[:] = schema
data = np.frombuffer(buff, dtype="byte")[8 + len(schema):]
metadata_offset = libnumbuf.write_to_buffer(serialized, memoryview(data))
metadata_offset = numbuf.write_to_buffer(serialized, memoryview(data))
raylib.finish_buffer(self.handle, objectid, segmentid, metadata_offset)

def get_object(self, objectid):
Expand All @@ -436,7 +436,7 @@ def get_object(self, objectid):
metadata_size = int(np.frombuffer(buff, dtype="int64", count=1)[0])
metadata = np.frombuffer(buff, dtype="byte", offset=8, count=metadata_size)
data = np.frombuffer(buff, dtype="byte")[8 + metadata_size:]
serialized = libnumbuf.read_from_buffer(memoryview(data), bytearray(metadata), metadata_offset)
serialized = numbuf.read_from_buffer(memoryview(data), bytearray(metadata), metadata_offset)
# If there is currently no ObjectFixture for this ObjectID, then create a
# new one. The object_fixtures object is a WeakValueDictionary, so entries
# will be discarded when there are no strong references to their values.
Expand All @@ -446,7 +446,7 @@ def get_object(self, objectid):
if objectid.id not in object_fixtures:
object_fixture = ObjectFixture(objectid, segmentid, self.handle)
object_fixtures[objectid.id] = object_fixture
deserialized = libnumbuf.deserialize_list(serialized, object_fixtures[objectid.id])
deserialized = numbuf.deserialize_list(serialized, object_fixtures[objectid.id])
# Unwrap the object from the list (it was wrapped put_object)
assert len(deserialized) == 1
result = deserialized[0]
Expand Down Expand Up @@ -855,11 +855,11 @@ def register_class(cls, pickle=False, worker=global_worker):
"""Enable workers to serialize or deserialize objects of a particular class.

This method runs the register_class function defined below on every worker,
which will enable libnumbuf to properly serialize and deserialize objects of
this class.
which will enable numbuf to properly serialize and deserialize objects of this
class.

Args:
cls (type): The class that libnumbuf should serialize.
cls (type): The class that numbuf should serialize.
pickle (bool): If False then objects of this class will be serialized by
turning their __dict__ fields into a dictionary. If True, then objects
of this class will be serialized using pickle.
Expand Down
1 change: 0 additions & 1 deletion test/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import string
import sys
from collections import namedtuple
import libnumbuf

import test_functions
import ray.array.remote as ra
Expand Down