[Openmp-commits] [PATCH] D76843: [Openmp] Libomptarget plugin for NEC SX-Aurora

Simon Moll via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Apr 8 10:19:00 PDT 2020


simoll added inline comments.


================
Comment at: openmp/libomptarget/plugins/ve/src/rtl.cpp:122
+    // Dynamically check how many devices we have
+    // For the moment we assume that VEO device IDs are consecutive
+    struct ve_nodeinfo node_info;
----------------
manorom wrote:
> efocht wrote:
> > simoll wrote:
> > > Can we assume that?
> > No. Devices can be missing or offline. For sizing the objects below this is ok, but not for selecting the ve nodeids.
> Do we have to assume that VE node ids can be assigned completely at random?
> 
> We hoped that that would not be the case. Our rationale for  simply re-using the device ids we get passed  from libomptarget was, that the user would be able to set OMP_DEFAULT_DEVICE or the device() clause to a VE node id.
> 
> Now it seems to me that libomptarget expects openmp device ids to be consecutive, so if VE node ids are random or if we only report those which are present and online, we need to have a mapping between openmp device ids and VE node ids which should be somewhat predictable for a user.
> Do we have to assume that VE node ids can be assigned completely at random?
Yes

> We hoped that that would not be the case. Our rationale for simply re-using the device ids we get passed from libomptarget was, that the user would be able to set OMP_DEFAULT_DEVICE or the device() clause to a VE node id.
OpenMP device ids should not be physical device ids. It really messes with portability.

> Now it seems to me that libomptarget expects openmp device ids to be consecutive, so if VE node ids are random or if we only report those which are present and online, we need to have a mapping between openmp device ids and VE node ids which should be somewhat predictable for a user.

Here is a mapping that gives you predicable behavior:

1. fill up an array compactly with the active VE node ids. Report the number of active VE nodes as 'NumDevices'
2. sort that array
3. use the array to index into the ProcHandles/Contests/FuncOrGlbEntry/LibraryHandles arrays.

The omp device ids are now deterministic (with regards to the available VE nodes) and you gain some portability, eg devices '0' to 'n-1' will be valid as long as there are 'n' available nodes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76843/new/

https://reviews.llvm.org/D76843





More information about the Openmp-commits mailing list