Open MPI logo

Hardware Locality Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Users mailing list

Subject: Re: [hwloc-users] OpenGL GPU detection code
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2013-02-01 08:57:53


I just committed big changes to the display branch (and I also merged
latest trunk changes).

lstopo will now report things like this:
        PCI 10de:06d1
          GPU L#0 ":0.0"
          GPU L#1 "cuda0"
          GPU L#2 "nvml0"

The changes include:

1) We don't have a "display" specific OS device anymore, it's just
another kind of GPU among cuda, opencl and nvml. The name is the X
server display name. There are string attributes in these new GL GPU OS
devices (lstopo -v):
  GPU L#9 (Backend=GL GPUVendor="NVIDIA Corporation" GPUModel="Tesla
C2050") ":0.2"

2) The gl component is now buildable as a plugin

3) Given (2), we can't expose internal GL routines in the public API. So
hwloc/gl.h is just made of inline helpers as any other hwloc/foo.h. It
now contains functions to convert between displays (name or port/device)
and hwloc OS devices:

hwloc_obj_t hwloc_gl_get_display_osdev_by_port_device(hwloc_topology_t
topology, unsigned port, unsigned device)
hwloc_obj_t hwloc_gl_get_display_osdev_by_name(hwloc_topology_t
topology, const char *name)
int hwloc_gl_get_display_by_osdev(hwloc_topology_t topology, hwloc_obj_t
osdev,unsigned *port, unsigned *device)

If you really need the PCI device, just use osdev->parent as documented.
If you need the locality, use hwloc_get_non_io_ancestor(topology,
osdev)->cpuset
See tests/gl.c for examples.

Please review hwloc/gl.h and let me know if that works for you. I hope I
used the words port/device/server/screen as expected.

The last thing on my TODO list is to decide is whether we keep the "GL"
name or switch to something among display/X11/X/... for filenames and
function names.

Brice