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

Add a doc section comparing different assembly strategies #1063

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fredrikekre
Copy link
Member

No description provided.

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.75%. Comparing base (431e6cf) to head (a5c3cb2).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1063   +/-   ##
=======================================
  Coverage   93.75%   93.75%           
=======================================
  Files          39       39           
  Lines        6018     6018           
=======================================
  Hits         5642     5642           
  Misses        376      376           

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

@fredrikekre
Copy link
Member Author

@KnutAM
Copy link
Member

KnutAM commented Sep 20, 2024

Quick comments (didn't read super carefully).

I think this is very nice to put numbers on! Thanks for putting this together!

Wouldn't using broadcasting be the more "julian" way instead of manually looping or directly doing non-dot +=? Using a view seems to give same perf as loop - not sure if this is an issue with SparseArrays.jl that its not equivalent to broadcasting.

function assemble_v1d(_, K, dofs, Ke)
    @. K[dofs, dofs] += Ke # Or K[dofs, dofs] .+= Ke
    return
end;

function assemble_v1v(_, K, dofs, Ke)
    Kv = view(K, dofs, dofs);
    Kv .+= Ke
    return
end;

julia> @btime assemble_v1d($assembler, $K, $dofs, $Ke);
  22.300 μs (11 allocations: 716.23 KiB)

julia> @btime assemble_v1v($assembler, $K, $dofs, $Ke);
  2.511 μs (0 allocations: 0 bytes)

Regarding the content, personally I find it a bit too verbose with both the single and full assembly for what its showing. Perhaps a golden midway would be to include the timings for the full assembly, but collapse the actual element routine and assembly routine, and simply report the results?

Finally, why not use the heat equation assembly which is simpler for new users to follow?

@fredrikekre
Copy link
Member Author

Wouldn't using broadcasting be the more "julian" way instead of manually looping or directly doing non-dot +=?

Yea, maybe, I can add a note about this.

Regarding the content, personally I find it a bit too verbose

I can hide the global assembly routine perhaps? I don't think verbosity is really a problem though. This is in a "topic" section where we can dig a bit deeper.

Finally, why not use the heat equation assembly which is simpler for new users to follow?

I just wanted a bit of a bigger local matrix but probably the point can be made also with the smaller heat eq one.

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.

3 participants