On Fri, Jan 27, 2012 at 12:04 PM, Tabrez Ali <span dir="ltr">&lt;<a href="mailto:stali@geology.wisc.edu">stali@geology.wisc.edu</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Matt<div><br></div><div>Thanks. Yes I can wait for a few weeks/months (its only a local memory footprint issue and in no way hampers my ability to solve problems).</div><div><br></div><div>
Btw just for curiosity are you using the same technique discussed by Barry?</div></div></blockquote><div><br></div><div>Basically. You have to store indices while counting if you don&#39;t want to overcount. This is the part he glosses over.</div>
<div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Maybe I am overlooking something trivial in his post.</div>
<span class="HOEnZb"><font color="#888888"><div><br></div><div>Tabrez</div></font></span><div><div class="h5"><div><br></div><div><br></div><div><div>On Jan 27, 2012, at 10:26 AM, Matthew Knepley wrote:</div><br><blockquote type="cite">
On Fri, Jan 27, 2012 at 10:32 AM, Tabrez Ali <span dir="ltr">&lt;<a href="mailto:stali@geology.wisc.edu" target="_blank">stali@geology.wisc.edu</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
 PETSc Gurus<br> <br> First I want to thank you for patiently answering questions that I have asked in past regarding preallocation. Unfortunately I am still having problems.<br> <br> I have a small unstructured FE (elasticity) code that uses PETSc.<br>
 <br> Unfortunately I am not yet able to find an _efficient_ way of calculating the non-zero structure so I simply overestimate the o_nz and d_nz values (= dimension x max_number_of nodes _a_node_contributes_to) which means that my stiffness matrix consumes at least 2X more memory. For example, for a perfectly structured mesh of linear hexes this number is 3*27=81=o_nz=d_nz. In complicated 3D linear tet/hex meshes that I have generated I rarely need to set a value greater than 150. In general I have found that as long as I keep DOF/core between 100-200K (assuming 1GB/per core) there is enough local RAM left even when memory for stiffness matrix is overestimated by 2X-6X.<br>
 <br> In any case now I do want to preallocate exactly for better memory performance and the ambiguity involved in choosing a reasonable o_nz/d_nz. The way I am trying to do it involves loops like ...<br> <br> do i=1, num_local_elements<br>
   do j=1, num_total_nodes<br>      ...<br>   end do<br> end do<br> <br> or using lists that involve searches.<br> <br> This unfortunately takes much time (much more than assembly and solve) due to the second loop. I am aware of many posts/slides by PETSc authors that mention that the non-zero structure can be found simply by looping once through elements but what to do next is not quite clear.<br>
 <br> I am also aware of this post by Barry [ <a href="http://lists.mcs.anl.gov/pipermail/petsc-users/2008-May/003020.html" target="_blank">http://lists.mcs.anl.gov/<u></u>pipermail/petsc-users/2008-<u></u>May/003020.html</a> ] but I cannot get it to work for a simple 4 element problem. Can some one please expand on the strategy being suggested by Barry specially where the loops are discussed (I understand the arrays and the vecscatter part). I am also not sure how does using a t of 0.5 and 1 prevents double counting. Shouldn&#39;t it be 0 and 1?<br>
 <br> I am also aware of some capabilities in DMMESH but right now I dont understand it well enough to utilize it.<br></blockquote><div><br></div><div>I agree with you here. Its not easy enough to use. However, I have rewritten the basics of it completely in C, which</div>
 <div>will all have easy Fortran bindings. You can specify your mesh with adjacency lists using Fortran arrays. The last part</div><div>I am working on is matrix preallocation. I would not normally ask you to wait, but I think I am pretty close. Mail me</div>
 <div>directly if you want more info. I think it should only take me a few weeks to finish.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 Alternatively does PETSc support MATMPIAIJ of size=integer(1)/logical instead of real(8) which I can use to put zeros/ones (when I loop over elements the first time) to get the non-zero structure?<br> <br> Thanks in advance.<span><font color="#888888"><br>
 <br> Tabrez<br> </font></span></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<br></blockquote></div><br></div></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<br>