Reputation: 195
I have a question concerning the access of the shared memory within the Ray Framework.
Imagine the following setup on 1 machine:
Is there a way to access the object O1 (put into shared memory from w1.py process) from another worker process w2.py?
When I execute ray.objects() from w2.py, I get the obejct reference string, but how could I retrieve the object from the shared memory then? I can not init a ObjectRef object in w2.py
Upvotes: 1
Views: 1209
Reputation: 925
This is not natively supported. The reason is ray’s objects have various metadata that is for various features (ex, perf optimization or automatic memory management using reference counting).
If you’d like to achieve this, I think there are 2 solutions.
Use a detached actor api. Detached actors are actors whose lifetime is not fare-sharing with drivers. Once you create a detached actor, you can obtain the actor handle using ray.get_actor API. This way, you can put an object inside a detached actor and access from multiple drivers.
There’s another way which uses cloudpickle, but I am not so familiar with this solution, so I won’t write about it. Please go to Ray’s discussion page in its Github repo to ask more details about it.
Upvotes: 1