Re: [petsc-dev] MatSetPreallocationCOO remove attached objects?

2022-03-01 Thread Barry Smith

  It may be that certain attached objects cannot be kept; or if kept, when used 
need to be checked that they are still valid. This could be tagged with the 
objectID and when checked the current objectid be compared and the attached 
objects discarded if out of date. Depends exactly on how the objects are used.

  

> On Mar 1, 2022, at 6:36 PM, Mark Adams  wrote:
> 
> If it's tricky I would just throw an error if there are attached objects. 
> It was easy for me to work around it.
> Worry about it later.
> 
> On Tue, Mar 1, 2022 at 5:49 PM Junchao Zhang  > wrote:
> I met errors and I don't know how to fix them,  
> https://gitlab.com/petsc/petsc/-/jobs/2151255655 
> 
> The errors are all hypre-related.  @Stefano Zampini 
>   might know more.
> Perhaps we can assert in MatHeaderMerge(A,C) and A does not contain composed 
> objects?  MatHeaderMerge() is so vague on what will be kept and what will be 
> discarded.
> 
> --Junchao Zhang
> 
> 
> On Tue, Mar 1, 2022 at 3:00 PM Mark Adams  > wrote:
> I can attach my containers (3!) after this call.
> Actually better structure in my code but this should be fixed.
> Thanks
> 
> On Tue, Mar 1, 2022 at 3:06 PM Barry Smith  > wrote:
> 
>   These might not need to be deleted but could possibly be moved over
> 
> ierr = PetscFunctionListDestroy(&((PetscObject)A)->qlist);CHKERRQ(ierr);
>   ierr = PetscObjectListDestroy(&((PetscObject)A)->olist);CHKERRQ(ierr);
>   ierr = PetscComposedQuantitiesDestroy((PetscObject)A);CHKERRQ(ierr);
> 
> also MatHeaderReplace() exists. I struggle to understand the exact 
> differences and why both exist but I think there are some subtle reasons why 
> there are both and don't know if they can be merged.
> 
>> On Mar 1, 2022, at 2:47 PM, Junchao Zhang > > wrote:
>> 
>> I realized this problem but did not expect someone would run into it :)
>> Let me think again.
>> 
>> --Junchao Zhang
>> 
>> 
>> On Tue, Mar 1, 2022 at 1:33 PM Mark Adams > > wrote:
>> I have a container attached to my matrix and it seems to go away after a 
>> call to MatSetPreallocationCOO.
>> Does that sound plausible?
> 



Re: [petsc-dev] MatSetPreallocationCOO remove attached objects?

2022-03-01 Thread Mark Adams
If it's tricky I would just throw an error if there are attached objects.
It was easy for me to work around it.
Worry about it later.

On Tue, Mar 1, 2022 at 5:49 PM Junchao Zhang 
wrote:

> I met errors and I don't know how to fix them,
> https://gitlab.com/petsc/petsc/-/jobs/2151255655
> The errors are all hypre-related.  @Stefano Zampini
>   might know more.
> Perhaps we can assert in MatHeaderMerge(A,C) and A does not contain
> composed objects?  MatHeaderMerge() is so vague on what will be kept and
> what will be discarded.
>
> --Junchao Zhang
>
>
> On Tue, Mar 1, 2022 at 3:00 PM Mark Adams  wrote:
>
>> I can attach my containers (3!) after this call.
>> Actually better structure in my code but this should be fixed.
>> Thanks
>>
>> On Tue, Mar 1, 2022 at 3:06 PM Barry Smith  wrote:
>>
>>>
>>>   These might not need to be deleted but could possibly be moved over
>>>
>>> ierr = PetscFunctionListDestroy(&((PetscObject)A)->qlist);CHKERRQ(ierr);
>>>   ierr = PetscObjectListDestroy(&((PetscObject)A)->olist);CHKERRQ(ierr);
>>>   ierr = PetscComposedQuantitiesDestroy((PetscObject)A);CHKERRQ(ierr);
>>>
>>> also MatHeaderReplace() exists. I struggle to understand the exact
>>> differences and why both exist but I think there are some subtle reasons
>>> why there are both and don't know if they can be merged.
>>>
>>> On Mar 1, 2022, at 2:47 PM, Junchao Zhang 
>>> wrote:
>>>
>>> I realized this problem but did not expect someone would run into it :)
>>> Let me think again.
>>>
>>> --Junchao Zhang
>>>
>>>
>>> On Tue, Mar 1, 2022 at 1:33 PM Mark Adams  wrote:
>>>
 I have a container attached to my matrix and it seems to go away after
 a call to MatSetPreallocationCOO.
 Does that sound plausible?

>>>
>>>


Re: [petsc-dev] MatSetPreallocationCOO remove attached objects?

2022-03-01 Thread Junchao Zhang
I met errors and I don't know how to fix them,
https://gitlab.com/petsc/petsc/-/jobs/2151255655
The errors are all hypre-related.  @Stefano Zampini
  might know more.
