<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 07.02.2012 18:17, Hong Zhang wrote:
<blockquote
cite="mid:CAGCphBt2kx3-kb5b8LkMvMfvYs46zkHPSV9RTUTBpZ4mK7mEiA@mail.gmail.com"
type="cite">Alexander :
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
<div class="im">
<blockquote type="cite">
<div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0pt
0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000"><br>
MatCreateMPIAIJ(PETSC_COMM_WORLD,
PETSC_DECIDE, PETSC_DECIDE, N, M, 12,
PETSC_NULL, 12, PETSC_NULL, &AT);<br>
MatTranspose(A,MAT_IGNORE_MATRIX,&AT);<br>
</div>
</blockquote>
<div><br>
</div>
<div>should be replaced with</div>
<div>MatTranspose(A,MAT_INITIAL_MATRIX,&AT);</div>
</div>
</div>
</blockquote>
</div>
Hm, it seems this was the reason...</div>
</blockquote>
<div> </div>
<div>With this change, do you still get different matrix product
comparing with Matlab's?</div>
<div>I'll add an error flag in petsc to prevent using
MatTranspose(A,MAT_IGNORE_MATRIX,&AT).</div>
</div>
</blockquote>
<br>
Hong,<br>
<br>
There is something I didn't get yet, I hope you could clarify it. <br>
<br>
So, when I use flag MAT_INITIAL_MATRIX in test program it works
fine.<br>
If I put this flag in my original program I get dozens of exceptions
like:<br>
[42]PETSC ERROR: Argument out of range!<br>
[42]PETSC ERROR: New nonzero at (1336,153341) caused a malloc!<br>
<br>
I changed this flag to MAT_REUSE_MATRIX and exceptions disappeared,
but result is incorrect again (same as for MAT_IGNORE_MATRIX) <br>
I tried test program with MAT_REUSE_MATRIX and it also gives
different matrix product.<br>
<br>
Since there is no description of MatReuse structure for MatTranspose
it's a bit confusing what to expect from it. <br>
<br>
<blockquote
cite="mid:CAGCphBt2kx3-kb5b8LkMvMfvYs46zkHPSV9RTUTBpZ4mK7mEiA@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
<div class="im">
<blockquote type="cite">
<div>
<div class="gmail_quote">
<div><br>
</div>
<div>Do you mean 'Cm = A'*B;'? </div>
<div>'Cm = A.'*B;' gives component-wise matrix
product, not matrix product.</div>
</div>
</div>
</blockquote>
<br>
</div>
.' operator means non-Hermitian transpose. That is what I
get with MatTranspose (in contrast with
MatHermitianTranspose)<br>
component-wise matrix product would be .*</div>
</blockquote>
<div>You are correct.</div>
<div><br>
</div>
<div>Hong </div>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
<div>
<div class="h5"><br>
<br>
<blockquote type="cite">
<div>
<div class="gmail_quote">
<div><br>
</div>
<div>Hong</div>
<div><br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin: 0pt
0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000"> C =
PetscBinaryRead('C.dat','complex',true);<br>
<br>
Matrix C is different depending on number of
cores I use. <br>
My PETSc is:<br>
Using Petsc Development HG revision:
876c894d95f4fa6561d0a91310ca914592527960 HG
Date: Tue Jan 10 19:27:14 2012 +0100
<div>
<div><br>
<br>
On 06.02.2012 17:13, Hong Zhang wrote:
<blockquote type="cite">MatMatMult() in
petsc is not well-tested for complex -
could be buggy.
<div>Can you send us the matrices A and
B in petsc binary format for
investigation?</div>
<div><br>
</div>
<div>Hong<br>
<br>
<div class="gmail_quote">On Mon, Feb
6, 2012 at 5:55 AM, Alexander
Grayver <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:agrayver@gfz-potsdam.de"
target="_blank">agrayver@gfz-potsdam.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="margin: 0pt 0pt 0pt 0.8ex;
border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;">Dear
PETSc team,<br>
<br>
I try to use:<br>
call
MatMatMult(A,B,MAT_INITIAL_MATRIX,PETSC_DEFAULT_DOUBLE_PRECISION,C,ierr);CHKERRQ(ierr)<br>
<br>
Where both A and B are
rectangular, but A is sparse and B
is dense. Both are double complex
and distributed.<br>
The product PETSc gives me
contains some errors in some part
of the matrix.<br>
I output A, B and C then computed
product in matlab.<br>
<br>
Attached you see figure plotted
as:<br>
imagesc(log10(abs(C-Cm)))<br>
<br>
Where Cm -- product computed in
matlab.<br>
<br>
The pattern and amplitude vary
depending on the number of cores I
use. This picture is obtained for
48 cores (I've tried 12, 64 cores
as well).<br>
<br>
Where should I look for possible
explanation?<span><font
color="#888888"><br>
<br>
-- <br>
Regards,<br>
Alexander<br>
</font></span></blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<br>
</div>
</div>
<span><font color="#888888">
<pre cols="72">--
Regards,
Alexander</pre>
</font></span></div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<br>
</div>
</div>
<span class="HOEnZb"><font color="#888888">
<pre cols="72">--
Regards,
Alexander</pre>
</font></span></div>
</blockquote>
</div>
<br>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Regards,
Alexander</pre>
</body>
</html>