]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
OpenMP 5.1: Add proc-bind 'primary' support
authorTobias Burnus <tobias@codesourcery.com>
Mon, 16 Aug 2021 07:05:02 +0000 (09:05 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Mon, 16 Aug 2021 07:05:02 +0000 (09:05 +0200)
In OpenMP 5.1 "master thread" was changed to "primary thread" and
the proc_bind clause and the OMP_PROC_BIND environment variable
now take 'primary' as argument as alias for 'master', while the
latter is deprecated.
This commit accepts 'primary' and adds the named constant
omp_proc_bind_primary and changes 'master thread' in the
documentation; however, given that not even OpenMP 5.0 is
fully supported, omp_display_env and the dumps currently
still output 'master' and there is no deprecation warning
when using the 'master' in the proc_bind clause.

gcc/c/ChangeLog:

* c-parser.c (c_parser_omp_clause_proc_bind): Accept
'primary' as alias for 'master'.

gcc/cp/ChangeLog:

* parser.c (cp_parser_omp_clause_proc_bind): Accept
'primary' as alias for 'master'.

gcc/fortran/ChangeLog:

* gfortran.h (gfc_omp_proc_bind_kind): Add OMP_PROC_BIND_PRIMARY.
* dump-parse-tree.c (show_omp_clauses): Add TODO comment to
change 'master' to 'primary' in proc_bind for OpenMP 5.1.
* intrinsic.texi (OMP_LIB): Mention OpenMP 5.1; add
omp_proc_bind_primary.
* openmp.c (gfc_match_omp_clauses): Accept
'primary' as alias for 'master'.
* trans-openmp.c (gfc_trans_omp_clauses): Handle
OMP_PROC_BIND_PRIMARY.

gcc/ChangeLog:

* tree-core.h (omp_clause_proc_bind_kind): Add
OMP_CLAUSE_PROC_BIND_PRIMARY.
* tree-pretty-print.c (dump_omp_clause): Add TODO comment to
change 'master' to 'primary' in proc_bind for OpenMP 5.1.

libgomp/ChangeLog:

* env.c (parse_bind_var): Accept 'primary' as alias for
'master'.
(omp_display_env): Add TODO comment to
change 'master' to 'primary' in proc_bind for OpenMP 5.1.
* libgomp.texi: Change 'master thread' to 'primary thread'
in line with OpenMP 5.1.
(omp_get_proc_bind): Add omp_proc_bind_primary and note that
omp_proc_bind_master is an alias of it.
(OMP_PROC_BIND): Mention 'PRIMARY'.
* omp.h.in (__GOMP_DEPRECATED_5_1): Define.
(omp_proc_bind_primary): Add.
(omp_proc_bind_master): Deprecate for OpenMP 5.1.
* omp_lib.f90.in (omp_proc_bind_primary): Add.
(omp_proc_bind_master): Deprecate for OpenMP 5.1.
* omp_lib.h.in (omp_proc_bind_primary): Add.
* testsuite/libgomp.c/affinity-1.c: Check that
'primary' works and is identical to 'master'.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/pr61486-2.c: Duplicate one proc_bind(master)
testcase and test proc_bind(primary) instead.
* gfortran.dg/gomp/affinity-1.f90: Likewise.

(cherry picked from commit 432de08498142d2266c0fb05f2c555a7f1e10ddd)

23 files changed:
gcc/ChangeLog.omp
gcc/c/ChangeLog.omp
gcc/c/c-parser.c
gcc/cp/ChangeLog.omp
gcc/cp/parser.c
gcc/fortran/ChangeLog.omp
gcc/fortran/dump-parse-tree.c
gcc/fortran/gfortran.h
gcc/fortran/intrinsic.texi
gcc/fortran/openmp.c
gcc/fortran/trans-openmp.c
gcc/testsuite/ChangeLog.omp
gcc/testsuite/c-c++-common/gomp/pr61486-2.c
gcc/testsuite/gfortran.dg/gomp/affinity-1.f90
gcc/tree-core.h
gcc/tree-pretty-print.c
libgomp/ChangeLog.omp
libgomp/env.c
libgomp/libgomp.texi
libgomp/omp.h.in
libgomp/omp_lib.f90.in
libgomp/omp_lib.h.in
libgomp/testsuite/libgomp.c/affinity-1.c

index f48d9b01b37924b1975d87b6058c199c763e4bf1..cb4be9369306d0ecff0861d1aa062adea3ed3a39 100644 (file)
@@ -1,3 +1,13 @@
+2021-08-16  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-08-12  Tobias Burnus  <tobias@codesourcery.com>
+
+       * tree-core.h (omp_clause_proc_bind_kind): Add
+       OMP_CLAUSE_PROC_BIND_PRIMARY.
+       * tree-pretty-print.c (dump_omp_clause): Add TODO comment to
+       change 'master' to 'primary' in proc_bind for OpenMP 5.1.
+
 2021-07-26  Thomas Schwinge  <thomas@codesourcery.com>
 
        Backported from master:
index b62d425ef955af5407aa4f5f23959a4c12afd2f4..db3dff6e8b7740ff3e93d4a791d52e4e1a475bd2 100644 (file)
@@ -1,3 +1,11 @@
+2021-08-16  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-08-12  Tobias Burnus  <tobias@codesourcery.com>
+
+       * c-parser.c (c_parser_omp_clause_proc_bind): Accept
+       'primary' as alias for 'master'.
+
 2021-07-19  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index e82fbb890da3e3c9affff9c7f031bc07fb0007fd..c028095fc24115eeb6fb885c20009e6e211a6831 100644 (file)
@@ -15977,7 +15977,8 @@ c_parser_omp_clause_dist_schedule (c_parser *parser, tree list)
    proc_bind ( proc-bind-kind )
 
    proc-bind-kind:
-     master | close | spread  */
+     primary | master | close | spread
+   where OpenMP 5.1 added 'primary' and deprecated the alias 'master'.  */
 
 static tree
 c_parser_omp_clause_proc_bind (c_parser *parser, tree list)
@@ -15993,7 +15994,9 @@ c_parser_omp_clause_proc_bind (c_parser *parser, tree list)
   if (c_parser_next_token_is (parser, CPP_NAME))
     {
       const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
-      if (strcmp ("master", p) == 0)
+      if (strcmp ("primary", p) == 0)
+       kind = OMP_CLAUSE_PROC_BIND_PRIMARY;
+      else if (strcmp ("master", p) == 0)
        kind = OMP_CLAUSE_PROC_BIND_MASTER;
       else if (strcmp ("close", p) == 0)
        kind = OMP_CLAUSE_PROC_BIND_CLOSE;
index b2a41e15f9da6dfc75175793273830fdde0bd50d..b6d196a245b1ec74d1dff87575328d7a9a288e7d 100644 (file)
@@ -1,3 +1,11 @@
+2021-08-16  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-08-12  Tobias Burnus  <tobias@codesourcery.com>
+
+       * parser.c (cp_parser_omp_clause_proc_bind): Accept
+       'primary' as alias for 'master'.
+
 2021-08-12  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index 7e8361d307d1a5cec369604622acf523c61684c6..6ffe43a7870d50a9fca99460b846f4d84b872c88 100644 (file)
@@ -38855,7 +38855,8 @@ cp_parser_omp_clause_dist_schedule (cp_parser *parser, tree list,
    proc_bind ( proc-bind-kind )
 
    proc-bind-kind:
-     master | close | spread  */
+     primary | master | close | spread
+   where OpenMP 5.1 added 'primary' and deprecated the alias 'master'.  */
 
 static tree
 cp_parser_omp_clause_proc_bind (cp_parser *parser, tree list,
@@ -38872,7 +38873,9 @@ cp_parser_omp_clause_proc_bind (cp_parser *parser, tree list,
       tree id = cp_lexer_peek_token (parser->lexer)->u.value;
       const char *p = IDENTIFIER_POINTER (id);
 
-      if (strcmp ("master", p) == 0)
+      if (strcmp ("primary", p) == 0)
+       kind = OMP_CLAUSE_PROC_BIND_PRIMARY;
+      else if (strcmp ("master", p) == 0)
        kind = OMP_CLAUSE_PROC_BIND_MASTER;
       else if (strcmp ("close", p) == 0)
        kind = OMP_CLAUSE_PROC_BIND_CLOSE;
index 2a3bafe3810fb512ca1a5431c3705dc04a0c2532..2c220fcf25efe24c6e0e0d5af4d12de27db8fe5f 100644 (file)
@@ -1,3 +1,18 @@
+2021-08-16  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-08-12  Tobias Burnus  <tobias@codesourcery.com>
+
+       * gfortran.h (gfc_omp_proc_bind_kind): Add OMP_PROC_BIND_PRIMARY.
+       * dump-parse-tree.c (show_omp_clauses): Add TODO comment to
+       change 'master' to 'primary' in proc_bind for OpenMP 5.1.
+       * intrinsic.texi (OMP_LIB): Mention OpenMP 5.1; add
+       omp_proc_bind_primary.
+       * openmp.c (gfc_match_omp_clauses): Accept
+       'primary' as alias for 'master'.
+       * trans-openmp.c (gfc_trans_omp_clauses): Handle
+       OMP_PROC_BIND_PRIMARY.
+
 2021-07-27  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index 26841eefb7ddbe147b1b29d1f63f19fa7a44b332..e1882bdcba2730ce0d3a031ecb9c7965dbc2a2b3 100644 (file)
@@ -1710,6 +1710,7 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses)
       const char *type;
       switch (omp_clauses->proc_bind)
        {
+       case OMP_PROC_BIND_PRIMARY: type = "PRIMARY"; break;
        case OMP_PROC_BIND_MASTER: type = "MASTER"; break;
        case OMP_PROC_BIND_SPREAD: type = "SPREAD"; break;
        case OMP_PROC_BIND_CLOSE: type = "CLOSE"; break;
index 5fe40e2330de0e18cf3c98f43494226c954c68cb..5c6462fc90312dc2144e388159e8eaff1f706d11 100644 (file)
@@ -1364,6 +1364,7 @@ enum gfc_omp_default_sharing
 enum gfc_omp_proc_bind_kind
 {
   OMP_PROC_BIND_UNKNOWN,
+  OMP_PROC_BIND_PRIMARY,
   OMP_PROC_BIND_MASTER,
   OMP_PROC_BIND_SPREAD,
   OMP_PROC_BIND_CLOSE
index c9049b539d5afe47d7884caa3759301db4758200..85e8e0e7c98c0b08381250473c7e27f93b3a5434 100644 (file)
@@ -15293,8 +15293,9 @@ with the following options: @code{-fno-unsafe-math-optimizations
 @section OpenMP Modules @code{OMP_LIB} and @code{OMP_LIB_KINDS}
 @table @asis
 @item @emph{Standard}:
-OpenMP Application Program Interface v4.5 and
-OpenMP Application Program Interface v5.0 (partially supported).
+OpenMP Application Program Interface v4.5,
+OpenMP Application Program Interface v5.0 (partially supported) and
+OpenMP Application Program Interface v5.1 (partially supported).
 @end table
 
 The OpenMP Fortran runtime library routines are provided both in
@@ -15357,6 +15358,7 @@ kind @code{omp_proc_bind_kind}:
 @table @asis
 @item @code{omp_proc_bind_false}
 @item @code{omp_proc_bind_true}
+@item @code{omp_proc_bind_primary}
 @item @code{omp_proc_bind_master}
 @item @code{omp_proc_bind_close}
 @item @code{omp_proc_bind_spread}
index 0d73adf642615169622d0b6f84a1cd8e56763a24..31bbfa02eaa97e9e03c17fbadbeae77d73b02d18 100644 (file)
@@ -2232,7 +2232,10 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
          if ((mask & OMP_CLAUSE_PROC_BIND)
              && c->proc_bind == OMP_PROC_BIND_UNKNOWN)
            {
-             if (gfc_match ("proc_bind ( master )") == MATCH_YES)
+             /* Primary is new and master is deprecated in OpenMP 5.1.  */
+             if (gfc_match ("proc_bind ( primary )") == MATCH_YES)
+               c->proc_bind = OMP_PROC_BIND_MASTER;
+             else if (gfc_match ("proc_bind ( master )") == MATCH_YES)
                c->proc_bind = OMP_PROC_BIND_MASTER;
              else if (gfc_match ("proc_bind ( spread )") == MATCH_YES)
                c->proc_bind = OMP_PROC_BIND_SPREAD;
index 5ab83b00688b839fcb9b04ee3ef69d6c5e3b55e3..4f262a8e77e6fa6a441fd42de2bb5ede1c4901a0 100644 (file)
@@ -3890,6 +3890,9 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
       c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_PROC_BIND);
       switch (clauses->proc_bind)
        {
+       case OMP_PROC_BIND_PRIMARY:
+         OMP_CLAUSE_PROC_BIND_KIND (c) = OMP_CLAUSE_PROC_BIND_PRIMARY;
+         break;
        case OMP_PROC_BIND_MASTER:
          OMP_CLAUSE_PROC_BIND_KIND (c) = OMP_CLAUSE_PROC_BIND_MASTER;
          break;
index 802ca90127de4c62011e2b98f86ae5adf09de7a2..3e55b54bb05b8f471d97965120512f21671f26e0 100644 (file)
@@ -1,3 +1,12 @@
+2021-08-16  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-08-12  Tobias Burnus  <tobias@codesourcery.com>
+
+       * c-c++-common/gomp/pr61486-2.c: Duplicate one proc_bind(master)
+       testcase and test proc_bind(primary) instead.
+       * gfortran.dg/gomp/affinity-1.f90: Likewise.
+
 2021-08-12  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index 4a680235fa1ea46fef8089b1ea2e897544c6834f..c86fd9184942c4b0bf85f227b0b2b7ed7bee6525 100644 (file)
@@ -216,6 +216,19 @@ test (int n, int o, int p, int q, int r, int s, int *pp)
          s = i * 10;
        }
     #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2])
+    #pragma omp teams distribute parallel for simd if (n != 6)default(shared) \
+       private (p) firstprivate (q) shared (n) reduction (+: r) \
+       thread_limit (n * 2) dist_schedule (static, 4) num_threads (n + 4) \
+       proc_bind (primary) lastprivate (s) schedule (static, 8) \
+       num_teams (n + 4) safelen(16) linear(i:1) aligned (pp:4)
+      for (i = 0; i < 10; i++)
+       {
+         r = r + 1;
+         p = q;
+         a[2+i] = p + q;
+         s = i * 10;
+       }
+    #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2])
     #pragma omp teams distribute simd default(shared) \
        private (p) firstprivate (q) shared (n) reduction (+: r) \
        thread_limit (n * 2) dist_schedule (static, 4) collapse (2) \
index b6e20b9ce63fe58e1fd12543f1461ef8a1172faa..cb1543b6b189e8d5252007630dc362791bed1ce5 100644 (file)
@@ -9,6 +9,15 @@
     j = 8
   end do
 !$omp end parallel do
+!$omp parallel do default(none)proc_bind(primary)shared(a)
+  do i = 1, 10
+    j = 4
+    do j = 1, 10
+      a(i, j) = i + j
+    end do
+    j = 8
+  end do
+!$omp end parallel do
 !$omp parallel proc_bind (close)
 !$omp parallel default(none) proc_bind (spread) firstprivate(a) private (i)
   do i = 1, 10
index b0e6979af0ffff1824e93b82321bc6a08a82ee2c..c3e590b11ac31770e541c2e863b4fc9e291c6d8c 100644 (file)
@@ -1492,6 +1492,7 @@ enum omp_clause_proc_bind_kind
   /* Numbers should match omp_proc_bind_t enum in omp.h.  */
   OMP_CLAUSE_PROC_BIND_FALSE = 0,
   OMP_CLAUSE_PROC_BIND_TRUE = 1,
+  OMP_CLAUSE_PROC_BIND_PRIMARY = 2,
   OMP_CLAUSE_PROC_BIND_MASTER = 2,
   OMP_CLAUSE_PROC_BIND_CLOSE = 3,
   OMP_CLAUSE_PROC_BIND_SPREAD = 4,
index c03ee3d1f1fd896b1225b53fc347b09f0f9fb13c..81005e4712e9a3b3a922040ec762ee59b4977491 100644 (file)
@@ -1059,6 +1059,8 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
       switch (OMP_CLAUSE_PROC_BIND_KIND (clause))
        {
        case OMP_CLAUSE_PROC_BIND_MASTER:
+         /* Same enum value: case OMP_CLAUSE_PROC_BIND_PRIMARY: */
+         /* TODO: Change to 'primary' for OpenMP 5.1.  */
          pp_string (pp, "master");
          break;
        case OMP_CLAUSE_PROC_BIND_CLOSE:
index 3a3299b17a0efc2c14e3967858beef3c07fe0052..d0f711777554a4bab1db5ec6c020dc51216c6b88 100644 (file)
@@ -1,3 +1,26 @@
+2021-08-16  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-08-12  Tobias Burnus  <tobias@codesourcery.com>
+
+       * env.c (parse_bind_var): Accept 'primary' as alias for
+       'master'.
+       (omp_display_env): Add TODO comment to
+       change 'master' to 'primary' in proc_bind for OpenMP 5.1.
+       * libgomp.texi: Change 'master thread' to 'primary thread'
+       in line with OpenMP 5.1.
+       (omp_get_proc_bind): Add omp_proc_bind_primary and note that
+       omp_proc_bind_master is an alias of it.
+       (OMP_PROC_BIND): Mention 'PRIMARY'.
+       * omp.h.in (__GOMP_DEPRECATED_5_1): Define.
+       (omp_proc_bind_primary): Add.
+       (omp_proc_bind_master): Deprecate for OpenMP 5.1.
+       * omp_lib.f90.in (omp_proc_bind_primary): Add.
+       (omp_proc_bind_master): Deprecate for OpenMP 5.1.
+       * omp_lib.h.in (omp_proc_bind_primary): Add.
+       * testsuite/libgomp.c/affinity-1.c: Check that
+       'primary' works and is identical to 'master'.
+
 2021-08-09  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index 5220877d533b591cd0f5d964a9d88ea5ff5f1b8b..9216998f6f7bbfbe2bc86700826e718a2425753a 100644 (file)
@@ -437,6 +437,7 @@ parse_bind_var (const char *name, char *p1stvalue,
     { "false", 5, omp_proc_bind_false },
     { "true", 4, omp_proc_bind_true },
     { "master", 6, omp_proc_bind_master },
+    { "primary", 7, omp_proc_bind_primary },
     { "close", 5, omp_proc_bind_close },
     { "spread", 6, omp_proc_bind_spread }
   };
@@ -450,14 +451,14 @@ parse_bind_var (const char *name, char *p1stvalue,
   if (*env == '\0')
     goto invalid;
 
-  for (i = 0; i < 5; i++)
+  for (i = 0; i < 6; i++)
     if (strncasecmp (env, kinds[i].name, kinds[i].len) == 0)
       {
        value = kinds[i].kind;
        env += kinds[i].len;
        break;
       }
-  if (i == 5)
+  if (i == 6)
     goto invalid;
 
   while (isspace ((unsigned char) *env))
@@ -497,14 +498,14 @@ parse_bind_var (const char *name, char *p1stvalue,
              if (*env == '\0')
                goto invalid;
 
-             for (i = 2; i < 5; i++)
+             for (i = 2; i < 6; i++)
                if (strncasecmp (env, kinds[i].name, kinds[i].len) == 0)
                  {
                    value = kinds[i].kind;
                    env += kinds[i].len;
                    break;
                  }
-             if (i == 5)
+             if (i == 6)
                goto invalid;
 
              values[nvalues++] = value;
@@ -1277,7 +1278,7 @@ omp_display_env (int verbose)
       fputs ("TRUE", stderr);
       break;
     case omp_proc_bind_master:
-      fputs ("MASTER", stderr);
+      fputs ("MASTER", stderr); /* TODO: Change to PRIMARY for OpenMP 5.1.  */
       break;
     case omp_proc_bind_close:
       fputs ("CLOSE", stderr);
@@ -1290,7 +1291,7 @@ omp_display_env (int verbose)
     switch (gomp_bind_var_list[i])
       {
       case omp_proc_bind_master:
-       fputs (",MASTER", stderr);
+       fputs (",MASTER", stderr); /* TODO: Change to PRIMARY for OpenMP 5.1. */
        break;
       case omp_proc_bind_close:
        fputs (",CLOSE", stderr);
index 2ee6f31fec4a3c288e7f86ed43f37d91e946eee6..472c285055089a7a6507ae0db30b39f6c551aeb4 100644 (file)
@@ -660,8 +660,9 @@ one thread per CPU online is used.
 @item @emph{Description}:
 This functions returns the currently active thread affinity policy, which is
 set via @env{OMP_PROC_BIND}.  Possible values are @code{omp_proc_bind_false},
-@code{omp_proc_bind_true}, @code{omp_proc_bind_master},
-@code{omp_proc_bind_close} and @code{omp_proc_bind_spread}.
+@code{omp_proc_bind_true}, @code{omp_proc_bind_primary},
+@code{omp_proc_bind_master}, @code{omp_proc_bind_close} and @code{omp_proc_bind_spread},
+where @code{omp_proc_bind_master} is an alias for @code{omp_proc_bind_primary}.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
@@ -822,7 +823,7 @@ Returns a unique thread identification number within the current team.
 In a sequential parts of the program, @code{omp_get_thread_num}
 always returns 0.  In parallel regions the return value varies
 from 0 to @code{omp_get_num_threads}-1 inclusive.  The return
-value of the master thread of a team is always 0.
+value of the primary thread of a team is always 0.
 
 @item @emph{C/C++}:
 @multitable @columnfractions .20 .80
@@ -1670,11 +1671,12 @@ nesting by default.  If undefined one thread per CPU is used.
 Specifies whether threads may be moved between processors.  If set to
 @code{TRUE}, OpenMP theads should not be moved; if set to @code{FALSE}
 they may be moved.  Alternatively, a comma separated list with the
-values @code{MASTER}, @code{CLOSE} and @code{SPREAD} can be used to specify
-the thread affinity policy for the corresponding nesting level.  With
-@code{MASTER} the worker threads are in the same place partition as the
-master thread.  With @code{CLOSE} those are kept close to the master thread
-in contiguous place partitions.  And with @code{SPREAD} a sparse distribution
+values @code{PRIMARY}, @code{MASTER}, @code{CLOSE} and @code{SPREAD} can
+be used to specify the thread affinity policy for the corresponding nesting
+level.  With @code{PRIMARY} and @code{MASTER} the worker threads are in the
+same place partition as the primary thread.  With @code{CLOSE} those are
+kept close to the primary thread in contiguous place partitions.  And
+with @code{SPREAD} a sparse distribution
 across the place partitions is used.  Specifying more than one item in the
 list will automatically enable nesting by default.
 
@@ -1951,23 +1953,23 @@ instance.
 @item @code{$<priority>} is an optional priority for the worker threads of a
 thread pool according to @code{pthread_setschedparam}.  In case a priority
 value is omitted, then a worker thread will inherit the priority of the OpenMP
-master thread that created it.  The priority of the worker thread is not
-changed after creation, even if a new OpenMP master thread using the worker has
+primary thread that created it.  The priority of the worker thread is not
+changed after creation, even if a new OpenMP primary thread using the worker has
 a different priority.
 @item @code{@@<scheduler-name>} is the scheduler instance name according to the
 RTEMS application configuration.
 @end itemize
 In case no thread pool configuration is specified for a scheduler instance,
-then each OpenMP master thread of this scheduler instance will use its own
+then each OpenMP primary thread of this scheduler instance will use its own
 dynamically allocated thread pool.  To limit the worker thread count of the
-thread pools, each OpenMP master thread must call @code{omp_set_num_threads}.
+thread pools, each OpenMP primary thread must call @code{omp_set_num_threads}.
 @item @emph{Example}:
 Lets suppose we have three scheduler instances @code{IO}, @code{WRK0}, and
 @code{WRK1} with @env{GOMP_RTEMS_THREAD_POOLS} set to
 @code{"1@@WRK0:3$4@@WRK1"}.  Then there are no thread pool restrictions for
 scheduler instance @code{IO}.  In the scheduler instance @code{WRK0} there is
 one thread pool available.  Since no priority is specified for this scheduler
-instance, the worker thread inherits the priority of the OpenMP master thread
+instance, the worker thread inherits the priority of the OpenMP primary thread
 that created it.  In the scheduler instance @code{WRK1} there are three thread
 pools available and their worker threads run at priority four.
 @end table
@@ -3876,7 +3878,7 @@ if (omp_get_thread_num () == 0)
 @end smallexample
 
 Alternately, we generate two copies of the parallel subfunction
-and only include this in the version run by the master thread.
+and only include this in the version run by the primary thread.
 Surely this is not worthwhile though...
 
 
@@ -4013,7 +4015,7 @@ broadcast would have to happen via SINGLE machinery instead.
 The private struct mentioned in the previous section should have 
 a pointer to an array of the type of the variable, indexed by the 
 thread's @var{team_id}.  The thread stores its final value into the 
-array, and after the barrier, the master thread iterates over the
+array, and after the barrier, the primary thread iterates over the
 array to collect the values.
 
 
index da34a9d98a6b1a19699a864b96dff303098c588b..314f964f8413d381c87953d4af54d552254d4468 100644 (file)
 # define __GOMP_DEPRECATED_5_0
 #endif
 
+#if defined(__GNUC__) && _OPENMP >= 202011
+# define __GOMP_DEPRECATED_5_1 __attribute__((__deprecated__))
+#else
+# define __GOMP_DEPRECATED_5_1
+#endif
+
 #ifndef _LIBGOMP_OMP_LOCK_DEFINED
 #define _LIBGOMP_OMP_LOCK_DEFINED 1
 /* These two structures get edited by the libgomp build process to 
@@ -64,7 +70,9 @@ typedef enum omp_proc_bind_t
 {
   omp_proc_bind_false = 0,
   omp_proc_bind_true = 1,
-  omp_proc_bind_master = 2,
+  omp_proc_bind_primary = 2,
+  omp_proc_bind_master __GOMP_DEPRECATED_5_1
+    = omp_proc_bind_primary,
   omp_proc_bind_close = 3,
   omp_proc_bind_spread = 4
 } omp_proc_bind_t;
index d7e804f4fd50eb68b51b18c34ef39630c38e87f5..6394e65bbf7b66b214401c2d8569e6c763459e4b 100644 (file)
@@ -48,6 +48,8 @@
                  parameter :: omp_proc_bind_false = 0
         integer (omp_proc_bind_kind), &
                  parameter :: omp_proc_bind_true = 1
+        integer (omp_proc_bind_kind), &
+                 parameter :: omp_proc_bind_primary = 2
         integer (omp_proc_bind_kind), &
                  parameter :: omp_proc_bind_master = 2
         integer (omp_proc_bind_kind), &
 
 #if _OPENMP >= 201811
 !GCC$ ATTRIBUTES DEPRECATED :: omp_get_nested, omp_set_nested
+#endif
+
+#if _OPENMP >= 202011
+!GCC$ ATTRIBUTES DEPRECATED :: omp_proc_bind_master
 #endif
 
       end module omp_lib
index 20c32645e3c4491e7f8b053d5001b2cde266a0c7..f2ad445f9241db482b89ccb8b350e86610e6b9e2 100644 (file)
       parameter (omp_proc_bind_kind = 4)
       integer (omp_proc_bind_kind) omp_proc_bind_false
       integer (omp_proc_bind_kind) omp_proc_bind_true
+      integer (omp_proc_bind_kind) omp_proc_bind_primary
       integer (omp_proc_bind_kind) omp_proc_bind_master
       integer (omp_proc_bind_kind) omp_proc_bind_close
       integer (omp_proc_bind_kind) omp_proc_bind_spread
       parameter (omp_proc_bind_false = 0)
       parameter (omp_proc_bind_true = 1)
+      parameter (omp_proc_bind_primary = 2)
       parameter (omp_proc_bind_master = 2)
       parameter (omp_proc_bind_close = 3)
       parameter (omp_proc_bind_spread = 4)
index 13a743efffd72bff6b0e0957d6b41361790c1c61..574a9f7b69ad81e2f24fa5060027caad99710f65 100644 (file)
@@ -183,20 +183,26 @@ main ()
   int test_false = env_proc_bind && strcmp (env_proc_bind, "false") == 0;
   int test_true = env_proc_bind && strcmp (env_proc_bind, "true") == 0;
   int test_spread_master_close
-    = env_proc_bind && strcmp (env_proc_bind, "spread,master,close") == 0;
+    = (env_proc_bind
+       && (strcmp (env_proc_bind, "spread,master,close") == 0
+          || strcmp (env_proc_bind, "spread,primary,close") == 0));
   char *env_places = getenv ("OMP_PLACES");
   int test_places = 0;
 
+  if (omp_proc_bind_master != omp_proc_bind_primary)
+    abort ();
+
 #ifdef DO_FORK
   if (env_places == NULL && contig_cpucount >= 8 && test_false
       && getenv ("GOMP_AFFINITY") == NULL)
     {
       int i, j, status;
       pid_t pid;
-      for (j = 0; j < 2; j++)
+      for (j = 0; j < 3; j++)
        {
-         if (setenv ("OMP_PROC_BIND", j ? "spread,master,close" : "true", 1)
-             < 0)
+         if (setenv ("OMP_PROC_BIND",
+                     j > 1 ? "spread,primary,close"
+                           : (j ? "spread,master,close" : "true"), 1) < 0)
            break;
          for (i = sizeof (places_array) / sizeof (places_array[0]) - 1;
               i; --i)