Re: [OMPI users] Python code inconsistency on complex multiplication in MPI (MPI4py)

2018-05-23 Thread Konstantinos Konstantinidis
Thanks Ben and Lisandro. You are right, my comparison based on the print() was misleading in terms of precision so I probably didn't copy enough decimal places :) I will also try to skip datatype specification and let MPI4py select the datatype, and see what's going on. On Tue, May 22, 2018 at

Re: [OMPI users] Python code inconsistency on complex multiplication in MPI (MPI4py)

2018-05-23 Thread Lisandro Dalcin
The beauty of floating point! Indeed, this is just a precision problem. Using 16 significative digits in program2.py produces the same result as in program1.py @Jorge Pretty good example for your Numerical Calculus teaching, for those kids that ask over and over again "What's the point of these na

Re: [OMPI users] Python code inconsistency on complex multiplication in MPI (MPI4py)

2018-05-22 Thread Ben Menadue
Hi Jeff, Konstantinos, I think you might want MPI.C_DOUBLE_COMPLEX for your datatype, since np.complex128 is a double-precision. But I think it’s either ignoring this and using the datatype of the object you’re sending or MPI4py is handling the conversion in the backend somewhere. You could act

Re: [OMPI users] Python code inconsistency on complex multiplication in MPI (MPI4py)

2018-05-22 Thread Konstantinos Konstantinidis
Thanks Jeff. I ran your code and saw your point. Based on that, it seems that my comparison by just printing the values was misleading. I have two questions for you: 1. Can you please describe your setup i.e. Python version, Numpy version, MPI4py version and Open MPI version? I'm asking since I

Re: [OMPI users] Python code inconsistency on complex multiplication in MPI (MPI4py)

2018-05-22 Thread Jeff Squyres (jsquyres)
There are two issues: 1. You should be using MPI.C_COMPLEX, not MPI.COMPLEX. MPI.COMPLEX is a Fortran datatype; MPI.C_COMPLEX is the C datatype (which is what NumPy is using behind the scenes). 2. Somehow the received B values are different between the two. I derived this program from your tw

[OMPI users] Python code inconsistency on complex multiplication in MPI (MPI4py)

2018-05-22 Thread Konstantinos Konstantinidis
Assume an Python MPI program where a master node sends a pair of complex matrices to each worker node and the worker node is supposed to compute their product (conventional matrix product). The input matrices are constructed at the master node according to some algorithm which there is no need to e