Implement MPIFFT2D and MPIFFTND#195
Conversation
|
Worked on implementing
Once we agree on the implementation, I will go ahead and update the documentation including the |
mrava87
left a comment
There was a problem hiding this comment.
@rohanbabbar04 this is a great addition to pylops-mpi!
I have gone through the PR mostly trying to understand the rationale of your code and the decision made in the implementation - left some comments and questions?
Once we agree on the right approach, I'll do a more focused review on the actual code 😄
|
|
||
| # Axis along which PFFT decomposes the output array across MPI processes | ||
| dist_axis = [i for i, s in enumerate(u_hat.subcomm) if s.Get_size() > 1] | ||
| y = DistributedArray(global_shape=self.dimsd, dtype=self.dtype, axis=dist_axis[0] if dist_axis else 0, |
There was a problem hiding this comment.
Does this mean that the output could have a different distribution of the input?
There was a problem hiding this comment.
Yes, it could be, as it depends on the axes parameter.
There was a problem hiding this comment.
@rohanbabbar04 ok, this is not ideal as it is not really predictable.
A user having a global 2d array chunked over axis=0 and flattened and then put into a 1D distributed array may get back a new 1D distributed array that contains local arrays that if reshaped to 2d have chunks over axis=1 and entire axis 0?
If so, how do you see a user knowing this, is there at least a parameter in the FFT operator they can consult?
|
@rohanbabbar04 thanks for the updates! I left a few additional comments (and unresolved some conversations to make sure I fully undestand some of your design choices... should be clear now but please confirm). Once you have handled these last few points, I think this is good to go! Next, we can look into enabling N-D Distributed arrays into MPI Linear Operators as in some cases like FFT we could benefit from not having to always distribute the first axis... I had a little play and it seems doable with minor code changes, I may create a draft PR to document what I did so far |
Thanks @mrava87 for the review, I have added the comments to the respective questions. Do let me know if you need any more information 🙂 ? |
Quite a few comments unanswered (you may have missed completely my comments from the second review I did... I pinged you in each of them, so you can easily find them 😄 |
|
|
||
| # Axis along which PFFT decomposes the output array across MPI processes | ||
| dist_axis = [i for i, s in enumerate(u_hat.subcomm) if s.Get_size() > 1] | ||
| y = DistributedArray(global_shape=self.dimsd, dtype=self.dtype, axis=dist_axis[0] if dist_axis else 0, |
There was a problem hiding this comment.
@rohanbabbar04 ok, this is not ideal as it is not really predictable.
A user having a global 2d array chunked over axis=0 and flattened and then put into a 1D distributed array may get back a new 1D distributed array that contains local arrays that if reshaped to 2d have chunks over axis=1 and entire axis 0?
If so, how do you see a user knowing this, is there at least a parameter in the FFT operator they can consult?
mrava87
left a comment
There was a problem hiding this comment.
Thanks @rohanbabbar04, this looks great now.
Happy with nfft being addressed later in a second PR, and perhaps we will also revisit things a bit when we will be able to pass ND-distributed arrays to solvers... right now I think what you do with internal redistributions and final reflattening with distribution over the axis=0 is the only possible way 😄
I will merge once the CI is finished.
mpi4py-fftMPIFFTND,MPIFFT2Dand_MPIBaseFFTNDexamples\fftshiftandifftshift.Note:
mpi4py-fftworks only with numpy arrays, and PFFT works with multi-dimensional arrays.