Example #1
0
static int test_item4(void)
{
    int rc = 0;
    char val[PMI2_MAX_VALLEN];
    int found = 0;
    /* Predefined Node attributes */
    const char *tkeys[] = {
            "memPoolType",
            "memSYSVid",
            "memAnonMMAPfd",
            "memNTName",
            NULL
    };
    const char **ptr = tkeys;

    if (_legacy) {
        return rc;
    }

    while (*ptr) {
        if (PMI2_SUCCESS != (rc = PMI2_Info_GetNodeAttr(*ptr, val, sizeof(val), &found, 1))) {
            log_fatal("PMI2_Info_GetNodeAttr: [%s] %d\n", *ptr, rc);
            return rc;
        }
        log_info("key=%s value=%s found=%d\n", *ptr, (found ? val : "N/A"), found);
        if (!_legacy) {
            log_assert(!found, "Check test. Probably PMIx has a new functionality");
        }
        ptr++;
    }

    return rc;
}
Example #2
0
static int test_item5(void)
{
    int rc = 0;
    char val[PMI2_MAX_VALLEN];
    int found = 0;
    const char *tkey = "sharedFilename";
    const char *tval = "pmix-pmi2-check";

    if (PMI2_SUCCESS != (rc = PMI2_Info_PutNodeAttr(tkey, tval))) {
        log_fatal("PMI2_Info_PutNodeAttr %d\n", rc);
        return rc;
    }

    if (PMI2_SUCCESS != (rc = PMI2_Info_GetNodeAttr(tkey, val, sizeof(val), &found, 1))) {
        log_fatal("PMI2_Info_GetNodeAttr %d\n", rc);
        return rc;
    }

    log_info("tkey=%s tval=%s val=%s found=%d\n", tkey, tval, val, found);

    log_assert(found, "PMI2_Info_GetNodeAttr does not find expected key");
    log_assert(strlen(tval) == strlen(val), "value does not meet expectation");
    log_assert(!strcmp(tval, val), "value does not meet expectation");

    return rc;
}
Example #3
0
File: pmi2.c Project: bosilca/ompi
void pmi_get_key_loc(int rank, char *key_name, int **key_val, int *key_size)
{
    int found, rc;
    size_t tmp_size;
    char *tmp = calloc(PMI2_MAX_VALLEN, sizeof(char));
    if( (rc = PMI2_Info_GetNodeAttr(key_name, tmp, PMI2_MAX_VALLEN, &found, 1) ) ){
        fprintf(stderr,"PMI2_Info_GetNodeAttr: error rc = %d\n", rc);
        abort();
    }
    if( !found ){
        fprintf(stderr,"pmi_get_key_loc: key %s not found\n", key_name);
        abort();
    }

    *key_val = (int*)pmi_decode(tmp, &tmp_size);
    *key_size = tmp_size / sizeof(int);

    if( NULL == *key_val ){
        fprintf(stderr,"pmi_decode: cannot decode key %s\n", key_name);
        abort();
    }
    free(tmp);
}