<html><head></head><body dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="ApplePlainTextBody"><div class="ApplePlainTextBody"><br><blockquote type="cite">On Oct 25, 2017, at 5:13 AM, Matthew Knepley <knepley@gmail.com> wrote:<br><br>On Wed, Oct 25, 2017 at 6:10 AM, Karin&NiKo <niko.karin@gmail.com> wrote:<br>Thank you very much for your answer.<br>Is there an example in the PETSc tests that shows how to prescribe the layout of the Mat that is passed to MatLoad()? I see how to specify a local size with MatSetSize but I do not see how to assign an entry of the Mat to a given process...<br><br>Mat object only have contiguous division of rows on processes, so specifying the size of each partition is all you can do.<br></blockquote><br> And indeed if you want the same layout as your MatViewed matrix then this is exactly what you need. MatView just stores from row 0 to n-1 in order and MatLoad reads from 0 to n-1 in order. If you want a different parallel ordering, like based on using a partitioning then you load the matrix and use MatPartitioningCreate() and then MatCreateSubMatrix() to redistribute the matrix (note in this case the "sub matrix" has the same size as the original matrix".<br><br> Note we don't recommend saving big old matrices to files and then reloading them for solves etc. This is not scalable, better to write your applications so the entire process doesn't require saving and load matrices.<br><br> Barry<br><br><br><blockquote type="cite"><br> Matt<br><br>Thanks,<br>Nicolas<br><br>2017-10-25 11:40 GMT+02:00 Matthew Knepley <knepley@gmail.com>:<br>On Wed, Oct 25, 2017 at 4:32 AM, Karin&NiKo <niko.karin@gmail.com> wrote:<br>Dear PETSc team,<br><br>I have a code that creates a parallel matrix based on domain decomposition. I serialize this matrix with MatView.<br>Then, I would like to relaod it with MatLoad but not leaving PETSc decide the parallel layout but rather use the original distribution of the degrees of freedom.<br>Does MatLoad help to do that? Shall I use the IS of the local/global mapping ?<br><br>You can prescribe the layout of the Mat that is passed to MatLoad(). However, if you are asking that the original<br>layout be stored in the file, we do not do that. It could be made to work by writing the layout to the .info file and<br>then having the option call MatSetSizes() on load. Should not be much code.<br><br> Thanks,<br><br> Matt<br><br>I look forward to reading you,<br>Nicolas<br><br><br><br><br><br>-- <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><br>https://www.cse.buffalo.edu/~knepley/<br><br><br><br><br>-- <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><br>https://www.cse.buffalo.edu/~knepley/<br></blockquote><br></div></body></html>