Loop multiprocessing and shared memory using ray

I am currently trying to measure the photo-consistency between two images thanks to the planesweep algorithm [Collins, 1995], therefore I have set up a variable called “score-map” of size H x W x L (H and W are the size of the processed images and L is the depth range). This process needs to be achieved very quickly, that’s why I am trying to exploit the 8 cores of my CPU in an optimal way.

I tried to parallel the processes since each increment i of depths is independent of the others. However, at the moment I am encountering some difficulties, the returning error is the following:

RayTaskError(ValueError): ray::iteration_planesweep() (pid=2320, ip= File “python\ray_raylet.pyx”, line 480, in ray._raylet.execute_task File “”, line 78, in iteration_planesweep ValueError: assignment destination is read-only

I am aware that the problem may comes from the variable that needs to be shared across all the processes, but I cannot translate this need into a concrete form. Because in the ray package, ray.put() is supposed to allow a variable to be shared across the different independent processes.
I have a solution which consist of saving a file for each processing loop but it is also time-consuming …

Another problem is to adapt the multiprocessing with the complexity of my algorithm, I tried to build two separate functions to make the adaptation to ray easier, also by exporting part of the processing outside the main class or the actor. But I can’t get a concrete result, either it returns an incomprehensible error, or the program runs without producing anything.

This is a link to a file containing my algorithm : https://we.tl/t-VaQk8yPaPv

I would be very thankful if someone could help me solve this problem.

Thank you in advance for your time and consideration.

Raphaël HAENEL

Thanks @RaphINSA7. Please tag me if you do not get a response for a while.
CC @sangcho