Hi All,

I am having a strange problem with the floating precision. I get correct precision when I launch with one process, but when the same code is launched with 2 or more process I am losing precision in MPI_Redcue(…, MPI_FLOAT, MPI_SUM..); call. Output from my code

 

(admin)host:~$ mpirun -np 1 string 10 0.1 0.9 10 3

sum = 1

sum = 0.999992

sum = 1.00043

 

(admin)host:~$ mpirun -np 2 string 10 0.1 0.9 10 3

sum = 1

sum = 1

sum = 1.00049

 

As you can see I am loosing precision. Can someone help me fix this code? Last parameter to my code is the number of iterations. I am attaching source code to this email.

 

Santhosh