[petsc-users] Conversion between AIJ & BAIJ

Matthew Knepley knepley at gmail.com
Wed Jan 21 16:03:14 CST 2015


On Wed, Jan 21, 2015 at 3:16 PM, Chung-Kan Huang <ckhuangf at gmail.com> wrote:

>
> On Wed, Jan 21, 2015 at 2:36 PM, Matthew Knepley <knepley at gmail.com>
> wrote:
>
>> On Wed, Jan 21, 2015 at 2:29 PM, Chung-Kan Huang <ckhuangf at gmail.com>
>> wrote:
>>
>>>
>>> On Wed, Jan 21, 2015 at 2:15 PM, Matthew Knepley <knepley at gmail.com>
>>> wrote:
>>>
>>>> On Wed, Jan 21, 2015 at 2:07 PM, Chung-Kan Huang <ckhuangf at gmail.com>
>>>> wrote:
>>>>
>>>>>
>>>>> On Wed, Jan 21, 2015 at 2:01 PM, Matthew Knepley <knepley at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> On Wed, Jan 21, 2015 at 1:55 PM, Chung-Kan Huang <ckhuangf at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>>
>>>>>>> On Wed, Jan 21, 2015 at 1:44 PM, Matthew Knepley <knepley at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On Wed, Jan 21, 2015 at 1:40 PM, Chung-Kan Huang <
>>>>>>>> ckhuangf at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Then A & AB are not longer the same matrix.  They become complete
>>>>>>>>> two individuals aren't they?
>>>>>>>>> If I do whatever to AB after AB is created the A is still the same
>>>>>>>>> old A and not going to be affected by the operations I do to AB.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Yes.
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> What I am really looking for is a way to create two interfaces
>>>>>>>>> (one as AIJ and one as BAIJ) but they both refer to the same matrix.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Why would you ever want this? Why not just using BAIJ?
>>>>>>>>
>>>>>>> As I mentioned in the beginning.  There are parts of the code gets
>>>>>>> benifit when AIJ is used and the other part gets benifit  if BAIJ is used.
>>>>>>>
>>>>>>> For instance,
>>>>>>>
>>>>>>> I'd like to use MatSetValuesBlocked but I also want to use ilu
>>>>>>> constructed by AIJ instead of BAIJ (our experience found ilu from BAIJ
>>>>>>> behaves funny sometimes.
>>>>>>>
>>>>>>
>>>>>> If the blocks truly are dense, then ILU(0) is identical on both.
>>>>>>
>>>>>
>>>>> Unfortunately the life is not that easy.  The blocks are spares and we
>>>>> found ILU(1) works better for our case.
>>>>> And besides that is not the only reason I want to have AIJ & BAIJ
>>>>> interfaces, we have some code management issue and I am looking for short
>>>>> cut to unite them.
>>>>>
>>>>> So go back to the original question the short answer is no way?
>>>>>
>>>>
>>>> Yes, it would not make sense.
>>>>
>>>> What problem are you using ILU(1) for?
>>>>
>>>
>>> I am using it for flow simulation for reservoir problems.
>>>
>>
>> Have you considered trying algebraic multigrid?
>>
>
> I am solving PDE fully implicitly and as far as I know algebraic multigrid
> only good for pressure equations
> I will need 2 stages PC while AMG is for pressure stage but I will still
> need something like ILU for second stage.
>

So you are using a mixed-formulation of Darcy? What equations do you have?

  Thanks,

     MAtt


>
>>
>>> Some issues we found is that
>>> 1) for a * x = 0 it doesn't return x = 0
>>>
>>
>> This is impossible. There must be a bug in the code.
>>
>>   Thanks,
>>
>>      Matt
>>
>>
>>> 2) After compared ILU(1) with BAIJ against with ILU(1) with AIJ I found
>>> latter one is better.  I could not find anything wrong with my BAIJ version
>>> though.  However, experiences suggested that BAIJ's ILU(1) should be better.
>>>
>>>
>>> Thanks,
>>>
>>> Kan
>>>
>>>>
>>>>   Thanks,
>>>>
>>>>      Matt
>>>>
>>>>
>>>>> Thanks,
>>>>>
>>>>> Kan
>>>>>
>>>>>>
>>>>>>   Matt
>>>>>>
>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Kan
>>>>>>>
>>>>>>>>
>>>>>>>>   Thanks,
>>>>>>>>
>>>>>>>>       Matt
>>>>>>>>
>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>>> Kan
>>>>>>>>> On Wed, Jan 21, 2015 at 1:20 PM, Matthew Knepley <
>>>>>>>>> knepley at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> On Wed, Jan 21, 2015 at 12:56 PM, Chung-Kan Huang <
>>>>>>>>>> ckhuangf at gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> So if I do
>>>>>>>>>>>
>>>>>>>>>>> Mat A, AB;
>>>>>>>>>>> MatCreateAIJ(comm,m,n,M,N,d_nz, d_nnz,o_nz, o_nnz, &A);
>>>>>>>>>>> MatConvert(A, MATBAIJ, MAT_INITAL_MATRIX, &AB);
>>>>>>>>>>> MatSetBlockSize(AB, bs)
>>>>>>>>>>> I can create AB as a BAIJ with block size of bs from A which is
>>>>>>>>>>> a AIJ matrix.
>>>>>>>>>>>
>>>>>>>>>>> So from this point I can use both A and AB and they will mean
>>>>>>>>>>> the same matrix. Am I right?
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Yes
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> At the end of the program do I only destory one of them or both?
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Both
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Do I need to worry about anything in terms of memory penalty?
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> It is twice the memory. Its another matrix.
>>>>>>>>>>
>>>>>>>>>> Did you catch when Jed said you could jsut create the BAIJ up
>>>>>>>>>> front?
>>>>>>>>>>
>>>>>>>>>>   Thanks,
>>>>>>>>>>
>>>>>>>>>>     Matt
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>>
>>>>>>>>>>> Kan
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Jan 20, 2015 at 4:39 PM, Barry Smith <bsmith at mcs.anl.gov
>>>>>>>>>>> > wrote:
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>   You can do a MatConvert() (requires another copy of the
>>>>>>>>>>>> matrix) for the parts that benefit from BAIJ.
>>>>>>>>>>>>
>>>>>>>>>>>>   Barry
>>>>>>>>>>>>
>>>>>>>>>>>> > On Jan 20, 2015, at 4:33 PM, Chung-Kan Huang <
>>>>>>>>>>>> ckhuangf at gmail.com> wrote:
>>>>>>>>>>>> >
>>>>>>>>>>>> > Hi,
>>>>>>>>>>>> >
>>>>>>>>>>>> > Does PETSc provide means for conversion between AIJ & BAIJ.
>>>>>>>>>>>> >
>>>>>>>>>>>> > My matrix is created as AIJ because it makes life easy for
>>>>>>>>>>>> most part of the applications but some part of applications actually get
>>>>>>>>>>>> some benefits with BAIJ.  So I wonder if a matrix can exist as two
>>>>>>>>>>>> idenfities and I can use either format depend on which one is more
>>>>>>>>>>>> convenient at run time.
>>>>>>>>>>>> >
>>>>>>>>>>>> > So in my case the block size is fixed and identical for all
>>>>>>>>>>>> blocks.
>>>>>>>>>>>> >
>>>>>>>>>>>> >
>>>>>>>>>>>> > Thanks,
>>>>>>>>>>>> >
>>>>>>>>>>>> >
>>>>>>>>>>>> > Kan
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>>> *Cheers*
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> What most experimenters take for granted before they begin their
>>>>>>>>>> experiments is infinitely more interesting than any results to which their
>>>>>>>>>> experiments lead.
>>>>>>>>>> -- Norbert Wiener
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>> *Cheers*
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> What most experimenters take for granted before they begin their
>>>>>>>> experiments is infinitely more interesting than any results to which their
>>>>>>>> experiments lead.
>>>>>>>> -- Norbert Wiener
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> *Cheers*
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> What most experimenters take for granted before they begin their
>>>>>> experiments is infinitely more interesting than any results to which their
>>>>>> experiments lead.
>>>>>> -- Norbert Wiener
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> *Cheers*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> What most experimenters take for granted before they begin their
>>>> experiments is infinitely more interesting than any results to which their
>>>> experiments lead.
>>>> -- Norbert Wiener
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> *Cheers*
>>>
>>
>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>
>
>
> --
>
> *Cheers*
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150121/5162fc28/attachment-0001.html>


More information about the petsc-users mailing list