GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
libgomp

Robustify device distance retrieval in libgomp

Fixes a data race and handles non-contiguous node numbering in libgomp's NUMA device distance retrieval.

This commit addresses issues in libgomp’s retrieval of NUMA (Non-Uniform Memory Access) device distances. It introduces fixes to prevent a data race during initialization and ensures proper handling of systems where NUMA nodes are not numbered consecutively. This makes the gomp_get_numa_distance function more robust and reliable in diverse NUMA environments.

In Details

The function gomp_get_numa_distance in config/linux/numa.c was susceptible to a data race during its initialization phase. Additionally, it did not correctly handle scenarios where NUMA nodes were sparsely or non-contiguously numbered. This patch ensures that initialization is thread-safe and that node distances are accurately read even when node IDs do not form a continuous sequence.

For Context
libgomp
The GNU implementation of OpenMP, a standard API for shared-memory parallel programming. libgomp provides the runtime library for OpenMP directives.
NUMA
Non-Uniform Memory Access. A memory architecture where memory access time depends on the memory location relative to the processor. Systems with NUMA often have performance benefits when memory is accessed locally to the processor.
Data race
A synchronization error condition that occurs when two or more threads access the same memory location concurrently, and at least one of the accesses is a write. The outcome of a data race is unpredictable.
Filed Under: libgompNUMAconcurrencyperformance