.


:




:

































 

 

 

 


MPI




MPI

int MPI_Init(int* argc, char** argv)

. , MPI , . MPI- MPI_Init.

: - MPI_SUCCESS, - . ( ).

MPI_Init , main:

:

int main(int argc, char** argv) { MPI_Init(&argc, &argv); }

MPI

int MPI_Finalize(void)

. MPI-, MPI_Init, . MPI_Finalize .

:

int main(int argc, char** argv) { MPI_Finalize(); }

 

int MPI_Comm_size(MPI_Comm comm, int* size)

comm ( comm MPI_COMM_WORLD - " ", ).

comm -

size - . , .

:

int size; MPI_Comm_size(MPI_COMM_WORLD, &size);

 

int MPI_Comm_rank(MPI_comm comm, int* rank)

comm. ( , rank) 0 size-1.

comm -

rank - comm

:

int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank);

 

int MPI_Abort(MPI_Comm comm, int errorcode)

. .

errorcode -

comm -

:

MPI_Abort(MPI_COMM_WORLD,MPI_ERR_OTHER);

 

int MPI_Send(void* buf, int count, MPI_Datatype datatype, int dest, int msgtag, MPI_Comm comm)

msgtag, count datatype, dest. buf. count . datatype ( - MPI_INT). . . , .

buf -

count -

datatype -

dest - -

msgtag -

comm -

:

#define N 10 int rank,buf[N]; MPI_Send(buf,N,MPI_INT,1,10,MPI_COMM_WORLD);

 

 

int MPI_Recv(void* buf, int count, MPI_Datatype datatype, int source, int msgtag, MPI_comm comm, MPI_Status *status)

msgtag source . count.

buf -

count -

datatype -

source - -

msgtag -

comm -

status -

:

#define N 10 int rank,buf[N]; MPI_Status status; MPI_Recv(buf,N,MPI_INT,1,10,MPI_COMM_WORLD,&status);




:


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


:

:

, ,
==> ...

1276 - | 1255 -


© 2015-2024 lektsii.org - -

: 0.008 .