How severe does this issue affect your experience of using Ray?
- Medium: It contributes to significant difficulty to complete my task, but I can work around it.
Hi! Recently I want to run a CFD application on Ray, it need to divide the grid into several sub-grids, and calculate on different workers.
But the questions is: during every calculation step of a sub-grid, it need to communicate with its neighbor, is there any way to send and receive message between workers? Or do I have to split the task and use ray.put()
and ray.get()
?
def sub_worker():
fe[1:-1, 1:-1] = 0.5 * (hc[1:-1, 1:-1] + hc[1:-1, 2:]) * self.u[1:-1, 1:-1]
fn[1:-1, 1:-1] = 0.5 * (hc[1:-1, 1:-1] + hc[2:, 1:-1]) * self.v[1:-1, 1:-1]
# need to exchange data with neighbor grid
fe = self.enforce_boundaries()
fn = self.enforce_boundaries()
# continue when data exchange are done
dh_new[1:-1, 1:-1] = -(
(fe[1:-1, 1:-1] - fe[1:-1, :-2]) / dx
+ (fn[1:-1, 1:-1] - fn[:-2, 1:-1]) / dy
)
# potential vorticity
q = q.at[1:-1, 1:-1].mul(
1.0 / (0.25 * (hc[1:-1, 1:-1] + hc[1:-1, 2:] + hc[2:, 1:-1] + hc[2:, 2:]))
)
# another data exchange
q = enforce_boundaries()
du_new = du.at[1:-1, 1:-1].set(
-GRAVITY * (h[1:-1, 2:] - h[1:-1, 1:-1]) / dx
+ 0.5
* (
q[1:-1, 1:-1] * 0.5 * (fn[1:-1, 1:-1] + fn[1:-1, 2:])
+ q[:-2, 1:-1] * 0.5 * (fn[:-2, 1:-1] + fn[:-2, 2:])
)
)