#include <mpi.h>
#include <vector>
Go to the source code of this file.
static double do_work |
( |
double * |
work | ) |
|
|
static |
static double* get_next_work_item |
( |
| ) |
|
|
static |
Definition at line 63 of file proc.cpp.
References numEntries.
Referenced by master().
67 static unsigned int numCalls = 0;
68 for (
unsigned int i = 0; i <
numEntries; ++i )
69 ret[i] = i + numCalls;
72 if ( numCalls > 1000 )
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 79 of file proc.cpp.
References master(), and slave().
85 MPI_Init(&argc, &argv);
89 MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
static void master |
( |
void |
| ) |
|
|
static |
Definition at line 105 of file proc.cpp.
References DIETAG, get_next_work_item(), numEntries, and WORKTAG.
Referenced by main().
116 MPI_Comm_size(MPI_COMM_WORLD, &ntasks);
120 for (rank = 1; rank < ntasks; ++rank) {
140 while (work != NULL) {
170 for (rank = 1; rank < ntasks; ++rank) {
171 MPI_Recv(&result, 1, MPI_DOUBLE, MPI_ANY_SOURCE,
172 MPI_ANY_TAG, MPI_COMM_WORLD, &status);
179 for (rank = 1; rank < ntasks; ++rank) {
180 MPI_Send(0, 0, MPI_INT, rank,
DIETAG, MPI_COMM_WORLD);
182 cout <<
"Tot = " << tot << endl;
static double * get_next_work_item()
static void slave |
( |
void |
| ) |
|
|
static |
Definition at line 187 of file proc.cpp.
References DIETAG, do_work(), and numEntries.
Referenced by main().
197 MPI_Recv( work,
numEntries, MPI_DOUBLE, 0, MPI_ANY_TAG,
198 MPI_COMM_WORLD, &status);
202 if (status.MPI_TAG ==
DIETAG) {
212 MPI_Send(&result, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD);
static double do_work(double *work)
const int numEntries = 10 |
Definition at line 60 of file proc.cpp.
Referenced by Conv< vector< vector< T > > >::buf2val(), Conv< vector< T > >::buf2val(), KinSparseMatrix::computeRowRate(), do_work(), get_next_work_item(), CubeMesh::getParentVoxel(), SparseMsg::initCinfo(), CylMesh::innerBuildDefaultMesh(), CubeMesh::innerBuildDefaultMesh(), NeuroMesh::innerBuildDefaultMesh(), master(), SharedFinfo::SharedFinfo(), slave(), and testGetMsg().