|
17 #ifndef HWLOC_OPENCL_H
18 #define HWLOC_OPENCL_H
21 #include <hwloc/autogen/config.h>
22 #include <hwloc/helper.h>
23 #ifdef HWLOC_LINUX_SYS
24 #include <hwloc/linux.h>
28 #include <CL/cl_ext.h>
59 static __hwloc_inline int
61 cl_device_id device __hwloc_attribute_unused,
64 #if (defined HWLOC_LINUX_SYS) && (defined CL_DEVICE_TOPOLOGY_AMD)
66 #define HWLOC_OPENCL_DEVICE_SYSFS_PATH_MAX 128
67 char path[HWLOC_OPENCL_DEVICE_SYSFS_PATH_MAX];
69 cl_device_topology_amd amdtopo;
77 clret = clGetDeviceInfo(device, CL_DEVICE_TOPOLOGY_AMD, sizeof(amdtopo), &amdtopo, NULL);
78 if (CL_SUCCESS != clret) {
82 if (CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD != amdtopo.raw.type) {
87 sprintf(path, "/sys/bus/pci/devices/0000:%02x:%02x.%01x/local_cpus", amdtopo.pcie.bus, amdtopo.pcie.device, amdtopo.pcie.function);
88 sysfile = fopen(path, "r");
121 unsigned platform_index, unsigned device_index)
123 unsigned x = (unsigned) -1, y = ( unsigned) -1;
128 && sscanf(osdev-> name, "opencl%ud%u", &x, &y) == 2
129 && platform_index == x && device_index == y)
150 cl_device_id device __hwloc_attribute_unused)
152 #ifdef CL_DEVICE_TOPOLOGY_AMD
154 cl_device_topology_amd amdtopo;
157 clret = clGetDeviceInfo(device, CL_DEVICE_TOPOLOGY_AMD, sizeof(amdtopo), &amdtopo, NULL);
158 if (CL_SUCCESS != clret) {
162 if (CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD != amdtopo.raw.type) {
170 if (strncmp(osdev-> name, "opencl", 6))
|
|
|