Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00019 #ifndef HWLOC_OPENFABRICS_VERBS_H
00020 #define HWLOC_OPENFABRICS_VERBS_H
00021
00022 #include <hwloc.h>
00023 #include <hwloc/autogen/config.h>
00024 #include <hwloc/linux.h>
00025
00026 #include <infiniband/verbs.h>
00027
00028
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032
00033
00046 static inline int
00047 hwloc_ibv_get_device_cpuset(hwloc_topology_t topology ,
00048 struct ibv_device *ibdev, hwloc_cpuset_t set)
00049 {
00050 #ifdef HWLOC_LINUX_SYS
00051
00052
00053 #define HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX 128
00054 char path[HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX];
00055 FILE *sysfile = NULL;
00056
00057 sprintf(path, "/sys/class/infiniband/%s/device/local_cpus",
00058 ibv_get_device_name(ibdev));
00059 sysfile = fopen(path, "r");
00060 if (!sysfile)
00061 return -1;
00062
00063 hwloc_linux_parse_cpumap_file(sysfile, set);
00064
00065 fclose(sysfile);
00066 #else
00067
00068 hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
00069 #endif
00070 return 0;
00071 }
00072
00076 #ifdef __cplusplus
00077 }
00078 #endif
00079
00080
00081 #endif