[petsc-users] custom sparse matrix

Matthew Knepley knepley at gmail.com
Mon Mar 21 11:39:53 CDT 2011


On Mon, Mar 21, 2011 at 10:27 AM, Jed Brown <jed at 59a2.org> wrote:

> 2011/3/21 Barry Smith <bsmith at mcs.anl.gov>
>
>>
>> On Mar 21, 2011, at 10:14 AM, Alejandro Marcos Aragón wrote:
>>
>> > Hi Barry,
>> >
>> > Thanks for your answer. I'll look into those functions, but instead of
>> copying, do you know if there is a way to give the address of the arrays?
>>
>
I would encourage you to instead use the MatSetValues() interface for
building your matrix directly, because:

  1) It works for arbitrary parallel layout, and does all communication for
you automatically

  2) You can switch between formats to optimize for your architecture

  3) You can switch to higher performance block matrix classes without
changing your code

    Matt


> MatCreateSeqAIJWithArrays() will not copy the arrays but just use them. In
>> parallel MatCreateMPIAIJWithSplitArrays() will not copy the arrays, just use
>> them but you need to have the correct format for the arrays (in parallel we
>> use a "non-standard" parallel compressed sparse row format that likely you
>> don't use but check the manual page
>> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-3.0.0/docs/manualpages/Mat/MatCreateMPIAIJWithSplitArrays.html
>
>
> There is slightly more info in the more recent man page
>
>
> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Mat/MatCreateMPIAIJWithSplitArrays.html
>



-- 
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/20110321/2eefcdf6/attachment.htm>


More information about the petsc-users mailing list