[petsc-users] Doubt in MPIPreallocation

Matthew Knepley knepley at gmail.com
Fri Feb 19 04:47:07 CST 2016


On Fri, Feb 19, 2016 at 4:34 AM, John Albequerque <johncfdcfd at gmail.com>
wrote:

> Currently I have used single processor. And without the Preallocation it
> works fine. And gives me the correct output as well. I have posted the full
> code for reference.
> *Here:* http://pastebin.com/kWUGHqSM
>

Look at the last row. Your condition 'j >= i' will produce no off-diagonal
rows here, but
clearly you have them, and this is the error you are getting.

   Matt


> On Fri, Feb 19, 2016 at 3:01 PM, Matthew Knepley <knepley at gmail.com>
> wrote:
>
>> On Fri, Feb 19, 2016 at 3:27 AM, John Albequerque <johncfdcfd at gmail.com>
>> wrote:
>>
>>> I came up with this could you please have a look at it as I am not
>>> getting it. I am getting an error
>>>
>>>
>>>
>>> *New nonzero at (0,4) caused a malloc*http://pastebin.com/ZxT7SWtc
>>>
>>> Could you please have a look at it.
>>>
>>
>> It looks like you are only allocating the upper triangle:
>>
>> if((j-i<=3) && (j>=i))
>>             values[(i-low)*nc+j]=1;
>> else
>> values[(i-low)*nc+j]=0;
>>
>>    Matt
>>
>>
>>> ---------------
>>> Thanks,
>>> John Albequerque
>>>
>>>
>>> On Fri, Feb 19, 2016 at 1:25 PM, Matthew Knepley <knepley at gmail.com>
>>> wrote:
>>>
>>>> On Fri, Feb 19, 2016 at 1:50 AM, John Albequerque <johncfdcfd at gmail.com
>>>> > wrote:
>>>>
>>>>> Could someone help me setting up this matrix i.e from preallocation to
>>>>> Set Values for an MPIAIJ matrix which has its entries.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *1  1  1  1  0  0  0  00  1  1  1  1  0  0  00  0  1  1  1  1  0  00
>>>>> 0  0  1  1  1  1  00  0  0  0  1  1  1  1*
>>>>>
>>>>> I am trying to do it from 3 days now but not able to figure it out.
>>>>> Could someone please help me do this.
>>>>>
>>>>
>>>> It will be enough to say that each row has 3 off-diagonal values, so
>>>> you can use the simplified preallocation rather
>>>> than giving a value for each row individually.
>>>>
>>>>    Matt
>>>>
>>>>
>>>>> Thanks.
>>>>>
>>>>> ----
>>>>> John Albequerque.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> 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
>>>>
>>>
>>>
>>
>>
>> --
>> 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
>>
>
>


-- 
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/20160219/fe88df23/attachment.html>


More information about the petsc-users mailing list