#include "../eSkel.c" // Parameters of the model #define PROCS 8 // Number of processes, not used here but for information #define STAGES 3 // Number of pipeline stages // !! when changing be careful with processes to stages affectation !! #define INPUTNB 4 // Number of input data #define INPUTSZ 2 // Size of the input data // Eventually, there is a nested deal (if 0<=DEALSTdata[0])[i]); ((int *) thingy->data[0])[i] += 1000; } printf("\n"); return thingy; } // The worker of the deal, taking as input a molecule, and returning a molecule // In this example, it prints the input data and add 1000 to all the data // (same job as a normal stage) eSkel_molecule_t * DealWorker (eSkel_molecule_t *thingy) { int i; printf("DealWorker -- len = %d, data = ", thingy->len[0]); for (i=0;ilen[0];i++) { printf("%.4d ", ((int *) thingy->data[0])[i]); ((int *) thingy->data[0])[i] += 1000; } printf("\n"); return thingy; } // This stage just performs a call to the Deal skeleton. // It is persistently nested. void StageDeal (void) { int workercol; int outmul; if ((myrank()==1) || (myrank()==3)) workercol = 0; else //if (myrank()==1) workercol = 1; //else // workercol = 2; Deal (WORKERS, IMPL, DealWorker, workercol, STRM, NULL, 0, 0, SPGLOBAL, MPI_INT, NULL, 0, &outmul, SPGLOBAL, MPI_INT, 0, mycomm()); } // Main procedure, defining the Pipeline parameters and calling the Pipeline int main (int argc, char *argv[]) { int i, j, p, next; spread_t spreads[STAGES+1]; MPI_Datatype types[STAGES+1]; Imode_t imodes[STAGES]; int outmul; int mystagenum; int mymult; int *inputs, *results; double secs; eSkel_molecule_t *(*stages[STAGES])(eSkel_molecule_t *); MPI_Init(&argc, &argv); SkelLibInit(); // Welcome message if (myrank()==0) printf("*** Entering Example 1 ***\n"); secs = MPI_Wtime(); // Define the input data inputs = (int *) malloc (sizeof(int)*INPUTNB*INPUTSZ); for (i=0; i=0) && (DEALST