kaipartmann / Peridynamics.jl

A Julia package for parallel peridynamics simulations
https://kaipartmann.github.io/Peridynamics.jl/
MIT License
32 stars 7 forks source link

Multithreading with PointNeighbors.jl and Polyester.jl #110

Open kaipartmann opened 1 week ago

kaipartmann commented 1 week ago

There are differences in performance (see https://github.com/kaipartmann/Peridynamics.jl/pull/107#issuecomment-2182414620) that seem to be related to combining Polyester.@batch and Base.Threads.

PointNeighbors.jl uses Polyester.@batch within the @threaded macro.

With threaded_nhs_update=true and changing all Threads.@threads calls in Peridynamics.jl, the following differences occur for the benchmark in https://github.com/kaipartmann/Peridynamics.jl/pull/107#issuecomment-2182414620:

# `@threads :static`
#  49.821336 seconds (2.93 M allocations: 3.263 GiB, 0.13% gc time)

# `@threads`
#  27.514394 seconds (2.92 M allocations: 3.262 GiB, 0.39% gc time)

# `Polyester.@batch`
#  11.450976 seconds (2.34 M allocations: 3.199 GiB, 0.49% gc time)

Originally posted by @kaipartmann in https://github.com/kaipartmann/Peridynamics.jl/issues/107#issuecomment-2182525712

kaipartmann commented 1 week ago

@efaulhaber