00001
00002
00003
00004
00005
00006
00017 #ifndef HWLOC_OPENFABRICS_VERBS_H
00018 #define HWLOC_OPENFABRICS_VERBS_H
00019
00020 #include <hwloc.h>
00021 #include <hwloc/config.h>
00022 #include <hwloc/linux.h>
00023
00024 #include <infiniband/verbs.h>
00025
00038 static inline hwloc_cpuset_t
00039 hwloc_ibv_get_device_cpuset(struct ibv_device *ibdev)
00040 {
00041 #if defined(HWLOC_LINUX_SYS)
00042
00043
00044 #define HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX 128
00045 char path[HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX];
00046 FILE *sysfile = NULL;
00047 hwloc_cpuset_t set;
00048
00049 sprintf(path, "/sys/class/infiniband/%s/device/local_cpus",
00050 ibv_get_device_name(ibdev));
00051 sysfile = fopen(path, "r");
00052 if (!sysfile)
00053 return NULL;
00054
00055 set = hwloc_linux_parse_cpumap_file(sysfile);
00056
00057 fclose(sysfile);
00058 return set;
00059 #else
00060
00061 return hwloc_cpuset_dup(hwloc_get_system_obj(topology)->cpuset);
00062 #endif
00063 }
00064
00067 #endif