mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-25 22:38:04 +02:00
MPI
This commit is contained in:
parent
3cec128f33
commit
b0bddad82f
8 changed files with 82 additions and 1 deletions
|
@ -0,0 +1,13 @@
|
|||
#include "mpi.h"
|
||||
|
||||
int rank;
|
||||
MPI_Comm comm;
|
||||
|
||||
...
|
||||
MPI_Comm_rank(comm, &rank);
|
||||
if (rank==0) {
|
||||
... Code fur Prozess 0 ...
|
||||
}
|
||||
else {
|
||||
... Code fur die anderen Prozesse ...
|
||||
}
|
1
documents/Programmierparadigmen/scripts/mpi/comm-rank.c
Normal file
1
documents/Programmierparadigmen/scripts/mpi/comm-rank.c
Normal file
|
@ -0,0 +1 @@
|
|||
int MPI_Comm_rank( MPI_Comm comm, int *rank )
|
|
@ -0,0 +1,7 @@
|
|||
#include "mpi.h"
|
||||
|
||||
int size;
|
||||
MPI_Comm comm;
|
||||
...
|
||||
MPI_Comm_size(comm, &size);
|
||||
...
|
1
documents/Programmierparadigmen/scripts/mpi/comm-size.c
Normal file
1
documents/Programmierparadigmen/scripts/mpi/comm-size.c
Normal file
|
@ -0,0 +1 @@
|
|||
int MPI_Comm_size( MPI_Comm comm, int *size )
|
|
@ -0,0 +1,10 @@
|
|||
#include "mpi.h"
|
||||
|
||||
int myid;
|
||||
int recvbuf[DATASIZE], sendbuf[DATA_SIZE];
|
||||
|
||||
...
|
||||
/* Minimum bilden */
|
||||
MPI_Reduce(sendbuf, recvbuf, DATA_SIZE, MPI_INT, MPI_MIN,
|
||||
0, MPI_COMM_WORLD);
|
||||
...
|
3
documents/Programmierparadigmen/scripts/mpi/mpi-reduce.c
Normal file
3
documents/Programmierparadigmen/scripts/mpi/mpi-reduce.c
Normal file
|
@ -0,0 +1,3 @@
|
|||
int MPI_Reduce(const void *sendbuf, void *recvbuf,
|
||||
int count, MPI_Datatype datatype,
|
||||
MPI_Op op, int root, MPI_Comm comm)
|
Loading…
Add table
Add a link
Reference in a new issue