On Thu, May 17, 2012 at 12:37 PM, Hautzenroeder, Brenna M <span dir="ltr"><<a href="mailto:bmhautz@sandia.gov" target="_blank">bmhautz@sandia.gov</a>></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>
<font face="Calibri"><span style="font-size:11pt">
<div>I’m running into time and memory problems creating an array to store multiple KSP objects.</div>
<div> </div>
<div>We are using a Fourier method for the temporal portion of our operator; currently, this is anywhere between 1024-2048 time samples equating to 1024-2048 frequencies to advance our solution. Each frequency has its own matrix, meaning there are 1024-2048
linear equations of the form Ax = b. So, while the matrices are different for each frequency, when we propagate the solution one step, the 1024-2048 matrices don’t change since the frequencies haven’t changed between steps.</div>
<div> </div>
<div>We would like to store each KSP solution (all 1024-2048 of them) in an array so that we can reuse them for the next step since this saves us time factoring the matrix. The problem I am seeing is that storing these KSP objects in any kind of array increases
the runtime and storage space exponentially – I am seeing times on the order of 30 mins to an hour and memory consumed hover around 20-30GB! Is there something inherent </div></span></font></div></blockquote><div><br></div>
<div>I don't think you really mean "exponential", but just big. Did you calculate how much space you expect? Storing a factor can take</div><div>N^3 space, and then you have 1000 of them, so it will take 1000x the space of 1 KSP. Did you compare the storage for both cases?</div>
<div>There is really not enough information in your question, however</div><div><br></div><div> Yes, storing KSPs is the right thing here</div><div><br></div><div> No, they do not take more space than necessary</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><font face="Calibri"><span style="font-size:11pt"><div>about the KSP object that I am missing and/or a better way to store these objects? I don’t
have any problems if I use one KSP object and set the operators each time to the different matrices, except that it takes longer than it normally would after the first step since it has to recalculate the preconditioner matrix.</div>
<div> </div>
<div>Note: We are using distributed matrices and vectors for our linear system.</div>
<div> </div>
<div>I have included some pseudocode to illustrate our linear system, which works:</div>
<div> </div>
<div>KSP k;</div>
<div>for steps = 1 to 100 do:</div>
<div style="text-indent:36pt">for time = 1 to 1024 do:</div>
<div> create distributed matrix A and fill with local values (A[step=1,time=1] = A[step=2,time=1], etc)</div>
<div> create distributed vector b and fill with local values for given time</div>
<div> create distributed vector x for result</div>
<div> create KSP k and set matrices</div>
<div> KSPSolve(k, b, x) => takes a little extra time each step</div>
<div> </div>
<div>However, the following creates time/storage problems:</div>
<div> </div>
<div>KSP* kArray;</div>
<div>create kArray => takes inordinate amout of time and storage</div>
<div>for steps = 1 to 100 do:</div>
<div> for time=1 to 1024 do:</div>
<div> create distributed matrix A and fill with local values (A[step=1,time=1] = A[step=2,time=1], etc)</div>
<div> create distributed vector b and fill with local values for given time</div>
<div> create distributed vector x for result</div>
<div> if time == 1 do:</div>
<div style="text-indent:36pt;padding-left:72pt">set matrices on kArray[time] => also takes an inordinate amount of time and storage</div>
<div> KSPSolve(kArray[time], b, x)</div>
<div> </div>
<div>Any insight would be greatly appreciated!</div><span class="HOEnZb"><font color="#888888">
<div>Brenna</div>
<div> </div>
</font></span></span></font>
</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>