File: ompi_info_support.c

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (133 lines) | stat: -rw-r--r-- 4,505 bytes parent folder | download | duplicates (2)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
 *                         University Research and Technology
 *                         Corporation.  All rights reserved.
 * Copyright (c) 2004-2006 The University of Tennessee and The University
 *                         of Tennessee Research Foundation.  All rights
 *                         reserved.
 * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
 *                         University of Stuttgart.  All rights reserved.
 * Copyright (c) 2004-2005 The Regents of the University of California.
 *                         All rights reserved.
 * Copyright (c) 2007-2014 Cisco Systems, Inc.  All rights reserved.
 * Copyright (c) 2011-2012 University of Houston. All rights reserved.
 * Copyright (c) 2010-2015 Los Alamos National Security, LLC.
 *                         All rights reserved.
 * Copyright (c) 2018      Amazon.com, Inc. or its affiliates.  All Rights reserved.
 * Copyright (c) 2019      Intel, Inc.  All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "ompi_config.h"

#include "ompi/include/ompi/constants.h"
#include "ompi/include/ompi/frameworks.h"
#include "ompi/communicator/communicator.h"

#include "ompi/runtime/params.h"

#include "opal/runtime/opal_info_support.h"
#include "ompi/runtime/ompi_info_support.h"

#include "opal/util/show_help.h"
#include "opal/util/printf.h"

const char *ompi_info_type_ompi = "ompi";
const char *ompi_info_type_base = "base";

static int ompi_info_registered = 0;

void ompi_info_register_types(opal_pointer_array_t *mca_types)
{
    int i;

    /* add the top-level type */
    opal_pointer_array_add(mca_types, (void *)ompi_info_type_ompi);
    opal_pointer_array_add(mca_types, "mpi");

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

int ompi_info_register_framework_params(opal_pointer_array_t *component_map)
{
    int rc;

    if (ompi_info_registered++) {
        return OMPI_SUCCESS;
    }

    /* Register the MPI layer's MCA parameters */
    if (OMPI_SUCCESS != (rc = ompi_mpi_register_params())) {
        fprintf(stderr, "ompi_info_register: ompi_mpi_register_params failed\n");
        return rc;
    }

    rc = opal_info_register_framework_params(component_map);
    if (OPAL_SUCCESS != rc) {
        return rc;
    }

    return opal_info_register_project_frameworks(ompi_info_type_ompi, ompi_frameworks, component_map);
}

void ompi_info_close_components(void)
{
    int i;

    assert(ompi_info_registered);
    if (--ompi_info_registered) {
        return;
    }

    /* Note that the order of shutdown here doesn't matter because
     * we aren't *using* any components -- none were selected, so
     * there are no dependencies between the frameworks.  We list
     * them generally "in order", but it doesn't really matter.

     * We also explicitly ignore the return values from the
     * close() functions -- what would we do if there was an
     * error?
     */
    for (i=0; NULL != ompi_frameworks[i]; i++) {
        (void) mca_base_framework_close(ompi_frameworks[i]);
    }

    (void) opal_info_close_components();
}

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

    (void)opal_asprintf(&tmp, "%s:version:full", ompi_info_type_ompi);
    tmp2 = opal_info_make_version_str(scope,
                                      OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
                                      OMPI_RELEASE_VERSION,
                                      OMPI_GREEK_VERSION,
                                      OMPI_REPO_REV);
    opal_info_out("Open MPI", tmp, tmp2);
    free(tmp);
    free(tmp2);
    (void)opal_asprintf(&tmp, "%s:version:repo", ompi_info_type_ompi);
    opal_info_out("Open MPI repo revision", tmp, OMPI_REPO_REV);
    free(tmp);
    (void)opal_asprintf(&tmp, "%s:version:release_date", ompi_info_type_ompi);
    opal_info_out("Open MPI release date", tmp, OMPI_RELEASE_DATE);
    free(tmp);

    tmp2 = opal_info_make_version_str(scope,
                                      MPI_VERSION, MPI_SUBVERSION,
                                      0, "", "");
    opal_info_out("MPI API", "mpi-api:version:full", tmp2);
    free(tmp2);

    opal_info_out("Ident string", "ident", OPAL_IDENT_STRING);
}