[petsc-users] Newbie Question - Really slow - PetscMemCpy

Parker, Andrew (UK Filton) Andrew.Parker2 at baesystems.com
Thu Apr 22 10:32:06 CDT 2010


Well that worked.  Now it errors like nobodies business.  To be clear
though, the sparsity pattern is just an int, indicating the number of
non-zero blocks in a row, including the diagonal?  In my case the
non-zero entries are due to entries from neighbouring cells, and myself,
so can't see how I messed that up.  I know the answer is that I have,
but just can't see why?  

My concern is that I've not understood what the sparsity is doing.  In
my case I have a fully unstructured graph, so the neighbour cell numbers
are in no way anywhere near in the number range to myself, the cell of
interest.  Therefore, telling it that I have 10 neighbours, does not let
it know the actual indices of those ten cells, which are not contiguous.
Unless there's some funky mapping going on down in the guts.  Anyway, if
the only number I need to give it is the number of non-zero blocks in a
row, then I've done that and I think I need to rule that out and look
for something else.

Any ideas?

Andy

-----Original Message-----
From: Jed Brown [mailto:five9a2 at gmail.com] On Behalf Of Jed Brown
Sent: 22 April 2010 15:23
To: Parker, Andrew (UK Filton); PETSc users list
Subject: Re: [petsc-users] Newbie Question - Really slow - PetscMemCpy


                    *** WARNING ***

  This message has originated outside your organisation,
  either from an external partner or the Global Internet. 
      Keep this in mind if you answer this message.
 

On Thu, 22 Apr 2010 15:15:12 +0100, "Parker, Andrew (UK Filton)"
<Andrew.Parker2 at baesystems.com> wrote:
> Well that's a worry, no error from:
> MatSetOption(_storage,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);
> 
> Still slow as hell, same behaviour as before.  I'm now using:
> 
>   MatCreate(PETSC_COMM_SELF,&_storage);
>   MatSetType(_storage, MATSEQBAIJ);
>   MatSetOption(_storage,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);
>  
> MatSetSizes(_storage,PETSC_DECIDE,PETSC_DECIDE,numVars*numLocs,numVars
> *n
> umLocs);
>   MatSetFromOptions(_storage);
>   
> MatSeqBAIJSetPreallocation(_storage,numVars,PETSC_NULL,sparsityStart);

This should work if you call both MatSetSizes and MatSetType before
MatSetOption.  There are technical reasons for this, mostly that it's
difficult to cache all the options and get them handled in a consistent
and debuggable manner once the implementation is chosen.

Unless someone disagrees, I'll make it an error to call MatSetOptions()
before the implementation is available (so you would get a useful error
with the usage above, instead of the option just being ignored).

Jed


********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************



More information about the petsc-users mailing list