1
1
openmpi/ompi/mca/coll/base/base.h
Jeff Squyres e7ecd56bd2 This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.

= ORTE Job-Level Output Messages =

Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):

 * orte_output(): (and corresponding friends ORTE_OUTPUT,
   orte_output_verbose, etc.)  This function sends the output directly
   to the HNP for processing as part of a job-specific output
   channel.  It supports all the same outputs as opal_output()
   (syslog, file, stdout, stderr), but for stdout/stderr, the output
   is sent to the HNP for processing and output.  More on this below.
 * orte_show_help(): This function is a drop-in-replacement for
   opal_show_help(), with two differences in functionality:
   1. the rendered text help message output is sent to the HNP for
      display (rather than outputting directly into the process' stderr
      stream)
   1. the HNP detects duplicate help messages and does not display them
      (so that you don't see the same error message N times, once from
      each of your N MPI processes); instead, it counts "new" instances
      of the help message and displays a message every ~5 seconds when
      there are new ones ("I got X new copies of the help message...")

opal_show_help and opal_output still exist, but they only output in
the current process.  The intent for the new orte_* functions is that
they can apply job-level intelligence to the output.  As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.

=== New code ===

For ORTE and OMPI programmers, here's what you need to do differently
in new code:

 * Do not include opal/util/show_help.h or opal/util/output.h.
   Instead, include orte/util/output.h (this one header file has
   declarations for both the orte_output() series of functions and
   orte_show_help()).
 * Effectively s/opal_output/orte_output/gi throughout your code.
   Note that orte_output_open() takes a slightly different argument
   list (as a way to pass data to the filtering stream -- see below),
   so you if explicitly call opal_output_open(), you'll need to
   slightly adapt to the new signature of orte_output_open().
 * Literally s/opal_show_help/orte_show_help/.  The function signature
   is identical.

=== Notes ===

 * orte_output'ing to stream 0 will do similar to what
   opal_output'ing did, so leaving a hard-coded "0" as the first
   argument is safe.
 * For systems that do not use ORTE's RML or the HNP, the effect of
   orte_output_* and orte_show_help will be identical to their opal
   counterparts (the additional information passed to
   orte_output_open() will be lost!).  Indeed, the orte_* functions
   simply become trivial wrappers to their opal_* counterparts.  Note
   that we have not tested this; the code is simple but it is quite
   possible that we mucked something up.

= Filter Framework =

Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr.  The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations.  The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc.  This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).

Filtering is not active by default.  Filter components must be
specifically requested, such as:

{{{
$ mpirun --mca filter xml ...
}}}

There can only be one filter component active.

= New MCA Parameters =

The new functionality described above introduces two new MCA
parameters:

 * '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
   help messages will be aggregated, as described above.  If set to 0,
   all help messages will be displayed, even if they are duplicates
   (i.e., the original behavior).
 * '''orte_base_show_output_recursions''': An MCA parameter to help
   debug one of the known issues, described below.  It is likely that
   this MCA parameter will disappear before v1.3 final.

= Known Issues =

 * The XML filter component is not complete.  The current output from
   this component is preliminary and not real XML.  A bit more work
   needs to be done to configure.m4 search for an appropriate XML
   library/link it in/use it at run time.
 * There are possible recursion loops in the orte_output() and
   orte_show_help() functions -- e.g., if RML send calls orte_output()
   or orte_show_help().  We have some ideas how to fix these, but
   figured that it was ok to commit before feature freeze with known
   issues.  The code currently contains sub-optimal workarounds so
   that this will not be a problem, but it would be good to actually
   solve the problem rather than have hackish workarounds before v1.3 final.

This commit was SVN r18434.
2008-05-13 20:00:55 +00:00

210 строки
7.1 KiB
C

