📄 dddot3.f
字号:
Function dddot3( k, partcomm, n, x, y ) Result( dotres )! --------------------------------------------------------------------- Use dist_module Use numerics Implicit None Integer :: k, n, partcomm Real(l_) :: x(n), y(n), dotres Include 'mpif.h' Integer :: datype, ierr Integer :: i Real(l_) :: s! ---------------------------------------------------------------------! --- Do local part of dotproduct. s = 0.0_l_ Do i = 1, n s = s + x(i)*y(i) End Do dotres = s! ---------------------------------------------------------------------! --- If on 1 processor we are done: Return. If ( k == 1 ) Return! ---------------------------------------------------------------------! --- Send partial results from all processors in communicator ! partcomm to processor 1. datype = MPI_Real8 Call MPI_Reduce( s, dotres, 1, datype, MPI_Sum, 0, & partcomm, ierr )! ---------------------------------------------------------------------! --- Send sum to all processors in communicator partcomm. If ( me < k ) Call MPI_Bcast( dotres, 1, datype, 0, partcomm, & ierr )! --------------------------------------------------------------------- End Function dddot3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -