13 #ifndef HWLOC_INTEL_MIC_H
14 #define HWLOC_INTEL_MIC_H
17 #include <hwloc/autogen/config.h>
18 #include <hwloc/helper.h>
19 #ifdef HWLOC_LINUX_SYS
20 #include <hwloc/linux.h>
57 static __hwloc_inline
int
59 int idx __hwloc_attribute_unused,
62 #ifdef HWLOC_LINUX_SYS
64 #define HWLOC_INTEL_MIC_DEVICE_SYSFS_PATH_MAX 128
65 char path[HWLOC_INTEL_MIC_DEVICE_SYSFS_PATH_MAX];
68 struct dirent *dirent;
69 unsigned pcibus, pcidev, pcifunc;
76 sprintf(path,
"/sys/class/mic/mic%d", idx);
77 sysdir = opendir(path);
81 while ((dirent = readdir(sysdir)) != NULL) {
82 if (sscanf(dirent->d_name,
"pci_%02x:%02x.%02x", &pcibus, &pcidev, &pcifunc) == 3) {
83 sprintf(path,
"/sys/class/mic/mic%d/pci_%02x:%02x.%02x/local_cpus", idx, pcibus, pcidev, pcifunc);
84 sysfile = fopen(path,
"r");
128 && !strncmp(
"mic", osdev->
name, 3)
129 && atoi(osdev->
name + 3) == (
int) idx)