Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance of main (2024-08-17) is worse compared to v8.6.0 #827

Closed
adtzlr opened this issue Aug 16, 2024 · 3 comments · Fixed by #828
Closed

Performance of main (2024-08-17) is worse compared to v8.6.0 #827

adtzlr opened this issue Aug 16, 2024 · 3 comments · Fixed by #828
Assignees
Labels
question Further information is requested

Comments

@adtzlr
Copy link
Owner

adtzlr commented Aug 16, 2024

The benchmark runs faster on v8.6.0 compared to main for the largest mesh. Try to figure out the reason(s) before creating a new release.

@adtzlr adtzlr added the question Further information is requested label Aug 16, 2024
@adtzlr adtzlr self-assigned this Aug 16, 2024
@adtzlr adtzlr changed the title Performance of main (2024-08-17) is worse compared to v8.8.0 Performance of main (2024-08-17) is worse compared to v8.6.0 Aug 16, 2024
@adtzlr
Copy link
Owner Author

adtzlr commented Aug 16, 2024

main:
image

v8.6.0:
image

@adtzlr
Copy link
Owner Author

adtzlr commented Aug 16, 2024

Try to use a minimal benchmark.

import felupe as fem

mesh = fem.Cube(n=21)
region = fem.RegionHexahedron(mesh)
field = fem.FieldContainer([fem.Field(region, dim=3)])
umat = fem.NeoHooke(mu=1, bulk=2)
solid = fem.SolidBody(umat=umat, field=field)

with

%timeit solid.assemble.matrix()

This gives 2.5 s (main) vs. 900 ms!!

@adtzlr
Copy link
Owner Author

adtzlr commented Aug 16, 2024

Let's use a more low-level benchmark.

import felupe as fem

mesh = fem.Cube(n=21)
region = fem.RegionHexahedron(mesh)
field = fem.FieldContainer([fem.Field(region, dim=3)])
umat = fem.NeoHooke(mu=1, bulk=2)

fun = umat.hessian(field.extract())
form = fem.IntegralForm(fun, field, region.dV, u=field)

values = form.integrate()
matrix = form.assemble(values)

# %timeit form.integrate()
# %timeit form.assemble(values)

1.8 s (main) vs. 380 ms

Something has changed in assembly.IntegralFormCartesian. The dhdX-arrays of the region are not C-contiguous anymore. That slows down the einsum-evaluation.

form.u[0].region.dhdX.flags
Out[25]: 
  C_CONTIGUOUS : False
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  WRITEBACKIFCOPY : False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant