<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3676" name=GENERATOR></HEAD>
<BODY
style="WORD-WRAP: break-word; webkit-nbsp-mode: space; webkit-line-break: after-white-space">
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=852360113-22042010>Ok,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=852360113-22042010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=852360113-22042010>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 <FONT face="Times New Roman" color=#000000 size=3>-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 <FONT face=Arial size=2>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 <FONT
face="Times New Roman" size=3>-mat_type seqbaij? In which case I need to
find out how to do that.</FONT></FONT></FONT></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000000 size=2><SPAN
class=852360113-22042010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000000 size=2><SPAN
class=852360113-22042010>Cheers again,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000000 size=2><SPAN
class=852360113-22042010>Andy</SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> petsc-users-bounces@mcs.anl.gov
[mailto:petsc-users-bounces@mcs.anl.gov] <B>On Behalf Of </B>Barry
Smith<BR><B>Sent:</B> 22 April 2010 13:59<BR><B>To:</B> PETSc users
list<BR><B>Subject:</B> Re: [petsc-users] Newbie Question - Really slow -
PetscMemCpy<BR></FONT><BR></DIV>
<DIV></DIV><PRE style="WHITE-SPACE: normal"> *** WARNING ***<BR><BR> This message has originated outside your organisation,<BR> either from an external partner or the Global Internet. <BR> Keep this in mind if you answer this message.<BR> <BR></PRE><BR>
<DIV>
<DIV>On Apr 22, 2010, at 7:33 AM, Parker, Andrew (UK Filton) wrote:</DIV><BR
class=Apple-interchange-newline>
<BLOCKQUOTE type="cite"><FONT face=Arial><FONT size=2></FONT></FONT>
<DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2>Hi,</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial size=2>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:</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2>memcpy</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2>PetscMemCpy</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2>MatSetValues_SeqAIJ</FONT></SPAN></DIV></DIV></BLOCKQUOTE>
<DIV><BR></DIV> It is using SeqAIJ matrices</DIV>
<DIV><BR>
<BLOCKQUOTE type="cite">
<DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2>MatSetValues</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial size=2>my own wrapper to
add values to a location within the matrix.</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial size=2>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....</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial size=2>I set up the
matrix like this</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial size=2>
MatCreate(PETSC_COMM_SELF,&_storage);<BR>
MatSetSizes(_storage,PETSC_DECIDE,PETSC_DECIDE,numVars*numLocs,numVars*numLocs);<BR>
MatSetFromOptions(_storage);<BR>
MatSeqBAIJSetPreallocation(_storage,numVars,PETSC_NULL,sparsityStart);</FONT></SPAN></DIV></DIV></BLOCKQUOTE>
<DIV><BR></DIV> Unless you use the argument -mat_type seqbaij
this will use SeqAIJ while you preallocate SeqBAIJ.</DIV>
<DIV><BR>
<BLOCKQUOTE type="cite">
<DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial size=2>However, using
this makes zero difference to the speed</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial size=2>
MatCreateSeqBAIJ(PETSC_COMM_SELF,<BR>
numVars,<BR>
numVars*numLocs,<BR>
numVars*numLocs,<BR>
0, </FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2> sparsityStart,</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2> &_storage);</FONT></SPAN></DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial size=2>It is so slow that
it has not even completed one cycle of the
solver....</FONT></SPAN></DIV></DIV></BLOCKQUOTE>
<DIV><BR></DIV> 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.</DIV>
<DIV><BR></DIV>
<DIV> Barry</DIV>
<DIV><BR>
<BLOCKQUOTE type="cite">
<DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=825482612-22042010><FONT face=Arial size=2>Cheers
again,<BR>Andy</FONT></SPAN></DIV><BR>********************************************************************<BR>This
email and any attachments are confidential to the intended<BR>recipient and
may also be privileged. If you are not the intended<BR>recipient please delete
it from your system and notify the sender.<BR>You should not copy it or use it
for any purpose nor disclose or<BR>distribute its contents to any other
person.<BR>********************************************************************<BR><BR></DIV></BLOCKQUOTE></DIV><BR></BODY></HTML>