[petsc-users] Error with VecDestroy_MPIFFTW+0x61

Matthew Knepley knepley at gmail.com
Mon Apr 15 11:53:04 CDT 2019


On Mon, Apr 15, 2019 at 12:48 PM Sajid Ali <sajidsyed2021 at u.northwestern.edu>
wrote:

>
> Hi Barry & Matt,
>
> I'd be happy to contribute a patch once I understand what's going on.
>
> @Matt, Where is the padding occurring? In the VecCreateFFTW I see that
> each process looks up the dimension of array it's supposed to hold and asks
> for memory to hold that via fftw_malloc (which as you say is just a wrapper
> to simd-aligned malloc). Is the crash occurring because the first vector
> was created via fftw_malloc and duplicated via PETScMalloc and they happen
> to have different alignment sizes (FFTW was compiled with simd=avx2 since
> I'm using a Broadwell-Xeon and PETScMalloc aligns to PETSC_MEMALIGN ?)
>

No. What is happening is that PetscMalloc() overallocates, writes a little
header on the the block of memory, and returns a pointer which is insider
the block after the header. However, this pointer was passed to fftw_free()
which just calls free() in it. free() says it never heard of this pointer
because its inside the block that was actually allocated (this is what
valgrind is telling us).

The change that is needed is just to replace all fftw_malloc() by
PetscMalloc1(). You have to be a little careful about
types to make sure we get the right sizes, but its not bad. I would do it
if this were not the end of the semester.

  Thanks,

    Matt


> PS: I've only ever used FFTW via the python interface (and automated the
> build & but couldn't automate testing of pyfftw-mpi since cython coverage
> reporting is confusing).
>
> Thank You,
> 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/20190415/0da6ffb5/attachment.html>


More information about the petsc-users mailing list