<div dir="ltr">On Sun, May 26, 2013 at 2:10 PM, Choi240 <span dir="ltr"><<a href="mailto:choi240@purdue.edu" target="_blank">choi240@purdue.edu</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><font size="5"><span style="font-size:17px">Thank you for your fast reply. However, I was already using 64 bit pointer.</span></font></div>
</blockquote><div><br></div><div style>Then it sounds like you ar really out of memory. Also, make sure you are checking all error codes</div><div style>with CHKERRQ so you do not get follow-on errors.</div><div style><br>
</div><div style> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>-------- Original message --------<br>Subject: Re: [petsc-users] Errors from large matrices <br>
From: Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> <br>To: Joon hee Choi <<a href="mailto:choi240@purdue.edu" target="_blank">choi240@purdue.edu</a>> <br>CC: <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <br>
<br><br><div style="word-break:break-all"><br>On May 26, 2013, at 6:19 AM, Joon hee Choi <<a href="mailto:choi240@purdue.edu" target="_blank">choi240@purdue.edu</a>> wrote:<br><br>> Hello all,<br>> <br>> I need to multiply a large seqaij matrix(X1) and a maij(or baij) matrix(CC). I set up X1 (size:4273949x108965941330383, nonzeros:143599552) and C (size:25495389x10, nonzeros:254953890) and created a maij matrix CC from C. However, I got errors such as out of memory and Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range. Is this memory problem, and do I have to change seqaij into mpiaij and use multi processors? Or do I have another methods fixing it? If you know the method, then please let me know it. Thank you.<br>
<br><a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#with-64-bit-indices" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html#with-64-bit-indices</a><br><br><br>> <br>> Joon<br>> <br>> <br>
> Code:<br>> ...<br>> ierr = MatCreate(PETSC_COMM_SELF, &X1); CHKERRQ(ierr);<br>> ierr = MatSetSizes(X1, PETSC_DECIDE, PETSC_DECIDE, I, J*K); CHKERRQ(ierr);<br>> ierr = MatSetBlockSizes(X1, I, J); CHKERRQ(ierr);<br>
> ierr = MatSetType(X1, MATSEQAIJ); CHKERRQ(ierr);<br>> ierr = MatSeqAIJSetPreallocation(X1, 0, nnz); CHKERRQ(ierr);<br>> <br>> for (int x=0; x<tups.size(); x++) {<br>> i = std::tr1::get<0>(tups[x]);<br>
> j = std::tr1::get<2>(tups[x]) + std::tr1::get<1>(tups[x])*J;<br>> val = std::tr1::get<3>(tups[x]);<br>> ierr = MatSetValues(X1, 1, &i, 1, &j, &val, INSERT_VALUES); CHKERRQ(ierr);<br>
> }<br>> ierr = MatAssemblyBegin(X1, MAT_FINAL_ASSEMBLY);<br>> ierr = MatAssemblyEnd(X1, MAT_FINAL_ASSEMBLY);<br>> ierr = PetscGetTime(&v1); CHKERRQ(ierr);<br>> ierr = PetscPrintf(PETSC_COMM_WORLD, "Setup Time: %2.1e \n", v1-v); CHKERRQ(ierr);<br>
> <br>> // Create a matrix C (K x R) with all values 1<br>> ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, K, R, R, NULL, &C); CHKERRQ(ierr);<br>> for (k=0; k<K; k++) {<br>> for (r=0; r<R; r++) {<br>
> ierr = MatSetValues(C, 1, &k, 1, &r, &one, INSERT_VALUES); CHKERRQ(ierr);<br>> }<br>> }<br>> ierr = MatAssemblyBegin(C, MAT_FINAL_ASSEMBLY); CHKERRQ(ierr);<br>> ierr = MatAssemblyEnd(C, MAT_FINAL_ASSEMBLY); CHKERRQ(ierr);<br>
> <br>> ierr = M...</div> </div></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>