Hello,
I am strugling to use mutliprocessing with salome, and some developer help would be highly appreciated. I need to create several objects in geom but it takes a lot of time, each geometric object is 100% independent of each other, they do not share anything in commun, for each of them i have a list of vertexes and I want to create an object using MakeInterpol and the list of vertexes.
for simplicity, i created a dummy testing case where i create random positions for vertexes and the vertexes in sequential (using list coomprehension) and then I would like to create spheres in the each of this vertexes.
so the script looks like this:
listOfPosition=[[random.random(),random.random(),random.random()] for i in range(100)]
listOfVertexes=[geompy.MakeVertex(p[0], p[1], p[2]) for p in listOfPosition]
listOfSpheres_=[geompy.MakeSpherePntR(v, 100) for v in listOfVertexes]
def create_sphere(vertex):
return geompy.MakeSpherePntR(vertex, 100)
with Pool(processes=4) as pool: # Adjust number of processes as needed
listOfSpheres = pool.map(create_sphere, listOfVertexes)
geompy.addToStudy(geompy.MakeCompound(listOfSpheres_),"")
geompy.addToStudy(geompy.MakeCompound(listOfSpheres),"")
as it can be seen, I am ‘creating’ two times the spheres, in a list coomprehension (ie., listOfSpheres_) and in multiprocessing (ie., listOfSpheres)
the thing is that this runs without errors until the geompy.MakeCompound() where it fails for the list created in parallel (ie., listOfSpheres). the thing is, when I print the content of listOfSpheres it is same type as the one made in list coomprehension. is there any way I can ‘continue’ with the one made with multiprocessing? any extra step so i can use listOfSpheres normally?
the error I am getting is the following:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/home/franco/Desktop/blalba.py", line 52, in <module>
geompy.addToStudy(geompy.MakeCompound(listOfSpheres),"")
File "/home/franco/Programs/Salome/SALOME-9.14.0/BINARIES-CO7/GEOM/lib/python3.9/site-packages/salome/salome/geom/geomBuilder.py", line 368, in OpenCallClose
res = theFunction(self, *args, **kwargs)
File "/home/franco/Programs/Salome/SALOME-9.14.0/BINARIES-CO7/GEOM/lib/python3.9/site-packages/salome/salome/geom/geomBuilder.py", line 5122, in MakeCompound
anObj = self.ShapesOp.MakeCompound(ToList(theShapes))
File "/home/franco/Programs/Salome/SALOME-9.14.0/BINARIES-CO7/GEOM/lib/python3.9/site-packages/salome/GEOM_Gen_idl.py", line 1814, in MakeCompound
return self._obj.invoke("MakeCompound", _0_GEOM.GEOM_IShapesOperations._d_MakeCompound, args)
omniORB.CORBA._omni_sys_exc: CORBA.OBJECT_NOT_EXIST(omniORB.OBJECT_NOT_EXIST_NoMatch, CORBA.COMPLETED_NO)
thanks in advance