.


:




:

































 

 

 

 





"-":

ü / - ;

ü , ; , , ; ;

ü , ( ) ;

ü MPI ;

ü , , -;

ü , "-".

 

MPI_Bcast , root, :

 

MPI_Bcast(buf, count, dataType, rootRank, communicator);

 

:

 

1. , rootRank , .

 

2. . , . , .

 

3. . MPI MPI_INT, MPI_CHAR, MPI_DOUBLE , MPI_Datatype. "MPI_" (int, char, double,...), .

 

4. , . communicator .

 

5. ().

 

MPI_Bcast ( ) :

 

int commSize, myRank;

MPI_Comm_size(communicator, &commSize);

MPI_Comm_rank(communicator, &myRank);

if(myRank == rootRank)

for(i=0; i<commSize; i++)

MPI_Send(buf, count, dataType, i,

tempMsgTag, communicator);

MPI_Recv(buf, count, dataType, rootRank, tempMsgTag,

communicator, &status);

 

MPI_Gather (sendBuf, sendCount, sendType, recvBuf, recvCount, recvType, rootRank, communicator) ("") root . :

 

MPI_Send(sendBuf, sendCount, sendType, rootRank,...);

if(myRank == rootRank) {

MPI_Type_extent(recvType, &elemSize);

for(i=0; i<commSize; i++)

MPI_Recv(((char*))recvBuf) + (i * recvCount * elemSize),

recvCount, recvType, i,...);

}

 

, ) recvType sendType , , ; ) - .

"" - MPI_Gatherv - -. , , , . / , recvCount. :

 

MPI_Send(sendBuf, sendCount, sendType, rootRank,...);

if(myRank == rootRank) {

MPI_Type_extent(recvType, &elemSize);

for(i=0; i<commSize; i++)

MPI_Recv(((char*))recvBuf) + displs[i] * recvCounts[i]

* elemSize, recvCounts[i], recvType, i,...);

}

 

MPI_Scatter (sendBuf, sendCount, sendType, recvBuf, recvCount, recvType, rootRank, communicator) (""): "" - root . :

 

if(myRank == rootRank) {

MPI_Type_extent(recvType, &elemSize);

for(i=0; i<commSize; i++)

MPI_Send(((char*)sendBuf) + i*sendCount*elemSize,

sendCount, sendType, i,...);

}

MPI_Recv(recvBuf, recvCount, recvType, rootRank,...);

 

- MPI_Scatterv, .

MPI_Allgather MPI_Gather, , : , . MPI_Gather, . MPI_Allgatherv.

MPI_Alltoall: ; . "" "" . MPI_Alltoallv.

"-": , , MPI_Recv MPI_Bcast.

:

 

int MPI_Barrier(MPI_Comm comm);

 

MPI_Barrier , , . , MPI_Barrier .

MPI , . , ; - , MPI_Barrier.

: 0 , MPI_Abort -, MPI_Abort .





:


: 2016-07-29; !; : 339 |


:

:

, ; , .
==> ...

1541 - | 1339 -


© 2015-2024 lektsii.org - -

: 0.01 .