From: Jakub Jelinek Date: Mon, 8 Oct 2018 11:57:38 +0000 (+0200) Subject: env.c (gomp_affinity_format_var): Use %i instead of %T and %A instead of %a. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81598272bfbbaf0f815b58e3dae07e636651382d;p=thirdparty%2Fgcc.git env.c (gomp_affinity_format_var): Use %i instead of %T and %A instead of %a. * 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 --- diff --git a/libgomp/ChangeLog.gomp b/libgomp/ChangeLog.gomp index 5e0b98cfe60f..cadbcb05c247 100644 --- a/libgomp/ChangeLog.gomp +++ b/libgomp/ChangeLog.gomp @@ -1,3 +1,16 @@ +2018-10-08 Jakub Jelinek + + * 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 * testsuite/libgomp.c++/task-reduction-5.C (main): Add forgotten diff --git a/libgomp/affinity-fmt.c b/libgomp/affinity-fmt.c index 871305c7f5b4..08937b69d4e4 100644 --- a/libgomp/affinity-fmt.c +++ b/libgomp/affinity-fmt.c @@ -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); diff --git a/libgomp/env.c b/libgomp/env.c index d37225d41c0e..f32c43fcd039 100644 --- a/libgomp/env.c +++ b/libgomp/env.c @@ -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; diff --git a/libgomp/testsuite/libgomp.c-c++-common/display-affinity-1.c b/libgomp/testsuite/libgomp.c-c++-common/display-affinity-1.c index 21aaf94be262..a67bb37f1f0a 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/display-affinity-1.c +++ b/libgomp/testsuite/libgomp.c-c++-common/display-affinity-1.c @@ -10,7 +10,7 @@ int main () { -#define FMT "L:%0.5L%%%n>%32h%32H 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; } diff --git a/libgomp/testsuite/libgomp.fortran/display-affinity-1.f90 b/libgomp/testsuite/libgomp.fortran/display-affinity-1.f90 index 418d9a2b6828..4811b6f801b9 100644 --- a/libgomp/testsuite/libgomp.fortran/display-affinity-1.f90 +++ b/libgomp/testsuite/libgomp.fortran/display-affinity-1.f90 @@ -9,7 +9,7 @@ character(len=1) :: buf4 integer :: l1, l2 - buf = 'L:%0.5L%%%n>%32h%32H