2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00

MPI Gather hinzugefügt

This commit is contained in:
Martin Thoma 2014-04-01 18:39:01 +02:00
parent e384b0ba07
commit cd7df763db
4 changed files with 47 additions and 8 deletions

View file

@ -0,0 +1,19 @@
#include "mpi.h"
#define ROOT 0
int numprocs, myid, bufsize;
int *sendbuf, *recvbuf;
...
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
...
... sendbuf allocieren, belegen ...
... bufsize belegen ...
if (myid==ROOT) {
...
recvbuf=malloc(bufsize*sizeof(int));
}
MPI_Gather(sendbuf, bufsize, MPI_INT, recvbuf, bufsize,
MPI_INT, ROOT, MPI_COMM_WORLD);
...

View file

@ -0,0 +1,3 @@
int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype, int root,
MPI_Comm comm)