]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
env.c (gomp_affinity_format_var): Use %i instead of %T and %A instead of %a.
authorJakub Jelinek <jakub@redhat.com>
Mon, 8 Oct 2018 11:57:38 +0000 (13:57 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 8 Oct 2018 11:57:38 +0000 (13:57 +0200)
* env.c (gomp_affinity_format_var): Use %i instead of %T and
%A instead of %a.
* affinity-fmt.c (affinity_types): Change short forms h to H,
a to A, A to a and T to i.  Change long forms thread_level to
nesting_level and thread_identifier to native_thread_id.  Add
team_num/t and num_teams/T entries.
(gomp_display_affinity): Adjust for the above changes.
* testsuite/libgomp.c-c++-common/display-affinity-1.c: Likewise.
Add test also for %{team_num}, %{num_teams}, %t and %T.
* testsuite/libgomp.fortran/display-affinity-1.f90: Likewise.

From-SVN: r264920

libgomp/ChangeLog.gomp
libgomp/affinity-fmt.c
libgomp/env.c
libgomp/testsuite/libgomp.c-c++-common/display-affinity-1.c
libgomp/testsuite/libgomp.fortran/display-affinity-1.f90

index 5e0b98cfe60fe3622f2ec596b469eb0372f5dcbc..cadbcb05c247436608df1977809e8c09ac33ace8 100644 (file)
@@ -1,3 +1,16 @@
+2018-10-08  Jakub Jelinek  <jakub@redhat.com>
+
+       * env.c (gomp_affinity_format_var): Use %i instead of %T and
+       %A instead of %a.
+       * affinity-fmt.c (affinity_types): Change short forms h to H,
+       a to A, A to a and T to i.  Change long forms thread_level to
+       nesting_level and thread_identifier to native_thread_id.  Add
+       team_num/t and num_teams/T entries.
+       (gomp_display_affinity): Adjust for the above changes.
+       * testsuite/libgomp.c-c++-common/display-affinity-1.c: Likewise.
+       Add test also for %{team_num}, %{num_teams}, %t and %T.
+       * testsuite/libgomp.fortran/display-affinity-1.f90: Likewise.
+
 2018-09-27  Jakub Jelinek  <jakub@redhat.com>
 
        * testsuite/libgomp.c++/task-reduction-5.C (main): Add forgotten
index 871305c7f5b4f8c979d600e15f97800dcbd5ec67..08937b69d4e43930916bb40e4b80220d5bb11f8a 100644 (file)
@@ -237,14 +237,16 @@ static struct affinity_types_struct affinity_types[] =
 {
 #define AFFINITY_TYPE(l, s) \
   { #l, sizeof (#l) - 1, s }
-  AFFINITY_TYPE (thread_level, 'L'),
+  AFFINITY_TYPE (team_num, 't'),
+  AFFINITY_TYPE (num_teams, 'T'),
+  AFFINITY_TYPE (nesting_level, 'L'),
   AFFINITY_TYPE (thread_num, 'n'),
-  AFFINITY_TYPE (host, 'h'),
-  AFFINITY_TYPE (process_id, 'P'),
-  AFFINITY_TYPE (thread_identifier, 'T'),
   AFFINITY_TYPE (num_threads, 'N'),
-  AFFINITY_TYPE (ancestor_tnum, 'A'),
-  AFFINITY_TYPE (thread_affinity, 'a')
+  AFFINITY_TYPE (ancestor_tnum, 'a'),
+  AFFINITY_TYPE (host, 'H'),
+  AFFINITY_TYPE (process_id, 'P'),
+  AFFINITY_TYPE (native_thread_id, 'i'),
+  AFFINITY_TYPE (thread_affinity, 'A')
 #undef AFFINITY_TYPE
 };
 
@@ -324,13 +326,25 @@ gomp_display_affinity (char *buffer, size_t size,
        }
       switch (c)
        {
+       case 't':
+         val = omp_get_team_num ();
+         goto do_int;
+       case 'T':
+         val = omp_get_num_teams ();
+         goto do_int;
        case 'L':
          val = ts->level;
          goto do_int;
        case 'n':
          val = ts->team_id;
          goto do_int;
-       case 'h':
+       case 'N':
+         val = ts->team ? ts->team->nthreads : 1;
+         goto do_int;
+       case 'a':
+         val = ts->team ? ts->team->prev_ts.team_id : -1;
+         goto do_int;
+       case 'H':
          gomp_display_hostname (buffer, size, &ret, right, sz);
          break;
        case 'P':
@@ -340,7 +354,7 @@ gomp_display_affinity (char *buffer, size_t size,
          val = 0;
 #endif
          goto do_int;
-       case 'T':
+       case 'i':
 #if defined(LIBGOMP_USE_PTHREADS) && defined(__GNUC__)
          /* Handle integral pthread_t.  */
          if (__builtin_classify_type (handle) == 1)
@@ -373,13 +387,7 @@ gomp_display_affinity (char *buffer, size_t size,
 #endif
          val = 0;
          goto do_int;
-       case 'N':
-         val = ts->team ? ts->team->nthreads : 1;
-         goto do_int;
        case 'A':
-         val = ts->team ? ts->team->prev_ts.team_id : -1;
-         goto do_int;
-       case 'a':
          if (sz == (size_t) -1)
            gomp_display_affinity_place (buffer, size, &ret,
                                         place - 1);
index d37225d41c0e5ecb42c9afeb1d3628e2a12c037f..f32c43fcd039fa2e724073ec66d598f1818698d1 100644 (file)
@@ -89,7 +89,7 @@ unsigned long gomp_places_list_len;
 int gomp_debug_var;
 unsigned int gomp_num_teams_var;
 bool gomp_display_affinity_var;
-char *gomp_affinity_format_var = "level %L thread %T affinity %a";
+char *gomp_affinity_format_var = "level %L thread %i affinity %A";
 size_t gomp_affinity_format_len;
 char *goacc_device_type;
 int goacc_device_num;
index 21aaf94be2623c8b1b8720425d399e1e091fa153..a67bb37f1f0a582488beb204d3f4b1a9908f5e16 100644 (file)
@@ -10,7 +10,7 @@
 int
 main ()
 {
-#define FMT "L:%0.5L%%%n>%32h<!%.33{host}!%.6P_%T_%0.18T_%0.7{ancestor_tnum} %18a"
+#define FMT "L:%0.5L%%%n>%32H<!%.33{host}!%.6P_%i_%0.18i_%0.7{ancestor_tnum} %18A"
   char buf[] = FMT, hostname[256], buf2[512 + 32], *q;
   size_t l, l2, l3;
   char *r = getenv ("OMP_AFFINITY_FORMAT");
@@ -52,12 +52,12 @@ main ()
       if (strlen (hostname) != l)
        abort ();
       l2 = omp_capture_affinity (NULL, 0,
-                                "%0.5{thread_level}%%%32{host}|||%.33h"
-                                "%0.7A%3N!%N!");
+                                "%0.5{nesting_level}%%%32{host}|||%.33H"
+                                "%0.7a%3N!%N!");
       if (l2 != (5 + 1 + (l > 32 ? l : 32) + 3 + (l > 33 ? l : 33)
                 + 7 + 3 + 1 + 1 + 1))
        abort ();
-      omp_set_affinity_format ("%.5L%%%32h|||%.33{host}%0.7{ancestor_tnum}"
+      omp_set_affinity_format ("%.5L%%%32H|||%.33{host}%0.7{ancestor_tnum}"
                               "%3{num_threads}!%{num_threads}!");
       l3 = omp_capture_affinity (buf2, sizeof buf2, "");
       if (l3 != l2)
@@ -86,6 +86,6 @@ main ()
        abort ();
     }
   #pragma omp parallel num_threads (4) proc_bind(spread)
-  omp_display_affinity ("%0.2A!%n!%.4L!%N;%a");
+  omp_display_affinity ("%0.2a!%n!%.4L!%N;%.2t;%0.2T;%{team_num};%{num_teams};%A");
   return 0;
 }
index 418d9a2b682815a93b29ad4cf2809607705393ba..4811b6f801b96e6cc12d05e839a63e619688732f 100644 (file)
@@ -9,7 +9,7 @@
   character(len=1) :: buf4
   integer :: l1, l2
 
-  buf = 'L:%0.5L%%%n>%32h<!%.33{host}!%.6P_%T_%0.18T_%0.7{ancestor_tnum} %18a'
+  buf = 'L:%0.5L%%%n>%32H<!%.33{host}!%.6P_%i_%0.18i_%0.7{ancestor_tnum} %18A'
   call omp_set_affinity_format (format = buf)
   if (omp_get_affinity_format (buf4) /= 68) stop 1
   if (buf4 /= 'L') stop 2
@@ -19,7 +19,7 @@
   if (buf3 /= 'L:%0.5L%') stop 6
   call omp_display_affinity ('')
   call omp_display_affinity ('%%%0.9N')
-  l1 = omp_capture_affinity (buf4, '%0.5{thread_level}%%|||%0.7A%3N!%N!')
+  l1 = omp_capture_affinity (buf4, '%0.5{nesting_level}%%|||%0.7a%3N!%N!')
   buf = '%.5L%%|||%0.7{ancestor_tnum}%3{num_threads}!%{num_threads}!'
   call omp_set_affinity_format (trim (buf))
   l2 = omp_capture_affinity (buf2, '')
@@ -28,6 +28,7 @@
   if (buf2 /= '    0%|||-0000011  !1!') stop 9
   if (buf4 /= '0') stop 10
 !$omp parallel num_threads (4) proc_bind(spread)
-  call omp_display_affinity ('%0.2A!%n!%.4L!%N;%a')
+  call omp_display_affinity ('%0.2a!%n!%.4L!%N;%.2t;%0.2T;&
+                             &%{team_num};%{num_teams};%A')
 !$omp end parallel
 end