---
name: "hwlocality_gl"
section: "3"
platform: "linux"
package: "hwloc"
version: "2.15.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/hwlocality_gl"
---

# hwlocality\_gl(3)

Interoperability with OpenGL displays

## NAME

hwlocality\_gl - Interoperability with OpenGL displays

## SYNOPSIS

### Functions

**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)\

## Detailed Description

This interface offers ways to retrieve topology information about OpenGL displays.

Only the NVIDIA display locality information is currently available, using the NV-CONTROL X11 extension and the NVCtrl library.

This code may hang when trying to connect to the X server. Hence the GL component is disabled unless HWLOC\_GL=1 in the environment.

## Function Documentation

### int hwloc\_gl\_get\_display\_by\_osdev (hwloc\_topology\_t topology, hwloc\_obj\_t osdev, unsigned \* port, unsigned \* device) \[inline\]

Get the OpenGL display port and device corresponding to the given hwloc OS object. Retrieves the OpenGL display port (server) in port and device (screen) in screen that correspond to the given hwloc OS device object.

**Returns**

0 on success.

\-1 if none could be found.

The topology topology does not necessarily have to match the current machine. For instance the topology may be an XML import of a remote host. I/O devices detection and the GL component must be enabled in the topology.

**Note**

The GL backend creating these OS devices is disabled by default since it may cause hwloc to hang when trying to connect to the X server. Set HWLOC\_GL=1 in the environment to reenable it.

### hwloc\_obj\_t hwloc\_gl\_get\_display\_osdev\_by\_name (hwloc\_topology\_t topology, const char \* name) \[inline\]

Get the hwloc OS device object corresponding to the OpenGL display given by name.

**Returns**

The hwloc OS device object describing the OpenGL display whose name is name, built as ":port.device" such as ":0.0" .

NULL if none could be found.

The topology topology does not necessarily have to match the current machine. For instance the topology may be an XML import of a remote host. I/O devices detection and the GL component must be enabled in the topology.

**Note**

The GL backend creating these OS devices is disabled by default since it may cause hwloc to hang when trying to connect to the X server. Set HWLOC\_GL=1 in the environment to reenable it.

The corresponding PCI device object can be obtained by looking at the OS device parent object (unless PCI devices are filtered out).

### hwloc\_obj\_t hwloc\_gl\_get\_display\_osdev\_by\_port\_device (hwloc\_topology\_t topology, unsigned port, unsigned device) \[inline\]

Get the hwloc OS device object corresponding to the OpenGL display given by port and device index.

**Returns**

The hwloc OS device object describing the OpenGL display whose port (server) is port and device (screen) is device.

NULL if none could be found.

The topology topology does not necessarily have to match the current machine. For instance the topology may be an XML import of a remote host. I/O devices detection and the GL component must be enabled in the topology.

**Note**

The GL backend creating these OS devices is disabled by default since it may cause hwloc to hang when trying to connect to the X server. Set HWLOC\_GL=1 in the environment to reenable it.

The corresponding PCI device object can be obtained by looking at the OS device parent object (unless PCI devices are filtered out).

## Author

Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code.
