[petsc-users] MatCompositeMerge + MatCreateRedundantMatrix

Matthew Knepley knepley at gmail.com
Mon Mar 18 21:47:08 CDT 2019


On Mon, Mar 18, 2019 at 10:30 PM Marius Buerkle <mbuerkle at web.de> wrote:

> I have another question
> regarding MatCreateRedundantMatrix and MPICreateSubMatricesMPI. The former
> works for MPIAIJ and  MPIDENSE and the later only for MPIAIJ. Would it be
> possible to use MatCreateRedundantMatrix with a factored matrix
>

We usually do not have direct access to the data for factored matrices
since it lives in the factorization package.


> and MPICreateSubMatricesMPI with dense and/or elemental matrices ?
>

This would not be hard, it would just take time. The dense case is easy. I
think Elemental already has such an operation, but we would have to find it
and call it.

  Thanks,

    Matt

> Indeed, was very easy to add. Are you going to include the Fortran
> interface for MPICreateSubMatricesMPI  in future releases of PETSC ?
>
> Regarding my initial problem, thanks a lot. It works very well with
> MPICreateSubMatricesMPI  and the solution can be implemented in a few
> lines.
>
> Thanks and Best,
>
> Marius
>
>
> On Tue, Mar 12, 2019 at 4:50 AM Marius Buerkle <mbuerkle at web.de> wrote:
>
>> I tried to follow your suggestions but it seems there is
>> no MPICreateSubMatricesMPI for Fortran. Is this correct?
>>
>
> We just have to write the binding. Its almost identical to
> MatCreateSubMatrices() in src/mat/interface/ftn-custom/zmatrixf.c
>
>    Matt
>
>>
>> On Wed, Feb 20, 2019 at 6:57 PM Marius Buerkle <mbuerkle at web.de> wrote:
>>
>>> ok, I think I understand now. I will give it a try and if there is some
>>> trouble comeback to you. thanks.
>>>
>>
>> Cool.
>>
>>    Matt
>>
>>
>>>
>>> marius
>>>
>>> On Tue, Feb 19, 2019 at 8:42 PM Marius Buerkle <mbuerkle at web.de> wrote:
>>>
>>>> ok, so it seems there is no straight forward way to transfer data
>>>> between PETSc matrices on different subcomms. Probably doing it by "hand"
>>>> extracting the matricies on the subcomms create a MPI_INTERCOMM transfering
>>>> the data to PETSC_COMM_WORLD and assembling them in a new PETSc matrix
>>>> would be possible, right?
>>>>
>>>
>>> That sounds too complicated. Why not just reverse
>>> MPICreateSubMatricesMPI()? Meaning make it collective on the whole big
>>> communicator, so that you can swap out all the subcommunicator for the
>>> aggregation call, just like we do in that function.
>>> Then its really just a matter of reversing the communication call.
>>>
>>>    Matt
>>>
>>>>
>>>> On Tue, Feb 19, 2019 at 7:12 PM Marius Buerkle <mbuerkle at web.de> wrote:
>>>>
>>>>> I see. This would work if the matrices are on different
>>>>> subcommumicators ? Is it possible to add this functionality ?
>>>>>
>>>>
>>>> Hmm, no. That is specialized to serial matrices. You need the inverse
>>>> of MatCreateSubMatricesMPI().
>>>>
>>>>   Thanks,
>>>>
>>>>      Matt
>>>>
>>>>
>>>>> marius
>>>>>
>>>>>
>>>>> You basically need the inverse of MatCreateSubmatrices(). I do not
>>>>> think we have that right now, but it could probably be done without too
>>>>> much trouble by looking at that code.
>>>>>
>>>>>   Thanks,
>>>>>
>>>>>      Matt
>>>>>
>>>>> On Tue, Feb 19, 2019 at 6:15 AM Marius Buerkle via petsc-users <
>>>>> petsc-users at mcs.anl.gov> wrote:
>>>>>
>>>>>> Hi !
>>>>>>
>>>>>> Is there some way to combine MatCompositeMerge
>>>>>> with MatCreateRedundantMatrix? I basically want to create copies of a
>>>>>> matrix from PETSC_COMM_WORLD to subcommunicators, do some work on each
>>>>>> subcommunicator and than gather the results back to PETSC_COMM_WORLD,
>>>>>> namely  I want to sum the  the invidual matrices from the subcommunicatos
>>>>>> component wise and get the resulting matrix on PETSC_COMM_WORLD. Is this
>>>>>> somehow possible without going through all the hassle of using MPI
>>>>>> directly?
>>>>>>
>>>>>> marius
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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
>>>>>
>>>>> https://www.cse.buffalo.edu/~knepley/
>>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>>
>>>>
>>>>
>>>> --
>>>> 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
>>>>
>>>> https://www.cse.buffalo.edu/~knepley/
>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>> https://www.cse.buffalo.edu/~knepley/
>>> <http://www.cse.buffalo.edu/~knepley/>
>>>
>>
>>
>> --
>> 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
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190318/d8cd44ef/attachment-0001.html>


More information about the petsc-users mailing list