underworldcode / underworld2

underworld2: A parallel, particle-in-cell, finite element code for Geodynamics.
http://www.underworldcode.org/
Other
168 stars 58 forks source link

running time #698

Open hakertop opened 3 months ago

hakertop commented 3 months ago

Hi all,

I recently used the underworld2 based on the Docker platform. It is very convenient compared to the native machine installation. However, I found it will take a lot of times when I run any project.

I want to know if it it normal? Could it improve the running speed if I install the Underworld2 into the native machine? Or Could we set the Docker parameters to improve?

all the best!

julesghub commented 3 months ago

Hi @hakertop , Glad you found the docker installation a convenience, that's what it's for.

In general the docker performance is below a native build as in includes non optimised code for the hardware of the host machine and there is a virtualisation layer.

Broadly speaking the Docker performance depends on 2 factors.

  1. Is the docker configuration appropriate for the host hardware. This is setup when you docker run. See https://docs.docker.com/config/containers/resource_constraints/
  2. Is the model appropriate for docker configuration.

Remember Underworld performance depends on the model - without know more I can't comment on it.

Could you single out an example model as a slow one that I can investigate?

Also what version of the docker are you trying?

hakertop commented 3 months ago

Hi Julian, Thanks for your reply! I hope everything is going well! Please allow me to provide more details, as I believe some people may encounter similar issues in the future. 1, My Docker version is 4.28.0, deployed in Windows under WSL2. Someone told me that deploying Docker under Linux might be better. 2, I haven't fully mastered the Docker configuration yet. I tried to modify different parameters, such as memory, swap, etc., but the results were not ideal. I have discovered that when I run my script, the CPU load reaches 100%, and VmmemWSL also occupies 100% of the CPU. I am looking for the cause of this situation. 3, I want to simulate the formation of detachment folds on a two-dimensional section. I wrote a new script to test a more extended profile by imitating a case in the project (d_26-NumericalSandboxCompression MovingWall. ipynb). This new script is attached below. Figure 1 shows the original state, and Figure 2 shows the state after 300 runs. The result made me extremely excited because it was what I wanted. Unfortunately, this program ran for several hours without even completing the preset number of runs. Figure 1

Figure2

4, Please forgive my unfamiliarity with crustal deformation parameters, as I still struggle to determine the appropriate coupling between parameters (i.e. Viscosity, DruckerPrager, Friction). I would greatly appreciate it if you could provide some suggestions for my new script or you could modify the script. This will enhance my insight into Underworld2 and save me time.
Underworld2 is a user-friendly project, and I am eagerly looking forward to using it to study my experimental area. All the best, Yangen
Yangen Shen

