The OpenNET Project / Index page

[ ÎÏ×ÏÓÔÉ /+++ | ÆÏÒÕÍ | ÔÅÇÉ | ]

ëÁÔÁÌÏÇ ÄÏËÕÍÅÎÔÁÃÉÉ / òÁÚÄÅÌ "ðÒÏÇÒÁÍÍÉÒÏ×ÁÎÉÅ, ÑÚÙËÉ" / ïÇÌÁ×ÌÅÎÉÅ ÄÏËÕÍÅÎÔÁ
next up previous contents
Next: MINLOó É MAXLOó Up: çÌÏÂÁÌØÎÙÅ ÏÐÅÒÁÃÉÉ ÒÅÄÕËÃÉÉ Previous: æÕÎËÃÉÑ Reduce   Contents

ðÒÅÄÏÐÒÅÄÅÌÅÎÎÙÅ ÏÐÅÒÁÃÉÉ ÒÅÄÕËÃÉÉ

óÌÅÄÕÀÝÉÅ ÐÒÅÄÏÐÒÅÄÅÌÅÎÎÙÅ ÏÐÅÒÁÃÉÉ ÍÏÇÕÔ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ MPI_REDUCE É ÒÏÄÓÔ×ÅÎÎÙÍÉ ÆÕÎËÃÉÑÍÉ MPI_ALLREDUCE, MPI_REDUCE_SCATTER É MPI_SCAN. áÒÇÕÍÅÎÔ op ÍÏÖÅÔ ÐÒÉÎÉÍÁÔØ ÓÌÅÄÕÀÝÉÅ ÚÎÁÞÅÎÉÑ:

éÍÑ úÎÁÞÅÎÉÅ
   
MPI_MAX ÍÁËÓÉÍÕÍ
MPI_MIN ÍÉÎÉÍÕÍ
MPI_SUM ÓÕÍÍÁ
MPI_PROD ÐÒÏÉÚ×ÅÄÅÎÉÅ
MPI_LAND ÌÏÇÉÞÅÓËÏÅ é
MPI_BAND ÐÏÒÁÚÒÑÄÎÏÅ é
MPI_LOR ÌÏÇÉÞÅÓËÏÅ éìé
MPI_BOR ÐÏÒÁÚÒÑÄÎÏÅ éìé
MPI_LXOR ÌÏÇÉÞÅÓËÏÅ ÉÓËÌÀÞÁÀÝÅÅ éìé
MPI_BXOR ÐÏÒÁÚÒÑÄÎÏÅ ÉÓËÌÀÞÁÀÝÅÅ éìé
MPI_MAXLOC ÍÁËÓÉÍÁÌØÎÏÅ ÚÎÁÞÅÎÉÅ É ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÑ
MPI_MINLOC ÍÉÎÉÍÁÌØÎÏÅ ÚÎÁÞÅÎÉÅ É ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÑ

ïÐÅÒÁÃÉÉ MPI_MINLOC É MPI_MAXLOC ÏÂÓÕÖÄÁÀÔÓÑ ÄÁÌÅÅ × ÒÁÚÄÅÌÅ 4.9.3. äÌÑ ÏÓÔÁÌØÎÙÈ ÐÒÅÄÏÐÒÅÄÅÌÅÎÎÙÈ ÏÐÅÒÁÃÉÊ ÎÉÖÅ ÐÒÉ×ÏÄÑÔÓÑ ÒÁÚÒÅÛÅÎÎÙÅ ËÏÍÂÉÎÁÃÉÉ ÁÒÇÕÍÅÎÔÏ× op É datatype. îÏ ÐÒÅÖÄÅ ÏÐÒÅÄÅÌÉÍ ÇÒÕÐÐÕ ÏÓÎÏ×ÎÙÈ ÔÉÐÏ× ÄÁÎÎÙÈ MPI ÓÌÅÄÕÀÝÉÍ ÏÂÒÁÚÏÍ:

óÉ integer: MPI_INT, MPI_LONG, MPI_SHORT,
MPI_UNSIGNED_SHORT, MPI_UNSIGNED,
MPI_UNSIGNED_LONG
æïòôòáî integer: MPI_INTEGER
Floating point: MPI_FLOAT, MPI_DOUBLE, MPI_REAL, MPI_DOUBLE_PRECISION, MPI_LONG_DOUBLE
Logical: MPI_LOGICAL
Complex: MPI_COMPLEX
Byte: MPI_BYTE

