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

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


Ok,
 
Cheers guys.  I did find that strange, that it was using AIJ, can I set
that in the code rather from an options file, what is the code
equivalent to -mat_type seqbaij, is it MatSetType or something like
that?  I'm going to try Jed's suggestion about error on on first
non-preallocated access.  Could my error actually be that the sparsity
is correct, but as you note below, the matrix type allocated with
MatSeqBAIJSetPreallocation is of type AIJ, and in which case, for that
matrix it has not be preallocated with the correct sparsity, or at all,
and hence the speed?  Or something like that??  Could the solution
possibly just be setting -mat_type seqbaij?  In which case I need to
find out how to do that.
 
Cheers again,
Andy

________________________________

From: petsc-users-bounces at mcs.anl.gov
[mailto:petsc-users-bounces at mcs.anl.gov] On Behalf Of Barry Smith
Sent: 22 April 2010 13:59
To: 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 Apr 22, 2010, at 7:33 AM, Parker, Andrew (UK Filton) wrote:


	
	Hi,
	 
	I'm new to these postings.  On very large cases, regardless of
where I stop the debugger it is always copying data.  I've put it into a
debugger because on smaller cases it runs fine, on larger it takes a
while (very long time) to get going.  The stack trace always gives
something like:
	 
	memcpy
	PetscMemCpy
	MatSetValues_SeqAIJ


    It is using SeqAIJ matrices


	MatSetValues
	my own wrapper to add values to a location within the matrix.
	 
	I'm using Seq_BAIJ.  My bets are that I've got the sparsity
wrong, or the preallocation wrong, but I'm not sure why.  I know this
could be anything, but has anybody got any thoughts, remember stopping
the debugger at random, regardless of the frequency always gives the
above....
	 
	I set up the matrix like this
	 
	  MatCreate(PETSC_COMM_SELF,&_storage);
	
MatSetSizes(_storage,PETSC_DECIDE,PETSC_DECIDE,numVars*numLocs,numVars*n
umLocs);
	  MatSetFromOptions(_storage);
	
MatSeqBAIJSetPreallocation(_storage,numVars,PETSC_NULL,sparsityStart);


    Unless you use the argument -mat_type seqbaij this will use SeqAIJ
while you preallocate SeqBAIJ.


	 
	However, using this makes zero difference to the speed
	 
	   MatCreateSeqBAIJ(PETSC_COMM_SELF,
	      numVars,
	      numVars*numLocs,
	      numVars*numLocs,
	      0,  
	       sparsityStart,
	      &_storage);
	 
	It is so slow that it has not even completed one cycle of the
solver....


    Your sparseityStart is wrong. Run with -info and grep the results
for malloc and you'll see it is mallocing many times to get enough
space.

   Barry


	 
	Cheers again,
	Andy

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100422/9116509f/attachment-0001.htm>


More information about the petsc-users mailing list