1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739
|
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2014, The University of Texas at Austin
Copyright (C) 2018 - 2019, Advanced Micro Devices, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name(s) of the copyright holder(s) nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "blis.h"
#include "assert.h"
void bli_l3_thrinfo_init_single
(
thrinfo_t* thread
)
{
bli_thrinfo_init_single( thread );
}
void bli_l3_thrinfo_free
(
rntm_t* rntm,
thrinfo_t* thread
)
{
bli_thrinfo_free( rntm, thread );
}
void bli_l3_sup_thrinfo_free
(
rntm_t* rntm,
thrinfo_t* thread
)
{
bli_thrinfo_free( rntm, thread );
}
// -----------------------------------------------------------------------------
void bli_l3_thrinfo_create_root
(
dim_t id,
thrcomm_t* gl_comm,
rntm_t* rntm,
cntl_t* cntl,
thrinfo_t** thread
)
{
// Query the global communicator for the total number of threads to use.
dim_t n_threads = bli_thrcomm_num_threads( gl_comm );
// Use the thread id passed in as the global communicator id.
dim_t gl_comm_id = id;
// Use the blocksize id of the current (root) control tree node to
// query the top-most ways of parallelism to obtain.
bszid_t bszid = bli_cntl_bszid( cntl );
dim_t xx_way = bli_rntm_ways_for( bszid, rntm );
// Determine the work id for this thrinfo_t node.
dim_t work_id = gl_comm_id / ( n_threads / xx_way );
// Create the root thrinfo_t node.
*thread = bli_thrinfo_create
(
rntm,
gl_comm,
gl_comm_id,
xx_way,
work_id,
TRUE,
bszid,
NULL
);
}
// -----------------------------------------------------------------------------
void bli_l3_sup_thrinfo_create_root
(
dim_t id,
thrcomm_t* gl_comm,
rntm_t* rntm,
thrinfo_t** thread
)
{
// Query the global communicator for the total number of threads to use.
dim_t n_threads = bli_thrcomm_num_threads( gl_comm );
// Use the thread id passed in as the global communicator id.
dim_t gl_comm_id = id;
// Use the BLIS_NC blocksize id to query the top-most ways of parallelism
// to obtain. Note that hard-coding BLIS_NC like this is a little bit of a
// hack, but it works fine since both of the sup algorithms (bp and pb) use
// the cache blocksizes down to the 3rd loop. (See the definitions of
// bli_rntm_calc_num_threads_bp() and bli_rntm_calc_num_threads_pb() for
// a concise enumeration of these bszid_t ids.)
const bszid_t bszid = BLIS_NC;
dim_t xx_way = bli_rntm_ways_for( BLIS_NC, rntm );
// Determine the work id for this thrinfo_t node.
dim_t work_id = gl_comm_id / ( n_threads / xx_way );
// Create the root thrinfo_t node.
*thread = bli_thrinfo_create
(
rntm,
gl_comm,
gl_comm_id,
xx_way,
work_id,
TRUE,
bszid,
NULL
);
}
// -----------------------------------------------------------------------------
void bli_l3_sup_thrinfo_update_root
(
rntm_t* rntm,
thrinfo_t* thread
)
{
// Query the current root for the total number of threads to use.
const dim_t n_threads = bli_thread_num_threads( thread );
// Query the current root for the (global) comm id.
const dim_t gl_comm_id = bli_thread_ocomm_id( thread );
// Query the rntm_t for the updated number of ways of parallelism.
const dim_t xx_way = bli_rntm_ways_for( BLIS_NC, rntm );
// Recompute the work id for this thrinfo_t node using the updated
// number of ways of parallelism.
dim_t work_id = gl_comm_id / ( n_threads / xx_way );
// Save the updated ways of parallelism and work id to the thrinfo_t node.
bli_thrinfo_set_n_way( xx_way, thread );
bli_thrinfo_set_work_id( work_id, thread );
}
// -----------------------------------------------------------------------------
void bli_l3_thrinfo_print_gemm_paths
(
thrinfo_t** threads
)
{
// In order to query the number of threads, we query the only thread we
// know exists: thread 0.
dim_t n_threads = bli_thread_num_threads( threads[0] );
// For the purposes of printing the "header" information that is common
// to the various instances of a thrinfo_t (ie: across all threads), we
// choose the last thread in case the problem is so small that there is
// only an "edge" case, which will always be assigned to the last thread
// (at least for higher levels of partitioning).
thrinfo_t* jc_info = threads[n_threads-1];
thrinfo_t* pc_info = NULL;
thrinfo_t* pb_info = NULL;
thrinfo_t* ic_info = NULL;
thrinfo_t* pa_info = NULL;
thrinfo_t* jr_info = NULL;
thrinfo_t* ir_info = NULL;
// Initialize the n_ways and n_threads fields of each thrinfo_t "level"
// to -1. More than likely, these will all be overwritten with meaningful
// values, but in case some thrinfo_t trees are not fully built (see
// next commnet), these will be the placeholder values.
dim_t jc_way = -1, pc_way = -1, pb_way = -1, ic_way = -1,
pa_way = -1, jr_way = -1, ir_way = -1;
dim_t jc_nt = -1, pc_nt = -1, pb_nt = -1, ic_nt = -1,
pa_nt = -1, jr_nt = -1, ir_nt = -1;
// NOTE: We must check each thrinfo_t pointer for NULLness. Certain threads
// may not fully build their thrinfo_t structures--specifically when the
// dimension being parallelized is not large enough for each thread to have
// even one unit of work (where as unit is usually a single micropanel's
// width, MR or NR).
if ( !jc_info ) goto print_header;
jc_way = bli_thread_n_way( jc_info );
jc_nt = bli_thread_num_threads( jc_info );
pc_info = bli_thrinfo_sub_node( jc_info );
if ( !pc_info ) goto print_header;
pc_way = bli_thread_n_way( pc_info );
pc_nt = bli_thread_num_threads( pc_info );
pb_info = bli_thrinfo_sub_node( pc_info );
if ( !pb_info ) goto print_header;
pb_way = bli_thread_n_way( pb_info );
pb_nt = bli_thread_num_threads( pb_info );
ic_info = bli_thrinfo_sub_node( pb_info );
if ( !ic_info ) goto print_header;
ic_way = bli_thread_n_way( ic_info );
ic_nt = bli_thread_num_threads( ic_info );
pa_info = bli_thrinfo_sub_node( ic_info );
if ( !pa_info ) goto print_header;
pa_way = bli_thread_n_way( pa_info );
pa_nt = bli_thread_num_threads( pa_info );
jr_info = bli_thrinfo_sub_node( pa_info );
if ( !jr_info ) goto print_header;
jr_way = bli_thread_n_way( jr_info );
jr_nt = bli_thread_num_threads( jr_info );
ir_info = bli_thrinfo_sub_node( jr_info );
if ( !ir_info ) goto print_header;
ir_way = bli_thread_n_way( ir_info );
ir_nt = bli_thread_num_threads( ir_info );
print_header:
printf( " jc kc pb ic pa jr ir\n" );
printf( "xx_nt: %4ld %4ld %4ld %4ld %4ld %4ld %4ld\n",
( unsigned long )jc_nt,
( unsigned long )pc_nt,
( unsigned long )pb_nt,
( unsigned long )ic_nt,
( unsigned long )pa_nt,
( unsigned long )jr_nt,
( unsigned long )ir_nt );
printf( "xx_way: %4ld %4ld %4ld %4ld %4ld %4ld %4ld\n",
( unsigned long )jc_way,
( unsigned long )pc_way,
( unsigned long )pb_way,
( unsigned long )ic_way,
( unsigned long )pa_way,
( unsigned long )jr_way,
( unsigned long )ir_way );
printf( "============================================\n" );
for ( dim_t gl_id = 0; gl_id < n_threads; ++gl_id )
{
jc_info = threads[gl_id];
dim_t jc_comm_id = -1, pc_comm_id = -1, pb_comm_id = -1, ic_comm_id = -1,
pa_comm_id = -1, jr_comm_id = -1, ir_comm_id = -1;
dim_t jc_work_id = -1, pc_work_id = -1, pb_work_id = -1, ic_work_id = -1,
pa_work_id = -1, jr_work_id = -1, ir_work_id = -1;
if ( !jc_info ) goto print_thrinfo;
jc_comm_id = bli_thread_ocomm_id( jc_info );
jc_work_id = bli_thread_work_id( jc_info );
pc_info = bli_thrinfo_sub_node( jc_info );
if ( !pc_info ) goto print_thrinfo;
pc_comm_id = bli_thread_ocomm_id( pc_info );
pc_work_id = bli_thread_work_id( pc_info );
pb_info = bli_thrinfo_sub_node( pc_info );
if ( !pb_info ) goto print_thrinfo;
pb_comm_id = bli_thread_ocomm_id( pb_info );
pb_work_id = bli_thread_work_id( pb_info );
ic_info = bli_thrinfo_sub_node( pb_info );
if ( !ic_info ) goto print_thrinfo;
ic_comm_id = bli_thread_ocomm_id( ic_info );
ic_work_id = bli_thread_work_id( ic_info );
pa_info = bli_thrinfo_sub_node( ic_info );
if ( !pa_info ) goto print_thrinfo;
pa_comm_id = bli_thread_ocomm_id( pa_info );
pa_work_id = bli_thread_work_id( pa_info );
jr_info = bli_thrinfo_sub_node( pa_info );
if ( !jr_info ) goto print_thrinfo;
jr_comm_id = bli_thread_ocomm_id( jr_info );
jr_work_id = bli_thread_work_id( jr_info );
ir_info = bli_thrinfo_sub_node( jr_info );
if ( !ir_info ) goto print_thrinfo;
ir_comm_id = bli_thread_ocomm_id( ir_info );
ir_work_id = bli_thread_work_id( ir_info );
print_thrinfo:
printf( "comm ids: %4ld %4ld %4ld %4ld %4ld %4ld %4ld\n",
( long )jc_comm_id,
( long )pc_comm_id,
( long )pb_comm_id,
( long )ic_comm_id,
( long )pa_comm_id,
( long )jr_comm_id,
( long )ir_comm_id );
printf( "work ids: %4ld %4ld %4ld %4ld %4ld %4ld %4ld\n",
( long )jc_work_id,
( long )pc_work_id,
( long )pb_work_id,
( long )ic_work_id,
( long )pa_work_id,
( long )jr_work_id,
( long )ir_work_id );
printf( "--------------------------------------------\n" );
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void bli_l3_thrinfo_print_trsm_paths
(
thrinfo_t** threads
)
{
// In order to query the number of threads, we query the only thread we
// know exists: thread 0.
dim_t n_threads = bli_thread_num_threads( threads[0] );
// For the purposes of printing the "header" information that is common
// to the various instances of a thrinfo_t (ie: across all threads), we
// choose the last thread in case the problem is so small that there is
// only an "edge" case, which will always be assigned to the last thread
// (at least for higher levels of partitioning).
thrinfo_t* jc_info = threads[n_threads-1];
thrinfo_t* pc_info = NULL;
thrinfo_t* pb_info = NULL;
thrinfo_t* ic_info = NULL;
thrinfo_t* pa_info = NULL; thrinfo_t* pa_info0 = NULL;
thrinfo_t* jr_info = NULL; thrinfo_t* jr_info0 = NULL;
thrinfo_t* ir_info = NULL; thrinfo_t* ir_info0 = NULL;
// Initialize the n_ways and n_threads fields of each thrinfo_t "level"
// to -1. More than likely, these will all be overwritten with meaningful
// values, but in case some thrinfo_t trees are not fully built (see
// next commnet), these will be the placeholder values.
dim_t jc_way = -1, pc_way = -1, pb_way = -1, ic_way = -1,
pa_way = -1, jr_way = -1, ir_way = -1,
pa_way0 = -1, jr_way0 = -1, ir_way0 = -1;
dim_t jc_nt = -1, pc_nt = -1, pb_nt = -1, ic_nt = -1,
pa_nt = -1, jr_nt = -1, ir_nt = -1,
pa_nt0 = -1, jr_nt0 = -1, ir_nt0 = -1;
// NOTE: We must check each thrinfo_t pointer for NULLness. Certain threads
// may not fully build their thrinfo_t structures--specifically when the
// dimension being parallelized is not large enough for each thread to have
// even one unit of work (where as unit is usually a single micropanel's
// width, MR or NR).
if ( !jc_info ) goto print_header;
jc_way = bli_thread_n_way( jc_info );
jc_nt = bli_thread_num_threads( jc_info );
pc_info = bli_thrinfo_sub_node( jc_info );
if ( !pc_info ) goto print_header;
pc_way = bli_thread_n_way( pc_info );
pc_nt = bli_thread_num_threads( pc_info );
pb_info = bli_thrinfo_sub_node( pc_info );
if ( !pb_info ) goto print_header;
pb_way = bli_thread_n_way( pb_info );
pb_nt = bli_thread_num_threads( pb_info );
ic_info = bli_thrinfo_sub_node( pb_info );
if ( !ic_info ) goto print_header;
ic_way = bli_thread_n_way( ic_info );
ic_nt = bli_thread_num_threads( ic_info );
pa_info = bli_thrinfo_sub_node( ic_info );
pa_info0 = bli_thrinfo_sub_prenode( ic_info );
// check_header_prenode:
if ( !pa_info0 ) goto check_header_node;
pa_way0 = bli_thread_n_way( pa_info0 );
pa_nt0 = bli_thread_num_threads( pa_info0 );
jr_info0 = bli_thrinfo_sub_node( pa_info0 );
if ( !jr_info0 ) goto check_header_node;
jr_way0 = bli_thread_n_way( jr_info0 );
jr_nt0 = bli_thread_num_threads( jr_info0 );
ir_info0 = bli_thrinfo_sub_node( jr_info0 );
if ( !ir_info0 ) goto check_header_node;
ir_way0 = bli_thread_n_way( ir_info0 );
ir_nt0 = bli_thread_num_threads( ir_info0 );
check_header_node:
if ( !pa_info ) goto print_header;
pa_way = bli_thread_n_way( pa_info );
pa_nt = bli_thread_num_threads( pa_info );
jr_info = bli_thrinfo_sub_node( pa_info );
if ( !jr_info ) goto print_header;
jr_way = bli_thread_n_way( jr_info );
jr_nt = bli_thread_num_threads( jr_info );
ir_info = bli_thrinfo_sub_node( jr_info );
if ( !ir_info ) goto print_header;
ir_way = bli_thread_n_way( ir_info );
ir_nt = bli_thread_num_threads( ir_info );
print_header:
printf( " jc kc pb ic pa jr ir\n" );
printf( "xx_nt: %4ld %4ld %4ld %4ld %2ld|%2ld %2ld|%2ld %2ld|%2ld\n",
( long )jc_nt,
( long )pc_nt,
( long )pb_nt,
( long )ic_nt,
( long )pa_nt0, ( long )pa_nt,
( long )jr_nt0, ( long )jr_nt,
( long )ir_nt0, ( long )ir_nt );
printf( "xx_way: %4ld %4ld %4ld %4ld %2ld|%2ld %2ld|%2ld %2ld|%2ld\n",
( long )jc_way,
( long )pc_way,
( long )pb_way,
( long )ic_way,
( long )pa_way0, ( long )pa_way,
( long )jr_way0, ( long )jr_way,
( long )ir_way0, ( long )ir_way );
printf( "==================================================\n" );
for ( dim_t gl_id = 0; gl_id < n_threads; ++gl_id )
{
jc_info = threads[gl_id];
#if 1
// NOTE: This cpp branch contains code that is safe to execute
// for small problems that are parallelized enough that one or
// more threads gets no work.
dim_t jc_comm_id = -1, pc_comm_id = -1, pb_comm_id = -1, ic_comm_id = -1,
pa_comm_id = -1, jr_comm_id = -1, ir_comm_id = -1,
pa_comm_id0 = -1, jr_comm_id0 = -1, ir_comm_id0 = -1;
dim_t jc_work_id = -1, pc_work_id = -1, pb_work_id = -1, ic_work_id = -1,
pa_work_id = -1, jr_work_id = -1, ir_work_id = -1,
pa_work_id0 = -1, jr_work_id0 = -1, ir_work_id0 = -1;
if ( !jc_info ) goto print_thrinfo;
jc_comm_id = bli_thread_ocomm_id( jc_info );
jc_work_id = bli_thread_work_id( jc_info );
pc_info = bli_thrinfo_sub_node( jc_info );
if ( !pc_info ) goto print_thrinfo;
pc_comm_id = bli_thread_ocomm_id( pc_info );
pc_work_id = bli_thread_work_id( pc_info );
pb_info = bli_thrinfo_sub_node( pc_info );
if ( !pb_info ) goto print_thrinfo;
pb_comm_id = bli_thread_ocomm_id( pb_info );
pb_work_id = bli_thread_work_id( pb_info );
ic_info = bli_thrinfo_sub_node( pb_info );
if ( !ic_info ) goto print_thrinfo;
ic_comm_id = bli_thread_ocomm_id( ic_info );
ic_work_id = bli_thread_work_id( ic_info );
pa_info = bli_thrinfo_sub_node( ic_info );
pa_info0 = bli_thrinfo_sub_prenode( ic_info );
// check_thrinfo_prenode:
if ( !pa_info0 ) goto check_thrinfo_node;
pa_comm_id0 = bli_thread_ocomm_id( pa_info0 );
pa_work_id0 = bli_thread_work_id( pa_info0 );
jr_info0 = bli_thrinfo_sub_node( pa_info0 );
if ( !jr_info0 ) goto check_thrinfo_node;
jr_comm_id0 = bli_thread_ocomm_id( jr_info0 );
jr_work_id0 = bli_thread_work_id( jr_info0 );
ir_info0 = bli_thrinfo_sub_node( jr_info0 );
if ( !ir_info0 ) goto check_thrinfo_node;
ir_comm_id0 = bli_thread_ocomm_id( ir_info0 );
ir_work_id0 = bli_thread_work_id( ir_info0 );
check_thrinfo_node:
if ( !pa_info ) goto print_thrinfo;
pa_comm_id = bli_thread_ocomm_id( pa_info );
pa_work_id = bli_thread_work_id( pa_info );
jr_info = bli_thrinfo_sub_node( pa_info );
if ( !jr_info ) goto print_thrinfo;
jr_comm_id = bli_thread_ocomm_id( jr_info );
jr_work_id = bli_thread_work_id( jr_info );
ir_info = bli_thrinfo_sub_node( jr_info );
if ( !ir_info ) goto print_thrinfo;
ir_comm_id = bli_thread_ocomm_id( ir_info );
ir_work_id = bli_thread_work_id( ir_info );
print_thrinfo:
#else
dim_t jc_comm_id;
dim_t pc_comm_id;
dim_t pb_comm_id;
dim_t ic_comm_id;
dim_t pa_comm_id0, pa_comm_id;
dim_t jr_comm_id0, jr_comm_id;
dim_t ir_comm_id0, ir_comm_id;
dim_t jc_work_id;
dim_t pc_work_id;
dim_t pb_work_id;
dim_t ic_work_id;
dim_t pa_work_id0, pa_work_id;
dim_t jr_work_id0, jr_work_id;
dim_t ir_work_id0, ir_work_id;
// NOTE: We must check each thrinfo_t pointer for NULLness. Certain threads
// may not fully build their thrinfo_t structures--specifically when the
// dimension being parallelized is not large enough for each thread to have
// even one unit of work (where as unit is usually a single micropanel's
// width, MR or NR).
if ( !jc_info )
{
jc_comm_id = pc_comm_id = pb_comm_id = ic_comm_id = pa_comm_id = jr_comm_id = ir_comm_id = -1;
jc_work_id = pc_work_id = pb_work_id = ic_work_id = pa_work_id = jr_work_id = ir_work_id = -1;
}
else
{
jc_comm_id = bli_thread_ocomm_id( jc_info );
jc_work_id = bli_thread_work_id( jc_info );
pc_info = bli_thrinfo_sub_node( jc_info );
if ( !pc_info )
{
pc_comm_id = pb_comm_id = ic_comm_id = pa_comm_id = jr_comm_id = ir_comm_id = -1;
pc_work_id = pb_work_id = ic_work_id = pa_work_id = jr_work_id = ir_work_id = -1;
}
else
{
pc_comm_id = bli_thread_ocomm_id( pc_info );
pc_work_id = bli_thread_work_id( pc_info );
pb_info = bli_thrinfo_sub_node( pc_info );
if ( !pb_info )
{
pb_comm_id = ic_comm_id = pa_comm_id = jr_comm_id = ir_comm_id = -1;
pb_work_id = ic_work_id = pa_work_id = jr_work_id = ir_work_id = -1;
}
else
{
pb_comm_id = bli_thread_ocomm_id( pb_info );
pb_work_id = bli_thread_work_id( pb_info );
ic_info = bli_thrinfo_sub_node( pb_info );
if ( !ic_info )
{
ic_comm_id = pa_comm_id = jr_comm_id = ir_comm_id = -1;
ic_work_id = pa_work_id = jr_work_id = ir_work_id = -1;
}
else
{
ic_comm_id = bli_thread_ocomm_id( ic_info );
ic_work_id = bli_thread_work_id( ic_info );
pa_info0 = bli_thrinfo_sub_prenode( ic_info );
pa_info = bli_thrinfo_sub_node( ic_info );
// Prenode
if ( !pa_info0 )
{
pa_comm_id0 = jr_comm_id0 = ir_comm_id0 = -1;
pa_work_id0 = jr_work_id0 = ir_work_id0 = -1;
}
else
{
pa_comm_id0 = bli_thread_ocomm_id( pa_info0 );
pa_work_id0 = bli_thread_work_id( pa_info0 );
jr_info0 = bli_thrinfo_sub_node( pa_info0 );
if ( !jr_info0 )
{
jr_comm_id0 = ir_comm_id0 = -1;
jr_work_id0 = ir_work_id0 = -1;
}
else
{
jr_comm_id0 = bli_thread_ocomm_id( jr_info0 );
jr_work_id0 = bli_thread_work_id( jr_info0 );
ir_info0 = bli_thrinfo_sub_node( jr_info0 );
if ( !ir_info0 )
{
ir_comm_id0 = -1;
ir_work_id0 = -1;
}
else
{
ir_comm_id0 = bli_thread_ocomm_id( ir_info0 );
ir_work_id0 = bli_thread_work_id( ir_info0 );
}
}
}
// Main node
if ( !pa_info )
{
pa_comm_id = jr_comm_id = ir_comm_id = -1;
pa_work_id = jr_work_id = ir_work_id = -1;
}
else
{
pa_comm_id = bli_thread_ocomm_id( pa_info );
pa_work_id = bli_thread_work_id( pa_info );
jr_info = bli_thrinfo_sub_node( pa_info );
if ( !jr_info )
{
jr_comm_id = ir_comm_id = -1;
jr_work_id = ir_work_id = -1;
}
else
{
jr_comm_id = bli_thread_ocomm_id( jr_info );
jr_work_id = bli_thread_work_id( jr_info );
ir_info = bli_thrinfo_sub_node( jr_info );
if ( !ir_info )
{
ir_comm_id = -1;
ir_work_id = -1;
}
else
{
ir_comm_id = bli_thread_ocomm_id( ir_info );
ir_work_id = bli_thread_work_id( ir_info );
}
}
}
}
}
}
}
#endif
printf( "comm ids: %4ld %4ld %4ld %4ld %2ld|%2ld %2ld|%2ld %2ld|%2ld\n",
( long )jc_comm_id,
( long )pc_comm_id,
( long )pb_comm_id,
( long )ic_comm_id,
( long )pa_comm_id0, ( long )pa_comm_id,
( long )jr_comm_id0, ( long )jr_comm_id,
( long )ir_comm_id0, ( long )ir_comm_id );
printf( "work ids: %4ld %4ld %4ld %4ld %2ld|%2ld %2ld|%2ld %2ld|%2ld\n",
( long )jc_work_id,
( long )pc_work_id,
( long )pb_work_id,
( long )ic_work_id,
( long )pa_work_id0, ( long )pa_work_id,
( long )jr_work_id0, ( long )jr_work_id,
( long )ir_work_id0, ( long )ir_work_id );
printf( "--------------------------------------------------\n" );
}
}
// -----------------------------------------------------------------------------
void bli_l3_thrinfo_free_paths
(
rntm_t* rntm,
thrinfo_t** threads
)
{
dim_t n_threads = bli_thread_num_threads( threads[0] );
dim_t i;
for ( i = 0; i < n_threads; ++i )
bli_l3_thrinfo_free( rntm, threads[i] );
bli_free_intl( threads );
}
|