[committed] openmp: Fix handling of numa_domains(1)

Thomas Schwinge thomas@codesourcery.com
Thu Nov 11 13:14:05 GMT 2021


Hi!

On 2021-10-18T15:03:08+0200, Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> On Fri, Oct 15, 2021 at 12:26:34PM -0700, sunil.k.pandey wrote:
>> 4764049dd620affcd3e2658dc7f03a6616370a29 is the first bad commit
>> commit 4764049dd620affcd3e2658dc7f03a6616370a29
>> Author: Jakub Jelinek <jakub@redhat.com>
>> Date:   Fri Oct 15 16:25:25 2021 +0200
>>
>>     openmp: Fix up handling of OMP_PLACES=threads(1)
>>
>> caused
>>
>> FAIL: libgomp.c/places-10.c execution test
>
> Reproduced on gcc112 in CompileFarm (my ws isn't NUMA).
> If numa-domains is used with num-places count, sometimes the function
> could create more places than requested and crash.  This depended on the
> content of /sys/devices/system/node/online file, e.g. if the file
> contains
> 0-1,16-17
> and all NUMA nodes contain at least one CPU in the cpuset of the program,
> then numa_domains(2) or numa_domains(4) (or 5+) work fine while
> numa_domains(1) or numa_domains(3) misbehave.  I.e. the function was able
> to stop after reaching limit on the , separators (or trivially at the end),
> but not within in the ranges.
>
> Fixed thusly, tested on powerpc64le-linux, committed to trunk.

There appears to be yet another issue: there still are quite a number of
'FAIL: libgomp.c/places-10.c execution test' reports on
<gcc-testresults@gcc.gnu.org>.  Also in my testing testing, on a system
where '/sys/devices/system/node/online' contains '0-1', I get a FAIL:

    [...]
    OPENMP DISPLAY ENVIRONMENT BEGIN
      _OPENMP = '201511'
      OMP_DYNAMIC = 'FALSE'
      OMP_NESTED = 'FALSE'
      OMP_NUM_THREADS = '8'
      OMP_SCHEDULE = 'DYNAMIC'
      OMP_PROC_BIND = 'TRUE'
      OMP_PLACES = '{0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30},{FAIL: libgomp.c/places-10.c execution test


Grüße
 Thomas


> 2021-10-18  Jakub Jelinek  <jakub@redhat.com>
>
>       * config/linux/affinity.c (gomp_affinity_init_numa_domains): Add
>       && gomp_places_list_len < count after nfirst <= nlast loop condition.
>
> --- libgomp/config/linux/affinity.c.jj        2021-10-15 16:28:30.374460522 +0200
> +++ libgomp/config/linux/affinity.c   2021-10-18 14:44:51.559667127 +0200
> @@ -401,7 +401,7 @@ gomp_affinity_init_numa_domains (unsigne
>           break;
>         q = end;
>       }
> -      for (; nfirst <= nlast; nfirst++)
> +      for (; nfirst <= nlast && gomp_places_list_len < count; nfirst++)
>       {
>         sprintf (name + prefix_len, "node%lu/cpulist", nfirst);
>         f = fopen (name, "r");
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955


More information about the Gcc-patches mailing list