https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125877
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tobias Burnus <[email protected]>: https://gcc.gnu.org/g:8af1592882509fbead16e30fd2d056330a9609e4 commit r17-1702-g8af1592882509fbead16e30fd2d056330a9609e4 Author: Tobias Burnus <[email protected]> Date: Fri Jun 19 18:00:37 2026 +0200 OpenMP: Add omp_get_device_distances routine [PR125877] On multi-device, multi-socket systems, this routine permits to find the GPU device that is closest to the thread calling this API routine. PR libgomp/125877 include/ChangeLog: * cuda/cuda.h (cuDeviceGetPCIBusId): Declare. libgomp/ChangeLog: * affinity.c (gomp_get_current_numa_node, gomp_get_numa_distance): New functions. * config/linux/affinity.c (gomp_get_current_numa_node, gomp_get_numa_distance): Likewise. * libgomp-plugin.h (GOMP_OFFLOAD_get_numa_node): Declare. * libgomp.h (gomp_get_current_numa_node, gomp_get_numa_distance): Declare. (struct gomp_device_descr): Add get_numa_node_func. * libgomp.map (OMP_6.1): Add. * libgomp.texi (omp_get_device_distances): Add routine. * omp.h.in (omp_get_device_distances): Declare. * omp_lib.f90.in (omp_get_device_distances): Add interface. * omp_lib.h.in (omp_get_device_distances): Likewise. * plugin/cuda-lib.def (cuDeviceGetPCIBusId): Add. * plugin/plugin-gcn.c (struct agent_info): Add numa_node. (GOMP_OFFLOAD_get_numa_node): New. * plugin/plugin-nvptx.c (struct ptx_device): Add numa_node. (GOMP_OFFLOAD_get_numa_node): New. * target.c (omp_get_device_distances): New function. (gomp_load_plugin_for_device): Load get_numa_node symbol. * testsuite/libgomp.c/omp-get-device-distances.c: New test. * testsuite/libgomp.fortran/omp-get-device-distances.f90: New test.
