Changeset 822 for soft/giet_vm/applications/rosenfeld/src-par/mca.c
- Timestamp:
- Jun 1, 2016, 10:25:43 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/src-par/mca.c
r821 r822 42 42 { 43 43 printf("MCA ERROR: %s\n", msg); 44 printf("now exiting to system...\n");45 44 exit(1); 46 45 } … … 164 163 MCA * mca_par; 165 164 166 printf("*** %s ***\n", __func__);167 MCA_VERBOSE 1(printf(" height = %d\n", height));168 MCA_VERBOSE 1(printf(" width = %d\n", width));165 MCA_VERBOSE1(printf("*** %s ***\n", __func__)); 166 MCA_VERBOSE2(printf(" height = %d\n", height)); 167 MCA_VERBOSE2(printf(" width = %d\n", width)); 169 168 170 169 // array of pointers to mca workers … … 179 178 height_mod = height % np; 180 179 181 MCA_VERBOSE 1(printf(" height_par = %d x %d + %d\n", height_par, np, height_mod));182 MCA_VERBOSE 1(printf(" ========================\n"));180 MCA_VERBOSE2(printf(" height_par = %d x %d + %d\n", height_par, np, height_mod)); 181 MCA_VERBOSE2(printf(" ========================\n")); 183 182 184 183 i1_par_previous = 0; … … 186 185 // puissance de 2 de chaque bande 187 186 ne_par = height_par * width + 1; 188 MCA_VERBOSE 1(printf(" ne_par = %d\n", ne_par));187 MCA_VERBOSE2(printf(" ne_par = %d\n", ne_par)); 189 188 pw2 = i32log2(ne_par); 190 189 if (ne_par > (1 << pw2)) { … … 192 191 } 193 192 nemax_par = 1 << pw2; 194 195 MCA_VERBOSE1(printf(" nemax_par = %d\n", nemax_par)); 193 mca->alpha = pw2; 194 195 MCA_VERBOSE2(printf(" nemax_par = %d\n", nemax_par)); 196 196 197 197 nb_level = i32log2(np); … … 230 230 // -- constructor -- // 231 231 // ----------------- // 232 MCA_VERBOSE 2(printf("-- p = %d ----------------\n", p));232 MCA_VERBOSE3(printf("-- p = %d ----------------\n", p)); 233 233 234 234 // alloc of mca workers into array of pointers … … 245 245 x = (p / NB_PROCS_MAX) / Y_SIZE; 246 246 y = (p / NB_PROCS_MAX) % Y_SIZE; 247 MCA_VERBOSE 2(printf("p = %d (x = %d, y = %d)\n", p, x, y));247 MCA_VERBOSE3(printf("p = %d (x = %d, y = %d)\n", p, x, y)); 248 248 #endif 249 249 … … 268 268 i1_par_previous = i1_par; 269 269 270 MCA_VERBOSE 2(printf("i0_par = %d\n", i0_par));271 MCA_VERBOSE 2(printf("i1_par = %d\n", i1_par));270 MCA_VERBOSE3(printf("i0_par = %d\n", i0_par)); 271 MCA_VERBOSE3(printf("i1_par = %d\n", i1_par)); 272 272 273 273 // etiquettes … … 281 281 } 282 282 283 MCA_VERBOSE 2(printf("e0_par = %d\n", e0_par));284 MCA_VERBOSE 2(printf("e1_par = %d\n", e1_par));283 MCA_VERBOSE3(printf("e0_par = %d\n", e0_par)); 284 MCA_VERBOSE3(printf("e1_par = %d\n", e1_par)); 285 285 286 286 mca_par->width = width; … … 313 313 if (p == 0) { 314 314 mca_par->T = remote_ui32vector(e0_par - 1, e1_par, x, y); // car e0 = 1, on a besoin que T[0] = 0 pour FindRoot 315 #if FEATURES316 315 mca_par->stats = remote_RegionStatsVector(e0_par - 1, e1_par, x, y); 317 #endif318 316 } 319 317 else { 320 318 mca_par->T = remote_ui32vector(e0_par, e1_par, x, y); 321 #if FEATURES322 319 mca_par->stats = remote_RegionStatsVector(e0_par, e1_par, x, y); 323 #endif324 320 } 325 321 326 322 mca_par->D = (uint32 **) remote_vvector(0, np - 1, x, y); 327 #if FEATURES328 323 mca_par->F = (RegionStats **) remote_vvector(0, np - 1, x, y); 329 #endif330 324 #else // !GIETVM 331 325 mca_par->X = ui8matrix (i0_par, i1_par, 0, width - 1); … … 334 328 if (p == 0) { 335 329 mca_par->T = ui32vector(e0_par - 1, e1_par); // car e0 = 1, on a besoin que T[0] = 0 pour FindRoot 336 #if FEATURES337 330 mca_par->stats = RegionStatsVector(e0_par - 1, e1_par); 338 339 #endif340 331 } 341 332 else { 342 333 mca_par->T = ui32vector(e0_par, e1_par); 343 #if FEATURES344 334 mca_par->stats = RegionStatsVector(e0_par, e1_par); 345 #endif346 335 } 347 336 348 337 mca_par->D = (uint32 **) vvector(0, np - 1); 349 #if FEATURES350 338 mca_par->F = (RegionStats **) vvector(0, np - 1); 351 #endif352 339 #endif 353 MCA_VERBOSE 2(printf("X = %p\n", mca_par->X));354 MCA_VERBOSE 2(printf("E = %p\n", mca_par->E));355 MCA_VERBOSE 2(printf("T = %p\n", mca_par->T));356 MCA_VERBOSE 2(printf("D = %p\n", mca_par->D));340 MCA_VERBOSE3(printf("X = %p\n", mca_par->X)); 341 MCA_VERBOSE3(printf("E = %p\n", mca_par->E)); 342 MCA_VERBOSE3(printf("T = %p\n", mca_par->T)); 343 MCA_VERBOSE3(printf("D = %p\n", mca_par->D)); 357 344 } // p 358 345 … … 365 352 uint32 e1 = mca_par->e1; 366 353 367 MCA_VERBOSE 2(printf("p = %d T[%d..%d]\n", p, e0, e1));354 MCA_VERBOSE3(printf("p = %d T[%d..%d]\n", p, e0, e1)); 368 355 if (p == 0) { 369 356 set_ui32vector_j(T, e0 - 1, e1); // car e0 = 1, on a besoin que T[0] = 0 pour FindRoot … … 372 359 set_ui32vector_j(T, e0, e1); 373 360 } 374 MCA_VERBOSE 2(printf("\n"));375 } 376 377 MCA_VERBOSE 2(printf("display des tables d'EQ\n"));361 MCA_VERBOSE3(printf("\n")); 362 } 363 364 MCA_VERBOSE3(printf("display des tables d'EQ\n")); 378 365 for (int p = 0; p < np; p++) { 379 366 MCA * mca_par = mcas[p]; … … 383 370 uint32 e1 = mca_par->e1; 384 371 385 MCA_VERBOSE 2(printf("p = %d T[%d..%d]\n", p, e0, e1));386 if (p == 0) { 387 MCA_VERBOSE 2(display_ui32vector_number(T, e0 - 1, e0 + 10, "%5d", "T"));388 } 389 else { 390 MCA_VERBOSE 2(display_ui32vector_number(T, e0, e0 + 10, "%5d", "T"));391 } 392 MCA_VERBOSE 2(printf("\n"));372 MCA_VERBOSE3(printf("p = %d T[%d..%d]\n", p, e0, e1)); 373 if (p == 0) { 374 MCA_VERBOSE3(display_ui32vector_number(T, e0 - 1, e0 + 10, "%5d", "T")); 375 } 376 else { 377 MCA_VERBOSE3(display_ui32vector_number(T, e0, e0 + 10, "%5d", "T")); 378 } 379 MCA_VERBOSE3(printf("\n")); 393 380 } 394 381 //exit(-1); … … 399 386 400 387 // table d'indirection distribuee D 401 MCA_VERBOSE 2(printf("nemax_par = %d\n", nemax_par));388 MCA_VERBOSE3(printf("nemax_par = %d\n", nemax_par)); 402 389 for (int p = 0; p < np; p++) { 403 390 MCA * mca_p = mcas[p]; … … 409 396 uint32 * T = mca_k->T; 410 397 D[k] = T + k * nemax_par; // il faut soustraire le "MSB" 411 #if FEATURES412 398 RegionStats * stat = mca_k->stats; 413 399 F[k] = stat + k * nemax_par; // il faut soustraire le "MSB" 414 #endif415 400 } // k 416 401 } // p 417 402 418 MCA_VERBOSE 2(printf("table d'indirection distribuee D\n"));419 420 for (int p = 0; p < np; p++) { 421 MCA_VERBOSE 2(printf("== p = %d ==========\n", p));403 MCA_VERBOSE3(printf("table d'indirection distribuee D\n")); 404 405 for (int p = 0; p < np; p++) { 406 MCA_VERBOSE3(printf("== p = %d ==========\n", p)); 422 407 423 408 MCA * mca_p = mcas[p]; … … 430 415 uint32 e0 = mca_k->e0; 431 416 uint32 e1 = mca_k->e1; 432 MCA_VERBOSE2(display_ui32vector_number(T, e0, e0 + 9, "%5d", "T")); 433 MCA_VERBOSE2(display_ui32vector(D[k], 0, 9, "%5d", "D\n")); 434 } 435 MCA_VERBOSE2(printf("\n")); 436 } 437 438 /**/ 439 //exit(-1); 440 441 //printf("[MCA_Initialize] positionnement des pointeurs de lignes (i0-1) et (i1+1)"); 442 443 for (int p = 0; p < np; p++) { 444 445 //printf(" --p = %d ------------------\n", p); 446 // cas general 447 417 MCA_VERBOSE3(display_ui32vector_number(T, e0, e0 + 9, "%5d", "T")); 418 MCA_VERBOSE3(display_ui32vector(D[k], 0, 9, "%5d", "D\n")); 419 } 420 MCA_VERBOSE3(printf("\n")); 421 } 422 423 for (int p = 0; p < np; p++) { 448 424 if (p > 0) { 449 425 //printf("i0_(%d) = %d i1_{%d} = %d\n", p, mcas[p]->i0, p-1, mcas[p-1]->i1); … … 476 452 (void) mca_par; 477 453 478 printf("*** MCA_Display_Parameters ***\n");479 480 MCA_VERBOSE 1(printf(" height = %d\n", mca->height));481 MCA_VERBOSE 1(printf(" width = %d\n", mca->width));482 MCA_VERBOSE 1(printf(" np = %d\n", mca->np));454 MCA_VERBOSE1(printf("*** MCA_Display_Parameters ***\n")); 455 456 MCA_VERBOSE2(printf(" height = %d\n", mca->height)); 457 MCA_VERBOSE2(printf(" width = %d\n", mca->width)); 458 MCA_VERBOSE2(printf(" np = %d\n", mca->np)); 483 459 484 460 for (int p = 0; p < np; p++) { 485 461 mca_par = mcas[p]; 486 462 487 MCA_VERBOSE 2(printf("Display MCA[%d]\n", p));488 MCA_VERBOSE 2(printf("p = %d\n", mca_par->p));489 MCA_VERBOSE 2(printf("i0 = %8d i1 = %8d\n", mca_par->i0, mca_par->i1));490 MCA_VERBOSE 2(printf("j0 = %8d j1 = %8d\n", mca_par->j0, mca_par->j1));491 MCA_VERBOSE 2(printf("e0 = %8d e1 = %8d\n", mca_par->e0, mca_par->e1));463 MCA_VERBOSE3(printf("Display MCA[%d]\n", p)); 464 MCA_VERBOSE3(printf("p = %d\n", mca_par->p)); 465 MCA_VERBOSE3(printf("i0 = %8d i1 = %8d\n", mca_par->i0, mca_par->i1)); 466 MCA_VERBOSE3(printf("j0 = %8d j1 = %8d\n", mca_par->j0, mca_par->j1)); 467 MCA_VERBOSE3(printf("e0 = %8d e1 = %8d\n", mca_par->e0, mca_par->e1)); 492 468 } 493 469 } … … 507 483 uint32 e0, e1; 508 484 509 printf("*** MCA_Finalize ***\n");485 MCA_VERBOSE1(printf("*** MCA_Finalize ***\n")); 510 486 511 487 #if PYR_BARRIERS … … 532 508 if (p == 0) { 533 509 free_ui32vector(mca_par->T, e0 - 1, e1); // car e0 = 1, on a besoin que T[0] = 0 pour FindRoot 534 #if FEATURES535 510 free_RegionStatsVector(mca_par->stats, e0 - 1, e1); 536 #endif537 511 } 538 512 else { 539 513 free_ui32vector(mca_par->T, e0, e1); 540 #if FEATURES541 514 free_RegionStatsVector(mca_par->stats, e0, e1); 542 #endif543 515 } 544 516 545 517 free_vvector((void **) mca_par->D, 0, np - 1); 546 #if FEATURES547 518 free_vvector((void **) mca_par->F, 0, np - 1); 548 #endif549 519 free(mca_par); 550 520 } … … 564 534 565 535 if (mca->p == 0) { 566 printf("*** MCA_Scatter_ImageX ***\n");536 MCA_VERBOSE1(printf("*** MCA_Scatter_ImageX ***\n")); 567 537 } 568 538 … … 593 563 594 564 if (mca->p == 0) { 595 printf("*** MCA_Gather_ImageL ***\n");565 MCA_VERBOSE1(printf("*** MCA_Gather_ImageL ***\n")); 596 566 } 597 567
Note: See TracChangeset
for help on using the changeset viewer.