<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div>I have found that the fortran version mpi_reduce does not work for real*18. This can be shown by the following program. I have not test the C version of mpi_reduce. <br></div><div><br></div><div><br></div><div>c-----------------------Fortran code begins -----------------------------<br></div><div><div> implicit real*8 (a-h, o-z)<br> include 'mpif.h'<br> real*16 h1, h<br><br><br> call mpi_init(ierr)<br> call mpi_comm_size(mpi_comm_world, nprocs, ierr)<br> call mpi_comm_rank(mpi_comm_world, myrank, ierr)<br><br><br> h1 = (myrank+4) *2.00000000000000<br> write(*,'(''before reduce --'', i4,2f12.8)')myrank, h1,h<br><br><br> call mpi_reduce(h1,h,1,mpi_long_double,mpi_sum,0,<br> & mpi_comm_world,ierr)<br> write(*,'(''after reduce --'',i4,2f12.8)')myrank, h1,h<br><br> call mpi_bcast(h,1,mpi_long_double,0,<br> & mpi_comm_world,ierr)<br><br> write(*,'(''bcastvalue -- '',i4,2f12.8)')myrank, h1,h<br><br> call mpi_finalize(ierr)<br> end<br><br>
<div>c-----------------------Fortran code begins -----------------------------</div><div><br></div><div><br></div><div>$ mpif77 a.f -o a.out<br>$ mpirun -np 3 ./a.out<br>before reduce -- 1 10.00000000 0.00000000<br>after reduce -- 1 10.00000000 0.00000000<br>before reduce -- 2 12.00000000 0.00000000<br>before reduce -- 0 8.00000000 0.00000000<br>after reduce -- 2 12.00000000 0.00000000<br>after reduce -- 0 8.00000000 8.00000000<br>bcastvalue -- 0 8.00000000 8.00000000<br>bcastvalue -- 1 10.00000000 8.00000000<br>bcastvalue -- 2 12.00000000 8.00000000<br><br><br></div>
</div></div></div>