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

FaceSkeleton Vroom 1 #759

Merged

Conversation

AbdAlazezAhmed
Copy link
Collaborator

@AbdAlazezAhmed AbdAlazezAhmed commented Jul 7, 2023

Makes face skeleton construction faster by using topology information.
Benchmarks:

julia> using Ferrite

julia> using BenchmarkTools

julia> grid = generate_grid(Hexahedron,(100,100,100))
Grid{3, Hexahedron, Float64} with 1000000 Hexahedron cells and 1030301 nodes

julia> topology = ExclusiveTopology(grid);

julia> @benchmark Ferrite. _faceskeleton(topology, grid)
BenchmarkTools.Trial: 19 samples with 1 evaluation.
 Range (min  max):  221.792 ms  410.902 ms  ┊ GC (min  max): 0.00%  0.00%
 Time  (median):     254.305 ms               ┊ GC (median):    0.00%
 Time  (mean ± σ):   271.663 ms ±  46.478 ms  ┊ GC (mean ± σ):  0.00% ± 0.00%

  ▁▁   ██▁█ ▁  █      █▁    ▁   ▁        ▁                    ▁  
  ██▁▁▁████▁█▁▁█▁▁▁▁▁▁██▁▁▁▁█▁▁▁█▁▁▁▁▁▁▁▁█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█ ▁
  222 ms           Histogram: frequency by time          411 ms <

 Memory estimate: 46.23 MiB, allocs estimate: 2.

Current implementation:

julia> using Ferrite

julia> using BenchmarkTools

julia> grid = generate_grid(Hexahedron,(100,100,100))
Grid{3, Hexahedron, Float64} with 1000000 Hexahedron cells and 1030301 nodes

julia> topology = ExclusiveTopology(grid);

julia> @benchmark Ferrite. _faceskeleton(topology, grid)
BenchmarkTools.Trial: 3 samples with 1 evaluation.
Range (min  max):  1.578 s     1.932 s  ┊ GC (min  max): 0.00%  18.59%
Time  (median):     1.763 s               ┊ GC (median):    0.00%
Time  (mean ± σ):   1.758 s ± 176.799 ms  ┊ GC (mean ± σ):  6.81% ± 10.74%

 █                             █                          █  
 █▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█ ▁
 1.58 s         Histogram: frequency by time         1.93 s <

Memory estimate: 652.91 MiB, allocs estimate: 17026973.

grid argument is kept in case it's needed in the future. The if-else thing can be avoided if we consistently define "faces" as vertices for 1D case.

@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d0f0e07) 92.98% compared to head (49bc732) 93.12%.
Report is 6 commits behind head on master.

❗ Current head 49bc732 differs from pull request most recent head 439978b. Consider uploading reports for the commit 439978b to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #759      +/-   ##
==========================================
+ Coverage   92.98%   93.12%   +0.14%     
==========================================
  Files          33       33              
  Lines        4950     4949       -1     
==========================================
+ Hits         4603     4609       +6     
+ Misses        347      340       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@termi-official termi-official added the gsoc23 Google Summer of Code 2023 label Jul 10, 2023
@termi-official
Copy link
Member

Can we add some additional tests to check if the construction works out fine? Especially for the 1D case.

Copy link
Member

@termi-official termi-official left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AbdAlazezAhmed
Copy link
Collaborator Author

Trying to improve performance a bit more

julia> @benchmark Ferrite. _faceskeleton(topology, grid)
BenchmarkTools.Trial: 39 samples with 1 evaluation.
 Range (min  max):  116.631 ms  164.498 ms  ┊ GC (min  max): 0.00%  28.98%
 Time  (median):     129.052 ms               ┊ GC (median):    0.00%
 Time  (mean ± σ):   128.925 ms ±   6.938 ms  ┊ GC (mean ± σ):  0.95% ±  4.64%

                 █▁                                              
  ▄▁▃▁▁▁▁▁▁▁▁▁▁▁▁██▆▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▃ ▁
  117 ms           Histogram: frequency by time          164 ms <

 Memory estimate: 46.23 MiB, allocs estimate: 2.

Maybe we can also get rid of the extra allocation (and GC?)

@termi-official
Copy link
Member

Can you resolve the conflict? Should be good to go then. 10x improvement is really nice. :)

@termi-official termi-official added the awaiting review PR is finished from the authors POV, waiting for feedback label Nov 14, 2023
src/Grid/topology.jl Outdated Show resolved Hide resolved
Co-authored-by: Maximilian Köhler <maximilian.koehler@ruhr-uni-bochum.de>
@termi-official termi-official merged commit 324bd4a into Ferrite-FEM:master Dec 6, 2023
6 checks passed
@AbdAlazezAhmed AbdAlazezAhmed deleted the FaceSkeletonVroom1 branch December 6, 2023 18:56
@fredrikekre fredrikekre removed the awaiting review PR is finished from the authors POV, waiting for feedback label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement gsoc23 Google Summer of Code 2023
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants