<div dir="ltr"><div>My Matrix setup workflow is like this:</div><div><br></div><div>1 MatCreate</div><div>2 MatSetSizes</div><div>3 MatSetType(A,MATAIJ)</div><div>4 MatMPIAIJSetPreallocation</div><div>5 MatSeqAIJSetPreallocation</div><div>6 MatSetLocalToGlobalMapping</div><div>7 MatSetOptionPrefix(A,"test_")<br></div><div>8 MatSetFromOptions</div><div>9 MatSetUp</div><div><br></div><div>10 loop all the nonzero entries by calling MatSetValuesLocal(A,1,&i,1,&j, &val, ADD_VALUES);</div><div><br></div><div>11 MatAssemblyBegin</div><div>12 MatAssemblyEnd<br></div><div><br></div><div>For the AIJ format, it works fine. -info gives "Number of mallocs during MatSetValues() is 0" and "Stash has 0 entries, uses 0 mallocs."</div><div><br></div><div>If I run the same code with -test_mat_type aijcusparse, it takes forever to finish step 10. Does this step really involve moving data from host to devices? Do I need to have more changes to use aijcusparse other than just changing mat_type from command line?<br></div><div><br></div><div>Thank you.</div><div><br></div><div>Best,<br></div><div>Xiangdong</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 22, 2019 at 1:53 AM Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
The aijcusparse actually uses the same data structures and code for setting values as does aij. So it is not related directly to that format.<br>
<br>
Barry<br>
<br>
<br>
> On Oct 21, 2019, at 6:26 PM, Xiangdong via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
> <br>
> Hello everyone,<br>
> <br>
> When I use matsetvalueslocal to form the matrix in aijcusparse format, I found that it takes forever to finish the loops of matsetvalueslocal. I am setting one entry a time, and there are about about 28 Million nonzeros. (It is fast if the matrix is aij, instead of aijcusparse).<br>
> <br>
> However, if I have the matrix ready in binary format and use matload to get it into aijcusparse format, it is fast.<br>
> <br>
> Is it the issue of matsetvalueslocal or my wrong way of using matsetvalueslocal? any suggestions to speed up the process?<br>
> <br>
> Thank you.<br>
> <br>
> Xiangdong<br>
<br>
</blockquote></div>