How can I change a variable from one process to another if the two processes are on different machines?

Goodmorning everyone!

I have a pretty simple question.

If I am using N processes (on a cluster, potentially with processes defined on different nodes) and I want to make sure that each process is able to modify a variable (or an array) defined only in the master process, how can I do this?

In practice I would like to “check” all processes and make sure that a variable (defined only in the master process) is modified only if a certain condition is met in at least one of the processes.

Thanks everyone in advance!

I’m not an expert on this, but I’ll respond because nobody else has taken it.

A worked out example of distributed computing can be found here:

For your first question, it sounds like you are looking for a SharedArray.
For the second, to prevent a race condition you would use a lock (pointer in the above thread). But I may misunderstand what you are asking for in your last paragraph.

1 Like