<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">Wiadomość napisana przez Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> w dniu 24.05.2017, o godz. 10:44:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote">On Wed, May 24, 2017 at 12:37 PM, Michał Dereziński<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:michal.derezinski@gmail.com" target="_blank" class="">michal.derezinski@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;"><div style="word-wrap: break-word;" class=""><div class="">Great! Then I have a follow-up question:</div><div class=""><br class=""></div><div class="">My goal is to be able to load the full matrix X from disk, while at the same time in parallel, performing computations on the submatrices that have already been loaded. Essentially, I want to think of X as a block matrix (where the blocks are horizontal, spanning the full width of the matrix), where I’m loading one block at a time, and all the blocks that have already been loaded are combined using MatCreateNest, so that I can make computations on that portion of the matrix.</div></div></blockquote><div class=""><br class=""></div><div class="">I need to understand better. So</div><div class=""><br class=""></div><div class=""> 1) You want to load a sparse matrix from disk</div><div class=""><br class=""></div></div></div></div></div></blockquote><div><br class=""></div><div>Yes, the matrix is sparse, stored on disk in row-wise chunks (one per process), with total size of around 3TB.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> 2) You are imagining that it is loaded row-wise, since you can do a calculation with some rows before others are loaded.</div><div class=""><br class=""></div><div class=""> What calculation, a MatMult?</div><div class=""> How long does that MatMult take compared to loading?</div><div class=""><br class=""></div></div></div></div></div></blockquote><div><br class=""></div><div>Yes, a MatMult.</div><div>I already have a more straightforward implementation where the matrix is loaded completely at the beginning, and then all of the multiplications are performed.</div><div>Based on the loading time and computation time with the current implementation, it appears that most of the computation time could be subsumed into the loading time.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> 3) If you are talking about a dense matrix, you should be loading in parallel using MPI-I/O. We do this for Vec.</div><div class=""><br class=""></div><div class="">Before you do complicated programming, I would assure myself that the performance gain is worth it.</div><div class=""> </div><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;"><div style="word-wrap: break-word;" class=""><div class="">In this scenario, every process needs to be simultaneously loading the next block of X, and perform computations on the previously loaded portion. My strategy is for each MPI process to spawn a thread for data loading (so that the memory between the process and the thread is shared), while the process does computations. My concern is that the data loading thread may be using up computational resources of the processor, even though it is mainly doing IO. Will this be an issue? What is the best way to minimize the cpu time of this parallel data loading scheme?</div></div></blockquote><div class=""><br class=""></div><div class="">Oh, you want to load each block in parallel, but there are many blocks. I would really caution you against using threads. They</div><div class="">are death to clean code. Use non-blocking reads.</div></div></div></div></div></blockquote><div><br class=""></div><div>I see. Could you expand on your suggestion regarding non-blocking reads? Are you proposing that each process makes an asynchronous read request in between every, say, MatMult operation?</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class=""> <span class="Apple-converted-space"> </span>Thanks,</div><div class=""><br class=""></div><div class=""> Matt</div><div class=""> </div><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;"><div style="word-wrap: break-word;" class=""><div class="">Thanks,</div><div class="">Michal.</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">Wiadomość napisana przez Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> w dniu 24.05.2017, o godz. 04:55:</div><br class="m_-4470384141015376847Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Wed, May 24, 2017 at 1:09 AM, Michal Derezinski<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:mderezin@ucsc.edu" target="_blank" class="">mderezin@ucsc.edu</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;"><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class="">I want to be able to perform matrix operations on several contiguous submatrices of a full matrix, without allocating the memory redundantly for the submatrices (in addition to the memory that is already allocated for the full matrix).</div><div class="">I tried using MatGetSubMatrix, but this function appears to allocate the additional memory.</div><div class=""><br class=""></div><div class="">The other way I found to do this is to create the smallest submatrices I need first, then use MatCreateNest to combine them into bigger ones (including the full matrix).</div><div class="">The documentation of MatCreateNest seems to indicate that it does not allocate additional memory for storing the new matrix.</div><div class="">Is this the right approach, or is there a better one?</div></div></blockquote><div class=""><br class=""></div><div class="">Yes, that is the right approach.</div><div class=""><br class=""></div><div class=""> <span class="Apple-converted-space"> </span>Thanks,</div><div class=""><br class=""></div><div class=""> <span class="Apple-converted-space"> </span>Matt</div><div class=""> </div><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;"><div dir="ltr" class=""><div class="">Thanks,</div><div class="">Michal Derezinski.</div></div></blockquote></div><br class=""><br clear="all" class=""><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="m_-4470384141015376847gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.caam.rice.edu/~mk51/" target="_blank" class="">http://www.caam.rice.edu/~<wbr class="">mk51/</a><br class=""></div></div></div></font></span></div></div></div></blockquote></div><br class=""></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.caam.rice.edu/~mk51/" target="_blank" class="">http://www.caam.rice.edu/~mk51/</a></div></div></div></div></div></div></blockquote></div><br class=""></body></html>