@. | ---- Replied Message ---- | From | Julian @.> | | Date | 7/2/2024 00:50 | | To | @.> | | Cc | @.>, @.***> | | Subject | Re: [underworldcode/underworld2] running time (Issue #698) |

Hi @hakertop , Glad you found the docker installation a convenience, that's what it's for.

In general the docker performance is below a native build as in includes non optimised code for the hardware of the host machine and there is a virtualisation layer.

Broadly speaking the Docker performance depends on 2 factors.

Is the docker configuration appropriate for the host hardware. This is setup when you docker run. See https://docs.docker.com/config/containers/resource_constraints/ Is the model appropriate for docker configuration.

Remember Underworld performance depends on the model - without know more I can't comment on it.

Could you single out an example model as a slow one that I can investigate?

Also what version of the docker are you trying?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

hakertop commented 2 months ago

Hi Julian,

I would like to know if you receive my messages. Do you think if I should run big model on HPC platform? I am not sure if the Underworld2 support the HPC platform. I find that it platform is relatively slow when I ran my model on the Docker.

Thanks,

hakertop commented 2 months ago

I think I should attach the code. I am testing 3D detachment folding.

`from underworld import UWGeodynamics as GEO from underworld import visualisation as vis

u = GEO.UnitRegistry

velocity = 2.5 u.centimeter / u.hour model_length = 40. u.centimeter model_height = 10. u.centimeter refViscosity = 1e7 u.pascal u.second bodyforce = 1560 u.kilogram / u.metre3 9.81 u.meter / u.second2

KL = model_length Kt = KL / velocity KM = bodyforce * KL*2 Kt**2

GEO.scaling_coefficients["[length]"] = KL GEO.scaling_coefficients["[time]"] = Kt GEO.scaling_coefficients["[mass]"]= KM

Model = GEO.Model(elementRes=(48,48,12), minCoord=(0. u.centimeter, 0. u.centimeter,-3.5 u.centimeter), maxCoord=(40. u.centimeter,40. u.centimeter, 6.5 u.centimeter), gravity=(0.0, 0.0, -9.81 * u.meter / u.second**2))

Model.outputDir="outputs_tutorial_IndentorB2"

Model.minViscosity = 1.0e5 u.pascal u.second Model.maxViscosity = 1e12 u.pascal u.second Model.density = 1560. * u.kilogram / u.metre**3

air = Model.add_material(name="Air", shape=GEO.shapes.Layer3D(top=Model.top, bottom=0.0u.centimetre)) sand1 = Model.add_material(name="Sand1", shape=GEO.shapes.Layer3D(top=air.bottom, bottom=Model.bottom)) sand2 = Model.add_material(name="Sand2", shape=GEO.shapes.Layer3D(top=-1.0 u.centimetre, bottom=-1.5u.centimetre)) microbeads = Model.add_material(name="Microbeads", shape=GEO.shapes.Layer3D(top=-2.5 u.centimetre, bottom=-3.5*u.centimetre))

import numpy as np

npoints = 500 coords = np.ndarray((npointsnpoints, 3)) KX= np.linspace(GEO.nd(Model.minCoord[0]), GEO.nd(Model.maxCoord[0]), npoints) KY= np.linspace(GEO.nd(Model.minCoord[1]), GEO.nd(Model.maxCoord[1]), npoints) for i in range(len(KX)): for j in range(len(KY)): coords[npointsi+j,0]=KX[i] coords[npoints*i+j,1]=KY[j]

coords[:, 2] = GEO.nd(sand1.top)

Model.add_passive_tracers(name="Interface1", vertices=coords)

coords[:, 2] = GEO.nd(sand2.top) Model.add_passive_tracers(name="Interface2", vertices=coords)

coords[:, 2] = GEO.nd(sand2.bottom) Model.add_passive_tracers(name="Interface3", vertices=coords)

coords[:, 2] = GEO.nd(microbeads.top) Model.add_passive_tracers(name="Interface4", vertices=coords)

coords[:, 2] = GEO.nd(microbeads.bottom) Model.add_passive_tracers(name="Interface5", vertices=coords)

air.density = 10. * u.kilogram / u.metre3 sand1.density = 1560. * u.kilogram / u.metre*3 sand2.density = 1560. u.kilogram / u.metre3 microbeads.density = 1480. * u.kilogram / u.metre**3

air.viscosity = 1.0e5 u.pascal u.second sand1.viscosity = 1.0e12 u.pascal u.second sand2.viscosity = 1.0e12 u.pascal u.second microbeads.viscosity = 1.0e12 u.pascal u.second

sandFriction = np.tan(np.radians(36.0)) sandFrictionW = np.tan(np.radians(31.0))

microbeadsFriction = np.tan(np.radians(22.0)) microbeadsFrictionW = np.tan(np.radians(21.0))

sand1.plasticity = GEO.DruckerPrager(cohesion=10.u.pascal, frictionCoefficient=sandFriction, frictionAfterSoftening=sandFrictionW) sand2.plasticity = GEO.DruckerPrager(cohesion=10.u.pascal, frictionCoefficient=sandFriction, frictionAfterSoftening=sandFrictionW)

sand3.plasticity = GEO.DruckerPrager(cohesion=10.*u.pascal, frictionCoefficient=sandFriction, frictionAfterSoftening=sandFrictionW)

microbeads.plasticity = GEO.DruckerPrager(cohesion=10.*u.pascal, frictionCoefficient=microbeadsFriction, frictionAfterSoftening=microbeadsFrictionW)

Model.set_velocityBCs(left=[0.0,0.0,0.0], right=GEO.MovingWall(velocity=-2.5 * u.centimetre / u.hour), front=[None, 0.0, None], back=[None, 0.0, None], top=[None, None, None], bottom=[None,0.0,0.0])

Model.init_model()

Model.solver.set_inner_method("mumps") Model.solver.set_penalty(1e6)

Model.run_for(duration=4.0u.hour, checkpoint_interval=10.0 u.minutes)`