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

Sparsity lifetime #19

Open
wrtobin opened this issue May 3, 2018 · 2 comments
Open

Sparsity lifetime #19

wrtobin opened this issue May 3, 2018 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@wrtobin
Copy link
Owner

wrtobin commented May 3, 2018

A sparsity is allocated inside of las and used to create a matrix of some type.

The matrix will then either own the sparsity and manage it's lifespan or the sparsity is still owned by the user and must be dealt with.

At present this detail is handled differently by different backends. When creating a PETSc matrix, the Sparsity NNZ is used to preallocate the matrix, but not owned by the PETSc Mat.

The sparse sparse(csr) backend captures the underlying CSR object, but doesn't own it since the object is not deleted when the matrix is. But if the user deletes the CSR object in user space the matrix would be invalidated.

We either need to copy the CSR (less desirable but not practically terrible), or invalidate the user-space pointer to the Sparsity so the user can't accidentally delete it and invalidate the Matrix, which would mean passing in a Sparsity ** to the matrix creation function instead of a Sparsity*.

@wrtobin wrtobin added the enhancement New feature or request label May 3, 2018
@wrtobin wrtobin self-assigned this May 3, 2018
@wrtobin
Copy link
Owner Author

wrtobin commented May 3, 2018

Also in the dense backend the Sparsity is used but not captured so the object doesn't need to persist and the user should immediately delete it
.
Basically the usage needs to be standardized across the board.

@wrtobin
Copy link
Owner Author

wrtobin commented May 8, 2018

Added the ability to specify csr ownership in the csrMat constructor in commit 3ee26dd, but usage of this additional interface facility isn't ubiquitous or consistent yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant