1
1
openmpi/oshmem/runtime/oshmem_info_support.c
Mike Dubman 2141e9e6b4 tools: Add oshmem_info utility
Reworked ompi_info tool to be close with orte_info implementation.
ompi_info_register_types(), ompi_info_close_components() and
ompi_info_show_ompi_version() are moved to runtime/ompi_info_support.c.

Added runtime/oshmem_info_support layer that exports following api to be
used into oshmem_info tool as
oshmem_info_register_types()
oshmem_info_register_framework_params()
oshmem_info_close_components()
oshmem_info_show_oshmem_version()
These functions call ompi_info_support related interfaces as long as
Oshmem supports Open MPI/SHMEM combination.

Now orte_info/ompi_info/oshmem_info have identical implementation approach.

Possible improvement:
OSHMEM processing of --config option is the same as OMPI`s (code is duplicated).
Probably list of info_support interfaces can be extended by xxx_info_do_config().
developed by Igor, reviewed by miked

This commit was SVN r29429.
2013-10-12 19:03:32 +00:00

101 строка
2.8 KiB
C

/*
* Copyright (c) 2013 Mellanox Technologies, Inc.
* 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"
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 = ompi_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 */
ompi_info_close_components();
}
void oshmem_info_show_oshmem_version(const char *scope)
{
char *tmp, *tmp2;
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_WANT_REPO_REV, OSHMEM_REPO_REV);
opal_info_out("Open SHMEM", tmp, tmp2);
free(tmp);
free(tmp2);
asprintf(&tmp, "%s:version:repo", oshmem_info_type_oshmem);
opal_info_out("Open SHMEM repo revision", tmp, OSHMEM_REPO_REV);
free(tmp);
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);
}