Perhaps we can assert in MatHeaderMerge(A,C) and A does not contain
composed objects?  MatHeaderMerge() is so vague on what will be kept and
what will be discarded.

--Junchao Zhang


On Tue, Mar 1, 2022 at 3:00 PM Mark Adams  wrote:

> I can attach my containers (3!) after this call.
> Actually better structure in my code but this should be fixed.
> Thanks
>
> On Tue, Mar 1, 2022 at 3:06 PM Barry Smith  wrote:
>
>>
>>   These might not need to be deleted but could possibly be moved over
>>
>> ierr = PetscFunctionListDestroy(&((PetscObject)A)->qlist);CHKERRQ(ierr);
>>   ierr = PetscObjectListDestroy(&((PetscObject)A)->olist);CHKERRQ(ierr);
>>   ierr = PetscComposedQuantitiesDestroy((PetscObject)A);CHKERRQ(ierr);
>>
>> also MatHeaderReplace() exists. I struggle to understand the exact
>> differences and why both exist but I think there are some subtle reasons
>> why there are both and don't know if they can be merged.
>>
>> On Mar 1, 2022, at 2:47 PM, Junchao Zhang 
>> wrote:
>>
>> I realized this problem but did not expect someone would run into it :)
>> Let me think again.
>>
>> --Junchao Zhang
>>
>>
>> On Tue, Mar 1, 2022 at 1:33 PM Mark Adams  wrote:
>>
>>> I have a container attached to my matrix and it seems to go away after a
>>> call to MatSetPreallocationCOO.
>>> Does that sound plausible?
>>>
>>
>>


Re: [petsc-dev] MatSetPreallocationCOO remove attached objects?

2022-03-01 Thread Mark Adams
I can attach my containers (3!) after this call.
Actually better structure in my code but this should be fixed.
Thanks

On Tue, Mar 1, 2022 at 3:06 PM Barry Smith  wrote:

>
>   These might not need to be deleted but could possibly be moved over
>
> ierr = PetscFunctionListDestroy(&((PetscObject)A)->qlist);CHKERRQ(ierr);
>   ierr = PetscObjectListDestroy(&((PetscObject)A)->olist);CHKERRQ(ierr);
>   ierr = PetscComposedQuantitiesDestroy((PetscObject)A);CHKERRQ(ierr);
>
> also MatHeaderReplace() exists. I struggle to understand the exact
> differences and why both exist but I think there are some subtle reasons
> why there are both and don't know if they can be merged.
>
> On Mar 1, 2022, at 2:47 PM, Junchao Zhang  wrote:
>
> I realized this problem but did not expect someone would run into it :)
> Let me think again.
>
> --Junchao Zhang
>
>
> On Tue, Mar 1, 2022 at 1:33 PM Mark Adams  wrote:
>
>> I have a container attached to my matrix and it seems to go away after a
>> call to MatSetPreallocationCOO.
>> Does that sound plausible?
>>
>
>


Re: [petsc-dev] MatSetPreallocationCOO remove attached objects?

2022-03-01 Thread Barry Smith

  These might not need to be deleted but could possibly be moved over

ierr = PetscFunctionListDestroy(&((PetscObject)A)->qlist);CHKERRQ(ierr);
  ierr = PetscObjectListDestroy(&((PetscObject)A)->olist);CHKERRQ(ierr);
  ierr = PetscComposedQuantitiesDestroy((PetscObject)A);CHKERRQ(ierr);

also MatHeaderReplace() exists. I struggle to understand the exact differences 
and why both exist but I think there are some subtle reasons why there are both 
and don't know if they can be merged.

> On Mar 1, 2022, at 2:47 PM, Junchao Zhang  wrote:
> 
> I realized this problem but did not expect someone would run into it :)
> Let me think again.
> 
> --Junchao Zhang
> 
> 
> On Tue, Mar 1, 2022 at 1:33 PM Mark Adams  > wrote:
> I have a container attached to my matrix and it seems to go away after a call 
> to MatSetPreallocationCOO.
> Does that sound plausible?



Re: [petsc-dev] MatSetPreallocationCOO remove attached objects?

2022-03-01 Thread Junchao Zhang
I realized this problem but did not expect someone would run into it :)
Let me think again.

--Junchao Zhang


On Tue, Mar 1, 2022 at 1:33 PM Mark Adams  wrote:

> I have a container attached to my matrix and it seems to go away after a
> call to MatSetPreallocationCOO.
> Does that sound plausible?
>


Re: [petsc-dev] MatSetPreallocationCOO remove attached objects?

2022-03-01 Thread Barry Smith


MatSetPreallocationCOO_SeqAIJ and MatSetPreallocationCOO_MPIAIJKokkos use 
MatHeaderMerge() that might lose some attached containers. It could be that 
MatHeaderMerge() needs to be revisited to ensure attached objects are not lost.

 Barry


> On Mar 1, 2022, at 2:32 PM, Mark Adams  wrote:
> 
> I have a container attached to my matrix and it seems to go away after a call 
> to MatSetPreallocationCOO.
> Does that sound plausible?