using PFFT is causing error, not sure why!
Hi,
I am following the example as in this thread just to make sure that everything works fine, from mpi4py import MPI from mpi4py_fft import PFFT, newDistArray FFT = PFFT(MPI.COMM_WORLD, [64, 64, 64]) u = newDistArray(FFT, False, rank=1) u_hat = newDistArray(FFT, True, rank=1)
but when I call PFFT(), the following error occurs,
PFFT(MPI.COMM_WORLD, [64, 64, 64])
Traceback (most recent call last):
File "
thanks a lot,
okay, I need to update this thread here, because I found out something very interesting. For some reason, PFFT is working with 2D arrays, but not in 3D array in the above case.
check out what I did below:
N = np.array([12, 20], dtype=int)
fft = PFFT(MPI.COMM_WORLD, N) fft <mpi4py_fft.mpifft.PFFT object at 0x2b345bf11ca0> u = newDistArray(fft, False) u[:] = np.random.random(u.shape).astype(u.dtype) u DistArray([[4.75179700e-01, 9.00272237e-01, 3.88389825e-02, 4.43223852e-01, 7.23486523e-01, 8.30510648e-01, 7.08455979e-02, 9.33153804e-01, 6.34450773e-01, 1.86274467e-01, 3.69390196e-01, 9.54890093e-01, 1.63599955e-01, 7.22375929e-01, 2.55018437e-01, 2.10975215e-01, 3.07019292e-01, 9.70251033e-01, 2.67878129e-01, 8.08412438e-01], [6.41010458e-01, 1.55316525e-01, 3.92985548e-01, 7.58982528e-01, 1.96172347e-01, 3.23822164e-01, 1.69856368e-01, 9.65051374e-01, 6.30040654e-01, .....
and then use fft, it works just fine!! u_hat = fft.forward(u)
u_hat array([[ 5.11894971e-01+0.00000000e+00j, 4.48722376e-04+3.38932184e-03j, 3.94412372e-03-4.13485466e-03j, -9.87726800e-03+5.53170883e-03j, 2.82209364e-02+3.43406317e-03j, 1.36319628e-02+1.20846741e-02j, 1.65555488e-02+7.51500775e-03j, 6.57208898e-03+3.25532557e-02j, 9.55557523e-03+4.51506201e-03j, -1.87489759e-02-2.10101392e-02j, 2.34454729e-03+0.00000000e+00j], [ 2.61748776e-03+6.02150010e-03j, 1.61801892e-02-3.11565343e-02j, 3.82726088e-03+2.90338948e-03j, 1.59308433e-02+1.27080990e-02j, 1.27047548e-03+1.85205872e-03j, 2.40894550e-02+7.90008996e-04j, -3.67148183e-03-1.58069722e-02j, -1.74244746e-02-8.15838596e-03j, -1.09787065e-02-3.50970431e-03j, 7.52425847e-03+1.20733633e-03j, -1.35393618e-02-5.06389990e-03j], .....
sorry for typing twice here
Hi I cannot reproduce this error.
Hi Mikael, thanks for the reply. yeah I honestly do not understand what's going on, haha. if it works for you, then maybe it is something that has to do with my envionment. Let me tell you about the environment I am using:
environment: gcc 9.3.0 openmpi 3.1.6 Python 3.9.16 FFTW 3.3.8
packages being used installed via pip: numpy 1.21.5 mpi4py 3.1.3 mpi4py-fft 2.0.5 pyfftw 0.13.1 h5py 3.9.0 h5df5 1.10.6
I also tried to trace the error to the file fftw_xfftn.pyx line 152 i may need your help to understand what this means, maybe I can try to see what's going on from my end and update this thread if I figure it out. in line 152-153 if self._plan == NULL: raise RuntimeError("Failure creating FFTW plan") what does self object refer to, what is _plan? also what does NULL mean? the way I understand FFTW plans is like a pointer that stores the N-D array somehow and FFTW use that informaton to compute the transforms later, correct?
Ahmad