ðÒÁ×ÉÌØÎÙÅ ÔÉÐÙ ÄÁÎÎÙÈ ÄÌÑ ËÁÖÄÏÊ ÏÐÅÒÁÃÉÉ ÏÐÒÅÄÅÌÅÎÙ ÎÉÖÅ.

Op òÁÚÒÅÛÅÎÎÙÅ ÔÉÐÙ
   
MPI_MAX, MPI_MIN óÉ integer, æïòôòáî integer, Floating point
MPI_SUM, MPI_PROD óÉ integer, æïòôòáî integer, Floating point, Complex
MPI_LAND, MPI_LOR, MPI_LXOR óÉ integer, Logical
MPI_BAND, MPI_BOR, MPI_BXOR óÉ integer, æïòôòáî integer, Byte

ðÒÉÍÅÒ 4.15 ðÒÏÃÅÄÕÒÁ ×ÙÞÉÓÌÑÅÔ ÓËÁÌÑÒÎÏÅ ÐÒÏÉÚ×ÅÄÅÎÉÅ Ä×ÕÈ ×ÅËÔÏÒÏ×, ÒÁÓÐÒÅÄÅÌÅÎÎÙÈ × ÇÒÕÐÐÅ ÐÒÏÃÅÓÓÏ×, É ×ÏÚ×ÒÁÝÁÅÔ ÒÅÚÕÌØÔÁÔ × ÎÕÌÅ×ÏÊ ÕÚÅÌ.

SUBROUTINE PAR_BLAS1(m, a, b, c, comm)
REAL a(m), b(m) ! ÌÏËÁÌØÎÁÑ ÞÁÓÔØ ÍÁÓÓÉ×Á
REAL c ! ÒÅÚÕÌØÔÁÔ (ÎÁ ÕÚÌÅ ÎÏÌØ)
REAL sum
INTEGER m, comm, i, ierr
! ÌÏËÁÌØÎÁÑ ÓÕÍÍÁ
sum = 0.0
DO i = 1, m
  sum = sum + a(i)*b(i)
END DO }
!ÇÌÏÂÁÌØÎÁÑ ÓÕÍÍÁ
CALL MPI_REDUCE(sum, c, 1, MPI_REAL, MPI_SUM, 0, comm, ierr)
RETURN

ðÒÉÍÅÒ 4.16 ðÒÏÃÅÄÕÒÁ ×ÙÞÉÓÌÑÅÔ ÐÒÏÉÚ×ÅÄÅÎÉÅ ×ÅËÔÏÒÁ ÎÁ ÍÁÓÓÉ×, ËÏÔÏÒÙÅ ÒÁÓÐÒÅÄÅÌÅÎÙ × ÇÒÕÐÐÅ ÐÒÏÃÅÓÓÏ×, É ×ÏÚ×ÒÁÝÁÅÔ ÒÅÚÕÌØÔÁÔ × ÎÕÌÅ×ÏÊ ÕÚÅÌ.

SUBROUTINE PAR_BLAS2(m, n, a, b, c, comm)
REAL a(m), b(m,n) ! ÌÏËÁÌØÎÁÑ ÞÁÓÔØ ÍÁÓÓÉ×Á
REAL c(n) ! ÒÅÚÕÌØÔÁÔ
REAL sum(n)
INTEGER n, comm, i, j, ierr
!ÌÏËÁÌØÎÁÑ ÓÕÍÍÁ
DO j= 1, n
  sum(j) = 0.0
  DO i = 1, m
    sum(j) = sum(j) + a(i)*b(i,j)
  END DO
END DO
! ÇÌÏÂÁÌØÎÁÑ ÓÕÍÍÁ
CALL MPI_REDUCE(sum, c, n, MPI_REAL, MPI_SUM, 0, comm, ierr)
RETURN


next up previous contents
Next: MINLOó É MAXLOó Up: çÌÏÂÁÌØÎÙÅ ÏÐÅÒÁÃÉÉ ÒÅÄÕËÃÉÉ Previous: æÕÎËÃÉÑ Reduce   Contents
Alex Otwagin 2002-12-10



ðÁÒÔΣÒÙ:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
èÏÓÔÉÎÇ:

úÁËÌÁÄËÉ ÎÁ ÓÁÊÔÅ
ðÒÏÓÌÅÄÉÔØ ÚÁ ÓÔÒÁÎÉÃÅÊ
Created 1996-2024 by Maxim Chirkov
äÏÂÁ×ÉÔØ, ðÏÄÄÅÒÖÁÔØ, ÷ÅÂÍÁÓÔÅÒÕ