Multicore Yade

Asked by Pawel

When I start
yade-1.07.0 -j4 --performance four cores are working, but when I start my script it works only on one thread.

################################
################################
################################
# FUNCTIONAL COMPONENTS

# simulation loop -- see presentation for the explanation
O.engines=[
   PyRunner(command='SaveData()',virtPeriod=1./1000),
   ForceResetter(),
   VppNeighbours(),
   VppPressureForce(),
   PyRunner(command='ChangeMask()',iterPeriod=1),
   PyRunner(command='ChangePos()',iterPeriod=1),
   PyRunner(command='ChangePosFoil()',iterPeriod=1),
   PyRunner(command='PreChangePos()',iterPeriod=1),
   PyRunner(command='PressureOn()',iterPeriod=1),
   PyRunner(command='PressureTimeOn()',iterPeriod=1),
     InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
  InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(interactionDetectionFactor=1.2),
  Ig2_Wall_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom6D()],
  [Ip2_FrictMat_FrictMat_FrictPhys(),
  Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=False,setCohesionOnNewContacts=False),
  VppIp2_VppCohFrictMat_VppCohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),
  VppIp2_CohFrictMat_VppCohFrictMat_CohFrictPhys(setCohesionNow=False,setCohesionOnNewContacts=False)#,
  #VppPressure_VppCohFrictMat_VppCohFrictMat()
  ],
  [Law2_ScGeom_FrictPhys_CundallStrack(),
  VppLaw2_ScGeom6D_CohFrictPhys_CohesionMoment(
   useIncrementalForm=False, #useIncrementalForm is turned on as we want plasticity on the contact moments
   always_use_moment_law=True, #if we want "rolling" friction even if the contact is not cohesive (or cohesion is broken), we will have to turn this true somewhere
   shearBreaksCohesion = False,
   label='cohesiveLaw')]
 ),
   # apply gravity force to particles
   GravityEngine(gravity=(0,0,-9.81)),
   # damping: numerical dissipation of energy
   NewtonIntegrator(damping=0.2)
]

# set timestep to a fraction of the critical timestep
# the fraction is very small, so that the simulation is not too fast
# and the motion can be observed
O.dt=utils.PWaveTimeStep()

# save the simulation, so that it can be reloaded later, for experimentation
O.saveTmp()
yade.qt.Controller(), yade.qt.View();

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hi Pawel,

please be more specific why you think it run only on one thread.

Morover, when attaching scripts, please post working pieces of code. I got
"NameError: name 'VppNeighbours' is not defined"

cheers
Jan

2016-06-03 20:12 GMT+02:00 Pawel <email address hidden>:

> New question #294845 on Yade:
> https://answers.launchpad.net/yade/+question/294845
>
> When I start
> yade-1.07.0 -j4 --performance four cores are working, but when I start my
> script it works only on one thread.
>
> ################################
> ################################
> ################################
> # FUNCTIONAL COMPONENTS
>
> # simulation loop -- see presentation for the explanation
> O.engines=[
> PyRunner(command='SaveData()',virtPeriod=1./1000),
> ForceResetter(),
> VppNeighbours(),
> VppPressureForce(),
> PyRunner(command='ChangeMask()',iterPeriod=1),
> PyRunner(command='ChangePos()',iterPeriod=1),
> PyRunner(command='ChangePosFoil()',iterPeriod=1),
> PyRunner(command='PreChangePos()',iterPeriod=1),
> PyRunner(command='PressureOn()',iterPeriod=1),
> PyRunner(command='PressureTimeOn()',iterPeriod=1),
>
> InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
> InteractionLoop(
>
> [Ig2_Sphere_Sphere_ScGeom6D(interactionDetectionFactor=1.2),
> Ig2_Wall_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom6D()],
> [Ip2_FrictMat_FrictMat_FrictPhys(),
>
> Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=False,setCohesionOnNewContacts=False),
>
> VppIp2_VppCohFrictMat_VppCohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),
>
> VppIp2_CohFrictMat_VppCohFrictMat_CohFrictPhys(setCohesionNow=False,setCohesionOnNewContacts=False)#,
> #VppPressure_VppCohFrictMat_VppCohFrictMat()
> ],
> [Law2_ScGeom_FrictPhys_CundallStrack(),
> VppLaw2_ScGeom6D_CohFrictPhys_CohesionMoment(
> useIncrementalForm=False, #useIncrementalForm is
> turned on as we want plasticity on the contact moments
> always_use_moment_law=True, #if we want "rolling"
> friction even if the contact is not cohesive (or cohesion is broken), we
> will have to turn this true somewhere
> shearBreaksCohesion = False,
> label='cohesiveLaw')]
> ),
> # apply gravity force to particles
> GravityEngine(gravity=(0,0,-9.81)),
> # damping: numerical dissipation of energy
> NewtonIntegrator(damping=0.2)
> ]
>
> # set timestep to a fraction of the critical timestep
> # the fraction is very small, so that the simulation is not too fast
> # and the motion can be observed
> O.dt=utils.PWaveTimeStep()
>
> # save the simulation, so that it can be reloaded later, for
> experimentation
> O.saveTmp()
> yade.qt.Controller(), yade.qt.View();
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Anton Gladky (gladky-anton) said :
#2

I have a gut feeling that the bottle neck of your simulations are
many python-functions executed by PyRunner. All of them are
normally executed by one thread.

Anton

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#3

Hi Pavel,
Yade has profiling features which should be useful in your case.
Please see https://yade-dem.org/doc/prog.html#timing

Until now I would follow Anton. If you did not implement parallel versions of the following functions then of course giving more cores is not magically parallelizing them :
   PyRunner(command='SaveData()',virtPeriod=1./1000),
   ForceResetter(),
   VppNeighbours(),
   VppPressureForce(),
   PyRunner(command='ChangeMask()',iterPeriod=1),
   PyRunner(command='ChangePos()',iterPeriod=1),
   PyRunner(command='ChangePosFoil()',iterPeriod=1),
   PyRunner(command='PreChangePos()',iterPeriod=1),
   PyRunner(command='PressureOn()',iterPeriod=1),
   PyRunner(command='PressureTimeOn()',iterPeriod=1),

Can you help with this problem?

Provide an answer of your own, or ask Pawel for more information if necessary.

To post a message you must log in.