[petsc-dev] preallocation checks

Barry Smith bsmith at mcs.anl.gov
Sat Jan 28 13:23:22 CST 2012


   I've updated docs and changes to reflect this new need for calling the preallocation routines.

   Barry

On Jan 28, 2012, at 1:11 PM, Barry Smith wrote:

> 
> On Jan 28, 2012, at 5:40 AM, Stefano Zampini wrote:
> 
>> 
>> I'm getting errors when not preallocating for MATSEQDENSE matrices. Is it what you want with dense matrices too?
> 
>    This comes about because we want the user to be free to set the matrix sizes BEFORE setting the matrix type or AFTER setting the matrix type.  Thus neither setting the sizes NOR setting the type to dense trigger the MatPreallocate(), 
> 
>     To match the paradigm of other matrix types we could still require calling MatSetUp() before setting values for dense, but that is kind of pedantic. An alternative is to have MatSetSizes_XXXDense() trigger allocation and have MatCreate_XXXDense() trigger allocation IFF the sizes have already been set then you the user do not need to call a preallocation or a MatSetUp().   The trouble with this is that then the user cannot provide the array space (that is provided by MatSeqDenseSetPreallocation()) themselves except before they call MatSetSizes() which is kind of unnatural. 
> 
>    Thus the current consensus is the user must call MatSetUp() or MatPreallocated() or MatSetUpPreallocation() or MatXXXSetPreallocation() UNIVERSALLY if creating the matrix themselves before setting values into even a dense matrix.
> 
> 
>    Barry
> 
> 
> 
> 
>> 
>> 2012/1/21 Stefano Zampini <stefano.zampini at gmail.com>
>> Just pulled and checked. The code works for me.
>> 
>> Stefano
>> 
>> 
>> 2012/1/21 Barry Smith <bsmith at mcs.anl.gov>
>> 
>> I have pushed an update so that converting from seqdense to seqaij does correct preallocation.  So this problem should be gone for you.  Please let me know if the problem does not resolve.
>> 
>>  Barry
>> 
>> On Jan 20, 2012, at 10:25 AM, Stefano Zampini wrote:
>> 
>>> I pulled the latest tip and recompiling my application I got this error when converting from SEQDENSE to SEQAIJ
>>> 
>>> [0]PETSC ERROR: ------------------------------------------------------------------------
>>> [0]PETSC ERROR: MatSetValues_SeqAIJ() line 331 in src/mat/impls/aij/seq/aij.c
>>> [0]PETSC ERROR: MatSetValues() line 1119 in src/mat/interface/matrix.c
>>> [0]PETSC ERROR: MatConvert_Basic() line 37 in src/mat/utils/convert.c
>>> [0]PETSC ERROR: MatConvert() line 3859 in src/mat/interface/matrix.c
>>> 
>>> Is there a way to disable from command line new nonzeros errors?
>>> 
>>> 2012/1/16 Lisandro Dalcin <dalcinl at gmail.com>
>>> On 16 January 2012 17:58, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>>>> On 15 January 2012 23:30, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>>>>> On Wed, Jan 11, 2012 at 22:10, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>>>>> 
>>>>>> That is not a concern, better to stop early with a useful message than
>>>>>> take tons of extra time on a huge job and make PETSc look extra bad at huge
>>>>>> problems.
>>>>> 
>>>>> 
>>>>> Done, I'll check the nightlies tomorrow to see which examples broke.
>>>>> 
>>>>> http://petsc.cs.iit.edu/petsc/petsc-dev/rev/631dbd3be1c5
>>>> 
>>>> I've got this regression in petsc4py converting CRL -> AIJ. Of course
>>>> I can fix the test, but perhaps this should be handled in PETSc?
>>>> 
>>> 
>>> More regressions:
>>> 
>>> [0] MatShift() line 166 in /home/devel/petsc/dev/src/mat/utils/axpy.c
>>> [0] MatSetValues() line 1119 in /home/devel/petsc/dev/src/mat/interface/matrix.c
>>> [0] MatSetValues_SeqAIJ() line 331 in
>>> /home/devel/petsc/dev/src/mat/impls/aij/seq/aij.c
>>> [0] Argument out of range
>>> [0] New nonzero at (0,0) caused a malloc
>>> 
>>> 
>>> 
>>> --
>>> Lisandro Dalcin
>>> ---------------
>>> CIMEC (INTEC/CONICET-UNL)
>>> Predio CONICET-Santa Fe
>>> Colectora RN 168 Km 472, Paraje El Pozo
>>> 3000 Santa Fe, Argentina
>>> Tel: +54-342-4511594 (ext 1011)
>>> Tel/Fax: +54-342-4511169
>>> 
>>> 
>>> 
>>> --
>>> Stefano
>> 
>> 
>> 
>> 
>> -- 
>> Stefano
>> 
>> 
>> 
>> -- 
>> Stefano
> 




More information about the petsc-dev mailing list