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

Feature required to fix GridapDistributed.jl issue #975

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed

- Changed how `symbolic_loop_matrix_vector!` loop works. Now it also takes account vector entries touched from matvecdata. Since PR[#975](https://github.com/gridap/Gridap.jl/pull/975).

## [0.17.22] - 2024-01-12

### Added
Expand Down
35 changes: 34 additions & 1 deletion src/FESpaces/SparseMatrixAssemblers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,44 @@ end
end

function symbolic_loop_matrix_and_vector!(A,b,a::SparseMatrixAssembler,data)
if LoopStyle(A) == DoNotLoop()
return A, b
end
matvecdata, matdata, vecdata = data
symbolic_loop_matrix!(A,a,matvecdata)
strategy = get_assembly_strategy(a)
for (cellmatvec,_cellidsrows,_cellidscols) in zip(matvecdata...)
cellidsrows = map_cell_rows(strategy,_cellidsrows)
cellidscols = map_cell_cols(strategy,_cellidscols)
@assert length(cellidscols) == length(cellidsrows)
@assert length(cellmatvec) == length(cellidsrows)
if length(cellmatvec) > 0
rows_cache = array_cache(cellidsrows)
cols_cache = array_cache(cellidscols)
vals_cache = array_cache(cellmatvec)
mat1, vec1 = getindex!(vals_cache,cellmatvec,1)
rows1 = getindex!(rows_cache,cellidsrows,1)
cols1 = getindex!(cols_cache,cellidscols,1)
touch! = TouchEntriesMap()
touch_mat_cache = return_cache(touch!,A,mat1,rows1,cols1)
touch_vec_cache = return_cache(touch!,b,vec1,rows1)
caches = touch_mat_cache, touch_vec_cache,rows_cache, cols_cache
_symbolic_loop_matvec!(A,b,caches,cellidsrows,cellidscols,mat1,vec1)
end
end
symbolic_loop_matrix!(A,a,matdata)
symbolic_loop_vector!(b,a,vecdata)
A, b
end

@noinline function _symbolic_loop_matvec!(A,b,caches,cell_rows,cell_cols,mat1,vec1)
touch_mat_cache, touch_vec_cache, rows_cache, cols_cache = caches
touch! = TouchEntriesMap()
for cell in 1:length(cell_cols)
rows = getindex!(rows_cache,cell_rows,cell)
cols = getindex!(cols_cache,cell_cols,cell)
evaluate!(touch_mat_cache,touch!,A,mat1,rows,cols)
evaluate!(touch_vec_cache,touch!,b,vec1,rows)
end
end

function numeric_loop_matrix_and_vector!(A,b,a::SparseMatrixAssembler,data)
Expand Down
Loading