[petsc-users] Error with VecDestroy_MPIFFTW+0x61

Matthew Knepley knepley at gmail.com
Sun Apr 14 19:36:16 CDT 2019

On Sun, Apr 14, 2019 at 8:29 PM Sajid Ali via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Hi PETSc Developers,
> 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).

1) These vectors have potentially different layout. That is why there are 3

2) If you want a copy of one of these vectors, use VecDuplicate().



> 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).
> 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)?
> 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.
> Thanks in advance for the help!
> --
> Sajid Ali
> Applied Physics
> Northwestern University

What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190414/6050e7d9/attachment.html>

More information about the petsc-users mailing list