For example, if I have a For systems with multiple GPUs, which may come from different vendors, I can list the devices by enumerating the PCI bus. This gives me the PCI vendor, device and bus ID. If I choose one of the (GPU) PCI devices to use For OpenCL calculations based on certain selection criteria, how to match it with OpenCL devices?
I can use clGetDeviceIDs() to enumerate GPU devices in OpenCL, but there is no obvious way to match OpenCL devices with PCI devices. The OpenCL function clGetDeviceInfo() provides information about the PCI vendor ID and device name Access, not PCI device or bus ID. I can try to match the PCI device name with the OpenCL device name, but you may have multiple devices of the same type, and the names are not always the same.
Why is this necessary? Say I know that program X runs CUDA or something on GPU A. I want to avoid using GPU A for OpenCL operations, so I choose GPU B. Then I need to figure out which OpenCL device is GPU A and which is GPU B. PCI ID It seems to be the only consistent and cross-platform way to identify GPU devices.
BTW, the CUDA API will provide PCI, bus and slot IDs (CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID), but CUDA is only available for NVidia devices.
p>
Ideally, I need to use C or C solutions.
I want to be able to connect the OpenCL device with the GPU in the system on the multi-GPU system recognized by the GPU Match.
For example, if I have a system with multiple GPUs, possibly from different vendors, I can list the devices by enumerating the PCI bus. This gives me PCI Vendor, device and bus ID. If I choose one of the (GPU) PCI devices for OpenCL calculations based on certain selection criteria, how do I match it with the OpenCL device?
I can use clGetDeviceIDs() to enumerate GPU devices in OpenCL, but there is no obvious way to match OpenCL devices with PCI devices. The OpenCL function clGetDeviceInfo() provides information about the PCI vendor ID and device name Access, not PCI device or bus ID. I can try to match the PCI device name with the OpenCL device name, but you may have multiple devices of the same type, and the names are not always the same.
Why is this necessary? Say I know that program X runs CUDA or something on GPU A. I want to avoid using GPU A for OpenCL operations, so I choose GPU B. Then I need to figure out which OpenCL device is GPU A and which is GPU B. PCI ID It seems to be the only consistent and cross-platform way to identify GPU devices.
BTW, the CUDA API will provide PCI, bus and slot IDs (CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID), but CUDA is only available for NVidia devices.
p>
Ideally, I need to use C or C solutions.
The way to do this is to use two vendor specific Extension. For AMD, you must use CL_DEVICE_TOPOLOGY_AMD, available on Windows and Linux, and return the PCIe bus ID, which is unique to the GPU. On NVIDIA, the query device is CL_DEVICE_PCI_BUS_ID_NV. See: https://anteru.net/2014 /08/01/2483/