root/ompi/runtime/ompi_info_support.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ompi_info_register_types
  2. ompi_info_register_framework_params
  3. ompi_info_close_components
  4. ompi_info_show_ompi_version

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2006 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2007-2014 Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2011-2012 University of Houston. All rights reserved.
  15  * Copyright (c) 2010-2015 Los Alamos National Security, LLC.
  16  *                         All rights reserved.
  17  * Copyright (c) 2018      Amazon.com, Inc. or its affiliates.  All Rights reserved.
  18  * $COPYRIGHT$
  19  *
  20  * Additional copyrights may follow
  21  *
  22  * $HEADER$
  23  */
  24 
  25 #include "ompi_config.h"
  26 
  27 #include "ompi/include/ompi/constants.h"
  28 #include "ompi/include/ompi/frameworks.h"
  29 #include "ompi/communicator/communicator.h"
  30 
  31 #include "ompi/runtime/params.h"
  32 
  33 #include "opal/runtime/opal_info_support.h"
  34 #include "ompi/runtime/ompi_info_support.h"
  35 
  36 #if OMPI_RTE_ORTE
  37 #include "orte/runtime/orte_info_support.h"
  38 #endif
  39 
  40 #include "opal/util/show_help.h"
  41 #include "opal/util/printf.h"
  42 
  43 const char *ompi_info_type_ompi = "ompi";
  44 const char *ompi_info_type_base = "base";
  45 
  46 static int ompi_info_registered = 0;
  47 
  48 void ompi_info_register_types(opal_pointer_array_t *mca_types)
  49 {
  50     int i;
  51 
  52     /* add the top-level type */
  53     opal_pointer_array_add(mca_types, (void *)ompi_info_type_ompi);
  54     opal_pointer_array_add(mca_types, "mpi");
  55 
  56     /* push all the types found by autogen */
  57     for (i=0; NULL != ompi_frameworks[i]; i++) {
  58         opal_pointer_array_add(mca_types, ompi_frameworks[i]->framework_name);
  59     }
  60 }
  61 
  62 int ompi_info_register_framework_params(opal_pointer_array_t *component_map)
  63 {
  64     int rc;
  65 
  66     if (ompi_info_registered++) {
  67         return OMPI_SUCCESS;
  68     }
  69 
  70     /* Register the MPI layer's MCA parameters */
  71     if (OMPI_SUCCESS != (rc = ompi_mpi_register_params())) {
  72         fprintf(stderr, "ompi_info_register: ompi_mpi_register_params failed\n");
  73         return rc;
  74     }
  75 
  76     rc = opal_info_register_framework_params(component_map);
  77     if (OPAL_SUCCESS != rc) {
  78         return rc;
  79     }
  80 
  81 #if OMPI_RTE_ORTE
  82     rc = orte_info_register_framework_params(component_map);
  83     if (ORTE_SUCCESS != rc) {
  84         return rc;
  85     }
  86 #endif
  87 
  88     return opal_info_register_project_frameworks(ompi_info_type_ompi, ompi_frameworks, component_map);
  89 }
  90 
  91 void ompi_info_close_components(void)
  92 {
  93     int i;
  94 
  95     assert(ompi_info_registered);
  96     if (--ompi_info_registered) {
  97         return;
  98     }
  99 
 100     /* Note that the order of shutdown here doesn't matter because
 101      * we aren't *using* any components -- none were selected, so
 102      * there are no dependencies between the frameworks.  We list
 103      * them generally "in order", but it doesn't really matter.
 104 
 105      * We also explicitly ignore the return values from the
 106      * close() functions -- what would we do if there was an
 107      * error?
 108      */
 109     for (i=0; NULL != ompi_frameworks[i]; i++) {
 110         (void) mca_base_framework_close(ompi_frameworks[i]);
 111     }
 112 
 113 #if OMPI_RTE_ORTE
 114     /* close the ORTE components */
 115     (void) orte_info_close_components();
 116 #endif
 117 
 118     (void) opal_info_close_components();
 119 }
 120 
 121 void ompi_info_show_ompi_version(const char *scope)
 122 {
 123     char *tmp, *tmp2;
 124 
 125     (void)opal_asprintf(&tmp, "%s:version:full", ompi_info_type_ompi);
 126     tmp2 = opal_info_make_version_str(scope,
 127                                       OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
 128                                       OMPI_RELEASE_VERSION,
 129                                       OMPI_GREEK_VERSION,
 130                                       OMPI_REPO_REV);
 131     opal_info_out("Open MPI", tmp, tmp2);
 132     free(tmp);
 133     free(tmp2);
 134     (void)opal_asprintf(&tmp, "%s:version:repo", ompi_info_type_ompi);
 135     opal_info_out("Open MPI repo revision", tmp, OMPI_REPO_REV);
 136     free(tmp);
 137     (void)opal_asprintf(&tmp, "%s:version:release_date", ompi_info_type_ompi);
 138     opal_info_out("Open MPI release date", tmp, OMPI_RELEASE_DATE);
 139     free(tmp);
 140 
 141 #if OMPI_RTE_ORTE
 142     /* show the orte version */
 143     orte_info_show_orte_version(scope);
 144 #endif
 145 
 146     /* show the opal version */
 147     opal_info_show_opal_version(scope);
 148 
 149     tmp2 = opal_info_make_version_str(scope,
 150                                       MPI_VERSION, MPI_SUBVERSION,
 151                                       0, "", "");
 152     opal_info_out("MPI API", "mpi-api:version:full", tmp2);
 153     free(tmp2);
 154 
 155     opal_info_out("Ident string", "ident", OPAL_IDENT_STRING);
 156 }

/* [<][>][^][v][top][bottom][index][help] */