16 #ifndef HWLOC_CUDART_H
17 #define HWLOC_CUDART_H
20 #include <hwloc/autogen/config.h>
21 #include <hwloc/helper.h>
22 #ifdef HWLOC_LINUX_SYS
23 #include <hwloc/linux.h>
26 #include <cuda_runtime_api.h>
44 int idx,
int *domain,
int *bus,
int *dev)
47 struct cudaDeviceProp prop;
49 cerr = cudaGetDeviceProperties(&prop, idx);
55 #ifdef CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID
56 *domain = prop.pciDomainID;
62 *dev = prop.pciDeviceID;
87 #ifdef HWLOC_LINUX_SYS
89 #define HWLOC_CUDART_DEVICE_SYSFS_PATH_MAX 128
90 char path[HWLOC_CUDART_DEVICE_SYSFS_PATH_MAX];
102 sprintf(path,
"/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", domain, bus, dev);
103 sysfile = fopen(path,
"r");
132 int domain, bus, dev;
164 && !strncmp(
"cuda", osdev->
name, 4)
165 && atoi(osdev->
name + 4) == (
int) idx)