Go to the documentation of this file.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
00026
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030
00031
00044 static inline int
00045 hwloc_ibv_get_device_cpuset(hwloc_topology_t topology ,
00046 struct ibv_device *ibdev, hwloc_cpuset_t set)
00047 {
00048 #ifdef HWLOC_LINUX_SYS
00049
00050
00051 #define HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX 128
00052 char path[HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX];
00053 FILE *sysfile = NULL;
00054
00055 sprintf(path, "/sys/class/infiniband/%s/device/local_cpus",
00056 ibv_get_device_name(ibdev));
00057 sysfile = fopen(path, "r");
00058 if (!sysfile)
00059 return -1;
00060
00061 hwloc_linux_parse_cpumap_file(sysfile, set);
00062
00063 fclose(sysfile);
00064 #else
00065
00066 hwloc_cpuset_copy(set, hwloc_topology_get_complete_cpuset(topology));
00067 #endif
00068 return 0;
00069 }
00070
00074 #ifdef __cplusplus
00075 }
00076 #endif
00077
00078
00079 #endif