← Back to team overview

yade-users team mailing list archive

Re: [Question #647852]: Using openmp in a python script.

 

Question #647852 on Yade changed:
https://answers.launchpad.net/yade/+question/647852

    Status: Answered => Open

Deepak is still having a problem:
Hello Bruno,

So I did a few tests with YADE and python (like calling OpenMP codes inside python with MPI), and they work quite well.
I noticed that the OpenMP performance goes low when one tries to get some data by looping through YADE objects 
(before Newton Integrator): 

for e.g: 
 def myfunc(self):
   pvel= []; prot = []
   for b in O.bodies: 
     pvel.append(b.state.vel); prot.append(b.state.angVel)
   # another function (parallelized with openmp (tested independently with python and mpi)) 
   fx = calcforce(pvel, prot)
   # now add forces to the bodies, this also reduces the performance.. 
   for i, b in enumerate(O.bodies:):
     O.forces.addF(b.id,Vector3(f[i][0],f[i][1],f[i][2])) 
     
so I re-phrase my question: Is there a possible way on how I could loop through the objects and addforces every timestep without compromising on the performance? 

A very crude working example is here:  https://pastebin.com/J5FsRWQe
(taken from examples/concrete/triax-test, see that last few lines of
adding forces)

Hi Gary, each mpi process can spawn an openmp thread, so I am quite sure
it's not about the number of processes set in mpi (I tested this too).

Thanks, 
deepak

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.