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.c-----------------------Fortran code begins ----------------------------- implicit real*8 (a-h, o-z)
include 'mpif.h'
real*16 h1, h
call mpi_init(ierr)
call mpi_comm_size(mpi_comm_world, nprocs, ierr)
call mpi_comm_rank(mpi_comm_world, myrank, ierr)
h1 = (myrank+4) *2.00000000000000
write(*,'(''before reduce --'', i4,2f12.8)')myrank, h1,h
call mpi_reduce(h1,h,1,mpi_long_double,mpi_sum,0,
& mpi_comm_world,ierr)
write(*,'(''after reduce --'',i4,2f12.8)')myrank, h1,h
call mpi_bcast(h,1,mpi_long_double,0,
& mpi_comm_world,ierr)
write(*,'(''bcastvalue -- '',i4,2f12.8)')myrank, h1,h
call mpi_finalize(ierr)
end
c-----------------------Fortran code begins ----------------------------- $ mpif77 a.f -o a.out
$ mpirun -np 3 ./a.out
before reduce -- 1 10.00000000 0.00000000
after reduce -- 1 10.00000000 0.00000000
before reduce -- 2 12.00000000 0.00000000
before reduce -- 0 8.00000000 0.00000000
after reduce -- 2 12.00000000 0.00000000
after reduce -- 0 8.00000000 8.00000000
bcastvalue -- 0 8.00000000 8.00000000
bcastvalue -- 1 10.00000000 8.00000000
bcastvalue -- 2 12.00000000 8.00000000
_______________________________________________
discuss mailing list discuss@mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss