325 int T,
i,
j, place, low, high, first, last,
count, current_place, num_places;
326 const int *place_nums;
327 int P =
parent->num_places;
333 for (
i = 0;
i < nchildren; ++
i)
335 partitions[T++] = children[
i];
337 if (proc_bind != omp_proc_bind_spread && proc_bind != omp_proc_bind_close &&
338 proc_bind != omp_proc_bind_master)
340 "Cannot check this proc bind type\n");
342 if (proc_bind == omp_proc_bind_spread) {
345 for (
i = 0;
i < T; ++
i) {
346 partition = partitions[
i];
352 high = P / T + (P % T ? 1 : 0);
353 if (num_places != low && num_places != high) {
355 "Incorrect number of places for thread %d: %d. "
356 "Expecting between %d and %d\n",
357 i, num_places, low, high);
360 for (
j = 1;
j < num_places; ++
j) {
361 if (place_nums[
j] != (place_nums[
j - 1] + 1) % P) {
363 "Not consecutive places: %d, %d in partition\n",
364 place_nums[
j - 1], place_nums[
j]);
367 first = place_nums[0];
368 last = place_nums[num_places - 1];
371 if (current_place !=
parent->current_place) {
374 "Primary thread not on same place (%d) as parent thread (%d)\n",
375 current_place,
parent->current_place);
379 if (current_place != first) {
381 "Thread's current place (%d) is not the first place "
382 "in its partition [%d, %d]\n",
383 current_place, first, last);
389 for (
j = 0;
j <
i; ++
j) {
392 if (f1 > l1 && f2 > l2) {
394 "partitions intersect. [%d, %d] and [%d, %d]\n", f1,
397 if (f1 > l1 && f2 <= l2)
398 if (f1 < l2 || l1 > f2) {
400 "partitions intersect. [%d, %d] and [%d, %d]\n", f1,
403 if (f1 <= l1 && f2 > l2)
404 if (f2 < l1 || l2 > f1) {
406 "partitions intersect. [%d, %d] and [%d, %d]\n", f1,
409 if (f1 <= l1 && f2 <= l2)
410 if (!(f2 > l1 || l2 < f1)) {
412 "partitions intersect. [%d, %d] and [%d, %d]\n", f1,
420 for (
i = 0;
i < T; ++
i) {
421 if (partitions[
i]->num_places != 1) {
424 "Incorrect number of places for thread %d: %d. Expecting 1\n",
i,
425 partitions[
i]->num_places);
430 high = T / P + (T % P ? 1 : 0);
431 for (
i = 1,
count = 1;
i < T; ++
i) {
432 if (partitions[
i]->place_nums[0] == partitions[
i - 1]->place_nums[0]) {
437 "Too many threads have place %d for their partition\n",
438 partitions[
i]->place_nums[0]);
444 "Not enough threads have place %d for their partition\n",
445 partitions[
i]->place_nums[0]);
452 if (
parent->current_place != -1 &&
453 current_place !=
parent->current_place) {
456 "Primary thread not on same place (%d) as parent thread (%d)\n",
457 current_place,
parent->current_place);
460 }
else if (proc_bind == omp_proc_bind_close ||
461 proc_bind == omp_proc_bind_master) {
463 for (
i = 0;
i < T; ++
i) {
464 partition = partitions[
i];
468 if (
parent->num_places != num_places) {
470 "Number of places in subpartition (%d) does not match "
472 num_places,
parent->num_places);
474 for (
j = 0;
j < num_places; ++
j) {
475 if (
parent->place_nums[
j] != place_nums[
j]) {
477 "Subpartition place (%d) does not match "
478 "parent partition place (%d)\n",
479 place_nums[
j],
parent->place_nums[
j]);
487 if (proc_bind == omp_proc_bind_close) {
491 for (
i = 0;
i < T; ++
i) {
492 partition = partitions[
i];
494 if (current_place !=
parent->place_nums[
j]) {
497 "Thread %d's current place (%d) is incorrect. expected %d\n",
i,
498 current_place,
parent->place_nums[
j]);
506 high = T / P + (T % P ? 1 : 0);
508 if (partitions[0]->current_place !=
parent->current_place) {
511 "Primary thread's place (%d) is not parent thread's place (%d)\n",
512 partitions[0]->current_place,
parent->current_place);
514 for (
i = 1;
i < T; ++
i) {
516 if (current_place ==
parent->place_nums[
j]) {
521 "Too many threads have place %d for their current place\n",
528 "Not enough threads have place %d for their current place\n",
532 if (current_place !=
parent->place_nums[
j]) {
535 "Thread %d's place (%d) is not corret. Expected %d\n",
i,
536 partitions[
i]->current_place,
parent->place_nums[
j]);
545 for (
i = 0;
i < T; ++
i) {
546 if (partitions[
i]->current_place !=
parent->current_place) {
549 "Thread %d's place (%d) is not the primary thread's place (%d)\n",
550 i, partitions[
i]->current_place,
parent->current_place);
557 for (
i = 0;
i < T; ++
i) {
562 for (
j = 0;
j < num_places; ++
j)
563 if (partitions[
i]->place_nums[
j] == current_place)
565 if (
j == num_places) {
567 "Thread %d's current place (%d) is not within its "
568 "partition [%d, %d]\n",
569 i, current_place, first, last);