File: oshmem_info_support.c

package info (click to toggle)
openmpi 5.0.8-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,692 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 (109 lines) | stat: -rw-r--r-- 3,180 bytes parent folder | download | duplicates (4)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 *  Copyright (c) 2013      Mellanox Technologies, Inc.
 *                          All rights reserved.
 * Copyright (c) 2014 Cisco Systems, Inc.  All rights reserved.
 * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
 * Copyright (c) 2018      Amazon.com, Inc. or its affiliates.  All Rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "oshmem_config.h"

#include "oshmem/include/oshmem/constants.h"
#include "oshmem/include/oshmem/frameworks.h"

#include "oshmem/runtime/params.h"
#include "oshmem/runtime/runtime.h"

#include "opal/runtime/opal_info_support.h"
#include "ompi/runtime/ompi_info_support.h"
#include "oshmem/runtime/oshmem_info_support.h"
#include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/util/printf.h"
#include "ompi/include/ompi/constants.h"

const char *oshmem_info_type_oshmem = "oshmem";

static bool oshmem_info_registered = false;

void oshmem_info_register_types(opal_pointer_array_t *mca_types)
{
    int i;

    /* add the top-level type */
    opal_pointer_array_add(mca_types, (void *)oshmem_info_type_oshmem);

    /* push all the types found by autogen */
    for (i = 0; NULL != oshmem_frameworks[i]; i++) {
        opal_pointer_array_add(mca_types, oshmem_frameworks[i]->framework_name);
    }
}

int oshmem_info_register_framework_params(opal_pointer_array_t *component_map)
{
    int rc;

    if (oshmem_info_registered) {
        return OSHMEM_SUCCESS;
    }

    oshmem_info_registered = true;

    /* Register the OSHMEM layer's MCA parameters */
    if (OSHMEM_SUCCESS != (rc = oshmem_shmem_register_params())) {
        fprintf(stderr, "oshmem_info_register: oshmem_register_params failed\n");
        return rc;
    }

    /* Do OMPI interface call */
    rc = opal_info_register_framework_params(component_map);
    if (OMPI_SUCCESS != rc) {
        return rc;
    }

    return opal_info_register_project_frameworks(oshmem_info_type_oshmem, oshmem_frameworks, component_map);
}

void oshmem_info_close_components(void)
{
    int i;

    for (i = 0; NULL != oshmem_frameworks[i]; i++) {
        (void) mca_base_framework_close(oshmem_frameworks[i]);
    }

    /* Do OMPI interface call */
    opal_info_close_components();
}

void oshmem_info_show_oshmem_version(const char *scope)
{
    char *tmp, *tmp2;

    if (0 < opal_asprintf(&tmp, "%s:version:full", oshmem_info_type_oshmem)) {
        tmp2 = opal_info_make_version_str(scope,
                OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
                OSHMEM_RELEASE_VERSION,
                OSHMEM_GREEK_VERSION,
                OSHMEM_REPO_REV);
        opal_info_out("Open SHMEM", tmp, tmp2);
        free(tmp);
        free(tmp2);
    }
    if(0 < opal_asprintf(&tmp, "%s:version:repo", oshmem_info_type_oshmem)) {
        opal_info_out("Open SHMEM repo revision", tmp, OSHMEM_REPO_REV);
        free(tmp);
    }
    if (0 < opal_asprintf(&tmp, "%s:version:release_date", oshmem_info_type_oshmem)) {
        opal_info_out("Open SHMEM release date", tmp, OSHMEM_RELEASE_DATE);
        free(tmp);
    }

    /* Do OMPI interface call */
    ompi_info_show_ompi_version(scope);
}