-
Notifications
You must be signed in to change notification settings - Fork 66
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
WIP: Improve sparse utils #107
Open
ahojukka5
wants to merge
34
commits into
master
Choose a base branch
from
feature/SparseVector
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
That is, we have at the end Ax=b, taking sparse matrices in standard format and giving back x = [u, la] vector.
- rewrite how update!solver) works using only SparseVector - this clearly reduces memory allocation and makes code more clear, a lot of magic disappeared - there is still some problem when constructing LinearSystem ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── solve!(solver) 1 217ms 89.6% 217ms 96.1MiB 50.0% 96.1MiB empty field assemblies before solution 1 132ms 54.4% 132ms 128B 0.00% 128B combine assemblies 1 82.1ms 33.9% 82.1ms 96.0MiB 49.9% 96.0MiB solve linear system 1 2.90ms 1.19% 2.90ms 37.5KiB 0.02% 37.5KiB solve boundary system using LU factorization 1 1.67ms 0.69% 1.67ms 6.27KiB 0.00% 6.27KiB solve interior domain using LDLt factorization 1 896μs 0.37% 896μs 8.81KiB 0.00% 8.81KiB solve Lagrange multipliers using LU factorization 1 43.1μs 0.02% 43.1μs 10.4KiB 0.01% 10.4KiB construct LinearSystem 1 123μs 0.05% 123μs 9.86KiB 0.01% 9.86KiB make stffiness matrix symmetric 1 38.5μs 0.02% 38.5μs 6.78KiB 0.00% 6.78KiB update solution vectors 1 1.21μs 0.00% 1.21μs 352B 0.00% 352B assemble!(solver) 1 24.6ms 10.1% 24.6ms 96.2MiB 50.0% 96.2MiB update!(solver) 1 521μs 0.21% 521μs 37.4KiB 0.02% 37.4KiB initialize!(solver) 1 23.7μs 0.01% 23.7μs 3.13KiB 0.00% 3.13KiB ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── versus ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── Time Allocations ────────────────────── ─────────────────────── Tot / % measured: 16.7s / 100% 21.0GiB / 100% Section ncalls time %tot avg alloc %tot avg ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── solve!(solver) 1 16.7s 99.8% 16.7s 21.0GiB 99.6% 21.0GiB construct LinearSystem 1 11.2s 67.2% 11.2s 14.9GiB 70.8% 14.9GiB make stffiness matrix symmetric 1 3.81s 22.8% 3.81s 4.47GiB 21.2% 4.47GiB solve linear system 1 1.34s 8.04% 1.34s 1.49GiB 7.08% 1.49GiB solve boundary system using LU factorization 1 1.25ms 0.01% 1.25ms 6.27KiB 0.00% 6.27KiB solve interior domain using LDLt factorization 1 688μs 0.00% 688μs 8.39KiB 0.00% 8.39KiB solve Lagrange multipliers using LU factorization 1 75.2μs 0.00% 75.2μs 9.99KiB 0.00% 9.99KiB empty field assemblies before solution 1 209ms 1.25% 209ms 128B 0.00% 128B combine assemblies 1 78.7ms 0.47% 78.7ms 96.0MiB 0.45% 96.0MiB update solution vectors 1 1.40μs 0.00% 1.40μs 352B 0.00% 352B assemble!(solver) 1 27.4ms 0.16% 27.4ms 96.2MiB 0.45% 96.2MiB update!(solver) 1 721μs 0.00% 721μs 39.9KiB 0.00% 39.9KiB initialize!(solver) 1 25.6μs 0.00% 25.6μs 3.13KiB 0.00% 3.13KiB ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
- If / when changing function calling, let's put old ones to deprecated.jl so that code won't break too much. - Fixed elastiticy tests, we do not use `u` and `la` in assemblies anymore.
To prevent test break again: - removed code aster mesh file reading (test only one thing at time) - define function get_solution_vector to return solution from solver
- Removed unnecessary stuff (test only one thing at time)
- block.assembly.u -> solver.u, or better, reshape(get_solution_vector(solver), solver.ndim, solver.nnodes)
- fixed way how solution is read from solver.
``` 23-Apr 17:15:05:INFO:root:Assembled 2 problems in 0.05 seconds. ndofs = 4634485491540951040. 23-Apr 17:15:05:INFO:root:Assembly times: 23-Apr 17:15:05:INFO:root:1 BLOCK 0.02 23-Apr 17:15:05:INFO:root:2 symmetry bc 0.02 23-Apr 17:15:05:INFO:root:Solving problems ... test 2d nonlinear elasticity with surface load: Error During Test Got an exception of type OutOfMemoryError outside of a @test ``` - But it's not showing in my local installation with same julia version. - Removed obsolete code from `assemble!(solver::Solver; with_mass_matrix=false)`. - Now also timings of assembly is done using TimerOutputs.
- block.assembly.u -> get_solution_vector(solver)
To prevent tests to break again, now we have a function `get_nodal_values` what can be used to query single nodal value from element, we use this from now on and do not read from solution vector directly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See issue #96. This is "Work in Progress", not to be merged yet.