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

Implementation of new hand written poisson #160

Merged
merged 3 commits into from
Dec 11, 2024
Merged

Implementation of new hand written poisson #160

merged 3 commits into from
Dec 11, 2024

Conversation

Cmurilochem
Copy link
Collaborator

Closes #159.

@Cmurilochem
Copy link
Collaborator Author

Cmurilochem commented Dec 11, 2024

@fverdugo and @raar1. The first draft of the new implementation of our hand written poisson is ready. But there are lots of things that we can still optimize.

For example, in assemble_fill and integrate_error_norms (and export_results to a lesser extent) I noticed that the core loops have nearly the same structure and there is a lot of code repetition. Maybe something to look at.

EDIT:

Even though, the timing of our minimal example:

import GalerkinToolkit as GT
using GalerkinToolkitExamples: Poisson

tol = 1.0e-10

n = 10
mesh = GT.cartesian_mesh((0,1,0,1,0,1),(n,n,n))

params = Dict{Symbol,Any}()
params[:implementation] = :hand_written
params[:mesh] = mesh
params[:integration_degree] = 2

@time results = Poisson.main(params)

@assert results[:error_l2_norm] < tol
@assert results[:error_h1_norm] < tol

is nearly optimal:

──────────────────────────────────────────────────────────────────────────────────
                                         Time                    Allocations
                                ───────────────────────   ────────────────────────
       Tot / % measured:             1.82s / 100.0%           1.73GiB / 100.0%

Section                 ncalls     time    %tot     avg     alloc    %tot      avg
──────────────────────────────────────────────────────────────────────────────────
export_results               1    908ms   49.9%   908ms    672MiB   38.0%   672MiB
assemble_system              1    608ms   33.4%   608ms    806MiB   45.6%   806MiB
setup                        1    168ms    9.3%   168ms    144MiB    8.1%   144MiB
solve_system                 1    102ms    5.6%   102ms   91.5MiB    5.2%  91.5MiB
integrate_error_norms        1   31.9ms    1.8%  31.9ms   55.1MiB    3.1%  55.1MiB
──────────────────────────────────────────────────────────────────────────────────
  1.822781 seconds (80.12 M allocations: 1.728 GiB, 5.09% gc time)

@fverdugo
Copy link
Collaborator

Perfect! @Cmurilochem can you please remove the old version?

@Cmurilochem
Copy link
Collaborator Author

Perfect! @Cmurilochem can you please remove the old version?

Yes, of course. Done!

@Cmurilochem Cmurilochem marked this pull request as ready for review December 11, 2024 07:59
@fverdugo fverdugo merged commit 4293a5b into main Dec 11, 2024
6 checks passed
@fverdugo fverdugo deleted the example_poisson branch December 11, 2024 08:44
@fverdugo
Copy link
Collaborator

We are "bending the line" 😀

Screenshot from 2024-12-11 09-43-32

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

Successfully merging this pull request may close these issues.

Split hand written poisson example into small pieces
2 participants