File: test_internal.c

package info (click to toggle)
openmpi 5.0.8-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 201,684 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (91 lines) | stat: -rw-r--r-- 2,537 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * Copyright (c) 2017      Mellanox Technologies, Inc.
 *                         All rights reserved.
 * Copyright (c) 2017-2019 Intel, Inc.  All rights reserved.
 * Copyright (c) 2021-2022 Nanook Consulting  All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 *
 */

#include "test_internal.h"

static void release_cb(pmix_status_t status, void *cbdata)
{
    int *ptr = (int *) cbdata;

    PMIX_HIDE_UNUSED_PARAMS(status);

    *ptr = 0;
}

static void get_cb(pmix_status_t status, pmix_value_t *kv, void *cbdata)
{
    get_cbdata *cb = (get_cbdata *) cbdata;
    if (PMIX_SUCCESS == status) {
        PMIx_Value_xfer(cb->kv, kv);
    }
    cb->in_progress = 0;
    cb->status = status;
}

int test_internal(char *my_nspace, pmix_rank_t my_rank, test_params params)
{
    int idx;
    char sval[PMIX_MAX_NSLEN];
    char key[PMIX_MAX_KEYLEN];
    pmix_value_t value;
    pmix_proc_t proc;
    pmix_status_t rc;

    PMIX_PROC_CONSTRUCT(&proc);
    pmix_strncpy(proc.nspace, my_nspace, PMIX_MAX_NSLEN);
    proc.rank = my_rank;

    for (idx = 0; idx < params.test_internal; idx++) {
        memset(sval, 0, PMIX_MAX_NSLEN);
        sprintf(sval, "test_internal:%s:%d:%d", my_nspace, my_rank, idx);

        SET_KEY(key, 0, idx, 1);
        value.type = PMIX_STRING;
        value.data.string = sval;
        if (PMIX_SUCCESS != (rc = PMIx_Store_internal(&proc, key, &value))) {
            TEST_ERROR(("%s:%d: PMIx_Store_internal failed: %d", my_nspace, my_rank, rc));
            PMIX_PROC_DESTRUCT(&proc);
            exit(rc);
        }
    }

    /* Submit the data */
    if (PMIX_SUCCESS != (rc = PMIx_Commit())) {
        TEST_ERROR(("%s:%d: PMIx_Commit failed: %d", my_nspace, my_rank, rc));
        PMIX_PROC_DESTRUCT(&proc);
        exit(rc);
    }

    proc.rank = PMIX_RANK_WILDCARD;
    FENCE(1, 1, (&proc), 1);
    if (PMIX_SUCCESS != rc) {
        TEST_ERROR(("%s:%d: PMIx_Fence failed: %d", my_nspace, my_rank, rc));
        PMIX_PROC_DESTRUCT(&proc);
        exit(rc);
    }

    for (idx = 0; idx < params.test_internal; idx++) {
        memset(sval, 0, PMIX_MAX_NSLEN);
        sprintf(sval, "test_internal:%s:%d:%d", my_nspace, my_rank, idx);

        GET(string, sval, my_nspace, my_rank, 0, idx, 1, 1, 0);
        if (PMIX_SUCCESS != rc) {
            TEST_ERROR(("%s:%d: PMIx_Get of remote key on local proc", my_nspace, my_rank));
            PMIX_PROC_DESTRUCT(&proc);
            exit(rc);
        }
    }

    PMIX_PROC_DESTRUCT(&proc);
    return PMIX_SUCCESS;
}