OpenMPI  0.1.1
base.h File Reference

MCA coll base framework public interface functions. More...

#include "ompi_config.h"
#include "mpi.h"
#include "opal/class/opal_list.h"

Go to the source code of this file.

Functions

BEGIN_C_DECLS OMPI_DECLSPEC int mca_coll_base_open (void)
 Initialize the coll MCA framework. More...
 
int mca_coll_base_find_available (bool enable_progress_threads, bool enable_mpi_threads)
 Create list of available coll components. More...
 
int mca_coll_base_comm_select (struct ompi_communicator_t *comm)
 Select an available component for a new communicator. More...
 
int mca_coll_base_comm_unselect (struct ompi_communicator_t *comm)
 Finalize a coll component on a specific communicator. More...
 
OMPI_DECLSPEC int mca_coll_base_close (void)
 Shut down the coll MCA framework. More...
 

Variables

OMPI_DECLSPEC int mca_coll_base_output
 Coll framework debugging stream ID used with opal_output() and opal_output_verbose().
 
bool mca_coll_base_components_opened_valid
 Indicator as to whether the list of opened coll components is valid or not.
 
OMPI_DECLSPEC opal_list_t mca_coll_base_components_opened
 List of all opened components; created when the coll framework is initialized and destroyed when we reduce the list to all available coll components.
 
bool mca_coll_base_components_available_valid
 Indicator as to whether the list of available coll components is valid or not.
 
opal_list_t mca_coll_base_components_available
 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.
 

Detailed Description

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

Function Documentation

OMPI_DECLSPEC int mca_coll_base_close ( void  )

Shut down the coll MCA framework.

Return values
OMPI_SUCCESSAlways

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.

References mca_coll_base_components_available, mca_coll_base_components_available_valid, mca_coll_base_components_opened, mca_coll_base_components_opened_valid, mca_coll_base_output, and OBJ_DESTRUCT.

Referenced by ompi_mpi_finalize().

int mca_coll_base_comm_select ( struct ompi_communicator_t comm)

Select an available component for a new communicator.

Parameters
commCommunicator that the component will be selected for.
preferredThe component that is preferred for this communicator (or NULL).
Returns
OMPI_SUCCESS Upon success.
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).

References mca_coll_base_module_2_0_0_t::coll_module_enable, mca_coll_base_comm_unselect(), mca_coll_base_components_available, mca_coll_base_output, OBJ_RELEASE, opal_list_remove_first(), opal_output_verbose(), and orte_show_help().

Referenced by ompi_mpi_init().

int mca_coll_base_comm_unselect ( struct ompi_communicator_t comm)

Finalize a coll component on a specific communicator.

Parameters
commThe communicator that is being destroyed.
Return values
OMPI_SUCCESSAlways.

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.

Referenced by mca_coll_base_comm_select().

int mca_coll_base_find_available ( bool  enable_progress_threads,
bool  enable_mpi_threads 
)

Create list of available coll components.

Parameters
allow_multi_user_threadsWill be set to true if any of the available components will allow multiple user threads
have_hidden_threadsWill be set to true if any of the available components have hidden threads.
Return values
OMPI_SUCCESSIf one or more coll components are available.
OMPI_ERRORIf 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 only be used by other coll base functions – it is not considered a public interface member – and is only mentioned here for completeness.

References mca_coll_base_components_available_valid, mca_coll_base_components_opened, mca_coll_base_components_opened_valid, mca_coll_base_output, OBJ_CONSTRUCT, OBJ_DESTRUCT, OBJ_RELEASE, opal_list_append, opal_list_remove_first(), opal_output_verbose(), and orte_show_help().

Referenced by ompi_mpi_init().

BEGIN_C_DECLS OMPI_DECLSPEC int mca_coll_base_open ( void  )

Initialize the coll MCA framework.

Return values
OMPI_SUCCESSUpon success
OMPI_ERRORUpon 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 only be used by other coll base functions – it is not considered a public interface member – and is only mentioned here for completeness.

References mca_coll_base_components_opened_valid, mca_coll_base_output, and opal_output_open().

Referenced by ompi_mpi_init().