[petsc-dev] [petsc-maint #49008] Problems with VecDotNorm2

Jose E. Roman jroman at dsic.upv.es
Thu Jul 8 11:56:25 CDT 2010


On 07/07/2010, Barry Smith wrote:

> 
> On Jul 6, 2010, at 9:49 AM, Jose E. Roman wrote:
> 
>> Dear all,
>> 
>> We at SLEPc have included a custom implementation of vectors that emulates block vectors in the spirit of PetscExt: v=[v1' v2']' where v1 and v2 are PETSc vectors. This is required for some new SLEPc solvers. With this new type of vectors, we avoid the VecGetArray/VecRestoreArray operations, which would imply array copies, and overload any other required operation. The only place outside SLEPc where these vectors are used is as arguments to KSPSolve.
>> 
>> The problem is VecDotNorm2, which is used in KSPSolve_BCGS and KSPSolve_GCR_cycle and invokes VecGetArray. VecDotNorm2 cannot be overloaded as the other functions, since it is not included in the _VecOps table. Therefore we cannot use KSP=bcgsl with our new solvers. A fix for us would be to promote VecDotNorm2 to be a true Vec operation
> 
> 
>  I have no objection to upgrading VecDotNorm2() to be a virtual function. 
> 
> 
>> . If possible, it would be nice that the fix would be included in petsc-3.1.
> 
>   We really don't like to make such a big change in a patch but if you make the change the change to 3.1 and test it then I have no objection.
> 
>   Barry
> 
>> 
>> Thanks,
>> Jose
>> 
>> PS. We plan to release slepc-3.1 in a few weeks.
>> 
>> 
> 

I am attaching two possible solutions to our problem.

1) patch-vecdotnorm2-table.diff --> this is the solution suggested initially. The problem is that if it is included in petsc-3.1 then the ABI will be incompatible with previous patches.

2) patch-vecdotnorm2-query.diff --> this uses PetscObjectQueryFunction so that the functionality can be replaced from outside. You may not like this hack but it maintains ABI compatibility.

You may decide to put 2) into petsc-release-3.1 and 1) into petsc-dev.

Note that both patchfiles are with respect to petsc-release-3.1.

Cheers,
Jose


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-vecdotnorm2-query.diff
Type: application/octet-stream
Size: 2402 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100708/3c01eb07/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-vecdotnorm2-table.diff
Type: application/octet-stream
Size: 2681 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100708/3c01eb07/attachment-0001.obj>


More information about the petsc-dev mailing list