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:
parent
e384b0ba07
commit
cd7df763db
4 changed files with 47 additions and 8 deletions
|
@ -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);
|
||||
...
|
3
documents/Programmierparadigmen/scripts/mpi/mpi-gather.c
Normal file
3
documents/Programmierparadigmen/scripts/mpi/mpi-gather.c
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue