Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-22 Thread Smith, Barry F. via petsc-users
Sajid, Where is the pull request for this? Better to get in the Bibuckit pull request system then have it drag out and have code change around. So please go ahead and post the pull request. It looked pretty much done the last time I saw it. Barry > On Apr 17, 2019, at 9:32 AM,

Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-17 Thread Sajid Ali via petsc-users
Hi Matt/Barry, I've implemented this for 1D-complex-mpi vec and tested it. Here is the modified source file -> https://bitbucket.org/sajid__ali/petsc/src/86fb19b57a7c4f8f42644e5160d2afbdc5e03639/src/mat/impls/fft/fftw/fftw.c Functions definitions at

Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-16 Thread Sajid Ali via petsc-users
Hi Barry/Matt, Since VecDuplicate calls v->ops->duplicate, can't we just add custom duplicate ops to the (f_in/f_out/b_out) vectors when they are created via MatCreateFFTW? (just like the custom destroy ops are defined) Also, what is the PetscObjectStateIncrease function doing ? Thank You,

Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-15 Thread Smith, Barry F. via petsc-users
> On Apr 15, 2019, at 6:57 PM, Matthew Knepley wrote: > > On Mon, Apr 15, 2019 at 2:44 PM Smith, Barry F. wrote: > > There are two distinct issues here. > > 1) the use of fftw_malloc(). This is a relatively minor issue. This is > causing the crash in the code because VecDuplicate()

Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-15 Thread Smith, Barry F. via petsc-users
There are two distinct issues here. 1) the use of fftw_malloc(). This is a relatively minor issue. This is causing the crash in the code because VecDuplicate() uses PetscMalloc() to obtain the array but when the array is freed fftw_malloc() is called on it. 2) the padding that FFTW needs

Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-15 Thread Sajid Ali via petsc-users
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

Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-14 Thread hong--- via petsc-users
FFTW interface was written by a summer graduate student many years ago. It was only used occasionally by users. Shall we continue maintain it? If so, it needs to be updated. For users, using FFTW directly might be better instead of using this interface. Hong On Sun, Apr 14, 2019 at 9:12 PM

Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-14 Thread Smith, Barry F. via petsc-users
http://www.fftw.org/doc/Memory-Allocation.html The issue isn't really the fftw_malloc() it is that the current code is broken if the user calls VecDuplicate() because the new vectors don't have the correct extra space needed by FFTW and could cause random crashes and incorrect answers.

Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-14 Thread Sajid Ali via petsc-users
Thanks for the temporary fix. (PS: I was wondering if it would be trivial to just extend the code to have four mallocs and create a new function but it looks like the logic is much more complicated.)

Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-14 Thread Matthew Knepley via petsc-users
On Sun, Apr 14, 2019 at 9:12 PM Sajid Ali wrote: > Just to confirm, there's no error when running with one rank. The error > occurs only with mpirun -np x (x>1). > This is completely broken. I attached a version that will work in parallel, but its ugly. PETSc People: The MatCreateVecsFFT()

Re: [petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-14 Thread Sajid Ali via petsc-users
Hi Matt, While in theory, that sounds perfect I still get the same error. I'm attaching a minimal test program which creates 3 vectors x,y,z via the petsc-fftw interface and a test vector via VecDuplicate and then destroy all the vectors. Without the test vector everything works fine. Thank

[petsc-users] Error with VecDestroy_MPIFFTW+0x61

2019-04-14 Thread Sajid Ali via petsc-users
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