<div dir="ltr">Joon,<div style>We have implemented MatTransposeMatMult() for aij and dense matrices in the master branch of petsc-dev</div><div style><a href="https://bitbucket.org/petsc/petsc/commits/cf22a14bc6cad51fdcbb947b8ac26f3ebf0d4d04?at=master">https://bitbucket.org/petsc/petsc/commits/cf22a14bc6cad51fdcbb947b8ac26f3ebf0d4d04?at=master</a><br>
</div><div style>based on Jed's suggestion.</div><div style><br></div><div style>You may give it a try and let us know if there is a problem.</div><div style>Hong</div><div style><br></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Tue, Jun 4, 2013 at 6:15 PM, Joon hee Choi <span dir="ltr"><<a href="mailto:choi240@purdue.edu" target="_blank">choi240@purdue.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I am trying to compress the matrix. I think it is the best way, because it may be not storable by MPI aij.<br>
If you get better solution in your lab meeting, then please let me know. :)<br>
Anyhow, thank you very much.<br>
<div class="im"><br>
Joon<br>
<br>
----- Original Message -----<br>
From: "Jed Brown" <<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>><br>
To: "Joon hee Choi" <<a href="mailto:choi240@purdue.edu">choi240@purdue.edu</a>><br>
</div><div class=""><div class="h5">Cc: <a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a><br>
Sent: Tuesday, June 4, 2013 2:35:15 PM<br>
Subject: Re: [petsc-users] The multiplication of the transpose of a dense matrix(A^T) and a large sparse matrix(X1)<br>
<br>
Joon hee Choi <<a href="mailto:choi240@purdue.edu">choi240@purdue.edu</a>> writes:<br>
<br>
> Thank you for your fast reply.<br>
> I got the out-of-memory error from MatTranspose(X1, MAT_INITIAL_MATRIX, &tempX1).<br>
> Also, it may take so much time to create X1 as X1^T because nnz for X1 cannot have 1200Tril elements because of memory.<br>
<br>
Yes, that is also the dimension of the result matrix, which would be<br>
dense with the normal rules about products of sparse and dense matrices.<br>
<br>
Instead, you should compress the column space, perhaps by just removing<br>
all the columns that have no nonzeros.<br>
<br>
> Is there a fast way to create X1^T?<br>
><br>
> Thank you,<br>
> Joon<br>
><br>
><br>
> ----- Original Message -----<br>
> From: "Jed Brown" <<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>><br>
> To: "Joon hee Choi" <<a href="mailto:choi240@purdue.edu">choi240@purdue.edu</a>>, <a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a><br>
> Sent: Tuesday, June 4, 2013 7:55:31 AM<br>
> Subject: Re: [petsc-users] The multiplication of the transpose of a dense matrix(A^T) and a large sparse matrix(X1)<br>
><br>
> Joon hee Choi <<a href="mailto:choi240@purdue.edu">choi240@purdue.edu</a>> writes:<br>
><br>
>> Hello,<br>
>><br>
>> I am trying to multiply the transpose of a dense matrix(A) and a large sparse matrix(X1). That is, A^T x X1.<br>
>><br>
>> X1 is a 26Mil x 1200Tril, 144Mil non-zeros sparse matrix and A is a 26Mil x 10 dense matrix.<br>
>><br>
>> I know that sparse x dense is faster than dense x sparse when using MatMatMult.  Thus, I tried to implement the following code:<br>
>><br>
>>         ierr = MatTranspose(X1, MAT_INITIAL_MATRIX, &tempX1); CHKERRQ(ierr);<br>
>>         ierr = MatMatMult(tempX1, A, MAT_INITIAL_MATRIX, 1.0, &MT);<br>
>>         ierr = MatDestroy(&tempX1); CHKERRQ(ierr);<br>
>>         ierr = MatTranspose(MT, MAT_INITIAL_MATRIX, &M); CHKERRQ(ierr);<br>
>>         ierr = MatDestroy(&MT); CHKERRQ(ierr);<br>
>><br>
>> However, I got the "out-of-memory" error when implementing<br>
>> MatTranspose().<br>
><br>
> Which MatTranspose?<br>
><br>
>> I think this is because the number of columns of X1 is much larger<br>
>> than that of rows of X1.  If there is a fast way to calculate M = A^T<br>
>> x X1,<br>
><br>
> Hong, do you have time to implement MatTransposeMatMult_MPIAIJ_MPIDense?<br>
><br>
> Can you create X1 as X1^T instead?<br>
><br>
> If you want to keep storing X1 is you do now, you can either store it as<br>
> ten vectors and use MatMultTranspose or you can pack it into one vector and use<br>
><br>
>   MatCreateMAIJ(X1,10,&X1m);<br>
>   MatMultTranspose(X1m,Apacked,Bpacked);<br>
><br>
> This is actually a better ordering for memory bandwidth.  The MAIJ<br>
> matrix does not need extra storage.<br>
</div></div></blockquote></div><br></div></div>