mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
MPI
This commit is contained in:
parent
c2db4122e7
commit
deea4832fe
7 changed files with 104 additions and 5 deletions
|
@ -0,0 +1,18 @@
|
|||
#include "mpi.h"
|
||||
...
|
||||
int signal, i, numprogs, me;
|
||||
MPI_Status stat;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &me);
|
||||
MPI_Comm_size(MPI_COMM_WORLD,
|
||||
&numprocs);
|
||||
if (me==ROOT) {
|
||||
...
|
||||
for (i=1; i<numprocs; i++) {
|
||||
MPI_Send(&signal, 1, MPI_INT, i, 0, MPI_COMM_WORLD);
|
||||
}
|
||||
...
|
||||
else {
|
||||
MPI_Recv(&sig, 1, MPI_INT, ROOT, MPI_ANY_TAG,
|
||||
MPI_COMM_WORLD, &stat);
|
||||
...
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue