2005-08-02 13:20:50 +00:00
/*
2007-03-16 23:11:45 +00:00
* Copyright ( c ) 2004 - 2007 The Trustees of Indiana University and Indiana
2005-11-05 19:57:48 +00:00
* University Research and Technology
* Corporation . All rights reserved .
2012-03-09 14:01:45 +00:00
* Copyright ( c ) 2004 - 2012 The University of Tennessee and The University
2005-11-05 19:57:48 +00:00
* of Tennessee Research Foundation . All rights
* reserved .
2005-08-02 13:20:50 +00:00
* 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 .
2012-07-12 15:13:08 +00:00
* Copyright ( c ) 2007 - 2012 Cisco Systems , Inc . All rights reserved .
2008-11-03 19:03:57 +00:00
* Copyright ( c ) 2008 Sun Microsystems , Inc . All rights reserved .
2012-06-27 01:28:28 +00:00
* Copyright ( c ) 2009 Oak Ridge National Laboratory
2013-02-28 17:31:47 +00:00
* Copyright ( c ) 2012 - 2013 Los Alamos National Security , LLC . All rights
2012-04-06 14:23:13 +00:00
* reserved .
2013-10-04 12:50:16 +00:00
* Copyright ( c ) 2013 NVIDIA Corporation . All rights reserved .
2005-08-02 13:20:50 +00:00
* $ COPYRIGHT $
*
* Additional copyrights may follow
*
* $ HEADER $
2006-03-11 03:09:24 +00:00
*
2005-08-02 13:20:50 +00:00
*/
# include "ompi_config.h"
2006-03-11 03:09:24 +00:00
2006-08-14 20:14:44 +00:00
# include "opal/opal_socket_errno.h"
2005-08-02 13:20:50 +00:00
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
# include <string.h>
# include <fcntl.h>
# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
# ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
# endif
# ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
# endif
# ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
# endif
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2007-04-25 01:55:40 +00:00
# ifdef HAVE_NETDB_H
# include <netdb.h>
# endif
# endif
2009-05-07 18:53:33 +00:00
# include <ctype.h>
2009-07-07 17:52:30 +00:00
# include <limits.h>
2005-08-02 13:20:50 +00:00
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 18:35:54 +00:00
# include "opal/mca/event/event.h"
2005-08-02 13:20:50 +00:00
# include "opal/util/if.h"
2009-02-14 02:26:12 +00:00
# include "opal/util/output.h"
2005-08-02 13:20:50 +00:00
# include "opal/util/argv.h"
2009-05-07 18:53:33 +00:00
# include "opal/util/net.h"
2013-02-12 21:10:11 +00:00
# include "opal/util/show_help.h"
2009-05-07 18:53:33 +00:00
2010-12-16 00:54:32 +00:00
# include "ompi/constants.h"
2009-05-07 18:53:33 +00:00
# include "ompi/mca/btl/btl.h"
2010-12-16 00:54:32 +00:00
# include "ompi/mca/btl/base/base.h"
2007-07-09 17:16:34 +00:00
# include "ompi/runtime/ompi_module_exchange.h"
2006-02-12 01:33:29 +00:00
# include "ompi/mca/mpool/base/base.h"
# include "ompi/mca/btl/base/btl_base_error.h"
2005-08-02 13:20:50 +00:00
# include "btl_tcp.h"
# include "btl_tcp_addr.h"
# include "btl_tcp_proc.h"
# include "btl_tcp_frag.h"
# include "btl_tcp_endpoint.h"
2013-11-01 12:19:40 +00:00
# if OPAL_CUDA_SUPPORT
2013-10-04 12:50:16 +00:00
# include "ompi/mca/common/cuda/common_cuda.h"
2013-11-01 12:19:40 +00:00
# endif /* OPAL_CUDA_SUPPORT */
2006-12-19 02:34:41 +00:00
2005-08-02 13:20:50 +00:00
2011-08-10 17:24:36 +00:00
/*
* Local functions
*/
static int mca_btl_tcp_component_register ( void ) ;
static int mca_btl_tcp_component_open ( void ) ;
static int mca_btl_tcp_component_close ( void ) ;
2013-03-27 21:09:41 +00:00
static char * mca_btl_tcp_if_seq_string ;
2011-08-10 17:24:36 +00:00
2005-08-02 13:20:50 +00:00
mca_btl_tcp_component_t mca_btl_tcp_component = {
{
/* First, the mca_base_component_t struct containing meta information
about the component itself */
{
2008-07-28 22:40:57 +00:00
MCA_BTL_BASE_VERSION_2_0_0 ,
2005-08-02 13:20:50 +00:00
" tcp " , /* MCA component name */
2007-07-11 15:45:25 +00:00
OMPI_MAJOR_VERSION , /* MCA component major version */
OMPI_MINOR_VERSION , /* MCA component minor version */
OMPI_RELEASE_VERSION , /* MCA component release version */
2005-08-02 13:20:50 +00:00
mca_btl_tcp_component_open , /* component open */
2011-08-10 17:24:36 +00:00
mca_btl_tcp_component_close , /* component close */
NULL , /* component query */
mca_btl_tcp_component_register , /* component register */
2005-08-02 13:20:50 +00:00
} ,
{
2007-03-16 23:11:45 +00:00
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
2005-08-02 13:20:50 +00:00
} ,
mca_btl_tcp_component_init ,
NULL ,
}
} ;
/*
* utility routines for parameter registration
*/
static inline char * mca_btl_tcp_param_register_string (
2007-07-25 12:21:00 +00:00
const char * param_name ,
const char * help_string ,
2013-03-27 21:09:41 +00:00
const char * default_value ,
2013-07-10 00:47:52 +00:00
int level ,
2013-03-27 21:09:41 +00:00
char * * storage )
2005-08-02 13:20:50 +00:00
{
2013-03-27 21:09:41 +00:00
* storage = ( char * ) default_value ;
( void ) mca_base_component_var_register ( & mca_btl_tcp_component . super . btl_version ,
param_name , help_string , MCA_BASE_VAR_TYPE_STRING ,
2013-07-10 00:47:52 +00:00
NULL , 0 , 0 , level ,
2013-03-27 21:09:41 +00:00
MCA_BASE_VAR_SCOPE_READONLY , storage ) ;
return * storage ;
2005-08-02 13:20:50 +00:00
}
static inline int mca_btl_tcp_param_register_int (
const char * param_name ,
2007-07-25 12:21:00 +00:00
const char * help_string ,
2013-03-27 21:09:41 +00:00
int default_value ,
2013-07-10 00:47:52 +00:00
int level ,
2013-03-27 21:09:41 +00:00
int * storage )
2005-08-02 13:20:50 +00:00
{
2013-03-27 21:09:41 +00:00
* storage = default_value ;
( void ) mca_base_component_var_register ( & mca_btl_tcp_component . super . btl_version ,
param_name , help_string , MCA_BASE_VAR_TYPE_INT ,
2013-07-10 00:47:52 +00:00
NULL , 0 , 0 , level ,
2013-03-27 21:09:41 +00:00
MCA_BASE_VAR_SCOPE_READONLY , storage ) ;
return * storage ;
}
static inline unsigned int mca_btl_tcp_param_register_uint (
const char * param_name ,
const char * help_string ,
unsigned int default_value ,
2013-07-10 00:47:52 +00:00
int level ,
2013-03-27 21:09:41 +00:00
unsigned int * storage )
{
* storage = default_value ;
( void ) mca_base_component_var_register ( & mca_btl_tcp_component . super . btl_version ,
param_name , help_string , MCA_BASE_VAR_TYPE_UNSIGNED_INT ,
2013-07-10 00:47:52 +00:00
NULL , 0 , 0 , level ,
2013-03-27 21:09:41 +00:00
MCA_BASE_VAR_SCOPE_READONLY , storage ) ;
return * storage ;
2005-08-02 13:20:50 +00:00
}
/*
* Data structure for accepting connections .
*/
struct mca_btl_tcp_event_t {
opal_list_item_t item ;
opal_event_t event ;
} ;
typedef struct mca_btl_tcp_event_t mca_btl_tcp_event_t ;
static void mca_btl_tcp_event_construct ( mca_btl_tcp_event_t * event )
{
OPAL_THREAD_LOCK ( & mca_btl_tcp_component . tcp_lock ) ;
opal_list_append ( & mca_btl_tcp_component . tcp_events , & event - > item ) ;
OPAL_THREAD_UNLOCK ( & mca_btl_tcp_component . tcp_lock ) ;
}
static void mca_btl_tcp_event_destruct ( mca_btl_tcp_event_t * event )
{
OPAL_THREAD_LOCK ( & mca_btl_tcp_component . tcp_lock ) ;
opal_list_remove_item ( & mca_btl_tcp_component . tcp_events , & event - > item ) ;
OPAL_THREAD_UNLOCK ( & mca_btl_tcp_component . tcp_lock ) ;
}
OBJ_CLASS_INSTANCE (
mca_btl_tcp_event_t ,
opal_list_item_t ,
mca_btl_tcp_event_construct ,
mca_btl_tcp_event_destruct ) ;
/*
* functions for receiving event callbacks
*/
static void mca_btl_tcp_component_recv_handler ( int , short , void * ) ;
2007-04-28 19:13:47 +00:00
static void mca_btl_tcp_component_accept_handler ( int , short , void * ) ;
2005-08-02 13:20:50 +00:00
2013-03-27 21:09:41 +00:00
static int mca_btl_tcp_component_verify ( void )
{
if ( mca_btl_tcp_component . tcp_port_min > USHRT_MAX ) {
opal_show_help ( " help-mpi-btl-tcp.txt " , " invalid minimum port " ,
true , " v4 " , ompi_process_info . nodename ,
mca_btl_tcp_component . tcp_port_min ) ;
mca_btl_tcp_component . tcp_port_min = 1024 ;
}
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2013-03-27 21:09:41 +00:00
if ( mca_btl_tcp_component . tcp6_port_min > USHRT_MAX ) {
opal_show_help ( " help-mpi-btl-tcp.txt " , " invalid minimum port " ,
true , " v6 " , ompi_process_info . nodename ,
mca_btl_tcp_component . tcp6_port_min ) ;
mca_btl_tcp_component . tcp6_port_min = 1024 ;
}
# endif
return OMPI_SUCCESS ;
}
2005-08-02 13:20:50 +00:00
/*
* Called by MCA framework to open the component , registers
* component parameters .
*/
2011-08-10 17:24:36 +00:00
static int mca_btl_tcp_component_register ( void )
2005-08-02 13:20:50 +00:00
{
2009-07-07 17:52:30 +00:00
char * message ;
2005-08-02 13:20:50 +00:00
/* register TCP component parameters */
2013-07-10 00:47:52 +00:00
mca_btl_tcp_param_register_uint ( " links " , NULL , 1 , OPAL_INFO_LVL_4 , & mca_btl_tcp_component . tcp_num_links ) ;
mca_btl_tcp_param_register_string ( " if_include " , " Comma-delimited list of devices and/or CIDR notation of networks to use for MPI communication (e.g., \" eth0,192.168.0.0/16 \" ). Mutually exclusive with btl_tcp_if_exclude. " , " " , OPAL_INFO_LVL_1 , & mca_btl_tcp_component . tcp_if_include ) ;
2013-03-27 21:09:41 +00:00
mca_btl_tcp_param_register_string ( " if_exclude " , " Comma-delimited list of devices and/or CIDR notation of networks to NOT use for MPI communication -- all devices not matching these specifications will be used (e.g., \" eth0,192.168.0.0/16 \" ). If set to a non-default value, it is mutually exclusive with btl_tcp_if_include. " ,
" 127.0.0.1/8,sppp " ,
2013-07-10 00:47:52 +00:00
OPAL_INFO_LVL_1 , & mca_btl_tcp_component . tcp_if_exclude ) ;
2013-03-27 21:09:41 +00:00
2013-07-10 00:47:52 +00:00
mca_btl_tcp_param_register_int ( " free_list_num " , NULL , 8 , OPAL_INFO_LVL_5 , & mca_btl_tcp_component . tcp_free_list_num ) ;
mca_btl_tcp_param_register_int ( " free_list_max " , NULL , - 1 , OPAL_INFO_LVL_5 , & mca_btl_tcp_component . tcp_free_list_max ) ;
mca_btl_tcp_param_register_int ( " free_list_inc " , NULL , 32 , OPAL_INFO_LVL_5 , & mca_btl_tcp_component . tcp_free_list_inc ) ;
mca_btl_tcp_param_register_int ( " sndbuf " , NULL , 128 * 1024 , OPAL_INFO_LVL_4 , & mca_btl_tcp_component . tcp_sndbuf ) ;
mca_btl_tcp_param_register_int ( " rcvbuf " , NULL , 128 * 1024 , OPAL_INFO_LVL_4 , & mca_btl_tcp_component . tcp_rcvbuf ) ;
2013-03-27 21:09:41 +00:00
mca_btl_tcp_param_register_int ( " endpoint_cache " ,
" The size of the internal cache for each TCP connection. This cache is "
" used to reduce the number of syscalls, by replacing them with memcpy. "
" Every read will read the expected data plus the amount of the "
2013-07-10 00:47:52 +00:00
" endpoint_cache " , 30 * 1024 , OPAL_INFO_LVL_4 , & mca_btl_tcp_component . tcp_endpoint_cache ) ;
mca_btl_tcp_param_register_int ( " use_nagle " , " Whether to use Nagle's algorithm or not (using Nagle's algorithm may increase short message latency) " , 0 , OPAL_INFO_LVL_4 , & mca_btl_tcp_component . tcp_not_use_nodelay ) ;
2013-03-27 21:09:41 +00:00
mca_btl_tcp_param_register_int ( " port_min_v4 " ,
" The minimum port where the TCP BTL will try to bind (default 1024) " ,
2013-07-10 00:47:52 +00:00
1024 , OPAL_INFO_LVL_2 , & mca_btl_tcp_component . tcp_port_min ) ;
2013-03-27 21:09:41 +00:00
2009-07-07 17:52:30 +00:00
asprintf ( & message ,
" The number of ports where the TCP BTL will try to bind (default %d). "
" This parameter together with the port min, define a range of ports "
" where Open MPI will open sockets. " ,
( 0x1 < < 16 ) - mca_btl_tcp_component . tcp_port_min - 1 ) ;
2013-03-27 21:09:41 +00:00
mca_btl_tcp_param_register_int ( " port_range_v4 " , message ,
( 0x1 < < 16 ) - mca_btl_tcp_component . tcp_port_min - 1 ,
2013-07-10 00:47:52 +00:00
OPAL_INFO_LVL_2 , & mca_btl_tcp_component . tcp_port_range ) ;
2009-07-07 17:52:30 +00:00
free ( message ) ;
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2013-03-27 21:09:41 +00:00
mca_btl_tcp_param_register_int ( " port_min_v6 " ,
" The minimum port where the TCP BTL will try to bind (default 1024) " , 1024 ,
2013-07-10 00:47:52 +00:00
OPAL_INFO_LVL_2 , & mca_btl_tcp_component . tcp6_port_min ) ;
2009-07-07 17:52:30 +00:00
asprintf ( & message ,
" The number of ports where the TCP BTL will try to bind (default %d). "
" This parameter together with the port min, define a range of ports "
" where Open MPI will open sockets. " ,
( 0x1 < < 16 ) - mca_btl_tcp_component . tcp6_port_min - 1 ) ;
2013-03-27 21:09:41 +00:00
mca_btl_tcp_param_register_int ( " port_range_v6 " , message ,
( 0x1 < < 16 ) - mca_btl_tcp_component . tcp6_port_min - 1 ,
2013-07-10 00:47:52 +00:00
OPAL_INFO_LVL_2 , & mca_btl_tcp_component . tcp6_port_range ) ;
2009-07-07 17:52:30 +00:00
free ( message ) ;
2007-10-26 16:36:51 +00:00
# endif
2011-08-10 17:24:36 +00:00
2014-01-08 00:21:25 +00:00
mca_btl_tcp_component . report_all_unfound_interfaces = false ;
( void ) mca_base_component_var_register ( & mca_btl_tcp_component . super . btl_version ,
" warn_all_unfound_interfaces " ,
" Issue a warning for all unfound interfaces included in if_exclude " ,
MCA_BASE_VAR_TYPE_BOOL ,
NULL , 0 , 0 , OPAL_INFO_LVL_5 ,
MCA_BASE_VAR_SCOPE_READONLY , & mca_btl_tcp_component . report_all_unfound_interfaces ) ;
2007-12-12 15:55:37 +00:00
mca_btl_tcp_module . super . btl_exclusivity = MCA_BTL_EXCLUSIVITY_LOW + 100 ;
2007-05-17 07:54:27 +00:00
mca_btl_tcp_module . super . btl_eager_limit = 64 * 1024 ;
2007-12-16 08:35:17 +00:00
mca_btl_tcp_module . super . btl_rndv_eager_limit = 64 * 1024 ;
2007-05-17 07:54:27 +00:00
mca_btl_tcp_module . super . btl_max_send_size = 128 * 1024 ;
2007-06-21 07:12:40 +00:00
mca_btl_tcp_module . super . btl_rdma_pipeline_send_length = 128 * 1024 ;
2007-05-17 07:54:27 +00:00
mca_btl_tcp_module . super . btl_rdma_pipeline_frag_size = INT_MAX ;
mca_btl_tcp_module . super . btl_min_rdma_pipeline_size = 0 ;
mca_btl_tcp_module . super . btl_flags = MCA_BTL_FLAGS_PUT |
2006-08-16 20:21:38 +00:00
MCA_BTL_FLAGS_SEND_INPLACE |
2007-05-17 07:54:27 +00:00
MCA_BTL_FLAGS_NEED_CSUM |
2007-08-28 21:23:44 +00:00
MCA_BTL_FLAGS_NEED_ACK |
MCA_BTL_FLAGS_HETEROGENEOUS_RDMA ;
2012-06-21 17:09:12 +00:00
mca_btl_tcp_module . super . btl_seg_size = sizeof ( mca_btl_base_segment_t ) ;
2007-05-17 07:54:27 +00:00
mca_btl_tcp_module . super . btl_bandwidth = 100 ;
2007-06-05 12:22:57 +00:00
mca_btl_tcp_module . super . btl_latency = 100 ;
2011-08-10 17:24:36 +00:00
2007-05-17 07:54:27 +00:00
mca_btl_base_param_register ( & mca_btl_tcp_component . super . btl_version ,
2009-04-10 16:44:37 +00:00
& mca_btl_tcp_module . super ) ;
2007-05-17 07:54:27 +00:00
2013-07-10 00:47:52 +00:00
mca_btl_tcp_param_register_int ( " disable_family " , NULL , 0 , OPAL_INFO_LVL_2 , & mca_btl_tcp_component . tcp_disable_family ) ;
2008-01-15 05:32:53 +00:00
2010-12-16 00:54:32 +00:00
/* Register a list of interfaces to use in sequence */
2013-03-27 21:09:41 +00:00
mca_btl_tcp_param_register_string ( " if_seq " ,
2013-07-10 00:47:52 +00:00
" If specified, a comma-delimited list of TCP interfaces. Interfaces will be assigned, one to each MPI process, in a round-robin fashion on each server. For example, if the list is \" eth0,eth1 \" and four MPI processes are run on a single server, then local ranks 0 and 2 will use eth0 and local ranks 1 and 3 will use eth1. " , NULL , OPAL_INFO_LVL_9 , & mca_btl_tcp_if_seq_string ) ;
2013-03-27 21:09:41 +00:00
2010-12-16 00:54:32 +00:00
mca_btl_tcp_component . tcp_if_seq = NULL ;
2013-03-27 21:09:41 +00:00
if ( NULL ! = mca_btl_tcp_if_seq_string & & ' \0 ' ! = * mca_btl_tcp_if_seq_string ) {
char * * argv = opal_argv_split ( mca_btl_tcp_if_seq_string , ' , ' ) ;
2010-12-16 00:54:32 +00:00
if ( NULL ! = argv & & ' \0 ' ! = * ( argv [ 0 ] ) ) {
int if_index , rc , count ;
2013-01-27 23:25:10 +00:00
ompi_node_rank_t node_rank ;
2010-12-16 00:54:32 +00:00
char name [ 256 ] ;
2013-01-27 23:25:10 +00:00
node_rank = ompi_process_info . my_node_rank ;
2010-12-16 00:54:32 +00:00
/* Now that we've got that local rank, take the
corresponding entry from the tcp_if_seq list ( wrapping
if necessary ) */
count = opal_argv_count ( argv ) ;
mca_btl_tcp_component . tcp_if_seq =
strdup ( argv [ node_rank % count ] ) ;
opal_argv_free ( argv ) ;
/* Double check that the selected interface actually exists */
for ( if_index = opal_ifbegin ( ) ; if_index > = 0 ;
if_index = opal_ifnext ( if_index ) ) {
if ( OPAL_SUCCESS ! =
( rc = opal_ifindextoname ( if_index , name , sizeof ( name ) ) ) ) {
return rc ;
}
if ( 0 = = strcmp ( name , mca_btl_tcp_component . tcp_if_seq ) ) {
break ;
}
}
if ( if_index < 0 ) {
2013-02-12 21:10:11 +00:00
opal_show_help ( " help-mpi-btl-tcp.txt " ,
2010-12-16 00:54:32 +00:00
" invalid if_inexclude " ,
true , " if_seq " ,
2013-01-27 23:25:10 +00:00
ompi_process_info . nodename ,
2010-12-16 00:54:32 +00:00
mca_btl_tcp_component . tcp_if_seq ,
" Interface does not exist " ) ;
2013-02-01 20:17:43 +00:00
free ( mca_btl_tcp_component . tcp_if_seq ) ;
mca_btl_tcp_component . tcp_if_seq = NULL ;
} else {
BTL_VERBOSE ( ( " Node rank %d using TCP interface %s " ,
node_rank , mca_btl_tcp_component . tcp_if_seq ) ) ;
2010-12-16 00:54:32 +00:00
}
}
}
2013-03-27 21:09:41 +00:00
return mca_btl_tcp_component_verify ( ) ;
2005-08-02 13:20:50 +00:00
}
2011-08-10 17:24:36 +00:00
static int mca_btl_tcp_component_open ( void )
{
2013-03-27 21:09:41 +00:00
if ( OMPI_SUCCESS ! = mca_btl_tcp_component_verify ( ) ) {
return OMPI_ERROR ;
}
2011-08-10 17:24:36 +00:00
/* initialize state */
mca_btl_tcp_component . tcp_listen_sd = - 1 ;
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2011-08-10 17:24:36 +00:00
mca_btl_tcp_component . tcp6_listen_sd = - 1 ;
# endif
mca_btl_tcp_component . tcp_num_btls = 0 ;
mca_btl_tcp_component . tcp_addr_count = 0 ;
mca_btl_tcp_component . tcp_btls = NULL ;
/* initialize objects */
OBJ_CONSTRUCT ( & mca_btl_tcp_component . tcp_lock , opal_mutex_t ) ;
OBJ_CONSTRUCT ( & mca_btl_tcp_component . tcp_procs , opal_hash_table_t ) ;
OBJ_CONSTRUCT ( & mca_btl_tcp_component . tcp_events , opal_list_t ) ;
OBJ_CONSTRUCT ( & mca_btl_tcp_component . tcp_frag_eager , ompi_free_list_t ) ;
OBJ_CONSTRUCT ( & mca_btl_tcp_component . tcp_frag_max , ompi_free_list_t ) ;
OBJ_CONSTRUCT ( & mca_btl_tcp_component . tcp_frag_user , ompi_free_list_t ) ;
opal_hash_table_init ( & mca_btl_tcp_component . tcp_procs , 256 ) ;
/* if_include and if_exclude need to be mutually exclusive */
if ( OPAL_SUCCESS ! =
2013-03-27 21:09:41 +00:00
mca_base_var_check_exclusive ( " ompi " ,
2011-08-10 17:24:36 +00:00
mca_btl_tcp_component . super . btl_version . mca_type_name ,
mca_btl_tcp_component . super . btl_version . mca_component_name ,
" if_include " ,
mca_btl_tcp_component . super . btl_version . mca_type_name ,
mca_btl_tcp_component . super . btl_version . mca_component_name ,
" if_exclude " ) ) {
/* Return ERR_NOT_AVAILABLE so that a warning message about
" open " failing is not printed */
return OMPI_ERR_NOT_AVAILABLE ;
}
return OMPI_SUCCESS ;
}
2005-08-02 13:20:50 +00:00
/*
* module cleanup - sanity checking of queue lengths
*/
2011-08-10 17:24:36 +00:00
static int mca_btl_tcp_component_close ( void )
2005-08-02 13:20:50 +00:00
{
opal_list_item_t * item ;
2008-11-03 19:03:57 +00:00
opal_list_item_t * next ;
2005-08-02 13:20:50 +00:00
2010-12-16 00:54:32 +00:00
if ( NULL ! = mca_btl_tcp_component . tcp_if_seq ) {
free ( mca_btl_tcp_component . tcp_if_seq ) ;
}
2008-11-04 16:49:46 +00:00
2005-08-02 13:20:50 +00:00
if ( NULL ! = mca_btl_tcp_component . tcp_btls )
free ( mca_btl_tcp_component . tcp_btls ) ;
2013-03-27 21:09:41 +00:00
2005-08-02 13:20:50 +00:00
if ( mca_btl_tcp_component . tcp_listen_sd > = 0 ) {
2010-10-28 15:22:46 +00:00
opal_event_del ( & mca_btl_tcp_component . tcp_recv_event ) ;
2006-08-24 16:38:08 +00:00
CLOSE_THE_SOCKET ( mca_btl_tcp_component . tcp_listen_sd ) ;
2005-08-02 13:20:50 +00:00
mca_btl_tcp_component . tcp_listen_sd = - 1 ;
}
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2007-04-25 01:55:40 +00:00
if ( mca_btl_tcp_component . tcp6_listen_sd > = 0 ) {
2010-10-28 15:22:46 +00:00
opal_event_del ( & mca_btl_tcp_component . tcp6_recv_event ) ;
2007-04-25 01:55:40 +00:00
CLOSE_THE_SOCKET ( mca_btl_tcp_component . tcp6_listen_sd ) ;
mca_btl_tcp_component . tcp6_listen_sd = - 1 ;
}
# endif
2005-08-02 13:20:50 +00:00
/* cleanup any pending events */
OPAL_THREAD_LOCK ( & mca_btl_tcp_component . tcp_lock ) ;
2008-11-03 19:03:57 +00:00
for ( item = opal_list_get_first ( & mca_btl_tcp_component . tcp_events ) ;
item ! = opal_list_get_end ( & mca_btl_tcp_component . tcp_events ) ;
item = next ) {
2005-08-02 13:20:50 +00:00
mca_btl_tcp_event_t * event = ( mca_btl_tcp_event_t * ) item ;
2008-11-03 19:03:57 +00:00
next = opal_list_get_next ( item ) ;
2010-10-28 15:22:46 +00:00
opal_event_del ( & event - > event ) ;
2005-08-02 13:20:50 +00:00
OBJ_RELEASE ( event ) ;
}
OPAL_THREAD_UNLOCK ( & mca_btl_tcp_component . tcp_lock ) ;
/* release resources */
OBJ_DESTRUCT ( & mca_btl_tcp_component . tcp_procs ) ;
OBJ_DESTRUCT ( & mca_btl_tcp_component . tcp_events ) ;
OBJ_DESTRUCT ( & mca_btl_tcp_component . tcp_frag_eager ) ;
OBJ_DESTRUCT ( & mca_btl_tcp_component . tcp_frag_max ) ;
OBJ_DESTRUCT ( & mca_btl_tcp_component . tcp_frag_user ) ;
OBJ_DESTRUCT ( & mca_btl_tcp_component . tcp_lock ) ;
2006-08-24 16:38:08 +00:00
2005-08-02 13:20:50 +00:00
return OMPI_SUCCESS ;
}
/*
* Create a btl instance and add to modules list .
*/
2007-04-25 01:55:40 +00:00
static int mca_btl_tcp_create ( int if_kindex , const char * if_name )
2005-08-02 13:20:50 +00:00
{
2007-03-20 11:50:17 +00:00
struct mca_btl_tcp_module_t * btl ;
2005-08-02 13:20:50 +00:00
char param [ 256 ] ;
2007-03-20 11:50:17 +00:00
int i ;
for ( i = 0 ; i < ( int ) mca_btl_tcp_component . tcp_num_links ; i + + ) {
btl = ( struct mca_btl_tcp_module_t * ) malloc ( sizeof ( mca_btl_tcp_module_t ) ) ;
if ( NULL = = btl )
return OMPI_ERR_OUT_OF_RESOURCE ;
memcpy ( btl , & mca_btl_tcp_module , sizeof ( mca_btl_tcp_module ) ) ;
OBJ_CONSTRUCT ( & btl - > tcp_endpoints , opal_list_t ) ;
mca_btl_tcp_component . tcp_btls [ mca_btl_tcp_component . tcp_num_btls + + ] = btl ;
/* initialize the btl */
2007-04-25 01:55:40 +00:00
btl - > tcp_ifkindex = ( uint16_t ) if_kindex ;
2005-08-02 13:20:50 +00:00
# if MCA_BTL_TCP_STATISTICS
2007-03-20 11:50:17 +00:00
btl - > tcp_bytes_recv = 0 ;
btl - > tcp_bytes_sent = 0 ;
btl - > tcp_send_handler = 0 ;
2005-08-02 13:20:50 +00:00
# endif
2007-03-20 11:50:17 +00:00
/* allow user to specify interface bandwidth */
sprintf ( param , " bandwidth_%s " , if_name ) ;
2013-07-10 00:47:52 +00:00
mca_btl_tcp_param_register_uint ( param , NULL , btl - > super . btl_bandwidth , OPAL_INFO_LVL_5 , & btl - > super . btl_bandwidth ) ;
2007-03-20 11:50:17 +00:00
/* allow user to override/specify latency ranking */
sprintf ( param , " latency_%s " , if_name ) ;
2013-07-10 00:47:52 +00:00
mca_btl_tcp_param_register_uint ( param , NULL , btl - > super . btl_latency , OPAL_INFO_LVL_5 , & btl - > super . btl_latency ) ;
2007-03-20 11:50:17 +00:00
if ( i > 0 ) {
btl - > super . btl_bandwidth > > = 1 ;
btl - > super . btl_latency < < = 1 ;
}
2007-05-30 14:12:05 +00:00
2007-03-20 11:50:17 +00:00
/* allow user to specify interface bandwidth */
sprintf ( param , " bandwidth_%s:%d " , if_name , i ) ;
2013-07-10 00:47:52 +00:00
mca_btl_tcp_param_register_uint ( param , NULL , btl - > super . btl_bandwidth , OPAL_INFO_LVL_5 , & btl - > super . btl_bandwidth ) ;
2005-08-02 13:20:50 +00:00
2007-03-20 11:50:17 +00:00
/* allow user to override/specify latency ranking */
sprintf ( param , " latency_%s:%d " , if_name , i ) ;
2013-07-10 00:47:52 +00:00
mca_btl_tcp_param_register_uint ( param , NULL , btl - > super . btl_latency , OPAL_INFO_LVL_5 , & btl - > super . btl_latency ) ;
2009-05-06 20:11:28 +00:00
#if 0 && OPAL_ENABLE_DEBUG
2007-03-20 11:50:17 +00:00
BTL_OUTPUT ( ( " interface %s instance %i: bandwidth %d latency %d \n " , if_name , i ,
btl - > super . btl_bandwidth , btl - > super . btl_latency ) ) ;
2005-08-02 13:20:50 +00:00
# endif
2007-03-20 11:50:17 +00:00
}
2005-08-02 13:20:50 +00:00
return OMPI_SUCCESS ;
}
2009-05-07 18:53:33 +00:00
/*
* Go through a list of argv ; if there are any subnet specifications
* ( a . b . c . d / e ) , resolve them to an interface name ( Currently only
* supporting IPv4 ) . If unresolvable , warn and remove .
*/
2013-12-21 01:51:11 +00:00
static char * * split_and_resolve ( char * * orig_str , char * name , bool reqd )
2009-05-07 18:53:33 +00:00
{
int i , ret , save , if_index ;
2009-05-07 20:31:26 +00:00
char * * argv , * str , * tmp ;
2009-05-07 18:53:33 +00:00
char if_name [ IF_NAMESIZE ] ;
struct sockaddr_storage argv_inaddr , if_inaddr ;
uint32_t argv_prefix ;
/* Sanity check */
if ( NULL = = orig_str | | NULL = = * orig_str ) {
2009-05-07 21:50:02 +00:00
return NULL ;
2009-05-07 18:53:33 +00:00
}
argv = opal_argv_split ( * orig_str , ' , ' ) ;
2009-05-07 21:50:02 +00:00
if ( NULL = = argv ) {
return NULL ;
}
2009-05-07 18:53:33 +00:00
for ( save = i = 0 ; NULL ! = argv [ i ] ; + + i ) {
if ( isalpha ( argv [ i ] [ 0 ] ) ) {
argv [ save + + ] = argv [ i ] ;
continue ;
}
/* Found a subnet notation. Convert it to an IP
address / netmask . Get the prefix first . */
argv_prefix = 0 ;
2009-05-07 20:31:26 +00:00
tmp = strdup ( argv [ i ] ) ;
2009-05-07 18:53:33 +00:00
str = strchr ( argv [ i ] , ' / ' ) ;
if ( NULL = = str ) {
2013-02-12 21:10:11 +00:00
opal_show_help ( " help-mpi-btl-tcp.txt " , " invalid if_inexclude " ,
2013-01-27 23:25:10 +00:00
true , name , ompi_process_info . nodename ,
2009-05-09 12:29:06 +00:00
tmp , " Invalid specification (missing \" / \" ) " ) ;
2009-05-07 18:53:33 +00:00
free ( argv [ i ] ) ;
2009-05-07 20:31:26 +00:00
free ( tmp ) ;
2009-05-07 18:53:33 +00:00
continue ;
}
* str = ' \0 ' ;
argv_prefix = atoi ( str + 1 ) ;
/* Now convert the IPv4 address */
( ( struct sockaddr * ) & argv_inaddr ) - > sa_family = AF_INET ;
ret = inet_pton ( AF_INET , argv [ i ] ,
& ( ( struct sockaddr_in * ) & argv_inaddr ) - > sin_addr ) ;
free ( argv [ i ] ) ;
if ( 1 ! = ret ) {
2013-02-12 21:10:11 +00:00
opal_show_help ( " help-mpi-btl-tcp.txt " , " invalid if_inexclude " ,
2013-01-27 23:25:10 +00:00
true , name , ompi_process_info . nodename , tmp ,
2009-05-09 12:29:06 +00:00
" Invalid specification (inet_pton() failed) " ) ;
2009-05-07 20:31:26 +00:00
free ( tmp ) ;
2009-05-07 18:53:33 +00:00
continue ;
}
2013-03-27 21:17:31 +00:00
opal_output_verbose ( 20 , ompi_btl_base_framework . framework_output ,
2009-05-07 18:53:33 +00:00
" btl: tcp: Searching for %s address+prefix: %s / %u " ,
name ,
opal_net_get_hostname ( ( struct sockaddr * ) & argv_inaddr ) ,
argv_prefix ) ;
/* Go through all interfaces and see if we can find a match */
for ( if_index = opal_ifbegin ( ) ; if_index > = 0 ;
if_index = opal_ifnext ( if_index ) ) {
opal_ifindextoaddr ( if_index ,
( struct sockaddr * ) & if_inaddr ,
sizeof ( if_inaddr ) ) ;
if ( opal_net_samenetwork ( ( struct sockaddr * ) & argv_inaddr ,
( struct sockaddr * ) & if_inaddr ,
argv_prefix ) ) {
break ;
}
}
/* If we didn't find a match, keep trying */
2013-12-26 15:02:41 +00:00
if ( if_index < 0 ) {
2014-01-08 00:21:25 +00:00
if ( reqd | | mca_btl_tcp_component . report_all_unfound_interfaces ) {
2013-12-26 15:02:41 +00:00
opal_show_help ( " help-mpi-btl-tcp.txt " , " invalid if_inexclude " ,
true , name , ompi_process_info . nodename , tmp ,
" Did not find interface matching this subnet " ) ;
}
2009-05-07 20:31:26 +00:00
free ( tmp ) ;
2009-05-07 18:53:33 +00:00
continue ;
}
/* We found a match; get the name and replace it in the
argv */
opal_ifindextoname ( if_index , if_name , sizeof ( if_name ) ) ;
2013-03-27 21:17:31 +00:00
opal_output_verbose ( 20 , ompi_btl_base_framework . framework_output ,
2009-05-07 18:53:33 +00:00
" btl: tcp: Found match: %s (%s) " ,
opal_net_get_hostname ( ( struct sockaddr * ) & if_inaddr ) ,
if_name ) ;
argv [ save + + ] = strdup ( if_name ) ;
2009-05-07 20:31:26 +00:00
free ( tmp ) ;
2009-05-07 18:53:33 +00:00
}
/* The list may have been compressed if there were invalid
entries , so ensure we end it with a NULL entry */
argv [ save ] = NULL ;
free ( * orig_str ) ;
* orig_str = opal_argv_join ( argv , ' , ' ) ;
return argv ;
}
2005-08-02 13:20:50 +00:00
/*
* Create a TCP BTL instance for either :
* ( 1 ) all interfaces specified by the user
* ( 2 ) all available interfaces
* ( 3 ) all available interfaces except for those excluded by the user
*/
static int mca_btl_tcp_component_create_instances ( void )
{
2007-04-25 01:55:40 +00:00
const int if_count = opal_ifcount ( ) ;
2005-08-02 13:20:50 +00:00
int if_index ;
2007-04-25 01:55:40 +00:00
int kif_count = 0 ;
2007-04-25 19:08:07 +00:00
int * kindexes = NULL ; /* this array is way too large, but never too small */
2005-08-02 13:20:50 +00:00
char * * include ;
char * * exclude ;
char * * argv ;
2007-04-25 19:08:07 +00:00
int ret = OMPI_SUCCESS ;
2005-08-02 13:20:50 +00:00
2007-04-25 01:55:40 +00:00
if ( if_count < = 0 ) {
2005-08-02 13:20:50 +00:00
return OMPI_ERROR ;
2007-04-25 01:55:40 +00:00
}
2007-09-12 15:29:58 +00:00
kindexes = ( int * ) malloc ( sizeof ( int ) * if_count ) ;
2007-04-25 20:17:19 +00:00
if ( NULL = = kindexes ) {
return OMPI_ERR_OUT_OF_RESOURCE ;
}
2007-04-25 19:08:07 +00:00
2007-04-25 01:55:40 +00:00
/* calculate the number of kernel indexes (number of physical NICs) */
{
int j ;
/* initialize array to 0. Assumption: 0 isn't a valid kernel index */
2007-04-25 19:08:07 +00:00
memset ( kindexes , 0 , sizeof ( int ) * if_count ) ;
2007-04-25 01:55:40 +00:00
/* assign the corresponding kernel indexes for all opal_list indexes
* ( loop over all addresses )
*/
for ( if_index = opal_ifbegin ( ) ; if_index > = 0 ; if_index = opal_ifnext ( if_index ) ) {
int index = opal_ifindextokindex ( if_index ) ;
if ( index > 0 ) {
2010-12-16 00:54:32 +00:00
bool want_this_if = true ;
/* Have we seen this if already? */
for ( j = 0 ; want_this_if & & ( j < kif_count ) ; j + + ) {
2007-04-25 01:55:40 +00:00
if ( kindexes [ j ] = = index ) {
2010-12-16 00:54:32 +00:00
want_this_if = false ;
}
}
/* If we have an if_seq list, see if this is the one
interface that we ' re supposed to have */
if ( NULL ! = mca_btl_tcp_component . tcp_if_seq ) {
char name [ 256 ] ;
opal_ifindextoname ( if_index , name , sizeof ( name ) ) ;
if ( 0 ! = strcmp ( mca_btl_tcp_component . tcp_if_seq , name ) ) {
want_this_if = false ;
2007-04-25 01:55:40 +00:00
}
}
2010-12-16 00:54:32 +00:00
if ( want_this_if ) {
2007-04-25 01:55:40 +00:00
kindexes [ kif_count ] = index ;
kif_count + + ;
}
}
}
}
2005-08-02 13:20:50 +00:00
/* allocate memory for btls */
2007-03-20 11:50:17 +00:00
mca_btl_tcp_component . tcp_btls = ( mca_btl_tcp_module_t * * ) malloc ( mca_btl_tcp_component . tcp_num_links *
2007-04-25 01:55:40 +00:00
kif_count * sizeof ( mca_btl_tcp_module_t * ) ) ;
if ( NULL = = mca_btl_tcp_component . tcp_btls ) {
2007-04-25 19:08:07 +00:00
ret = OMPI_ERR_OUT_OF_RESOURCE ;
goto cleanup ;
2007-04-25 01:55:40 +00:00
}
mca_btl_tcp_component . tcp_addr_count = if_count ;
2005-08-02 13:20:50 +00:00
/* if the user specified an interface list - use these exclusively */
2009-05-07 18:53:33 +00:00
argv = include = split_and_resolve ( & mca_btl_tcp_component . tcp_if_include ,
2013-12-21 01:51:11 +00:00
" include " , true ) ;
2005-08-02 13:20:50 +00:00
while ( argv & & * argv ) {
char * if_name = * argv ;
2007-04-25 01:55:40 +00:00
int if_index = opal_ifnametokindex ( if_name ) ;
2005-08-02 13:20:50 +00:00
if ( if_index < 0 ) {
BTL_ERROR ( ( " invalid interface \" %s \" " , if_name ) ) ;
2009-05-07 18:53:33 +00:00
ret = OMPI_ERR_NOT_FOUND ;
goto cleanup ;
2005-08-02 13:20:50 +00:00
}
2009-07-13 19:40:00 +00:00
mca_btl_tcp_create ( if_index , if_name ) ;
2005-08-02 13:20:50 +00:00
argv + + ;
}
opal_argv_free ( include ) ;
2009-05-07 18:53:33 +00:00
/* If we made any modules, then the "include" list was non-empty,
and therefore we ' re done . */
if ( mca_btl_tcp_component . tcp_num_btls > 0 ) {
2007-04-25 19:08:07 +00:00
ret = OMPI_SUCCESS ;
goto cleanup ;
}
2005-08-02 13:20:50 +00:00
/* if the interface list was not specified by the user, create
* a BTL for each interface that was not excluded .
*/
2009-05-07 18:53:33 +00:00
exclude = split_and_resolve ( & mca_btl_tcp_component . tcp_if_exclude ,
2013-12-21 01:51:11 +00:00
" exclude " , false ) ;
2007-04-25 01:55:40 +00:00
{
int i ;
for ( i = 0 ; i < kif_count ; i + + ) {
2008-11-05 18:45:42 +00:00
/* IF_NAMESIZE is defined in opal/util/if.h */
char if_name [ IF_NAMESIZE ] ;
2007-04-25 01:55:40 +00:00
if_index = kindexes [ i ] ;
opal_ifkindextoname ( if_index , if_name , sizeof ( if_name ) ) ;
/* check to see if this interface exists in the exclude list */
2009-07-13 19:40:00 +00:00
argv = exclude ;
while ( argv & & * argv ) {
2010-03-03 15:51:15 +00:00
if ( strncmp ( * argv , if_name , strlen ( * argv ) ) = = 0 )
2009-07-13 19:40:00 +00:00
break ;
argv + + ;
}
/* if this interface was not found in the excluded list, create a BTL */
if ( argv = = 0 | | * argv = = 0 ) {
2005-08-02 13:20:50 +00:00
mca_btl_tcp_create ( if_index , if_name ) ;
}
}
}
opal_argv_free ( exclude ) ;
2007-04-25 19:08:07 +00:00
cleanup :
2007-04-25 20:17:19 +00:00
if ( NULL ! = kindexes ) {
free ( kindexes ) ;
}
2007-04-25 19:08:07 +00:00
return ret ;
2005-08-02 13:20:50 +00:00
}
/*
* Create a listen socket and bind to all interfaces
*/
2007-04-25 01:55:40 +00:00
static int mca_btl_tcp_component_create_listen ( uint16_t af_family )
2005-08-02 13:20:50 +00:00
{
int flags ;
2007-04-25 01:55:40 +00:00
int sd ;
2007-10-26 16:36:51 +00:00
struct sockaddr_storage inaddr ;
2006-09-14 21:29:51 +00:00
opal_socklen_t addrlen ;
2005-08-02 13:20:50 +00:00
/* create a listen socket for incoming connections */
2007-04-25 01:55:40 +00:00
sd = socket ( af_family , SOCK_STREAM , 0 ) ;
if ( sd < 0 ) {
2007-05-16 20:11:47 +00:00
if ( EAFNOSUPPORT ! = opal_socket_errno ) {
BTL_ERROR ( ( " socket() failed: %s (%d) " ,
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
}
return OMPI_ERR_IN_ERRNO ;
2005-08-02 13:20:50 +00:00
}
2007-04-25 01:55:40 +00:00
mca_btl_tcp_set_socket_options ( sd ) ;
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2007-04-25 01:55:40 +00:00
{
struct addrinfo hints , * res = NULL ;
int error ;
memset ( & hints , 0 , sizeof ( hints ) ) ;
hints . ai_family = af_family ;
hints . ai_socktype = SOCK_STREAM ;
hints . ai_flags = AI_PASSIVE ;
if ( ( error = getaddrinfo ( NULL , " 0 " , & hints , & res ) ) ) {
2008-06-09 14:53:58 +00:00
opal_output ( 0 ,
2007-04-25 01:55:40 +00:00
" mca_btl_tcp_create_listen: unable to resolve. %s \n " ,
gai_strerror ( error ) ) ;
2007-10-26 16:36:51 +00:00
CLOSE_THE_SOCKET ( sd ) ;
return OMPI_ERROR ;
2007-04-25 01:55:40 +00:00
}
memcpy ( & inaddr , res - > ai_addr , res - > ai_addrlen ) ;
addrlen = res - > ai_addrlen ;
freeaddrinfo ( res ) ;
2007-06-28 18:52:15 +00:00
# ifdef IPV6_V6ONLY
2007-04-25 01:55:40 +00:00
/* in case of AF_INET6, disable v4-mapped addresses */
if ( AF_INET6 = = af_family ) {
More more discussion and testing has occurred off-ticket.
Short version: there is a bug in OS X/Snow Leopard, but there is also
a bug in Open MPI. Fixing the bug in Open MPI is both trivial (a
1-line change) and avoids the bug in OS X. We'll file an OS X bug
report upstream with Apple, but it should no longer affect us here in
OMPI.
Fixes trac:2039.
More details:
Some background first:
1. IPv4 sockets can only accept incoming IPv4 connections. However,
IPv6 sockets can be configured to accept ''only'' incoming IPv6
connection, or ''both'' incoming IPv4 and IPv6 connections. An
IPv6 socket attribute sets which listening behavior is used.
1. IPv4 and IPv6 have different port namespaces. Hence, it is
permissable to bind a v4 socket to port X ''and'' also bind a v6
socket to that same port X on the same interface (assuming that
the v6 socket is only accepting incoming v6 connections).
Incoming v4 connections to port X on the interface should get
matched to the listening v4 socket; incoming v6 connections should
get matched to the listening v6 socket.
1. When v6 sockets accept ''both'' incoming v4 and v6 connections, it
should claim port X in both namespaces.
1. Linux's default behavior is to only allow one listening socket to
be bound to a given port (i.e., ''either'' a v6 or v4 socket to be
bound to a single port X -- not both). A v6 socket can listen for
both v4 and v6 incoming connections on that port, but still --
only one socket will be bound to that port.
1. Snow Leopard's default behavior is to share ports -- i.e., let
both a v4 and a v6 listening socket to be bound to port X
(assuming that the v6 socket is only accepting incoming v6
connections).
The TCP BTL creates a listening socket for each address family.
Hence, it creates a v4 listening socket on INADDR_ANY and a v6
listening socket on the v6 equivalent of INADDR_ANY. OMPI then
iteratively tries to find ports to listen on within the range of
[mca_btl_tcp_port_min, mca_btl_tcp_port_min + mca_btl_tcp_port_range).
On Linux, the v4 socket will be bound to port X and the v6 socket will
likely be bound to port Y (where X != Y). On Snow Leopard, the v4
socket will be bound to port X and the v6 socket may ''also'' be bound
to port X. Since the namespaces are separate, this shouldn't be a
problem.
However, Open MPI was accidentally setting the v6 listening behavior
to accept ''both'' v4 and v6 incoming connections. This is a trivial
thing to fix -- change a 0 to a 1 in the code. On Linux, this issue
didn't matter because the v4 and v6 sockets were on different ports.
So even though the v6 socket ''would'' have accepted incoming v4
connections, that never happened because OMPI would direct v4
connections to the v4 port.
But on Snow Leopard, the v4 and v6 listening ports could end up
sharing the same port number. As mentioned above, this ''shouldn't''
have been a problem, but it looks like Snow Leopard has the following
bugs:
* If a v4 socket is already bound to port X, we're pretty sure that a
v6 socket with the "accept both v4 and v6 incoming connections"
listening behavior should not be able to claim port X (because
there's already a v4 socket listening on X). However, Snow Leopard
would allow binding a v4 socket to port X, and then allow a v6
socket configured to allow incoming v4 and v6 connections to
''also'' be bound to port X.
* After binding the v6 socket to port X, Snow Leopard then lets
''another'' v4 socket ''also'' get bound to port X. Hence, there's
now '''three''' sockets all listening on port X.
This obviously led to mis-matched TCP connections, and things went
downhill from there.
That being said, Snow Leopard doesn't exhibit this behavior if v6
sockets only allow incoming v6 connections. And technically, that is
exactly the behavior we want (we want v6 sockets to only accept
incoming v6 connections). So if we just change the flag to make our
v6 listening socket us this behavior, the problem on OS X goes away.
That's what this commit does -- it changes a 0 to a 1, indicating
"only let this v6 socket allow incoming v6 connections."
That was simple, wasn't it?
This commit was SVN r22788.
The following Trac tickets were found above:
Ticket 2039 --> https://svn.open-mpi.org/trac/ompi/ticket/2039
2010-03-05 17:37:57 +00:00
int flg = 1 ;
2007-04-25 01:55:40 +00:00
if ( setsockopt ( sd , IPPROTO_IPV6 , IPV6_V6ONLY ,
2009-07-02 14:41:03 +00:00
( char * ) & flg , sizeof ( flg ) ) < 0 ) {
2008-06-09 14:53:58 +00:00
opal_output ( 0 ,
2007-04-25 01:55:40 +00:00
" mca_btl_tcp_create_listen: unable to disable v4-mapped addresses \n " ) ;
}
}
2007-06-28 18:52:15 +00:00
# endif /* IPV6_V6ONLY */
2007-04-25 01:55:40 +00:00
}
# else
2007-10-26 16:36:51 +00:00
( ( struct sockaddr_in * ) & inaddr ) - > sin_family = AF_INET ;
( ( struct sockaddr_in * ) & inaddr ) - > sin_addr . s_addr = INADDR_ANY ;
addrlen = sizeof ( struct sockaddr_in ) ;
2007-04-25 01:55:40 +00:00
# endif
2007-10-26 16:36:51 +00:00
{ /* Don't reuse ports */
int flg = 0 ;
2008-09-08 15:39:30 +00:00
if ( setsockopt ( sd , SOL_SOCKET , SO_REUSEADDR , ( const char * ) & flg , sizeof ( flg ) ) < 0 ) {
2009-05-14 13:57:37 +00:00
BTL_ERROR ( ( " mca_btl_tcp_create_listen: unable to unset the "
" SO_REUSEADDR option (%s:%d) \n " ,
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
2007-10-26 16:36:51 +00:00
CLOSE_THE_SOCKET ( sd ) ;
return OMPI_ERROR ;
}
2005-08-02 13:20:50 +00:00
}
2007-04-25 01:55:40 +00:00
2007-10-26 16:36:51 +00:00
{
int index , range , port ;
2007-10-26 20:15:28 +00:00
range = mca_btl_tcp_component . tcp_port_range ;
port = mca_btl_tcp_component . tcp_port_min ;
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2007-10-26 16:36:51 +00:00
if ( AF_INET6 = = af_family ) {
range = mca_btl_tcp_component . tcp6_port_range ;
port = mca_btl_tcp_component . tcp6_port_min ;
}
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# endif /* OPAL_ENABLE_IPV6 */
2007-10-26 16:36:51 +00:00
for ( index = 0 ; index < range ; index + + ) {
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2009-07-07 17:21:28 +00:00
( ( struct sockaddr_in6 * ) & inaddr ) - > sin6_port = htons ( port + index ) ;
2007-10-26 16:36:51 +00:00
# else
2009-07-07 17:21:28 +00:00
( ( struct sockaddr_in * ) & inaddr ) - > sin_port = htons ( port + index ) ;
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# endif /* OPAL_ENABLE_IPV6 */
2007-10-26 16:36:51 +00:00
if ( bind ( sd , ( struct sockaddr * ) & inaddr , addrlen ) < 0 ) {
if ( ( EADDRINUSE = = opal_socket_errno ) | | ( EADDRNOTAVAIL = = opal_socket_errno ) ) {
continue ;
}
BTL_ERROR ( ( " bind() failed: %s (%d) " ,
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
CLOSE_THE_SOCKET ( sd ) ;
return OMPI_ERROR ;
}
goto socket_binded ;
}
if ( AF_INET = = af_family ) {
BTL_ERROR ( ( " bind() failed: no port available in the range [%d..%d] " ,
mca_btl_tcp_component . tcp_port_min ,
mca_btl_tcp_component . tcp_port_min + range ) ) ;
}
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2007-10-26 16:36:51 +00:00
if ( AF_INET6 = = af_family ) {
BTL_ERROR ( ( " bind6() failed: no port available in the range [%d..%d] " ,
mca_btl_tcp_component . tcp6_port_min ,
mca_btl_tcp_component . tcp6_port_min + range ) ) ;
}
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# endif /* OPAL_ENABLE_IPV6 */
2007-10-26 16:36:51 +00:00
CLOSE_THE_SOCKET ( sd ) ;
return OMPI_ERROR ;
}
socket_binded :
2005-08-02 13:20:50 +00:00
/* resolve system assignend port */
2007-04-25 01:55:40 +00:00
if ( getsockname ( sd , ( struct sockaddr * ) & inaddr , & addrlen ) < 0 ) {
2006-12-14 18:20:43 +00:00
BTL_ERROR ( ( " getsockname() failed: %s (%d) " ,
2007-03-20 11:50:17 +00:00
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
2007-10-26 16:36:51 +00:00
CLOSE_THE_SOCKET ( sd ) ;
2005-08-02 13:20:50 +00:00
return OMPI_ERROR ;
}
2007-04-25 01:55:40 +00:00
if ( AF_INET = = af_family ) {
2007-10-26 16:36:51 +00:00
mca_btl_tcp_component . tcp_listen_port = ( ( struct sockaddr_in * ) & inaddr ) - > sin_port ;
mca_btl_tcp_component . tcp_listen_sd = sd ;
2007-04-25 01:55:40 +00:00
}
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2007-04-25 01:55:40 +00:00
if ( AF_INET6 = = af_family ) {
2007-10-26 16:36:51 +00:00
mca_btl_tcp_component . tcp6_listen_port = ( ( struct sockaddr_in6 * ) & inaddr ) - > sin6_port ;
mca_btl_tcp_component . tcp6_listen_sd = sd ;
2007-04-25 01:55:40 +00:00
}
# endif
2005-08-02 13:20:50 +00:00
/* setup listen backlog to maximum allowed by kernel */
2007-04-25 01:55:40 +00:00
if ( listen ( sd , SOMAXCONN ) < 0 ) {
2006-12-14 18:20:43 +00:00
BTL_ERROR ( ( " listen() failed: %s (%d) " ,
2007-03-20 11:50:17 +00:00
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
2007-10-26 16:36:51 +00:00
CLOSE_THE_SOCKET ( sd ) ;
2005-08-02 13:20:50 +00:00
return OMPI_ERROR ;
}
/* set socket up to be non-blocking, otherwise accept could block */
2007-04-25 01:55:40 +00:00
if ( ( flags = fcntl ( sd , F_GETFL , 0 ) ) < 0 ) {
2006-12-14 18:20:43 +00:00
BTL_ERROR ( ( " fcntl(F_GETFL) failed: %s (%d) " ,
2007-03-20 11:50:17 +00:00
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
2007-10-26 16:36:51 +00:00
CLOSE_THE_SOCKET ( sd ) ;
2005-08-02 13:20:50 +00:00
return OMPI_ERROR ;
} else {
flags | = O_NONBLOCK ;
2007-04-25 01:55:40 +00:00
if ( fcntl ( sd , F_SETFL , flags ) < 0 ) {
2006-12-14 18:20:43 +00:00
BTL_ERROR ( ( " fcntl(F_SETFL) failed: %s (%d) " ,
2007-03-20 11:50:17 +00:00
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
2007-10-26 16:36:51 +00:00
CLOSE_THE_SOCKET ( sd ) ;
2005-08-02 13:20:50 +00:00
return OMPI_ERROR ;
}
}
/* register listen port */
2007-04-25 01:55:40 +00:00
if ( AF_INET = = af_family ) {
2010-10-28 15:22:46 +00:00
opal_event_set ( opal_event_base , & mca_btl_tcp_component . tcp_recv_event ,
2007-10-26 16:36:51 +00:00
mca_btl_tcp_component . tcp_listen_sd ,
2007-04-28 19:13:47 +00:00
OPAL_EV_READ | OPAL_EV_PERSIST ,
mca_btl_tcp_component_accept_handler ,
0 ) ;
2010-10-28 15:22:46 +00:00
opal_event_add ( & mca_btl_tcp_component . tcp_recv_event , 0 ) ;
2007-04-25 01:55:40 +00:00
}
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2007-04-25 01:55:40 +00:00
if ( AF_INET6 = = af_family ) {
2010-10-28 15:22:46 +00:00
opal_event_set ( opal_event_base , & mca_btl_tcp_component . tcp6_recv_event ,
2007-10-26 16:36:51 +00:00
mca_btl_tcp_component . tcp6_listen_sd ,
2007-04-28 19:13:47 +00:00
OPAL_EV_READ | OPAL_EV_PERSIST ,
mca_btl_tcp_component_accept_handler ,
0 ) ;
2010-10-28 15:22:46 +00:00
opal_event_add ( & mca_btl_tcp_component . tcp6_recv_event , 0 ) ;
2007-04-25 01:55:40 +00:00
}
# endif
2005-08-02 13:20:50 +00:00
return OMPI_SUCCESS ;
}
/*
* Register TCP module addressing information . The MCA framework
* will make this available to all peers .
*/
static int mca_btl_tcp_component_exchange ( void )
{
2007-04-28 19:13:47 +00:00
int rc = 0 , index ;
size_t i = 0 ;
2007-04-25 01:55:40 +00:00
size_t size = mca_btl_tcp_component . tcp_addr_count *
2007-04-28 19:13:47 +00:00
mca_btl_tcp_component . tcp_num_links * sizeof ( mca_btl_tcp_addr_t ) ;
2007-04-25 01:55:40 +00:00
/* adi@2007-04-12:
*
* We ' ll need to explain things a bit here :
* 1. We normally have as many BTLs as physical NICs .
* 2. With num_links , we now have num_btl = num_links * # NICs
* 3. we might have more than one address per NIC
*/
size_t xfer_size = 0 ; /* real size to transfer (may differ from 'size') */
size_t current_addr = 0 ;
2005-08-02 13:20:50 +00:00
if ( mca_btl_tcp_component . tcp_num_btls ! = 0 ) {
mca_btl_tcp_addr_t * addrs = ( mca_btl_tcp_addr_t * ) malloc ( size ) ;
2007-04-28 19:13:47 +00:00
memset ( addrs , 0 , size ) ;
2007-04-25 01:55:40 +00:00
/* here we start populating our addresses */
2007-04-28 19:13:47 +00:00
for ( i = 0 ; i < mca_btl_tcp_component . tcp_num_btls ; i + + ) {
2007-04-25 01:55:40 +00:00
for ( index = opal_ifbegin ( ) ; index > = 0 ;
index = opal_ifnext ( index ) ) {
struct sockaddr_storage my_ss ;
/* look if the address belongs to this (enabled) NIC.
* If not , go to next address
*/
if ( opal_ifindextokindex ( index ) ! =
mca_btl_tcp_component . tcp_btls [ i ] - > tcp_ifkindex ) {
continue ;
}
if ( OPAL_SUCCESS ! =
2007-05-17 01:17:59 +00:00
opal_ifindextoaddr ( index , ( struct sockaddr * ) & my_ss ,
sizeof ( my_ss ) ) ) {
2008-06-09 14:53:58 +00:00
opal_output ( 0 ,
2007-04-25 01:55:40 +00:00
" btl_tcp_component: problems getting address for index %i (kernel index %i) \n " ,
index , opal_ifindextokindex ( index ) ) ;
continue ;
}
if ( ( AF_INET = = my_ss . ss_family ) & &
( 4 ! = mca_btl_tcp_component . tcp_disable_family ) ) {
memcpy ( & addrs [ current_addr ] . addr_inet ,
& ( ( struct sockaddr_in * ) & my_ss ) - > sin_addr ,
sizeof ( addrs [ 0 ] . addr_inet ) ) ;
addrs [ current_addr ] . addr_port =
mca_btl_tcp_component . tcp_listen_port ;
addrs [ current_addr ] . addr_family = MCA_BTL_TCP_AF_INET ;
xfer_size + = sizeof ( mca_btl_tcp_addr_t ) ;
addrs [ current_addr ] . addr_inuse = 0 ;
addrs [ current_addr ] . addr_ifkindex =
opal_ifindextokindex ( index ) ;
current_addr + + ;
}
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2007-04-25 01:55:40 +00:00
if ( ( AF_INET6 = = my_ss . ss_family ) & &
( 6 ! = mca_btl_tcp_component . tcp_disable_family ) ) {
memcpy ( & addrs [ current_addr ] . addr_inet ,
& ( ( struct sockaddr_in6 * ) & my_ss ) - > sin6_addr ,
sizeof ( addrs [ 0 ] . addr_inet ) ) ;
addrs [ current_addr ] . addr_port =
mca_btl_tcp_component . tcp6_listen_port ;
addrs [ current_addr ] . addr_family = MCA_BTL_TCP_AF_INET6 ;
xfer_size + = sizeof ( mca_btl_tcp_addr_t ) ;
addrs [ current_addr ] . addr_inuse = 0 ;
addrs [ current_addr ] . addr_ifkindex =
opal_ifindextokindex ( index ) ;
current_addr + + ;
}
# endif
} /* end of for opal_ifbegin() */
} /* end of for tcp_num_btls */
2007-07-09 17:16:34 +00:00
rc = ompi_modex_send ( & mca_btl_tcp_component . super . btl_version ,
addrs , xfer_size ) ;
2005-08-02 13:20:50 +00:00
free ( addrs ) ;
2007-04-25 01:55:40 +00:00
} /* end if */
2005-08-02 13:20:50 +00:00
return rc ;
}
/*
* TCP module initialization :
* ( 1 ) read interface list from kernel and compare against module parameters
* then create a BTL instance for selected interfaces
* ( 2 ) setup TCP listen socket for incoming connection attempts
* ( 3 ) register BTL parameters with the MCA
*/
mca_btl_base_module_t * * mca_btl_tcp_component_init ( int * num_btl_modules ,
bool enable_progress_threads ,
bool enable_mpi_threads )
{
2007-07-13 16:38:36 +00:00
int ret = OMPI_SUCCESS ;
2005-08-02 13:20:50 +00:00
mca_btl_base_module_t * * btls ;
* num_btl_modules = 0 ;
/* initialize free lists */
2007-11-01 23:38:50 +00:00
ompi_free_list_init_new ( & mca_btl_tcp_component . tcp_frag_eager ,
2005-09-07 13:25:05 +00:00
sizeof ( mca_btl_tcp_frag_eager_t ) +
mca_btl_tcp_module . super . btl_eager_limit ,
2010-07-06 14:33:36 +00:00
opal_cache_line_size ,
2005-08-02 13:20:50 +00:00
OBJ_CLASS ( mca_btl_tcp_frag_eager_t ) ,
2010-07-06 14:33:36 +00:00
0 , opal_cache_line_size ,
2005-08-02 13:20:50 +00:00
mca_btl_tcp_component . tcp_free_list_num ,
mca_btl_tcp_component . tcp_free_list_max ,
mca_btl_tcp_component . tcp_free_list_inc ,
NULL ) ;
2007-11-01 23:38:50 +00:00
ompi_free_list_init_new ( & mca_btl_tcp_component . tcp_frag_max ,
2005-09-07 13:25:05 +00:00
sizeof ( mca_btl_tcp_frag_max_t ) +
mca_btl_tcp_module . super . btl_max_send_size ,
2010-07-06 14:33:36 +00:00
opal_cache_line_size ,
2005-08-02 13:20:50 +00:00
OBJ_CLASS ( mca_btl_tcp_frag_max_t ) ,
2010-07-06 14:33:36 +00:00
0 , opal_cache_line_size ,
2005-08-02 13:20:50 +00:00
mca_btl_tcp_component . tcp_free_list_num ,
mca_btl_tcp_component . tcp_free_list_max ,
mca_btl_tcp_component . tcp_free_list_inc ,
NULL ) ;
2007-11-01 23:38:50 +00:00
ompi_free_list_init_new ( & mca_btl_tcp_component . tcp_frag_user ,
2005-08-02 13:20:50 +00:00
sizeof ( mca_btl_tcp_frag_user_t ) ,
2010-07-06 14:33:36 +00:00
opal_cache_line_size ,
2005-08-02 13:20:50 +00:00
OBJ_CLASS ( mca_btl_tcp_frag_user_t ) ,
2010-07-06 14:33:36 +00:00
0 , opal_cache_line_size ,
2005-08-02 13:20:50 +00:00
mca_btl_tcp_component . tcp_free_list_num ,
mca_btl_tcp_component . tcp_free_list_max ,
mca_btl_tcp_component . tcp_free_list_inc ,
NULL ) ;
/* create a BTL TCP module for selected interfaces */
2007-07-13 16:38:36 +00:00
if ( OMPI_SUCCESS ! = ( ret = mca_btl_tcp_component_create_instances ( ) ) ) {
2005-08-02 13:20:50 +00:00
return 0 ;
2007-04-25 01:55:40 +00:00
}
2005-08-02 13:20:50 +00:00
/* create a TCP listen socket for incoming connection attempts */
2007-07-13 16:38:36 +00:00
if ( OMPI_SUCCESS ! = ( ret = mca_btl_tcp_component_create_listen ( AF_INET ) ) ) {
2005-08-02 13:20:50 +00:00
return 0 ;
2007-04-25 01:55:40 +00:00
}
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2007-05-16 20:11:47 +00:00
if ( ( ret = mca_btl_tcp_component_create_listen ( AF_INET6 ) ) ! = OMPI_SUCCESS ) {
2012-04-06 14:23:13 +00:00
if ( ! ( OMPI_ERR_IN_ERRNO = = ret & &
2010-05-17 23:08:56 +00:00
EAFNOSUPPORT = = opal_socket_errno ) ) {
2008-06-09 14:53:58 +00:00
opal_output ( 0 , " mca_btl_tcp_component: IPv6 listening socket failed \n " ) ;
2007-05-16 20:11:47 +00:00
return 0 ;
}
2007-04-25 01:55:40 +00:00
}
# endif
2005-08-02 13:20:50 +00:00
/* publish TCP parameters with the MCA framework */
2007-07-13 16:38:36 +00:00
if ( OMPI_SUCCESS ! = ( ret = mca_btl_tcp_component_exchange ( ) ) ) {
2005-08-02 13:20:50 +00:00
return 0 ;
2007-04-25 01:55:40 +00:00
}
2005-08-02 13:20:50 +00:00
btls = ( mca_btl_base_module_t * * ) malloc ( mca_btl_tcp_component . tcp_num_btls *
sizeof ( mca_btl_base_module_t * ) ) ;
2007-04-25 01:55:40 +00:00
if ( NULL = = btls ) {
2005-08-02 13:20:50 +00:00
return NULL ;
2007-04-25 01:55:40 +00:00
}
2005-08-02 13:20:50 +00:00
2013-11-01 12:19:40 +00:00
# if OPAL_CUDA_SUPPORT
2013-10-04 12:50:16 +00:00
mca_common_cuda_stage_one_init ( ) ;
2013-11-01 12:19:40 +00:00
# endif /* OPAL_CUDA_SUPPORT */
2013-10-04 12:50:16 +00:00
2005-08-02 13:20:50 +00:00
memcpy ( btls , mca_btl_tcp_component . tcp_btls , mca_btl_tcp_component . tcp_num_btls * sizeof ( mca_btl_tcp_module_t * ) ) ;
* num_btl_modules = mca_btl_tcp_component . tcp_num_btls ;
return btls ;
}
2007-04-28 19:13:47 +00:00
/**
* Called by the event engine when the listening socket has
* a connection event . Accept the incoming connection request
* and queue them for completion of the connection handshake .
*/
static void mca_btl_tcp_component_accept_handler ( int incoming_sd ,
short ignored ,
void * unused )
2005-08-02 13:20:50 +00:00
{
while ( true ) {
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 16:37:40 +00:00
# if OPAL_ENABLE_IPV6
2007-04-25 01:55:40 +00:00
struct sockaddr_in6 addr ;
# else
2005-08-02 13:20:50 +00:00
struct sockaddr_in addr ;
2007-04-25 01:55:40 +00:00
# endif
opal_socklen_t addrlen = sizeof ( addr ) ;
2005-08-02 13:20:50 +00:00
mca_btl_tcp_event_t * event ;
2007-04-25 01:55:40 +00:00
int sd = accept ( incoming_sd , ( struct sockaddr * ) & addr , & addrlen ) ;
2005-08-02 13:20:50 +00:00
if ( sd < 0 ) {
2006-08-14 20:14:44 +00:00
if ( opal_socket_errno = = EINTR )
2005-08-02 13:20:50 +00:00
continue ;
2006-08-24 16:38:08 +00:00
if ( opal_socket_errno ! = EAGAIN & & opal_socket_errno ! = EWOULDBLOCK )
2006-12-14 18:20:43 +00:00
BTL_ERROR ( ( " accept() failed: %s (%d). " ,
2007-03-20 11:50:17 +00:00
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
2005-08-02 13:20:50 +00:00
return ;
}
mca_btl_tcp_set_socket_options ( sd ) ;
/* wait for receipt of peers process identifier to complete this connection */
event = OBJ_NEW ( mca_btl_tcp_event_t ) ;
2010-10-28 15:22:46 +00:00
opal_event_set ( opal_event_base , & event - > event , sd , OPAL_EV_READ , mca_btl_tcp_component_recv_handler , event ) ;
opal_event_add ( & event - > event , 0 ) ;
2005-08-02 13:20:50 +00:00
}
}
2007-04-28 19:13:47 +00:00
/**
2005-08-02 13:20:50 +00:00
* Event callback when there is data available on the registered
2007-04-28 19:13:47 +00:00
* socket to recv . This callback is triggered only once per lifetime
* for any socket , in the beginning when we setup the handshake
* protocol .
2005-08-02 13:20:50 +00:00
*/
static void mca_btl_tcp_component_recv_handler ( int sd , short flags , void * user )
{
2013-01-27 23:25:10 +00:00
ompi_process_name_t guid ;
2007-04-28 19:13:47 +00:00
struct sockaddr_storage addr ;
2005-08-02 13:20:50 +00:00
int retval ;
mca_btl_tcp_proc_t * btl_proc ;
2006-09-14 21:29:51 +00:00
opal_socklen_t addr_len = sizeof ( addr ) ;
2005-08-02 13:20:50 +00:00
mca_btl_tcp_event_t * event = ( mca_btl_tcp_event_t * ) user ;
OBJ_RELEASE ( event ) ;
/* recv the process identifier */
retval = recv ( sd , ( char * ) & guid , sizeof ( guid ) , 0 ) ;
if ( retval ! = sizeof ( guid ) ) {
2006-08-24 16:38:08 +00:00
CLOSE_THE_SOCKET ( sd ) ;
2005-08-02 13:20:50 +00:00
return ;
}
2013-01-27 23:25:10 +00:00
OMPI_PROCESS_NAME_NTOH ( guid ) ;
2005-08-02 13:20:50 +00:00
/* now set socket up to be non-blocking */
if ( ( flags = fcntl ( sd , F_GETFL , 0 ) ) < 0 ) {
2006-12-14 18:20:43 +00:00
BTL_ERROR ( ( " fcntl(F_GETFL) failed: %s (%d) " ,
2007-03-20 11:50:17 +00:00
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
2005-08-02 13:20:50 +00:00
} else {
flags | = O_NONBLOCK ;
if ( fcntl ( sd , F_SETFL , flags ) < 0 ) {
2006-12-14 18:20:43 +00:00
BTL_ERROR ( ( " fcntl(F_SETFL) failed: %s (%d) " ,
2007-03-20 11:50:17 +00:00
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
2005-08-02 13:20:50 +00:00
}
}
/* lookup the corresponding process */
btl_proc = mca_btl_tcp_proc_lookup ( & guid ) ;
if ( NULL = = btl_proc ) {
2006-08-24 16:38:08 +00:00
CLOSE_THE_SOCKET ( sd ) ;
2005-08-02 13:20:50 +00:00
return ;
}
/* lookup peer address */
if ( getpeername ( sd , ( struct sockaddr * ) & addr , & addr_len ) ! = 0 ) {
2006-12-14 18:20:43 +00:00
BTL_ERROR ( ( " getpeername() failed: %s (%d) " ,
2007-03-20 11:50:17 +00:00
strerror ( opal_socket_errno ) , opal_socket_errno ) ) ;
2006-08-24 16:38:08 +00:00
CLOSE_THE_SOCKET ( sd ) ;
2005-08-02 13:20:50 +00:00
return ;
}
/* are there any existing peer instances will to accept this connection */
2007-04-28 19:13:47 +00:00
if ( mca_btl_tcp_proc_accept ( btl_proc , ( struct sockaddr * ) & addr , sd ) = = false ) {
2006-08-24 16:38:08 +00:00
CLOSE_THE_SOCKET ( sd ) ;
2005-08-02 13:20:50 +00:00
return ;
}
}