https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125951
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2026-06-23
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Question: Is there a good way to obtain the NUMA distance between nodes on
Solaris?
However, the main problem is that I missed the special value omp_default_device
(= -5) initially; I added code to handle it for the distance-is-known path
(i.e. for Linux) but forgot to also add it to the not-supported code path, i.e.
the following is missing:
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -6155,8 +6155,13 @@ omp_get_device_distances (int ndevs, const int *devs,
int *distances)
for (int i = 0; i < ndevs; i++)
- if (devs[i] < omp_initial_device || devs[i] > num_devices)
- distances[i] = -1; /* invalid */
- else if (devs[i] == omp_initial_device || devs[i] == num_devices)
- distances[i] = 0;
- else
- distances[i] = 10;
+ {
+ int device_num = (devs[i] == omp_default_device
+ ? gomp_get_default_device () : devs[i]);
+ if (device_num < omp_initial_device || device_num > num_devices)
+ distances[i] = -1; /* invalid */
+ else if (device_num == omp_initial_device
+ || device_num == num_devices)
+ distances[i] = 0;
+ else
+ distances[i] = 10;
+ }
return;