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 __hwloc_inline int
00039 hwloc_ibv_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
00040 struct ibv_device *ibdev, hwloc_cpuset_t set)
00041 {
00042 #ifdef HWLOC_LINUX_SYS
00043
00044
00045 #define HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX 128
00046 char path[HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX];
00047 FILE *sysfile = NULL;
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 -1;
00054
00055 hwloc_linux_parse_cpumap_file(sysfile, set);
00056
00057 fclose(sysfile);
00058 #else
00059
00060 hwloc_cpuset_copy(set, hwloc_topology_get_complete_cpuset(topology));
00061 #endif
00062 return 0;
00063 }
00064
00067 #endif