<div dir="ltr"><div dir="ltr">On Sun, Apr 14, 2019 at 8:29 PM Sajid Ali via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><div></div>Hi PETSc Developers, <br><br></div>I happen to be a user who needs 4 vectors whose layout is aligned with FFTW. The usual MatCreateVecsFFTW allows one to make 3 such vectors. To get around this I call the function twice, once with three vectors, once with one vector (and 2x NULL). This causes a strange segfault when freeing the memory with VecDestroy (for the lone vector I'm guessing). <br></div></div></blockquote><div><br></div><div>1) These vectors have potentially different layout. That is why there are 3 arguments.</div><div><br></div><div>2) If you want a copy of one of these vectors, use VecDuplicate().</div><div><br></div><div>   Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">My program runs with no issues if I create the fourth vector with VecCreateMPI (I need the 4th vector for point-wise multiply so this would be ineffiient). <br><br> To get around this problem, is there a way to ask for 4 vectors aligned to the FFTW matrix? If not is there a way to get the intended behavior from VecCreateMPI, (perhaps by using a helper function to determine the data alignment and pass to it instead of using PETSC_DECIDE)? <br><br></div><div>I'm attaching my code just in case what I'm thinking is wrong and anyone would be kind enough to point it out to me. The issue is at line 87/88. With 87, the program crashes, with 88 it works fine. <br></div><div dir="ltr"><div><div><br></div><div>Thanks in advance for the help! <br></div><div><br>-- <br><div dir="ltr" class="gmail-m_8852034931574679415gmail_signature"><div dir="ltr"><div style="font-size:12.8px">Sajid Ali<br></div><div style="font-size:12.8px">Applied Physics<br></div><div style="font-size:12.8px">Northwestern University</div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>