-
Notifications
You must be signed in to change notification settings - Fork 15
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
In-place Assembly of PSparseMatrices #138
Comments
It depends on how
In any case, I think that if we match the local numbering of the FE space DOFs and that of the local linear system, then |
btw I agree there is a bug, and should be solved in Gridap |
Hi @JordiManyer A[i,j] = v also uses binary search for A::SparseMatricCSC |
Hi @amartinhuertas , @fverdugo , I'll then go ahead and fix the bug in Gridap. |
@amartinhuertas I have found a potential inefficiency in the in-place assembly of distributed linear systems.
Some context:
In Gridap, we declare the function
Algebra.add_entry
, which is used to assemble an(i,j,v)
triplet into different structures (counters, COOs and matrices). As usual, there are different specializations of this function. In particular, we have different functions forAbstractMatrix
andAbstractSparseMatrix
:BUG 1: As we can see, for
AbstractMatrix
we callcombine(aij,v)
whereas forAbstractSparseMatrix
we callcombine(v,aij)
. This leads to different behaviors whencombine
is not commutative. For instance,(a,b) -> a
would create different matrices depending on the type.Due to the above bug, I have also uncovered something I believe is quite bad:
When in-place assembling distributed matrices, we assemble the local contributions by using a local view of the global matrix. This view is given by the function
local_views(A,rows,cols)
, which returns an object of typeThis means that the local portion of a
PSparseMatrix
will be assembled as anAbstractMatrix
, and NOT as anAbstractSparseMatrix
, therefore triggering theadd_entry!
version forAbstractMatrix
, which tries to access the matrix entry directly instead of using a sparse-specific access pattern likenz_index(A,i,j)
.My concern is the following: Is this efficient?
The text was updated successfully, but these errors were encountered: