|
19 | 19 |
|
20 | 20 | #include <stdlib.h>
|
21 | 21 | #include <fcntl.h>
|
| 22 | +#include <ctype.h> |
22 | 23 |
|
23 | 24 | #include "opal/memoryhooks/memory.h"
|
24 | 25 | #include "opal/runtime/opal_params.h"
|
@@ -56,8 +57,47 @@ mca_base_var_enum_value_t rcache_values[] = {
|
56 | 57 | {-1, NULL} /* sentinal */
|
57 | 58 | };
|
58 | 59 |
|
59 |
| -static int |
60 |
| -btl_ugni_component_register(void) |
| 60 | +mca_base_var_enum_value_flag_t cdm_flags[] = { |
| 61 | + {.flag = GNI_CDM_MODE_FORK_NOCOPY, .string = "fork-no-copy", .conflicting_flag = GNI_CDM_MODE_FORK_FULLCOPY | GNI_CDM_MODE_FORK_PARTCOPY}, |
| 62 | + {.flag = GNI_CDM_MODE_FORK_FULLCOPY, .string = "fork-full-copy", .conflicting_flag = GNI_CDM_MODE_FORK_NOCOPY | GNI_CDM_MODE_FORK_PARTCOPY}, |
| 63 | + {.flag = GNI_CDM_MODE_FORK_PARTCOPY, .string = "fork-part-copy", .conflicting_flag = GNI_CDM_MODE_FORK_NOCOPY | GNI_CDM_MODE_FORK_FULLCOPY}, |
| 64 | + {.flag = GNI_CDM_MODE_ERR_NO_KILL, .string = "err-no-kill", .conflicting_flag = GNI_CDM_MODE_ERR_ALL_KILL}, |
| 65 | + {.flag = GNI_CDM_MODE_ERR_ALL_KILL, .string = "err-all-kill", .conflicting_flag = GNI_CDM_MODE_ERR_NO_KILL}, |
| 66 | + {.flag = GNI_CDM_MODE_FAST_DATAGRAM_POLL, .string = "fast-datagram-poll", .conflicting_flag = 0}, |
| 67 | + {.flag = GNI_CDM_MODE_BTE_SINGLE_CHANNEL, .string = "bte-single-channel", .conflicting_flag = 0}, |
| 68 | + {.flag = GNI_CDM_MODE_USE_PCI_IOMMU, .string = "use-pci-iommu", .conflicting_flag = 0}, |
| 69 | + {.flag = GNI_CDM_MODE_MDD_DEDICATED, .string = "mdd-dedicated", .conflicting_flag = GNI_CDM_MODE_MDD_SHARED}, |
| 70 | + {.flag = GNI_CDM_MODE_MDD_SHARED, .string = "mdd-shared", .conflicting_flag = GNI_CDM_MODE_MDD_DEDICATED}, |
| 71 | + {.flag = GNI_CDM_MODE_FMA_DEDICATED, .string = "fma-dedicated", .conflicting_flag = GNI_CDM_MODE_FMA_SHARED}, |
| 72 | + {.flag = GNI_CDM_MODE_FMA_SHARED, .string = "fma-shared", .conflicting_flag = GNI_CDM_MODE_FMA_DEDICATED}, |
| 73 | + {.flag = GNI_CDM_MODE_CACHED_AMO_ENABLED, .string = "cached-amo-enabled", .conflicting_flag = 0}, |
| 74 | + {.flag = GNI_CDM_MODE_CQ_NIC_LOCAL_PLACEMENT, .string = "cq-nic-placement", .conflicting_flag = 0}, |
| 75 | + {.flag = GNI_CDM_MODE_FMA_SMALL_WINDOW, .string = "fma-small-window", .conflicting_flag = 0}, |
| 76 | + {} |
| 77 | +}; |
| 78 | + |
| 79 | +static inline int mca_btl_ugni_get_stat (const mca_base_pvar_t *pvar, void *value, void *obj) |
| 80 | +{ |
| 81 | + gni_statistic_t statistic = (gni_statistic_t) (intptr_t) pvar->ctx; |
| 82 | + gni_return_t rc = GNI_RC_SUCCESS; |
| 83 | + |
| 84 | + rc = GNI_GetNicStat (mca_btl_ugni_component.modules[0].device.dev_handle, statistic, |
| 85 | + value); |
| 86 | + |
| 87 | + return mca_btl_rc_ugni_to_opal (rc); |
| 88 | +} |
| 89 | + |
| 90 | +static inline int mca_btl_ugni_notify_stat (mca_base_pvar_t *pvar, mca_base_pvar_event_t event, void *obj, int *count) |
| 91 | +{ |
| 92 | + if (MCA_BASE_PVAR_HANDLE_BIND == event) { |
| 93 | + /* one value for each virtual device handle */ |
| 94 | + *count = mca_btl_ugni_component.virtual_device_count; |
| 95 | + } |
| 96 | + |
| 97 | + return OPAL_SUCCESS; |
| 98 | +} |
| 99 | + |
| 100 | +static int btl_ugni_component_register(void) |
61 | 101 | {
|
62 | 102 | mca_base_var_enum_t *new_enum;
|
63 | 103 | gni_nic_device_t device_type;
|
@@ -228,6 +268,31 @@ btl_ugni_component_register(void)
|
228 | 268 | MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, NULL,
|
229 | 269 | NULL, NULL, &mca_btl_ugni_progress_thread_wakeups);
|
230 | 270 |
|
| 271 | + /* register network statistics as performance variables */ |
| 272 | + for (int i = 0 ; i < GNI_NUM_STATS ; ++i) { |
| 273 | + char name[128], desc[128]; |
| 274 | + size_t str_len = strlen (gni_statistic_str[i]); |
| 275 | + |
| 276 | + assert (str_len < sizeof (name)); |
| 277 | + |
| 278 | + /* we can get an all-caps string for the variable from gni_statistic_str. need to make it lowercase |
| 279 | + * to match ompi standards */ |
| 280 | + for (size_t j = 0 ; j < str_len ; ++j) { |
| 281 | + name[j] = tolower (gni_statistic_str[i][j]); |
| 282 | + desc[j] = ('_' == name[j]) ? ' ' : name[j]; |
| 283 | + } |
| 284 | + |
| 285 | + name[str_len] = '\0'; |
| 286 | + desc[str_len] = '\0'; |
| 287 | + |
| 288 | + (void) mca_base_component_pvar_register (&mca_btl_ugni_component.super.btl_version, name, desc, |
| 289 | + OPAL_INFO_LVL_4, MCA_BASE_PVAR_CLASS_COUNTER, |
| 290 | + MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, MCA_BASE_VAR_BIND_NO_OBJECT, |
| 291 | + MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, |
| 292 | + mca_btl_ugni_get_stat, NULL, mca_btl_ugni_notify_stat, |
| 293 | + (void *) (intptr_t) i); |
| 294 | + } |
| 295 | + |
231 | 296 | /* btl/ugni can only support only a fixed set of rcache components (these rcache components have compatible resource
|
232 | 297 | * structures) */
|
233 | 298 | rc = mca_base_var_enum_create ("btl_ugni_rcache", rcache_values, &new_enum);
|
|
0 commit comments