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
Remove PETScWrappers deprecations #9937
Remove PETScWrappers deprecations #9937
Conversation
I'm actually using these quite extensively, including for some rectangular structural matrices (i.e. without an associated FE space). Once this is merged, the only remaining constructor will require a SparsityPattern. How do I replace somehing like It seems it will require constructing SparsityPattern manually before initializing the matrix. |
Yes, this has been deprecated for a couple of years already without any complaints. |
Perhaps I miss something. If I can create a PETSc matrix by using I specifically mean matrices, which are not square system matrices, but other objects. |
@dealii/dealii Can someone that uses |
I'll take a look. |
Sorry for the delays - I promise I will get to this soon! |
We have talked about support for this kind of operation in other places (if I recall correctly we want to support wrapping @agrayver We deprecated this since we wanted to make the interface to all of our sparse matrix classes the same. Would a matrix view that owns a |
@drwells thanks for looking at it.
Yes, it would. Is there such a mechanism? |
More specifically, do you mean one could add a constructor like?
If this is ok, I could add such constructor quickly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this and would be happy to take a follow-up PR that adds a constructor. @drwells do you agree?
It's not that easy. The model right now is that the class actually owns the pointer and its destructor is responsible for destroying the object. If you pass in a Separately, |
I think we could modify the PETSc internal reference count using PetscObjectReference / PetscObjectDereference. The last call to MatDestroy will then delete it. |
Yes, this seems a fully legit way that is used in PETSc examples, e.g.: https://www.mcs.anl.gov/petsc/petsc-current/src/ts/tutorials/ex3.c.html |
Alright. @agrayver you were saying that you could add a constructor quickly? We can then decide what we want to have in the release and what not. |
Huh, I had no idea that PETSc does reference counting on its objects... |
Its not that obvious from the names (or PETSc's documentation) but @agrayver is absolutely right. PETSc does reference count: PetscErrorCode MatDestroy(Mat *A)
{
PetscErrorCode ierr;
PetscFunctionBegin;
if (!*A) PetscFunctionReturn(0);
PetscValidHeaderSpecific(*A,MAT_CLASSID,1);
if (--((PetscObject)(*A))->refct > 0) {*A = NULL; PetscFunctionReturn(0);}
... I am not sure that we have enough time to do this before the release: we would also need to check that older versions of PETSc implement this logic, add tests for the new feature, etc. I believe it would be best to preserve the status quo (i.e., not merge this patch [1]) and then fix things once the release is out (in fact, I have 'update PETSc stuff' on my hackathon list). I really like the idea of adding views to PETSc objects this way - this is much better than what I had in mind! [1] By this patch I mean the present PR. |
Yes, let's not address accepting external |
For me, the question is whether we still want to merge this pull request for the release or not. |
Shall we vote? I think we should not merge this PR yet. |
Same here, let's not break anything right before the release. |
Fine. Let's just remove it from the milestone then. |
I just quote the above statement and adjust the milestone:
|
Do we want to tackle this shortly after next release? |
I would be happy if we could finally clean this up. |
Since I was the one who used these wrappers, just wanted to say that I have found an alternative way of doing things and do not need them anymore. |
I merged this pull request with |
This should be ready now. |
…recation Remove PETScWrappers deprecations
Deprecated in #2749 and some time before #6986.