/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 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$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
/** @file
* MCA coll base framework public interface functions.
*
* These functions are normally invoked by the back-ends of:
*
* - The back-ends of MPI_Init() and MPI_Finalize()
* - Communuicactor constructors (e.g., MPI_Comm_split()) and
* destructors (e.g., MPI_Comm_free())
* - The laminfo command
*/
#ifndef MCA_COLL_BASE_H
#define MCA_COLL_BASE_H
#include "ompi_config.h"
#include "mpi.h"
#include "opal/class/opal_list.h"
#include "ompi/mca/coll/coll.h"
/*
* Global functions for MCA overall collective open and close
*/
BEGIN_C_DECLS
/**
* Initialize the coll MCA framework
*
* @retval OMPI_SUCCESS Upon success
* @retval OMPI_ERROR Upon failure
*
* This must be the first function invoked in the coll MCA
* framework. It initializes the coll MCA framework, finds and
* opens coll components, etc.
*
* This function is invoked during ompi_mpi_init() and during the
* initialization of the special case of the laminfo command.
*
* This function fills in the internal global variable
* mca_coll_base_components_opened, which is a list of all coll components
* that were successfully opened. This variable should \em only be
* used by other coll base functions -- it is not considered a
* public interface member -- and is only mentioned here for
* completeness.
*/
OMPI_DECLSPEC int mca_coll_base_open(void);
/**
* Create list of available coll components.
*
* @param allow_multi_user_threads Will be set to true if any of the
* available components will allow multiple user threads
* @param have_hidden_threads Will be set to true if any of the
* available components have hidden threads.
*
* @retval OMPI_SUCCESS If one or more coll components are available.
* @retval OMPI_ERROR If no coll components are found to be available.
*
* This function is invoked during ompi_mpi_init() to query all
* successfully opened coll components and create a list of all
* available coll components.
*
* This function traverses the (internal global variable)
* mca_coll_base_components_opened list and queries each component to see
* if it ever might want to run during this MPI process. It creates
* another internal global variable list named
* mca_coll_base_components_available, consisting of a list of components
* that are available for selection when communicators are created.
* This variable should \em only be used by other coll base
* functions -- it is not considered a public interface member --
* and is only mentioned here for completeness.
*/
int mca_coll_base_find_available(bool enable_progress_threads,
bool enable_mpi_threads);
/**
* Select an available component for a new communicator.
*
* @param comm Communicator that the component will be selected for.
* @param preferred The component that is preferred for this
* communicator (or NULL).
*
* @return OMPI_SUCCESS Upon success.
* @return OMPI_ERROR Upon failure.
*
* Note that the types of the parameters have "struct" in them
* (e.g., ompi_communicator_t" vs. a plain "ompi_communicator_t") to
* avoid an include file loop. All similar types (e.g., "struct
* ompi_communicator_t *", "ompi_communicator_t *", and "MPI_Comm")
* are all typedef'ed to be the same, so the fact that we use struct
* here in the prototype is ok.
*
* This function is invoked when a new communicator is created and a
* coll component needs to be selected for it. It should be invoked
* near the end of the communicator creation process such that
* almost everything else is functional on the communicator (e.g.,
* point-to-point communication).
*
* Note that new communicators may be created as a result of
* invoking this function. Specifically: this function is called in
* the depths of communicator creation, but during the execution of
* this function, new communicators may be created, and therefore
* communicator creation functions may be re-entered (albiet with
* different arguments).
*/
int mca_coll_base_comm_select(struct ompi_communicator_t *comm);
/**
* Finalize a coll component on a specific communicator.
*
* @param comm The communicator that is being destroyed.
*
* @retval OMPI_SUCCESS Always.
*
* Note that the type of the parameter is only a "struct
* ompi_communicator_t" (vs. a plain "ompi_communicator_t") to avoid
* an include file loop. The types "struct ompi_communicator_t *",
* "ompi_communicator_t *", and "MPI_Comm" are all typedef'ed to be
* the same, so the fact that we use struct here in the prototype is
* ok.
*
* This function is invoked near the beginning of the destruction of
* a communicator. It finalizes the coll component associated with the
* communicator (e.g., allowing the component to clean up and free any
* resources allocated for that communicator). Note that similar to
* mca_coll_base_select(), as result of this function, other
* communicators may also be destroyed.
*/
int mca_coll_base_comm_unselect(struct ompi_communicator_t *comm);
/**
* Shut down the coll MCA framework.
*
* @retval OMPI_SUCCESS Always
*
* This function shuts down everything in the coll MCA framework,
* and is called during ompi_mpi_finalize() and the special case of
* the laminfo command.
*
* It must be the last function invoked on the coll MCA framework.
*/
OMPI_DECLSPEC int mca_coll_base_close(void);
/*
* Globals
*/
/**
* Index number from the "coll" MCA parameter, created when the coll
* framework is initialized and used during scope selection.
*/
OMPI_DECLSPEC extern int mca_coll_base_param;
/**
* Coll framework debugging stream ID used with orte_output() and
* orte_output_verbose().
*/
OMPI_DECLSPEC extern int mca_coll_base_output;
/**
* Indicator as to whether the list of opened coll components is valid or
* not.
*/
extern bool mca_coll_base_components_opened_valid;
/**
* List of all opened components; created when the coll framework is
* initialized and destroyed when we reduce the list to all available
* coll components.
*/
OMPI_DECLSPEC extern opal_list_t mca_coll_base_components_opened;
/**
* Indicator as to whether the list of available coll components is valid
* or not.
*/
extern bool mca_coll_base_components_available_valid;
/**
* List of all available components; created by reducing the list of open
* components to all those who indicate that they may run during this
* process.
*/
extern opal_list_t mca_coll_base_components_available;
END_C_DECLS
#endif /* MCA_BASE_COLL_H */