Re: [Yade-users] [Question #704389]: Problem with OpenMP

2023-01-18 Thread Bruno Chareyre
Question #704389 on Yade changed:
https://answers.launchpad.net/yade/+question/704389

Bruno Chareyre proposed the following answer:
Hello Roxana,
I have no real knowledge of how LiqControl works but maybe it's taking most of 
the time, and if it is not parallelized it would explain.
I see you enabled timing, would you paste the output of "timing.stats()" after 
many iterations? It would tell.
Bruno

-- 
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 : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #704389]: Problem with OpenMP

2023-01-17 Thread Karol Brzezinski
Question #704389 on Yade changed:
https://answers.launchpad.net/yade/+question/704389

Status: Open => Answered

Karol Brzezinski proposed the following answer:
Hi Roxana,

Please note that this was discussed in this forum several times, and you
can find more information on other topics (e.g., [1]).

Very briefly, I would summarise it in two points:
- First, parallelization efficiency depends on the simulation. If one person 
can paint the room in eight hours, it doesn't mean that 48 people would paint 
the room in ten minutes :) 
- Secondly, the source code needs to be prepared for OpenMP parallelization. In 
Yade, it is usually realized by "#pragma omp parallel for" directive [2]. It 
tells the program where computations can be split in several threads without 
causing problems. It is usually used for long loops of independent operations 
(e.g. newtonIntegrator). So, if your engine does not have such a directive 
inside, your simulation will use one core most of the time. 

Best wishes
Karol

[1] https://answers.launchpad.net/yade/+question/699458
[2] https://yade-dem.org/doc/prog.html#parallel-execution

-- 
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 : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #704389]: Problem with OpenMP

2023-01-13 Thread Roxana Saghafian Larijani
New question #704389 on Yade:
https://answers.launchpad.net/yade/+question/704389

Dear all ,

I am trying to run my simulation on multiple cores using openMP (using j -n). 
However, I can see that only one core is being used at 100% cpu.  I have 
provided the MWE below and was wondering if you know what might be wrong?

I am not sure if it is the same problem as question 689131 or not. I tried to 
use sp.cellFill as Jan mentions in that question, but if I am not mistaken it 
cannot be used for periodic=False case , and my simulation is not periodic.

from yade import ymport
from yade import pack
from yade import utils, plot,wrapper


fr = 0.38
rho = 3000

En = 0.22
Et = 0.22
poi=0.3
yoM=200e6


r = 0.0005  


Gamma = 0.073 
Theta = 0
vB = 6.03  * 1e-9 
CapType="Rabinovich"
KN=2*(47.17)
KS=2*(13.48)
CN=2*(0.0053)
CS=2*(0.0015)



##definig material

mat=O.materials.append(
ViscElCapMat(frictionAngle=fr, density=rho, poisson=poi, young= yoM, 
Vb=vB, gamma=Gamma, theta=Theta, Capillar=True, CapillarType=CapType,en=En, 
et=Et,kn=KN,ks=KS,cn=CN, cs=CS)
)

#defining the spheres

sp=pack.SpherePack()
sp.makeCloud((-0.033,-0.033,-0.01),(0.033,0.033,0.01),rMean=r)
sp.toSimulation(material=mat)
Nprtcl=len(O.bodies)
print(Nprtcl)
Tt= utils.PWaveTimeStep()
O.dt = 0.5*Tt


#liquidMigration
VV=0.03
Vmin=0.0

for s in O.bodies:
if not type(s.shape)==wrapper.Sphere:
continue
s.state.Vf=VV * (4/3) * 3.14*(s.shape.radius)**3
s.state.Vmin=Vmin
##

Drum=geom.facetCylinder(material=mat,center=(0.0,0.0,0.0), segmentsNumber=32, 
radius=0.05,height=0.03,orientation=Quaternion(Vector3(0,0,1),(pi/2.0)))
walls = O.bodies.append(Drum)


##engine
O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
[Ip2_ViscElCapMat_ViscElCapMat_ViscElCapPhys()],
[Law2_ScGeom_ViscElCapPhys_Basic()],

),
   
NewtonIntegrator(gravity=[0, -9.8, 0]),
RotationEngine(ids=walls,rotationAxis=[0,0,1],rotateAroundZero=True, 
zeroPoint=[0.0,0.0,0.0], angularVelocity=0.45),
LiqControl(label='lqc')
]


import math


O.timingEnabled = 1
from yade import timing

duration=60.0/O.dt
O.run( 2 * math.floor(duration),True)

timing.stats()

###saving for Restart
O.save('test.bz2')


Regards,
Roxana

-- 
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 : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp