File: test_helloworld.c

package info (click to toggle)
openmpi 5.0.8-4
  • links: PTS, VCS
  • area: main
  • in suites:
  • 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 (54 lines) | stat: -rw-r--r-- 1,748 bytes parent folder | download | duplicates (8)
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
/*
 * Copyright (c) 2020      Triad National Security, LLC.
 *                         All rights reserved.
 *
 * Copyright (c) 2021      Nanook Consulting.  All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

/* Test of namespace and rank validity */

#include "pmix.h"
#include "test_common.h"

pmix_proc_t this_proc;

int main(int argc, char *argv[])
{

    size_t ninfo = 0;
    test_params l_params;
    validation_params v_params;

    /* Handles all setup that's required prior to calling PMIx_Init() */
    pmixt_pre_init(argc, argv, &l_params, &v_params, NULL);
    /* initialization */
    PMIXT_CHECK(PMIx_Init(&this_proc, NULL, ninfo), l_params, v_params);

    /* Handles everything that needs to happen after PMIx_Init() */
    pmixt_post_init(&this_proc, &l_params, &v_params);

    /* Check that our validation side-channel (passed from server to client as argument)
     * has the same values as this_proc */
    if (!(0 == strncmp(v_params.pmix_nspace, this_proc.nspace, PMIX_MAX_NSLEN))) {
        TEST_ERROR(("Client ns %s validation ns: %s rank %d: nspace validation failed",
                    this_proc.nspace, v_params.pmix_nspace, v_params.pmix_rank));
        exit(1);
    }
    if (!(v_params.pmix_rank == this_proc.rank)) {
        TEST_ERROR(("Client ns %s rank %d validation rank: %d: rank validation failed",
                    this_proc.nspace, this_proc.rank, v_params.pmix_rank));
        exit(1);
    }
    TEST_VERBOSE(
        ("nspace validated: %s, rank validated: %d", v_params.pmix_nspace, v_params.pmix_rank));

    PMIXT_CHECK(PMIx_Finalize(NULL, 0), l_params, v_params);

    /* Handles cleanup */
    pmixt_post_finalize(&this_proc, &l_params, &v_params);
}