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

Faster ExclusiveTopology construction #927

Closed
wants to merge 2 commits into from
Closed

Faster ExclusiveTopology construction #927

wants to merge 2 commits into from

Conversation

KnutAM
Copy link
Member

@KnutAM KnutAM commented May 20, 2024

Had this as notes lingering around after seeing #617, nothing urgent or major.
Timings should be verified by someone since this is so heavy on GC it seems to be quite unreliable to time it and profiling changes from run to run...

Somewhat representative btime runs give

grid = generate_grid(Hexahedron, (40, 40, 40)) # more stable timings than 3x80
@btime ExclusiveTopology($grid);
528.067 ms (3582741 allocations: 378.69 MiB) # PR
580.268 ms (4094719 allocations: 464.89 MiB) # master

Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.84%. Comparing base (1fcdef1) to head (b09ac4b).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #927      +/-   ##
==========================================
- Coverage   93.86%   93.84%   -0.02%     
==========================================
  Files          36       36              
  Lines        5313     5296      -17     
==========================================
- Hits         4987     4970      -17     
  Misses        326      326              

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

@KnutAM KnutAM changed the title Faster construction Faster ExclusiveTopology construction May 20, 2024
@@ -107,17 +107,18 @@ function _num_shared_vertices(cell_a::C1, cell_b::C2) where {C1, C2}
end

function _exclusive_topology_ctor(cells::Vector{C}, vertex_cell_table::Array{Set{Int}}, vertex_table, face_table, edge_table, cell_neighbor_table) where C <: AbstractCell
cell_neighbor_ids = Set{Int}()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there an advantage to making this ordered so the order in the cell_neighbor_table[cell_id] will not be "random"? Maybe it doesn't matter.

Copy link
Member

Choose a reason for hiding this comment

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

Probably this does not matter, because we do not enforce any ordering and locality properties on our grids in general.

@termi-official
Copy link
Member

I cannot see any significant difference between the PR and master unfortunately.

Master 966.810 ms (4094719 allocations: 464.89 MiB)
PR 956.878 ms (3582741 allocations: 378.69 MiB)

So a about 1% difference on my machine. We need to think about how to increase data locality and reduce allocations here if we want to see a significant speedup.

@KnutAM
Copy link
Member Author

KnutAM commented May 29, 2024

Thanks for checking it!

@KnutAM KnutAM closed this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants