2004-08-21 04:49:07 +04:00
/*
2007-03-17 02:11:45 +03:00
* Copyright ( c ) 2004 - 2007 The Trustees of Indiana University and Indiana
2005-11-05 22:57:48 +03:00
* 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 .
2004-11-28 23:09:25 +03:00
* Copyright ( c ) 2004 - 2005 High Performance Computing Center Stuttgart ,
* University of Stuttgart . All rights reserved .
2005-03-24 15:43:37 +03:00
* Copyright ( c ) 2004 - 2005 The Regents of the University of California .
* All rights reserved .
2008-07-29 02:40:57 +04:00
* Copyright ( c ) 2008 Cisco Systems , Inc . All rights reserved .
2004-11-22 04:38:40 +03:00
* $ COPYRIGHT $
*
* Additional copyrights may follow
*
2004-08-21 04:49:07 +04:00
* $ HEADER $
2005-09-03 15:49:46 +04:00
*/
/**
* @ file
2004-08-21 04:49:07 +04:00
*
2005-09-03 15:49:46 +04:00
* Most of the description of the data layout is in the
* coll_sm_module . c file .
2004-08-21 04:49:07 +04:00
*/
# include "ompi_config.h"
2006-02-12 04:33:29 +03:00
# include "ompi/constants.h"
2005-08-24 01:22:00 +04:00
# include "ompi/communicator/communicator.h"
# include "ompi/mca/coll/coll.h"
2008-06-09 18:53:58 +04:00
# include "orte/util/show_help.h"
2004-08-21 04:49:07 +04:00
# include "coll_sm.h"
2005-01-30 04:42:57 +03:00
2004-08-21 04:49:07 +04:00
/*
* Public string showing the coll ompi_sm component version number
*/
const char * mca_coll_sm_component_version_string =
Major simplifications to component versioning:
- After long discussions and ruminations on how we run components in
LAM/MPI, made the decision that, by default, all components included
in Open MPI will use the version number of their parent project
(i.e., OMPI or ORTE). They are certaint free to use a different
number, but this simplification makes the common cases easy:
- components are only released when the parent project is released
- it is easy (trivial?) to distinguish which version component goes
with with version of the parent project
- removed all autogen/configure code for templating the version .h
file in components
- made all ORTE components use ORTE_*_VERSION for version numbers
- made all OMPI components use OMPI_*_VERSION for version numbers
- removed all VERSION files from components
- configure now displays OPAL, ORTE, and OMPI version numbers
- ditto for ompi_info
- right now, faking it -- OPAL and ORTE and OMPI will always have the
same version number (i.e., they all come from the same top-level
VERSION file). But this paves the way for the Great Configure
Reorganization, where, among other things, each project will have
its own version number.
So all in all, we went from a boatload of version numbers to
[effectively] three. That's pretty good. :-)
This commit was SVN r6344.
2005-07-05 00:12:36 +04:00
" Open MPI sm collective MCA component version " OMPI_VERSION ;
2005-01-30 04:42:57 +03:00
/*
* Local functions
*/
static int sm_open ( void ) ;
2005-07-16 00:01:35 +04:00
static int sm_close ( void ) ;
2005-01-30 04:42:57 +03:00
2004-08-21 04:49:07 +04:00
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
2005-07-16 00:01:35 +04:00
mca_coll_sm_component_t mca_coll_sm_component = {
2004-08-21 04:49:07 +04:00
2008-07-29 02:40:57 +04:00
/* First, fill in the super */
2004-08-21 04:49:07 +04:00
2005-01-30 04:42:57 +03:00
{
2005-07-16 00:01:35 +04:00
/* First, the mca_component_t struct containing meta
information about the component itself */
{
2008-07-29 02:40:57 +04:00
MCA_COLL_BASE_VERSION_2_0_0 ,
2005-07-16 00:01:35 +04:00
/* Component name and version */
" sm " ,
OMPI_MAJOR_VERSION ,
OMPI_MINOR_VERSION ,
OMPI_RELEASE_VERSION ,
/* Component open and close functions */
sm_open ,
sm_close ,
} ,
{
2007-03-17 02:11:45 +03:00
/* The component is not checkpoint ready */
MCA_BASE_METADATA_PARAM_NONE
2005-07-16 00:01:35 +04:00
} ,
/* Initialization / querying functions */
mca_coll_sm_init_query ,
mca_coll_sm_comm_query ,
2005-01-30 04:42:57 +03:00
} ,
2004-08-21 04:49:07 +04:00
2005-07-16 00:01:35 +04:00
/* sm-component specifc information */
2004-08-21 04:49:07 +04:00
2005-08-24 01:22:00 +04:00
/* (default) priority */
2005-09-29 22:05:47 +04:00
/* JMS temporarily lowered until we can get more testing */
0 ,
2004-08-21 04:49:07 +04:00
2005-09-03 15:49:46 +04:00
/* (default) control size (bytes) */
4096 ,
2005-08-24 01:22:00 +04:00
/* (default) bootstrap filename */
2006-07-20 00:55:29 +04:00
" shared_mem_sm_bootstrap " ,
2005-08-24 01:22:00 +04:00
/* (default) number of segments in bootstrap file */
8 ,
/* (default) mpool name to use */
2005-07-16 00:01:35 +04:00
" sm " ,
2005-08-24 01:22:00 +04:00
2005-09-03 15:49:46 +04:00
/* (default) number of "in use" flags for each communicator's area
in the mpool */
2 ,
2005-08-24 01:22:00 +04:00
/* (default) number of segments for each communicator in the mpool
area */
2005-09-03 15:49:46 +04:00
8 ,
2005-08-24 01:22:00 +04:00
/* (default) fragment size */
8192 ,
/* (default) degree of tree for tree-based operations (must be <=
control unit size ) */
4 ,
2005-09-03 15:49:46 +04:00
/* (default) number of processes in coll_sm_shared_mem_size
information variable */
4 ,
2005-08-24 01:22:00 +04:00
/* default values for non-MCA parameters */
0 , /* bootstrap size -- filled in below */
0 , /* mpool data size -- filled in below */
NULL , /* data mpool pointer */
false , /* whether this process created the data mpool */
2005-10-06 17:17:27 +04:00
NULL , /* pointer to meta data about bootstrap area */
false , /* whether the component sm has been [lazily] inited or not */
false /* whether lazy init was successful or not */
/* the lock for lazy initialization is not initialized here --
there is no static initializer for opal_atomic_lock_t */
2004-08-21 04:49:07 +04:00
} ;
2005-01-30 04:42:57 +03:00
/*
* Open the component
*/
static int sm_open ( void )
{
2005-08-24 01:22:00 +04:00
size_t size1 , size2 ;
mca_base_component_t * c = & mca_coll_sm_component . super . collm_version ;
mca_coll_sm_component_t * cs = & mca_coll_sm_component ;
2005-07-16 00:01:35 +04:00
2005-01-30 04:42:57 +03:00
/* If we want to be selected (i.e., all procs on one node), then
we should have a high priority */
2005-07-16 00:01:35 +04:00
2005-08-24 01:22:00 +04:00
mca_base_param_reg_int ( c , " priority " ,
" Priority of the sm coll component " ,
false , false ,
cs - > sm_priority ,
& cs - > sm_priority ) ;
mca_base_param_reg_int ( c , " control_size " ,
2005-09-03 15:49:46 +04:00
" Length of the control data -- should usually be either the length of a cache line on most SMPs, or the size of a page on machines that support direct memory affinity page placement (in bytes) " ,
2005-08-24 01:22:00 +04:00
false , false ,
cs - > sm_control_size ,
& cs - > sm_control_size ) ;
mca_base_param_reg_string ( c , " bootstrap_filename " ,
" Filename (in the Open MPI session directory) of the coll sm component bootstrap rendezvous mmap file " ,
false , false ,
cs - > sm_bootstrap_filename ,
& cs - > sm_bootstrap_filename ) ;
mca_base_param_reg_int ( c , " bootstrap_num_segments " ,
" Number of segments in the bootstrap file " ,
false , false ,
cs - > sm_bootstrap_num_segments ,
& cs - > sm_bootstrap_num_segments ) ;
mca_base_param_reg_int ( c , " fragment_size " ,
2005-09-07 01:41:55 +04:00
" Fragment size (in bytes) used for passing data through shared memory (will be rounded up to the nearest control_size size) " ,
2005-08-24 01:22:00 +04:00
false , false ,
cs - > sm_fragment_size ,
& cs - > sm_fragment_size ) ;
if ( 0 ! = ( cs - > sm_fragment_size % cs - > sm_control_size ) ) {
cs - > sm_fragment_size + = cs - > sm_control_size -
( cs - > sm_fragment_size % cs - > sm_control_size ) ;
}
mca_base_param_reg_string ( c , " mpool " ,
" Name of the mpool component to use " ,
false , false ,
cs - > sm_mpool_name ,
& cs - > sm_mpool_name ) ;
2005-09-03 15:49:46 +04:00
mca_base_param_reg_int ( c , " comm_in_use_flags " ,
" Number of \" in use \" flags, used to mark a message passing area segment as currently being used or not (must be >= 2 and <= comm_num_segments) " ,
2005-08-24 01:22:00 +04:00
false , false ,
2005-09-03 15:49:46 +04:00
cs - > sm_comm_num_in_use_flags ,
& cs - > sm_comm_num_in_use_flags ) ;
if ( cs - > sm_comm_num_in_use_flags < 2 ) {
cs - > sm_comm_num_in_use_flags = 2 ;
}
mca_base_param_reg_int ( c , " comm_num_segments " ,
" Number of segments in each communicator's shared memory message passing area (must be >= 2, and must be a multiple of comm_in_use_flags) " ,
false , false ,
cs - > sm_comm_num_segments ,
& cs - > sm_comm_num_segments ) ;
2005-09-07 01:41:55 +04:00
if ( cs - > sm_comm_num_segments < cs - > sm_comm_num_in_use_flags ) {
cs - > sm_comm_num_segments = cs - > sm_comm_num_in_use_flags ;
2005-09-03 15:49:46 +04:00
}
if ( 0 ! = ( cs - > sm_comm_num_segments % cs - > sm_comm_num_in_use_flags ) ) {
cs - > sm_comm_num_segments + = cs - > sm_comm_num_in_use_flags -
( cs - > sm_comm_num_segments % cs - > sm_comm_num_in_use_flags ) ;
2005-09-02 16:57:47 +04:00
}
2005-10-01 03:12:23 +04:00
cs - > sm_segs_per_inuse_flag =
cs - > sm_comm_num_segments / cs - > sm_comm_num_in_use_flags ;
2005-07-16 00:01:35 +04:00
2005-08-24 01:22:00 +04:00
mca_base_param_reg_int ( c , " tree_degree " ,
2005-09-03 15:49:46 +04:00
" Degree of the tree for tree-based operations (must be => 1 and <= min(control_size, 255)) " ,
2005-08-24 01:22:00 +04:00
false , false ,
cs - > sm_tree_degree ,
& cs - > sm_tree_degree ) ;
if ( cs - > sm_tree_degree > cs - > sm_control_size ) {
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-14 00:00:55 +04:00
orte_show_help ( " help-coll-sm.txt " ,
2005-08-24 01:22:00 +04:00
" tree-degree-larger-than-control " , true ,
cs - > sm_tree_degree , cs - > sm_control_size ) ;
cs - > sm_tree_degree = cs - > sm_control_size ;
}
if ( cs - > sm_tree_degree > 255 ) {
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-14 00:00:55 +04:00
orte_show_help ( " help-coll-sm.txt " ,
2005-08-24 01:22:00 +04:00
" tree-degree-larger-than-255 " , true ,
cs - > sm_tree_degree ) ;
cs - > sm_tree_degree = 255 ;
}
2005-09-02 16:57:47 +04:00
/* Size of the bootstrap shared memory area. */
2005-08-24 01:22:00 +04:00
size1 =
sizeof ( mca_coll_sm_bootstrap_header_extension_t ) +
( mca_coll_sm_component . sm_bootstrap_num_segments *
sizeof ( mca_coll_sm_bootstrap_comm_setup_t ) ) +
( sizeof ( uint32_t ) * mca_coll_sm_component . sm_bootstrap_num_segments ) ;
mca_base_param_reg_int ( c , " shared_mem_used_bootstrap " ,
" Amount of shared memory used in the shared memory bootstrap area (in bytes) " ,
false , true ,
2006-11-08 19:54:03 +03:00
( int ) size1 , NULL ) ;
2005-08-24 01:22:00 +04:00
2005-09-07 01:41:55 +04:00
/* Calculate how much space we need in the data mpool. This
formula taken directly from coll_sm_module . c . */
2005-08-24 01:22:00 +04:00
2005-09-03 15:49:46 +04:00
mca_base_param_reg_int ( c , " info_num_procs " ,
" Number of processes to use for the calculation of the shared_mem_size MCA information parameter (must be => 2) " ,
false , false ,
cs - > sm_info_comm_size ,
& cs - > sm_info_comm_size ) ;
2005-09-07 01:41:55 +04:00
size2 = 4 * cs - > sm_control_size +
( cs - > sm_comm_num_in_use_flags * cs - > sm_control_size ) +
( cs - > sm_comm_num_segments * ( cs - > sm_info_comm_size * cs - > sm_control_size * 2 ) ) +
( cs - > sm_comm_num_segments * ( cs - > sm_info_comm_size * cs - > sm_fragment_size ) ) ;
2005-09-02 16:57:47 +04:00
mca_base_param_reg_int ( c , " shared_mem_used_data " ,
2005-09-07 01:41:55 +04:00
" Amount of shared memory used in the shared memory data area for info_num_procs processes (in bytes) " ,
2005-09-02 16:57:47 +04:00
false , true ,
2006-11-08 19:54:03 +03:00
( int ) size2 , NULL ) ;
2005-07-16 00:01:35 +04:00
return OMPI_SUCCESS ;
}
/*
* Close the component
*/
static int sm_close ( void )
{
if ( NULL ! = mca_coll_sm_component . sm_mpool_name ) {
free ( mca_coll_sm_component . sm_mpool_name ) ;
mca_coll_sm_component . sm_mpool_name = NULL ;
}
2005-01-30 04:42:57 +03:00
2005-08-24 01:22:00 +04:00
mca_coll_sm_bootstrap_finalize ( ) ;
2005-01-30 04:42:57 +03:00
return OMPI_SUCCESS ;
}
2007-08-19 07:37:49 +04:00
static void
mca_coll_sm_module_construct ( mca_coll_sm_module_t * module )
{
module - > sm_data = NULL ;
module - > previous_reduce_module = NULL ;
}
static void
mca_coll_sm_module_destruct ( mca_coll_sm_module_t * module )
{
mca_coll_sm_comm_t * data ;
/* Free the space in the data mpool and the data hanging off the
communicator */
data = module - > sm_data ;
if ( NULL ! = data ) {
/* If this was the process that allocated the space in the
data mpool , then this is the process that frees it */
if ( NULL ! = data - > mcb_data_mpool_malloc_addr ) {
mca_coll_sm_component . sm_data_mpool - > mpool_free ( mca_coll_sm_component . sm_data_mpool ,
data - > mcb_data_mpool_malloc_addr , NULL ) ;
}
/* Now free the data hanging off the communicator */
free ( data ) ;
}
if ( NULL ! = module - > previous_reduce_module ) {
OBJ_RELEASE ( module - > previous_reduce_module ) ;
}
}
OBJ_CLASS_INSTANCE ( mca_coll_sm_module_t ,
2008-07-29 02:40:57 +04:00
mca_coll_base_module_t ,
2007-08-19 07:37:49 +04:00
mca_coll_sm_module_construct ,
mca_coll_sm_module_destruct ) ;