How to properly use spmd in matlab with handle classes and synchonize data between workers

88 Views Asked by At

my problem is following:

I have a handle class with many objects and I want to link them to each other. So my vertex(1) from my class vertex needs to be linked to vertex(2) and vertex(3), so that my vertex(1) has the properties vertex(1).neighboor_vertex=vertex(2) (and vertex(3)).

This is just one thing that has to be done (actually I need to link and relink different classes to each other and because its millions of objects and want to do it in parrallel and the fact that linking is not working in parallel stops me from following steps).

So while worker 1 links vertex(1) to vertex(2), no other worker should be able to change the properties of both, they can lets say link 5 to 7 or so, and when the linking is done the new link of vertex(1) to vertex(2) and vertex(2) to vertex(1), needs to be updates to all other workers, so that when another worker wants to link vertex(3) to vertex(1), it has to know that it is alreay linked to vertex(1), otherwise there would be 2 different versions of vertex(1), one linked to vertex(2) and one linked to vertex(3).

So for the blocking that multiple workers cant change the the vertex I would need something like a mutex within the spmd, otherwise it wouldnt be threatsave...

What would be the best way to do this in Matlab?

Many Thanks in advance Best regards

0

There are 0 best solutions below