Pass arguments to remote function without serialization

Hi Everyone
I am new to ray, I request your answer in the following task:

  1. I need to pass arguments to a function which is being executed by ray multiprocessing without arguments being serialized and deserialized. Right now I am running a multiprocessing on a single machine, in future it will be remote function might be in another machine as well.
  2. How can I access a global variable in ray remote function?

It looks counterintuitive, but would it be possible to do that?
Your help is very much appreciated.

Hi @Parth_Mandaliya. Could you share your code? What kind of data are you working with?

1 Like

Hi @cade thanks for your reply, but I was able to resolve the issue.
I learned ray will always serialize data when passed to it or access within ray process.

  1. Serialization and deserialization is necessary, but if you use numpy array, ray will use shared memory, and it will only deserialize the metadata, not the data.
  2. I recommend you reading Anti-pattern: Using global variables to share state between tasks and actors — Ray 3.0.0.dev0
1 Like