20 #include <hwloc/autogen/config.h>
21 #include <hwloc/helper.h>
22 #ifdef HWLOC_LINUX_SYS
23 #include <hwloc/linux.h>
44 CUdevice cudevice,
int *domain,
int *bus,
int *dev)
48 #ifdef CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID
49 cres = cuDeviceGetAttribute(domain, CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, cudevice);
50 if (cres != CUDA_SUCCESS) {
57 cres = cuDeviceGetAttribute(bus, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, cudevice);
58 if (cres != CUDA_SUCCESS) {
62 cres = cuDeviceGetAttribute(dev, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, cudevice);
63 if (cres != CUDA_SUCCESS) {
91 #ifdef HWLOC_LINUX_SYS
93 #define HWLOC_CUDA_DEVICE_SYSFS_PATH_MAX 128
94 char path[HWLOC_CUDA_DEVICE_SYSFS_PATH_MAX];
96 int domainid, busid, deviceid;
106 sprintf(path,
"/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", domainid, busid, deviceid);
107 sysfile = fopen(path,
"r");
136 int domain, bus, dev;
161 int domain, bus, dev;
169 if (strncmp(osdev->
name,
"cuda", 4))
205 && !strncmp(
"cuda", osdev->
name, 4)
206 && atoi(osdev->
name + 4) == (
int) idx)