[Patch] OpenMP: Add get_device_from_uid/omp_get_uid_from_device routines

Tobias Burnus tburnus@baylibre.com
Thu Sep 19 13:23:54 GMT 2024


Hi all,

in order to know and potentially re-use a specific offload device (reproducibility,
affinity wise close to a CPU (socket), …) a mapping between an (universal?) unique
identifier and the OpenMP device number is useful. Thus, TR13 added support for it.

This is a collateral patch caused by looking at the API routines for other reasons
and looking at that part of the spec during the OpenMP F2F.

Besides the added API routines, the UID will be used elsewhere:
* In context selectors: 'target_device' supports 'uid(<string>)'.
* In the OMP_AVAILABLE_DEVICES and OMP_DEFAULT_DEVICE env vars.

@Sandra: Besides the usual .texi part, for the 'target_device' trait set:
if you add a new GOMP routine for kind/arch/isa - can you also add an
UID argument such that we don't have to update the API when needing in the
not so far future.

@Andrew + @Thomas: Any comment? Especially to the nvptx/gcn side (plugin +
.texi)?

@Jakub or anyone else — any comments, suggestions, remarks?

[The patch was tested without GPUs, with one Nvidia GPU and one AMD GPU
and seems to work fine.]

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omp-uid.diff
Type: text/x-patch
Size: 26074 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20240919/8c640544/attachment-0001.bin>


More information about the Fortran mailing list