// ------------------------------------------------------------------------- // // --- This example is a 3-stage pipeline version of --- // // --- the multiple-baseline stereo application --- // // --- Stage 2 is a nested Deal --- // // --- Author: Anne Benoit --- // // --- Last modification: 08/02/2005 --- // // ------------------------------------------------------------------------- // #include #include "../eSkel.c" #include "stereo.h" #define DEBUG 0 // set to 1 for debugging mode, 0 for normal mode #define WINX 13 // window rows #define WINY 13 // window columns // For eSkel #define STAGES 3 // pipeline stages // For display #define CASEDEAL 1 #define CASE3ST 2 #define CASESEQ 3 #define CASEMPI 4 double dsecsG=0, esecsG=0; double st3secs[ITERS]; // times between completions at stage 3, // st3secs[0] must be ignored, leaving // ITERS-1 interesting readings double truethrput; // gendiffimg forms the difference image void gendiffimg(int ref[(ROWS+WINY)*COLS], int m1[(ROWS+WINY)*COLS], int m2[(ROWS+WINY)*COLS], float diffimg[(ROWS+WINY)*COLS], int curdisp) { int i,j; for (i=0;idata[0]))[0]; m1 = &((int *)(thingy->data[0]))[(ROWS+WINY)*COLS]; m2 = &((int *)(thingy->data[0]))[2*(ROWS+WINY)*COLS]; for (i=0;ilen[0] = 1; thingy->data[0] = curbestdisp; return thingy; } // second stage nesting a deal (devolved interaction mode) void stage2 (void) { int outmul; Deal (mycommsize(), IMPL, worker, myrank(), STRM, NULL, 0, 0, SPGLOBAL, MPI_int_array, NULL, 0, &outmul, SPGLOBAL, MPI_int_array, 0, mycomm()); } void stage3 (void) { int i; int **len_ptr = (int **) malloc (sizeof (int *)); void **data; int *curbestdisp; double oldsecs = 0, newsecs; int itercount = 0; while (data = Take(len_ptr)) { curbestdisp = (int *) *data; testdata(curbestdisp); newsecs = MPI_Wtime(); st3secs[itercount++] = newsecs - oldsecs; oldsecs = newsecs; } // Compute and send true throughput truethrput = 0; for (i=1; i