[158] | 1 | #include "stdio.h" |
---|
| 2 | |
---|
| 3 | //////////////////////////////////// |
---|
| 4 | // Image parameters |
---|
| 5 | |
---|
| 6 | #define PIXEL_SIZE 2 |
---|
| 7 | #define NL 1024 |
---|
| 8 | #define NP 1024 |
---|
| 9 | #define BLOCK_SIZE 1024 |
---|
| 10 | |
---|
| 11 | #define PRINTF if(lid==0) tty_printf |
---|
| 12 | |
---|
| 13 | #define TA(c,l,p) (A[c][((NP)*(l))+(p)]) |
---|
| 14 | #define TB(c,p,l) (B[c][((NL)*(p))+(l)]) |
---|
| 15 | #define TC(c,l,p) (C[c][((NP)*(l))+(p)]) |
---|
| 16 | #define TD(c,l,p) (D[c][((NP)*(l))+(p)]) |
---|
| 17 | #define TZ(c,l,p) (Z[c][((NP)*(l))+(p)]) |
---|
| 18 | |
---|
| 19 | #define max(x,y) ((x) > (y) ? (x) : (y)) |
---|
| 20 | #define min(x,y) ((x) < (y) ? (x) : (y)) |
---|
| 21 | |
---|
| 22 | /////////////////////////////////////////// |
---|
| 23 | // tricks to read parameters from ldscript |
---|
| 24 | /////////////////////////////////////////// |
---|
| 25 | |
---|
| 26 | struct plaf; |
---|
| 27 | |
---|
| 28 | extern struct plaf seg_heap_base; |
---|
| 29 | extern struct plaf NB_PROCS; |
---|
| 30 | extern struct plaf NB_CLUSTERS; |
---|
| 31 | |
---|
| 32 | ///////////// |
---|
| 33 | void main() |
---|
| 34 | { |
---|
| 35 | |
---|
| 36 | ////////////////////////////////// |
---|
| 37 | // convolution kernel parameters |
---|
| 38 | // The content of this section is |
---|
| 39 | // Philips proprietary information. |
---|
| 40 | /////////////////////////////////// |
---|
| 41 | |
---|
| 42 | int vnorm = 115; |
---|
| 43 | int vf[35]; |
---|
| 44 | vf[0] = 1; |
---|
| 45 | vf[1] = 1; |
---|
| 46 | vf[2] = 2; |
---|
| 47 | vf[3] = 2; |
---|
| 48 | vf[4] = 2; |
---|
| 49 | vf[5] = 2; |
---|
| 50 | vf[6] = 3; |
---|
| 51 | vf[7] = 3; |
---|
| 52 | vf[8] = 3; |
---|
| 53 | vf[9] = 4; |
---|
| 54 | vf[10] = 4; |
---|
| 55 | vf[11] = 4; |
---|
| 56 | vf[12] = 4; |
---|
| 57 | vf[13] = 5; |
---|
| 58 | vf[14] = 5; |
---|
| 59 | vf[15] = 5; |
---|
| 60 | vf[16] = 5; |
---|
| 61 | vf[17] = 5; |
---|
| 62 | vf[18] = 5; |
---|
| 63 | vf[19] = 5; |
---|
| 64 | vf[20] = 5; |
---|
| 65 | vf[21] = 5; |
---|
| 66 | vf[22] = 4; |
---|
| 67 | vf[23] = 4; |
---|
| 68 | vf[24] = 4; |
---|
| 69 | vf[25] = 4; |
---|
| 70 | vf[26] = 3; |
---|
| 71 | vf[27] = 3; |
---|
| 72 | vf[28] = 3; |
---|
| 73 | vf[29] = 2; |
---|
| 74 | vf[30] = 2; |
---|
| 75 | vf[31] = 2; |
---|
| 76 | vf[32] = 2; |
---|
| 77 | vf[33] = 1; |
---|
| 78 | vf[34] = 1; |
---|
| 79 | |
---|
| 80 | int hrange = 100; |
---|
| 81 | int hnorm = 201; |
---|
| 82 | |
---|
| 83 | unsigned int date = 0; |
---|
| 84 | |
---|
| 85 | int c; // cluster index for loops |
---|
| 86 | int l; // line index for loops |
---|
| 87 | int p; // pixel index for loops |
---|
| 88 | int x; // filter index for loops |
---|
| 89 | |
---|
| 90 | int pid = procid(); // processor id |
---|
| 91 | int nprocs = (int)&NB_PROCS; // number of processors per cluster |
---|
| 92 | int nclusters = (int)&NB_CLUSTERS; // number of clusters |
---|
| 93 | int lid = pid%nprocs; // local task id |
---|
| 94 | int cid = pid/nprocs; // cluster task id |
---|
| 95 | int base = (unsigned int)&seg_heap_base; // base address for shared buffers |
---|
| 96 | int increment = (0x80000000 / nclusters) * 2; // cluster increment |
---|
| 97 | int ntasks = nclusters * nprocs; // number of tasks |
---|
| 98 | int nblocks = (NP*NL*PIXEL_SIZE)/BLOCK_SIZE; // number of blocks per image |
---|
| 99 | |
---|
| 100 | int lines_per_task = NL/ntasks; // number of lines per task |
---|
| 101 | int lines_per_cluster = NL/nclusters; // number of lines per cluster |
---|
| 102 | int pixels_per_task = NP/ntasks; // number of columns per task |
---|
| 103 | int pixels_per_cluster = NP/nclusters; // number of columns per cluster |
---|
| 104 | |
---|
| 105 | int first, last; |
---|
| 106 | |
---|
| 107 | PRINTF("\n*** Processor %d entering main at cycle %d ***\n\n", pid, proctime()); |
---|
| 108 | |
---|
| 109 | ////////////////////////// |
---|
| 110 | // parameters checking |
---|
| 111 | if( (nprocs != 1) && (nprocs != 2) && (nprocs != 4) ) |
---|
| 112 | { |
---|
| 113 | PRINTF("NB_PROCS must be 1, 2 or 4\n"); |
---|
| 114 | while(1); |
---|
| 115 | } |
---|
| 116 | if( (nclusters != 4) && (nclusters != 8) && (nclusters != 16) && |
---|
| 117 | (nclusters != 32) && (nclusters != 64) && (nclusters !=128) && (nclusters != 256) ) |
---|
| 118 | { |
---|
| 119 | PRINTF("NB_CLUSTERS must be a power of 2 between 4 and 256\n"); |
---|
| 120 | while(1); |
---|
| 121 | } |
---|
| 122 | if( pid >= ntasks ) |
---|
| 123 | { |
---|
| 124 | PRINTF("processor id %d larger than NB_CLUSTERS*NB_PROCS\n", pid); |
---|
| 125 | while(1); |
---|
| 126 | } |
---|
| 127 | if ( NL % nclusters != 0 ) |
---|
| 128 | { |
---|
| 129 | PRINTF("NB_CLUSTERS must be a divider of NL"); |
---|
| 130 | while(1); |
---|
| 131 | } |
---|
| 132 | if( NP % nclusters != 0 ) |
---|
| 133 | { |
---|
| 134 | PRINTF("NB_CLUSTERS must be a divider of NP"); |
---|
| 135 | while(1); |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | ////////////////////////////////////////////////////////////////// |
---|
| 139 | // Arrays of pointers on the shared, distributed buffers |
---|
| 140 | // containing the images (sized for the worst case : 256 clusters) |
---|
| 141 | unsigned short* A[256]; |
---|
| 142 | int* B[256]; |
---|
| 143 | int* C[256]; |
---|
| 144 | int* D[256]; |
---|
| 145 | unsigned char* Z[256]; |
---|
| 146 | |
---|
[170] | 147 | // Arrays of pointers on the instrumentation arrays |
---|
| 148 | // These arrays are indexed by the cluster index (sized for the worst case : 256 clusters) |
---|
| 149 | // each pointer points on the base adress of an array of 4 (NPROCS max) unsigned int |
---|
| 150 | unsigned int* LOAD_START[256]; |
---|
| 151 | unsigned int* LOAD_ENDED[256]; |
---|
| 152 | unsigned int* VERT_START[256]; |
---|
| 153 | unsigned int* VERT_ENDED[256]; |
---|
| 154 | unsigned int* HORI_START[256]; |
---|
| 155 | unsigned int* HORI_ENDED[256]; |
---|
| 156 | unsigned int* DISP_START[256]; |
---|
| 157 | unsigned int* DISP_ENDED[256]; |
---|
| 158 | |
---|
[158] | 159 | // The shared, distributed buffers addresses are computed |
---|
| 160 | // from the seg_heap_base value defined in the ldscript file |
---|
| 161 | // and from the cluster increment = 4Gbytes/nclusters. |
---|
| 162 | // These arrays of pointers are identical and |
---|
| 163 | // replicated in the stack of each task |
---|
| 164 | for( c=0 ; c<nclusters ; c++) |
---|
| 165 | { |
---|
[170] | 166 | A[c] = (unsigned short*) (base + increment*c); |
---|
| 167 | Z[c] = (unsigned char*) (base + 2*NP*NL/nclusters + increment*c); |
---|
| 168 | B[c] = (int*) (base + 4*NP*NL/nclusters + increment*c); |
---|
| 169 | C[c] = (int*) (base + 8*NP*NL/nclusters + increment*c); |
---|
| 170 | D[c] = (int*) (base + 12*NP*NL/nclusters + increment*c); |
---|
| 171 | |
---|
| 172 | LOAD_START[c] = (unsigned int*) (base + 3*NL*NP/nclusters + increment*c); |
---|
| 173 | LOAD_ENDED[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 16 + increment*c); |
---|
| 174 | VERT_START[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 32 + increment*c); |
---|
| 175 | VERT_ENDED[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 48 + increment*c); |
---|
| 176 | HORI_START[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 64 + increment*c); |
---|
| 177 | HORI_ENDED[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 80 + increment*c); |
---|
| 178 | DISP_START[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 96 + increment*c); |
---|
| 179 | DISP_ENDED[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 112 + increment*c); |
---|
[158] | 180 | } |
---|
| 181 | |
---|
| 182 | PRINTF("NCLUSTERS = %d\n", nclusters); |
---|
| 183 | PRINTF("NPROCS = %d\n\n", nprocs); |
---|
| 184 | |
---|
| 185 | PRINTF("*** Starting barrier init at cycle %d ***\n", proctime()); |
---|
| 186 | |
---|
| 187 | // barriers initialization |
---|
| 188 | barrier_init(0, ntasks); |
---|
| 189 | barrier_init(1, ntasks); |
---|
| 190 | barrier_init(2, ntasks); |
---|
[170] | 191 | barrier_init(3, ntasks); |
---|
[158] | 192 | |
---|
| 193 | PRINTF("*** Completing barrier init at cycle %d ***\n", proctime()); |
---|
| 194 | |
---|
| 195 | //////////////////////////////////////////////////////// |
---|
| 196 | // pseudo parallel load from disk to A[c] buffers |
---|
| 197 | // only task running on processor with (lid==0) does it |
---|
| 198 | // nblocks/nclusters are loaded in each cluster |
---|
| 199 | |
---|
| 200 | if ( lid == 0 ) |
---|
| 201 | { |
---|
[170] | 202 | int p; |
---|
[174] | 203 | date = proctime(); |
---|
| 204 | PRINTF("\n*** Starting load at cycle %d\n", date); |
---|
[170] | 205 | for ( p=0 ; p<nprocs ; p++ ) LOAD_START[cid][p] = date; |
---|
[158] | 206 | |
---|
| 207 | if( ioc_read(nblocks*cid/nclusters, |
---|
| 208 | A[cid] , |
---|
| 209 | nblocks/nclusters) ) |
---|
| 210 | { |
---|
| 211 | PRINTF("echec ioc_read\n"); |
---|
| 212 | while(1); |
---|
| 213 | } |
---|
| 214 | if ( ioc_completed() ) |
---|
| 215 | { |
---|
| 216 | PRINTF("echec ioc_completed\n"); |
---|
| 217 | while(1); |
---|
| 218 | } |
---|
| 219 | |
---|
[174] | 220 | date = proctime(); |
---|
| 221 | PRINTF("*** Completing load at cycle %d\n", date); |
---|
[170] | 222 | for ( p=0 ; p<nprocs ; p++ ) LOAD_ENDED[cid][p] = date; |
---|
[158] | 223 | } |
---|
| 224 | |
---|
| 225 | barrier_wait(0); |
---|
| 226 | |
---|
| 227 | ////////////////////////////////////////////////////////// |
---|
| 228 | // parallel horizontal filter : |
---|
[159] | 229 | // B <= transpose(FH(A)) |
---|
| 230 | // D <= A - FH(A) |
---|
[158] | 231 | // Each task computes (NL/ntasks) lines |
---|
| 232 | // The image must be extended : |
---|
| 233 | // if (z<0) TA(cid,l,z) == TA(cid,l,0) |
---|
| 234 | // if (z>NP-1) TA(cid,l,z) == TA(cid,l,NP-1) |
---|
| 235 | |
---|
[174] | 236 | date = proctime(); |
---|
| 237 | PRINTF("\n*** Starting horizontal filter at cycle %d\n", date); |
---|
[170] | 238 | HORI_START[cid][lid] = date; |
---|
[158] | 239 | |
---|
| 240 | // l = absolute line index / p = absolute pixel index |
---|
| 241 | // first & last define which lines are handled by a given task(cid,lid) |
---|
| 242 | |
---|
| 243 | first = (cid*nprocs + lid)*lines_per_task; |
---|
| 244 | last = first + lines_per_task; |
---|
| 245 | |
---|
| 246 | for ( l=first ; l<last ; l++) |
---|
| 247 | { |
---|
| 248 | // src_c and src_l are the cluster index and the line index for A & D |
---|
| 249 | int src_c = l/lines_per_cluster; |
---|
| 250 | int src_l = l%lines_per_cluster; |
---|
| 251 | |
---|
| 252 | // We use the spécific values of the horizontal ep-filter for optimisation: |
---|
| 253 | // sum(p) = sum(p-1) + TA[p+hrange] - TA[p-hrange-1] |
---|
| 254 | // To minimize the number of tests, the loop on pixels is split in three domains |
---|
| 255 | |
---|
[159] | 256 | int sum_p = (hrange+2)*TA(src_c, src_l, 0); |
---|
| 257 | for ( x = 1 ; x < hrange ; x++) sum_p = sum_p + TA(src_c, src_l, x); |
---|
[158] | 258 | |
---|
| 259 | // first domain : from 0 to hrange |
---|
| 260 | for ( p=0 ; p<hrange+1 ; p++) |
---|
| 261 | { |
---|
| 262 | // dst_c and dst_p are the cluster index and the pixel index for B |
---|
| 263 | int dst_c = p/pixels_per_cluster; |
---|
| 264 | int dst_p = p%pixels_per_cluster; |
---|
[159] | 265 | sum_p = sum_p + (int)TA(src_c, src_l, p+hrange) - (int)TA(src_c, src_l, 0); |
---|
| 266 | TB(dst_c, dst_p, l) = sum_p/hnorm; |
---|
| 267 | TD(src_c, src_l, p) = (int)TA(src_c, src_l, p) - sum_p/hnorm; |
---|
[158] | 268 | } |
---|
| 269 | // second domain : from (hrange+1) to (NP-hrange-1) |
---|
| 270 | for ( p = hrange+1 ; p < NP-hrange ; p++) |
---|
| 271 | { |
---|
| 272 | // dst_c and dst_p are the cluster index and the pixel index for B |
---|
| 273 | int dst_c = p/pixels_per_cluster; |
---|
| 274 | int dst_p = p%pixels_per_cluster; |
---|
[159] | 275 | sum_p = sum_p + (int)TA(src_c, src_l, p+hrange) - (int)TA(src_c, src_l, p-hrange-1); |
---|
| 276 | TB(dst_c, dst_p, l) = sum_p/hnorm; |
---|
| 277 | TD(src_c, src_l, p) = (int)TA(src_c, src_l, p) - sum_p/hnorm; |
---|
[158] | 278 | } |
---|
| 279 | // third domain : from (NP-hrange) to (NP-1) |
---|
| 280 | for ( p = NP-hrange ; p < NP ; p++) |
---|
| 281 | { |
---|
| 282 | // dst_c and dst_p are the cluster index and the pixel index for B |
---|
| 283 | int dst_c = p/pixels_per_cluster; |
---|
| 284 | int dst_p = p%pixels_per_cluster; |
---|
[159] | 285 | sum_p = sum_p + (int)TA(src_c, src_l, NP-1) - (int)TA(src_c, src_l, p-hrange-1); |
---|
| 286 | TB(dst_c, dst_p, l) = sum_p/hnorm; |
---|
| 287 | TD(src_c, src_l, p) = (int)TA(src_c, src_l, p) - sum_p/hnorm; |
---|
[158] | 288 | } |
---|
| 289 | |
---|
| 290 | PRINTF(" - line %d computed at cycle %d\n", l, proctime()); |
---|
| 291 | } |
---|
| 292 | |
---|
[174] | 293 | date = proctime(); |
---|
| 294 | PRINTF("*** Completing horizontal filter at cycle %d\n", date); |
---|
[170] | 295 | HORI_ENDED[cid][lid] = date; |
---|
[158] | 296 | |
---|
| 297 | barrier_wait(1); |
---|
| 298 | |
---|
| 299 | ////////////////////////////////////////////////////////// |
---|
| 300 | // parallel vertical filter : |
---|
| 301 | // C <= transpose(FV(B)) |
---|
| 302 | // Each task computes (NP/ntasks) columns |
---|
| 303 | // The image must be extended : |
---|
| 304 | // if (l<0) TB(cid,p,x) == TB(cid,p,0) |
---|
| 305 | // if (l>NL-1) TB(cid,p,x) == TB(cid,p,NL-1) |
---|
| 306 | |
---|
[174] | 307 | date = proctime(); |
---|
| 308 | PRINTF("\n*** starting vertical filter at cycle %d\n", date); |
---|
[170] | 309 | VERT_START[cid][lid] = date; |
---|
[158] | 310 | |
---|
| 311 | // l = absolute line index / p = absolute pixel index |
---|
| 312 | // first & last define which pixels are handled by a given task(cid,lid) |
---|
| 313 | |
---|
| 314 | first = (cid*nprocs + lid)*pixels_per_task; |
---|
| 315 | last = first + pixels_per_task; |
---|
| 316 | |
---|
| 317 | for ( p=first ; p<last ; p++) |
---|
| 318 | { |
---|
| 319 | // src_c and src_p are the cluster index and the pixel index for B |
---|
| 320 | int src_c = p/pixels_per_cluster; |
---|
| 321 | int src_p = p%pixels_per_cluster; |
---|
| 322 | |
---|
[159] | 323 | int sum_l; |
---|
[158] | 324 | |
---|
| 325 | // We use the specific values of the vertical ep-filter |
---|
| 326 | // To minimize the number of tests, the NL lines are split in three domains |
---|
| 327 | |
---|
[159] | 328 | // first domain : explicit computation for the first 18 values |
---|
| 329 | for ( l=0 ; l<18 ; l++) |
---|
[158] | 330 | { |
---|
| 331 | // dst_c and dst_l are the cluster index and the line index for C |
---|
| 332 | int dst_c = l/lines_per_cluster; |
---|
| 333 | int dst_l = l%lines_per_cluster; |
---|
| 334 | |
---|
[159] | 335 | for ( x=0, sum_l=0 ; x<35 ; x++ ) |
---|
[158] | 336 | { |
---|
[159] | 337 | sum_l = sum_l + vf[x] * TB(src_c, src_p, max(l-17+x,0) ); |
---|
[158] | 338 | } |
---|
[159] | 339 | TC(dst_c, dst_l, p) = sum_l/vnorm; |
---|
[158] | 340 | } |
---|
| 341 | // second domain |
---|
[159] | 342 | for ( l = 18 ; l < NL-17 ; l++ ) |
---|
[158] | 343 | { |
---|
| 344 | // dst_c and dst_l are the cluster index and the line index for C |
---|
| 345 | int dst_c = l/lines_per_cluster; |
---|
| 346 | int dst_l = l%lines_per_cluster; |
---|
| 347 | |
---|
[159] | 348 | sum_l = sum_l + TB(src_c, src_p, l+4) |
---|
| 349 | + TB(src_c, src_p, l+8) |
---|
| 350 | + TB(src_c, src_p, l+11) |
---|
| 351 | + TB(src_c, src_p, l+15) |
---|
| 352 | + TB(src_c, src_p, l+17) |
---|
| 353 | - TB(src_c, src_p, l-5) |
---|
| 354 | - TB(src_c, src_p, l-9) |
---|
| 355 | - TB(src_c, src_p, l-12) |
---|
| 356 | - TB(src_c, src_p, l-16) |
---|
| 357 | - TB(src_c, src_p, l-18); |
---|
| 358 | TC(dst_c, dst_l, p) = sum_l/vnorm; |
---|
[158] | 359 | } |
---|
| 360 | // third domain |
---|
[159] | 361 | for ( l = NL-17 ; l < NL ; l++ ) |
---|
[158] | 362 | { |
---|
| 363 | // dst_c and dst_l are the cluster index and the line index for C |
---|
| 364 | int dst_c = l/lines_per_cluster; |
---|
| 365 | int dst_l = l%lines_per_cluster; |
---|
| 366 | |
---|
[159] | 367 | sum_l = sum_l + TB(src_c, src_p, min(l+4,NL-1)) |
---|
| 368 | + TB(src_c, src_p, min(l+8,NL-1)) |
---|
| 369 | + TB(src_c, src_p, min(l+11,NL-1)) |
---|
| 370 | + TB(src_c, src_p, min(l+15,NL-1)) |
---|
| 371 | + TB(src_c, src_p, min(l+17,NL-1)) |
---|
| 372 | - TB(src_c, src_p, l-5) |
---|
| 373 | - TB(src_c, src_p, l-9) |
---|
| 374 | - TB(src_c, src_p, l-12) |
---|
| 375 | - TB(src_c, src_p, l-16) |
---|
| 376 | - TB(src_c, src_p, l-18); |
---|
| 377 | TC(dst_c, dst_l, p) = sum_l/vnorm; |
---|
[158] | 378 | } |
---|
| 379 | PRINTF(" - column %d computed at cycle %d\n", p, proctime()); |
---|
| 380 | } |
---|
| 381 | |
---|
[174] | 382 | date = proctime(); |
---|
| 383 | PRINTF("*** Completing vertical filter at cycle %d\n", date); |
---|
[170] | 384 | VERT_ENDED[cid][lid] = date; |
---|
[158] | 385 | |
---|
| 386 | barrier_wait(2); |
---|
| 387 | |
---|
[159] | 388 | //////////////////////////////////////////////////////////////// |
---|
| 389 | // final computation and parallel display |
---|
| 390 | // Z <= D + C |
---|
[158] | 391 | // Each processor use its private DMA channel to display |
---|
| 392 | // the resulting image, line per line (one byte per pixel). |
---|
| 393 | // Eah processor computes & displays (NL/ntasks) lines. |
---|
| 394 | |
---|
[174] | 395 | date = proctime(); |
---|
| 396 | PRINTF("\n*** Starting display at cycle %d\n", date); |
---|
[170] | 397 | DISP_START[cid][lid] = date; |
---|
[158] | 398 | |
---|
[162] | 399 | first = lid*lines_per_task; |
---|
| 400 | last = first + lines_per_task; |
---|
| 401 | |
---|
| 402 | for ( l=first ; l<last ; l++) |
---|
[158] | 403 | { |
---|
[162] | 404 | for ( p=0 ; p<NP ; p++) |
---|
[158] | 405 | { |
---|
| 406 | TZ(cid,l,p) = (unsigned char)(((TD(cid,l,p) + TC(cid,l,p))>>8) & 0xFF); |
---|
| 407 | } |
---|
[162] | 408 | fb_write(NP*(cid*lines_per_cluster+l), &TZ(cid,l,0), NP); |
---|
[158] | 409 | } |
---|
| 410 | |
---|
[174] | 411 | date = proctime(); |
---|
| 412 | PRINTF("*** Completing display at cycle %d\n", date); |
---|
[170] | 413 | DISP_ENDED[cid][lid] = date; |
---|
[158] | 414 | |
---|
[170] | 415 | barrier_wait(3); |
---|
| 416 | |
---|
[174] | 417 | ///////////////////////////////////////////////////////// |
---|
| 418 | // Instrumentation (done by processor 0 in cluster 0) |
---|
[170] | 419 | |
---|
[174] | 420 | if ( pid == 0 ) |
---|
| 421 | { |
---|
| 422 | date = proctime(); |
---|
| 423 | PRINTF("\n*** Starting Instrumentation at cycle %d\n\n", date); |
---|
[170] | 424 | |
---|
[174] | 425 | int cc, pp; |
---|
| 426 | unsigned int min_load_start = 1000000000; |
---|
| 427 | unsigned int max_load_start = 0; |
---|
| 428 | unsigned int min_load_ended = 1000000000; |
---|
| 429 | unsigned int max_load_ended = 0; |
---|
[170] | 430 | |
---|
[174] | 431 | unsigned int min_hori_start = 1000000000; |
---|
| 432 | unsigned int max_hori_start = 0; |
---|
| 433 | unsigned int min_hori_ended = 1000000000; |
---|
| 434 | unsigned int max_hori_ended = 0; |
---|
[170] | 435 | |
---|
[174] | 436 | unsigned int min_vert_start = 1000000000; |
---|
| 437 | unsigned int max_vert_start = 0; |
---|
| 438 | unsigned int min_vert_ended = 1000000000; |
---|
| 439 | unsigned int max_vert_ended = 0; |
---|
[170] | 440 | |
---|
[174] | 441 | unsigned int min_disp_start = 1000000000; |
---|
| 442 | unsigned int max_disp_start = 0; |
---|
| 443 | unsigned int min_disp_ended = 1000000000; |
---|
| 444 | unsigned int max_disp_ended = 0; |
---|
| 445 | |
---|
[170] | 446 | for ( cc=0 ; cc<nclusters ; cc++ ) |
---|
| 447 | { |
---|
| 448 | for ( pp=0 ; pp<nprocs ; pp++ ) |
---|
| 449 | { |
---|
| 450 | if ( LOAD_START[cc][pp] < min_load_start ) min_load_start = LOAD_START[cc][pp]; |
---|
| 451 | if ( LOAD_START[cc][pp] > max_load_start ) max_load_start = LOAD_START[cc][pp]; |
---|
| 452 | if ( LOAD_ENDED[cc][pp] < min_load_ended ) min_load_ended = LOAD_ENDED[cc][pp]; |
---|
| 453 | if ( LOAD_ENDED[cc][pp] > max_load_ended ) max_load_ended = LOAD_ENDED[cc][pp]; |
---|
| 454 | |
---|
| 455 | if ( HORI_START[cc][pp] < min_hori_start ) min_hori_start = HORI_START[cc][pp]; |
---|
| 456 | if ( HORI_START[cc][pp] > max_hori_start ) max_hori_start = HORI_START[cc][pp]; |
---|
| 457 | if ( HORI_ENDED[cc][pp] < min_hori_ended ) min_hori_ended = HORI_ENDED[cc][pp]; |
---|
| 458 | if ( HORI_ENDED[cc][pp] > max_hori_ended ) max_hori_ended = HORI_ENDED[cc][pp]; |
---|
| 459 | |
---|
| 460 | if ( VERT_START[cc][pp] < min_vert_start ) min_vert_start = VERT_START[cc][pp]; |
---|
| 461 | if ( VERT_START[cc][pp] > max_vert_start ) max_vert_start = VERT_START[cc][pp]; |
---|
| 462 | if ( VERT_ENDED[cc][pp] < min_vert_ended ) min_vert_ended = VERT_ENDED[cc][pp]; |
---|
| 463 | if ( VERT_ENDED[cc][pp] > max_vert_ended ) max_vert_ended = VERT_ENDED[cc][pp]; |
---|
| 464 | |
---|
| 465 | if ( DISP_START[cc][pp] < min_disp_start ) min_disp_start = DISP_START[cc][pp]; |
---|
| 466 | if ( DISP_START[cc][pp] > max_disp_start ) max_disp_start = DISP_START[cc][pp]; |
---|
| 467 | if ( DISP_ENDED[cc][pp] < min_disp_ended ) min_disp_ended = DISP_ENDED[cc][pp]; |
---|
| 468 | if ( DISP_ENDED[cc][pp] > max_disp_ended ) max_disp_ended = DISP_ENDED[cc][pp]; |
---|
| 469 | } |
---|
| 470 | } |
---|
[174] | 471 | PRINTF(" - LOAD_START : min = %d / max = %d / med = %d / delta = %d\n", |
---|
| 472 | min_load_start, max_load_start, (min_load_start+max_load_start)/2, max_load_start-min_load_start); |
---|
| 473 | PRINTF(" - LOAD_END : min = %d / max = %d / med = %d / delta = %d\n", |
---|
| 474 | min_load_ended, max_load_ended, (min_load_ended+max_load_ended)/2, max_load_ended-min_load_ended); |
---|
[170] | 475 | |
---|
[174] | 476 | PRINTF(" - HORI_START : min = %d / max = %d / med = %d / delta = %d\n", |
---|
| 477 | min_hori_start, max_hori_start, (min_hori_start+max_hori_start)/2, max_hori_start-min_hori_start); |
---|
| 478 | PRINTF(" - HORI_END : min = %d / max = %d / med = %d / delta = %d\n", |
---|
| 479 | min_hori_ended, max_hori_ended, (min_hori_ended+max_hori_ended)/2, max_hori_ended-min_hori_ended); |
---|
[170] | 480 | |
---|
[174] | 481 | PRINTF(" - VERT_START : min = %d / max = %d / med = %d / delta = %d\n", |
---|
| 482 | min_vert_start, max_vert_start, (min_vert_start+max_vert_start)/2, max_vert_start-min_vert_start); |
---|
| 483 | PRINTF(" - VERT_END : min = %d / max = %d / med = %d / delta = %d\n", |
---|
| 484 | min_vert_ended, max_vert_ended, (min_vert_ended+max_vert_ended)/2, max_vert_ended-min_vert_ended); |
---|
[170] | 485 | |
---|
[174] | 486 | PRINTF(" - DISP_START : min = %d / max = %d / med = %d / delta = %d\n", |
---|
| 487 | min_disp_start, max_disp_start, (min_disp_start+max_disp_start)/2, max_disp_start-min_disp_start); |
---|
| 488 | PRINTF(" - DISP_END : min = %d / max = %d / med = %d / delta = %d\n", |
---|
| 489 | min_disp_ended, max_disp_ended, (min_disp_ended+max_disp_ended)/2, max_disp_ended-min_disp_ended); |
---|
[170] | 490 | |
---|
[174] | 491 | PRINTF(" - BARRIER LOAD/HORI = %d\n", min_hori_start - max_load_ended); |
---|
| 492 | PRINTF(" - BARRIER HORI/VERT = %d\n", min_vert_start - max_hori_ended); |
---|
| 493 | PRINTF(" - BARRIER VERT/DISP = %d\n", min_disp_start - max_vert_ended); |
---|
[170] | 494 | |
---|
[174] | 495 | PRINTF(" - LOAD = %d\n", max_load_ended); |
---|
| 496 | PRINTF(" - FILTER = %d\n", max_vert_ended - max_load_ended); |
---|
| 497 | PRINTF(" - DISPLAY = %d\n", max_disp_ended - max_vert_ended); |
---|
| 498 | |
---|
| 499 | PRINTF("\nBEGIN LOAD_START\n"); |
---|
| 500 | for ( cc=0 ; cc<nclusters ; cc++ ) |
---|
| 501 | { |
---|
| 502 | for ( pp=0 ; pp<nprocs ; pp++ ) |
---|
| 503 | { |
---|
| 504 | PRINTF("cluster= %d proc= %d date= %d\n", cc, pp, LOAD_START[cc][pp]); |
---|
| 505 | } |
---|
| 506 | } |
---|
| 507 | PRINTF("END\n"); |
---|
| 508 | PRINTF("\nBEGIN LOAD_ENDED\n"); |
---|
| 509 | for ( cc=0 ; cc<nclusters ; cc++ ) |
---|
| 510 | { |
---|
| 511 | for ( pp=0 ; pp<nprocs ; pp++ ) |
---|
| 512 | { |
---|
| 513 | PRINTF("cluster= %d proc= %d date= %d\n", cc, pp, LOAD_ENDED[cc][pp]); |
---|
| 514 | } |
---|
| 515 | } |
---|
| 516 | PRINTF("END\n"); |
---|
| 517 | PRINTF("\nBEGIN HORI_START\n"); |
---|
| 518 | for ( cc=0 ; cc<nclusters ; cc++ ) |
---|
| 519 | { |
---|
| 520 | for ( pp=0 ; pp<nprocs ; pp++ ) |
---|
| 521 | { |
---|
| 522 | PRINTF("cluster= %d proc= %d date= %d\n", cc, pp, HORI_START[cc][pp]); |
---|
| 523 | } |
---|
| 524 | } |
---|
| 525 | PRINTF("END\n"); |
---|
| 526 | PRINTF("\nBEGIN HORI_ENDED\n"); |
---|
| 527 | for ( cc=0 ; cc<nclusters ; cc++ ) |
---|
| 528 | { |
---|
| 529 | for ( pp=0 ; pp<nprocs ; pp++ ) |
---|
| 530 | { |
---|
| 531 | PRINTF("cluster= %d proc= %d date= %d\n", cc, pp, HORI_ENDED[cc][pp]); |
---|
| 532 | } |
---|
| 533 | } |
---|
| 534 | PRINTF("END\n"); |
---|
| 535 | PRINTF("\nBEGIN VERT_START\n"); |
---|
| 536 | for ( cc=0 ; cc<nclusters ; cc++ ) |
---|
| 537 | { |
---|
| 538 | for ( pp=0 ; pp<nprocs ; pp++ ) |
---|
| 539 | { |
---|
| 540 | PRINTF("cluster= %d proc= %d date= %d\n", cc, pp, VERT_START[cc][pp]); |
---|
| 541 | } |
---|
| 542 | } |
---|
| 543 | PRINTF("END\n"); |
---|
| 544 | PRINTF("\nBEGIN VERT_ENDED\n"); |
---|
| 545 | for ( cc=0 ; cc<nclusters ; cc++ ) |
---|
| 546 | { |
---|
| 547 | for ( pp=0 ; pp<nprocs ; pp++ ) |
---|
| 548 | { |
---|
| 549 | PRINTF("cluster= %d proc= %d date= %d\n", cc, pp, VERT_ENDED[cc][pp]); |
---|
| 550 | } |
---|
| 551 | } |
---|
| 552 | PRINTF("END\n"); |
---|
| 553 | PRINTF("\nBEGIN DISP_START\n"); |
---|
| 554 | for ( cc=0 ; cc<nclusters ; cc++ ) |
---|
| 555 | { |
---|
| 556 | for ( pp=0 ; pp<nprocs ; pp++ ) |
---|
| 557 | { |
---|
| 558 | PRINTF("cluster= %d proc= %d date= %d\n", cc, pp, DISP_START[cc][pp]); |
---|
| 559 | } |
---|
| 560 | } |
---|
| 561 | PRINTF("END\n"); |
---|
| 562 | PRINTF("\nBEGIN DISP_ENDED\n"); |
---|
| 563 | for ( cc=0 ; cc<nclusters ; cc++ ) |
---|
| 564 | { |
---|
| 565 | for ( pp=0 ; pp<nprocs ; pp++ ) |
---|
| 566 | { |
---|
| 567 | PRINTF("cluster= %d proc= %d date= %d\n", cc, pp, DISP_ENDED[cc][pp]); |
---|
| 568 | } |
---|
| 569 | } |
---|
| 570 | PRINTF("END\n"); |
---|
| 571 | } |
---|
| 572 | |
---|
[158] | 573 | while(1); |
---|
| 574 | |
---|
| 575 | } // end main() |
---|
| 576 | |
---|