2014-04-28 23:55:09 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2004-05-21 23:36:19 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2011-10-04 18:50:31 +04:00
|
|
|
* Copyright (c) 2004-2011 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2013-10-02 18:26:40 +04:00
|
|
|
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
2004-11-28 23:09:25 +03:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2009-01-11 05:30:00 +03:00
|
|
|
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
2007-09-11 17:23:46 +04:00
|
|
|
* Copyright (c) 2007 Voltaire All rights reserved.
|
2010-01-07 19:26:30 +03:00
|
|
|
* Copyright (c) 2006-2010 University of Houston. All rights reserved.
|
2009-02-24 20:17:33 +03:00
|
|
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
2014-04-28 23:55:09 +04:00
|
|
|
* Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights
|
2013-10-02 18:26:40 +04:00
|
|
|
* reserved.
|
2012-03-21 17:46:26 +04:00
|
|
|
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
|
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 20:37:40 +04:00
|
|
|
* Copyright (c) 2013 Intel, Inc. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
2013-10-02 18:26:40 +04:00
|
|
|
*
|
2004-11-22 04:38:40 +03:00
|
|
|
* Additional copyrights may follow
|
2013-10-02 18:26:40 +04:00
|
|
|
*
|
2004-05-21 23:36:19 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "opal/dss/dss.h"
|
2013-10-02 18:26:40 +04:00
|
|
|
#include "ompi/proc/proc.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/communicator/communicator.h"
|
2009-02-24 20:17:33 +03:00
|
|
|
#include "ompi/op/op.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
2007-12-21 09:02:00 +03:00
|
|
|
#include "opal/class/opal_pointer_array.h"
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/pml/pml.h"
|
2013-01-28 03:25:10 +04:00
|
|
|
#include "ompi/mca/rte/rte.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/coll/base/base.h"
|
2005-09-13 00:36:04 +04:00
|
|
|
#include "ompi/request/request.h"
|
2013-10-02 18:26:40 +04:00
|
|
|
#include "ompi/runtime/ompi_module_exchange.h"
|
2006-12-13 01:01:39 +03:00
|
|
|
#include "ompi/runtime/mpiruntime.h"
|
2008-06-18 07:15:56 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
BEGIN_C_DECLS
|
2004-05-21 23:36:19 +04:00
|
|
|
|
|
|
|
/**
|
2013-10-02 18:26:40 +04:00
|
|
|
* These functions make sure, that we determine the global result over
|
2004-05-21 23:36:19 +04:00
|
|
|
* an intra communicators (simple), an inter-communicator and a
|
|
|
|
* pseudo inter-communicator described by two separate intra-comms
|
|
|
|
* and a bridge-comm (intercomm-create scenario).
|
|
|
|
*/
|
|
|
|
|
2009-05-02 22:03:57 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
typedef int ompi_comm_cid_allredfct (int *inbuf, int* outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
2004-08-04 02:07:45 +04:00
|
|
|
ompi_communicator_t *comm,
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
void* lleader, void* rleader,
|
2004-08-05 20:31:30 +04:00
|
|
|
int send_first );
|
2004-06-17 02:37:03 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_intra (int *inbuf, int* outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
2004-08-04 02:07:45 +04:00
|
|
|
ompi_communicator_t *intercomm,
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
void* local_leader,
|
2004-08-05 20:31:30 +04:00
|
|
|
void* remote_ledaer,
|
|
|
|
int send_first );
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_inter (int *inbuf, int *outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
2004-08-04 02:07:45 +04:00
|
|
|
ompi_communicator_t *intercomm,
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
void* local_leader,
|
2004-08-05 20:31:30 +04:00
|
|
|
void* remote_leader,
|
|
|
|
int send_first );
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_intra_bridge(int *inbuf, int* outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
2004-08-04 02:07:45 +04:00
|
|
|
ompi_communicator_t *intercomm,
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
void* local_leader,
|
2004-08-05 20:31:30 +04:00
|
|
|
void* remote_leader,
|
|
|
|
int send_first);
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_intra_oob (int *inbuf, int* outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
2004-08-04 02:07:45 +04:00
|
|
|
ompi_communicator_t *intercomm,
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
void* local_leader,
|
|
|
|
void* remote_leader,
|
2004-08-05 20:31:30 +04:00
|
|
|
int send_first );
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_group (int *inbuf, int* outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
|
|
|
ompi_communicator_t *intercomm,
|
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
void* local_leader,
|
|
|
|
void* remote_leader,
|
|
|
|
int send_first);
|
|
|
|
|
|
|
|
/* non-blocking intracommunicator allreduce */
|
|
|
|
static int ompi_comm_allreduce_intra_nb (int *inbuf, int *outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
|
|
|
ompi_communicator_t *comm,
|
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
ompi_request_t **req);
|
|
|
|
|
|
|
|
/* non-blocking intercommunicator allreduce */
|
|
|
|
static int ompi_comm_allreduce_inter_nb (int *inbuf, int *outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
|
|
|
ompi_communicator_t *intercomm,
|
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
ompi_request_t **req);
|
|
|
|
|
|
|
|
|
2004-09-21 22:39:06 +04:00
|
|
|
static int ompi_comm_register_cid (uint32_t contextid);
|
|
|
|
static int ompi_comm_unregister_cid (uint32_t contextid);
|
|
|
|
static uint32_t ompi_comm_lowest_cid ( void );
|
|
|
|
|
|
|
|
struct ompi_comm_reg_t{
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t super;
|
2004-09-21 22:39:06 +04:00
|
|
|
uint32_t cid;
|
|
|
|
};
|
|
|
|
typedef struct ompi_comm_reg_t ompi_comm_reg_t;
|
2004-10-22 20:06:05 +04:00
|
|
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_comm_reg_t);
|
2004-09-21 22:39:06 +04:00
|
|
|
|
|
|
|
static void ompi_comm_reg_constructor(ompi_comm_reg_t *regcom);
|
|
|
|
static void ompi_comm_reg_destructor(ompi_comm_reg_t *regcom);
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE (ompi_comm_reg_t,
|
2007-04-06 23:18:31 +04:00
|
|
|
opal_list_item_t,
|
|
|
|
ompi_comm_reg_constructor,
|
|
|
|
ompi_comm_reg_destructor );
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
static opal_mutex_t ompi_cid_lock;
|
2005-07-03 20:22:16 +04:00
|
|
|
static opal_list_t ompi_registered_comms;
|
2004-09-17 20:28:58 +04:00
|
|
|
|
2010-01-07 19:26:30 +03:00
|
|
|
|
2009-07-07 22:32:14 +04:00
|
|
|
/* This variable is zero (false) if all processes in MPI_COMM_WORLD
|
|
|
|
* did not require MPI_THREAD_MULTIPLE support, and is 1 (true) as
|
|
|
|
* soon as at least one process requested support for THREAD_MULTIPLE */
|
|
|
|
static int ompi_comm_world_thread_level_mult=0;
|
|
|
|
|
|
|
|
|
|
|
|
int ompi_comm_cid_init (void)
|
|
|
|
{
|
2013-08-28 21:44:04 +04:00
|
|
|
#if OMPI_ENABLE_THREAD_MULTIPLE
|
2009-07-07 22:32:14 +04:00
|
|
|
ompi_proc_t **procs, *thisproc;
|
|
|
|
uint8_t thread_level;
|
|
|
|
void *tlpointer;
|
2009-07-11 22:36:43 +04:00
|
|
|
int ret;
|
|
|
|
size_t i, size, numprocs;
|
2013-10-02 18:26:40 +04:00
|
|
|
|
2009-07-07 22:32:14 +04:00
|
|
|
/** Note that the following call only returns processes
|
2013-10-02 18:26:40 +04:00
|
|
|
* with the same jobid. This is on purpose, since
|
|
|
|
* we switch for the dynamic communicators anyway
|
2009-07-07 22:32:14 +04:00
|
|
|
* to the original (slower) cid allocation algorithm.
|
2013-10-02 18:26:40 +04:00
|
|
|
*/
|
2009-07-07 22:32:14 +04:00
|
|
|
procs = ompi_proc_world ( &numprocs );
|
|
|
|
|
|
|
|
for ( i=0; i<numprocs; i++ ) {
|
|
|
|
thisproc = procs[i];
|
2013-10-02 18:26:40 +04:00
|
|
|
|
2010-02-03 08:07:40 +03:00
|
|
|
ret = ompi_modex_recv_string("MPI_THREAD_LEVEL", thisproc, &tlpointer, &size);
|
|
|
|
if (OMPI_SUCCESS == ret) {
|
|
|
|
thread_level = *((uint8_t *) tlpointer);
|
|
|
|
if ( OMPI_THREADLEVEL_IS_MULTIPLE (thread_level) ) {
|
|
|
|
ompi_comm_world_thread_level_mult = 1;
|
|
|
|
break;
|
|
|
|
}
|
2012-04-06 18:23:13 +04:00
|
|
|
} else if (OMPI_ERR_NOT_IMPLEMENTED == ret) {
|
2010-02-03 08:07:40 +03:00
|
|
|
if (ompi_mpi_thread_multiple) {
|
|
|
|
ompi_comm_world_thread_level_mult = 1;
|
|
|
|
}
|
2009-07-07 22:32:14 +04:00
|
|
|
break;
|
2010-02-03 08:07:40 +03:00
|
|
|
} else {
|
|
|
|
return ret;
|
2009-07-07 22:32:14 +04:00
|
|
|
}
|
|
|
|
}
|
2011-07-08 20:39:58 +04:00
|
|
|
free(procs);
|
2013-08-28 21:44:04 +04:00
|
|
|
#else
|
|
|
|
ompi_comm_world_thread_level_mult = 0; // silence compiler warning if not used
|
|
|
|
#endif
|
2013-10-02 18:26:40 +04:00
|
|
|
|
2009-07-07 22:32:14 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
int ompi_comm_nextcid ( ompi_communicator_t* newcomm,
|
|
|
|
ompi_communicator_t* comm,
|
|
|
|
ompi_communicator_t* bridgecomm,
|
2004-09-17 20:28:58 +04:00
|
|
|
void* local_leader,
|
|
|
|
void* remote_leader,
|
|
|
|
int mode, int send_first )
|
|
|
|
{
|
2012-03-21 17:46:26 +04:00
|
|
|
int ret;
|
2010-01-15 06:15:18 +03:00
|
|
|
int nextcid;
|
2006-08-24 20:38:08 +04:00
|
|
|
bool flag;
|
2010-01-15 01:01:26 +03:00
|
|
|
int nextlocal_cid;
|
|
|
|
int done=0;
|
|
|
|
int response, glresponse=0;
|
|
|
|
int start;
|
|
|
|
unsigned int i;
|
2013-10-02 18:26:40 +04:00
|
|
|
|
2004-09-17 20:28:58 +04:00
|
|
|
ompi_comm_cid_allredfct* allredfnct;
|
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
/**
|
2004-09-17 20:28:58 +04:00
|
|
|
* Determine which implementation of allreduce we have to use
|
2013-10-02 18:26:40 +04:00
|
|
|
* for the current scenario
|
2004-09-17 20:28:58 +04:00
|
|
|
*/
|
2009-05-27 19:21:07 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
switch (mode)
|
2010-10-04 18:54:58 +04:00
|
|
|
{
|
2013-10-02 18:26:40 +04:00
|
|
|
case OMPI_COMM_CID_INTRA:
|
2004-09-17 20:28:58 +04:00
|
|
|
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_intra;
|
|
|
|
break;
|
|
|
|
case OMPI_COMM_CID_INTER:
|
|
|
|
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_inter;
|
|
|
|
break;
|
2013-10-02 18:26:40 +04:00
|
|
|
case OMPI_COMM_CID_INTRA_BRIDGE:
|
2004-09-17 20:28:58 +04:00
|
|
|
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_intra_bridge;
|
|
|
|
break;
|
2013-10-02 18:26:40 +04:00
|
|
|
case OMPI_COMM_CID_INTRA_OOB:
|
2004-09-17 20:28:58 +04:00
|
|
|
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_intra_oob;
|
|
|
|
break;
|
2013-10-02 18:26:40 +04:00
|
|
|
case OMPI_COMM_CID_GROUP:
|
|
|
|
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_group;
|
|
|
|
break;
|
|
|
|
default:
|
2004-09-17 20:28:58 +04:00
|
|
|
return MPI_UNDEFINED;
|
|
|
|
break;
|
2010-10-04 18:54:58 +04:00
|
|
|
}
|
2013-10-02 18:26:40 +04:00
|
|
|
|
|
|
|
ret = ompi_comm_register_cid (comm->c_contextid);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
return ret;
|
|
|
|
}
|
2010-01-07 19:26:30 +03:00
|
|
|
start = ompi_mpi_communicators.lowest_free;
|
2013-10-02 18:26:40 +04:00
|
|
|
|
2010-01-07 19:26:30 +03:00
|
|
|
while (!done) {
|
2010-10-04 18:54:58 +04:00
|
|
|
/**
|
2013-10-02 18:26:40 +04:00
|
|
|
* This is the real algorithm described in the doc
|
2010-10-04 18:54:58 +04:00
|
|
|
*/
|
|
|
|
OPAL_THREAD_LOCK(&ompi_cid_lock);
|
|
|
|
if (comm->c_contextid != ompi_comm_lowest_cid() ) {
|
|
|
|
/* if not lowest cid, we do not continue, but sleep and try again */
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_cid_lock);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_cid_lock);
|
|
|
|
|
2014-04-28 23:55:09 +04:00
|
|
|
nextlocal_cid = mca_pml.pml_max_contextid;
|
2014-04-29 21:39:14 +04:00
|
|
|
flag = false;
|
2010-10-04 18:54:58 +04:00
|
|
|
for (i=start; i < mca_pml.pml_max_contextid ; i++) {
|
2013-10-02 18:26:40 +04:00
|
|
|
flag = opal_pointer_array_test_and_set_item(&ompi_mpi_communicators,
|
2013-03-26 18:45:21 +04:00
|
|
|
i, comm);
|
2010-10-04 18:54:58 +04:00
|
|
|
if (true == flag) {
|
|
|
|
nextlocal_cid = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-21 17:46:26 +04:00
|
|
|
ret = (allredfnct)(&nextlocal_cid, &nextcid, 1, MPI_MAX, comm, bridgecomm,
|
|
|
|
local_leader, remote_leader, send_first );
|
|
|
|
if( OMPI_SUCCESS != ret ) {
|
2013-03-26 18:45:21 +04:00
|
|
|
opal_pointer_array_set_item(&ompi_mpi_communicators, nextlocal_cid, NULL);
|
|
|
|
goto release_and_return;
|
2012-03-21 17:46:26 +04:00
|
|
|
}
|
2014-04-28 23:55:09 +04:00
|
|
|
|
|
|
|
if (mca_pml.pml_max_contextid == (unsigned int) nextcid) {
|
|
|
|
/* at least one peer ran out of CIDs */
|
2014-04-29 21:39:14 +04:00
|
|
|
if (flag) {
|
2014-04-28 23:55:09 +04:00
|
|
|
opal_pointer_array_set_item(&ompi_mpi_communicators, nextlocal_cid, NULL);
|
|
|
|
ret = OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
goto release_and_return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-04 18:54:58 +04:00
|
|
|
if (nextcid == nextlocal_cid) {
|
|
|
|
response = 1; /* fine with me */
|
|
|
|
}
|
|
|
|
else {
|
2013-10-02 18:26:40 +04:00
|
|
|
opal_pointer_array_set_item(&ompi_mpi_communicators,
|
2010-10-04 18:54:58 +04:00
|
|
|
nextlocal_cid, NULL);
|
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
flag = opal_pointer_array_test_and_set_item(&ompi_mpi_communicators,
|
2010-10-04 18:54:58 +04:00
|
|
|
nextcid, comm );
|
|
|
|
if (true == flag) {
|
|
|
|
response = 1; /* works as well */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
response = 0; /* nope, not acceptable */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-21 17:46:26 +04:00
|
|
|
ret = (allredfnct)(&response, &glresponse, 1, MPI_MIN, comm, bridgecomm,
|
|
|
|
local_leader, remote_leader, send_first );
|
|
|
|
if( OMPI_SUCCESS != ret ) {
|
2013-03-26 18:45:21 +04:00
|
|
|
opal_pointer_array_set_item(&ompi_mpi_communicators, nextcid, NULL);
|
|
|
|
goto release_and_return;
|
2012-03-21 17:46:26 +04:00
|
|
|
}
|
2010-10-04 18:54:58 +04:00
|
|
|
if (1 == glresponse) {
|
|
|
|
done = 1; /* we are done */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if ( 0 == glresponse ) {
|
|
|
|
if ( 1 == response ) {
|
|
|
|
/* we could use that, but other don't agree */
|
2013-10-02 18:26:40 +04:00
|
|
|
opal_pointer_array_set_item(&ompi_mpi_communicators,
|
2010-10-04 18:54:58 +04:00
|
|
|
nextcid, NULL);
|
|
|
|
}
|
|
|
|
start = nextcid+1; /* that's where we can start the next round */
|
|
|
|
}
|
2004-09-17 20:28:58 +04:00
|
|
|
}
|
2010-10-04 18:54:58 +04:00
|
|
|
|
2004-09-17 20:28:58 +04:00
|
|
|
/* set the according values to the newcomm */
|
|
|
|
newcomm->c_contextid = nextcid;
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item (&ompi_mpi_communicators, nextcid, newcomm);
|
2010-10-04 18:54:58 +04:00
|
|
|
|
2013-03-26 18:45:21 +04:00
|
|
|
release_and_return:
|
2010-01-07 19:26:30 +03:00
|
|
|
ompi_comm_unregister_cid (comm->c_contextid);
|
2010-10-04 18:54:58 +04:00
|
|
|
|
2013-03-26 18:45:21 +04:00
|
|
|
return ret;
|
2004-09-17 20:28:58 +04:00
|
|
|
}
|
2006-12-13 01:01:39 +03:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
/* Non-blocking version of ompi_comm_nextcid */
|
|
|
|
struct mca_comm_nextcid_context {
|
|
|
|
ompi_communicator_t* newcomm;
|
|
|
|
ompi_communicator_t* comm;
|
|
|
|
ompi_communicator_t* bridgecomm;
|
|
|
|
int mode;
|
|
|
|
int nextcid;
|
|
|
|
int nextlocal_cid;
|
|
|
|
int start;
|
|
|
|
int flag, rflag;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* find the next available local cid and start an allreduce */
|
|
|
|
static int ompi_comm_allreduce_getnextcid (ompi_comm_request_t *request);
|
|
|
|
/* verify that the maximum cid is locally available and start an allreduce */
|
|
|
|
static int ompi_comm_checkcid (ompi_comm_request_t *request);
|
|
|
|
/* verify that the cid was available globally */
|
|
|
|
static int ompi_comm_nextcid_check_flag (ompi_comm_request_t *request);
|
|
|
|
|
|
|
|
int ompi_comm_nextcid_nb (ompi_communicator_t* newcomm,
|
|
|
|
ompi_communicator_t* comm,
|
|
|
|
ompi_communicator_t* bridgecomm,
|
|
|
|
int mode, ompi_request_t **req)
|
|
|
|
{
|
|
|
|
struct mca_comm_nextcid_context *context;
|
|
|
|
ompi_comm_request_t *request;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine which implementation of allreduce we have to use
|
|
|
|
* for the current scenario
|
|
|
|
*/
|
|
|
|
if (OMPI_COMM_CID_INTRA != mode && OMPI_COMM_CID_INTER != mode) {
|
|
|
|
return MPI_UNDEFINED;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = ompi_comm_register_cid (comm->c_contextid);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
context = calloc (1, sizeof (*context));
|
|
|
|
if (NULL == context) {
|
|
|
|
ompi_comm_unregister_cid (comm->c_contextid);
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
request = ompi_comm_request_get ();
|
|
|
|
if (NULL == request) {
|
|
|
|
ompi_comm_unregister_cid (comm->c_contextid);
|
|
|
|
free (context);
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
context->newcomm = newcomm;
|
|
|
|
context->comm = comm;
|
|
|
|
context->bridgecomm = bridgecomm;
|
|
|
|
context->mode = mode;
|
|
|
|
context->start = ompi_mpi_communicators.lowest_free;
|
|
|
|
|
|
|
|
request->context = context;
|
|
|
|
|
|
|
|
ompi_comm_request_schedule_append (request, ompi_comm_allreduce_getnextcid, NULL, 0);
|
|
|
|
ompi_comm_request_start (request);
|
|
|
|
|
|
|
|
*req = &request->super;
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ompi_comm_allreduce_getnextcid (ompi_comm_request_t *request)
|
|
|
|
{
|
|
|
|
struct mca_comm_nextcid_context *context = request->context;
|
|
|
|
ompi_request_t *subreq;
|
|
|
|
unsigned int i;
|
|
|
|
bool flag;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the real algorithm described in the doc
|
|
|
|
*/
|
|
|
|
OPAL_THREAD_LOCK(&ompi_cid_lock);
|
|
|
|
if (context->comm->c_contextid != ompi_comm_lowest_cid() ) {
|
|
|
|
/* if not lowest cid, we do not continue, but sleep and try again */
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_cid_lock);
|
|
|
|
ompi_comm_request_schedule_append (request, ompi_comm_allreduce_getnextcid, NULL, 0);
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_cid_lock);
|
|
|
|
|
2014-04-29 21:39:14 +04:00
|
|
|
flag = false;
|
2014-04-28 23:55:09 +04:00
|
|
|
context->nextlocal_cid = mca_pml.pml_max_contextid;
|
2013-10-02 18:26:40 +04:00
|
|
|
for (i = context->start ; i < mca_pml.pml_max_contextid ; ++i) {
|
|
|
|
flag = opal_pointer_array_test_and_set_item(&ompi_mpi_communicators,
|
|
|
|
i, context->comm);
|
|
|
|
if (true == flag) {
|
|
|
|
context->nextlocal_cid = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (context->mode == OMPI_COMM_CID_INTRA) {
|
|
|
|
ret = ompi_comm_allreduce_intra_nb (&context->nextlocal_cid, &context->nextcid, 1, MPI_MAX,
|
|
|
|
context->comm, context->bridgecomm, &subreq);
|
|
|
|
} else {
|
|
|
|
ret = ompi_comm_allreduce_inter_nb (&context->nextlocal_cid, &context->nextcid, 1, MPI_MAX,
|
|
|
|
context->comm, context->bridgecomm, &subreq);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-04-28 23:55:09 +04:00
|
|
|
if ((unsigned int) context->nextlocal_cid == mca_pml.pml_max_contextid) {
|
|
|
|
/* at least one peer ran out of CIDs */
|
|
|
|
if (flag) {
|
|
|
|
opal_pointer_array_test_and_set_item(&ompi_mpi_communicators, context->nextlocal_cid, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
/* next we want to verify that the resulting commid is ok */
|
|
|
|
ompi_comm_request_schedule_append (request, ompi_comm_checkcid, &subreq, 1);
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ompi_comm_checkcid (ompi_comm_request_t *request)
|
|
|
|
{
|
|
|
|
struct mca_comm_nextcid_context *context = request->context;
|
|
|
|
ompi_request_t *subreq;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
context->flag = (context->nextcid == context->nextlocal_cid);
|
|
|
|
|
|
|
|
if (!context->flag) {
|
|
|
|
opal_pointer_array_set_item(&ompi_mpi_communicators, context->nextlocal_cid, NULL);
|
|
|
|
|
|
|
|
context->flag = opal_pointer_array_test_and_set_item(&ompi_mpi_communicators,
|
|
|
|
context->nextcid, context->comm);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (context->mode == OMPI_COMM_CID_INTRA) {
|
|
|
|
ret = ompi_comm_allreduce_intra_nb (&context->flag, &context->rflag, 1, MPI_MIN, context->comm,
|
|
|
|
context->bridgecomm, &subreq);
|
|
|
|
} else {
|
|
|
|
ret = ompi_comm_allreduce_inter_nb (&context->flag, &context->rflag, 1, MPI_MIN, context->comm,
|
|
|
|
context->bridgecomm, &subreq);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ompi_comm_request_schedule_append (request, ompi_comm_nextcid_check_flag, &subreq, 1);
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ompi_comm_nextcid_check_flag (ompi_comm_request_t *request)
|
|
|
|
{
|
|
|
|
struct mca_comm_nextcid_context *context = request->context;
|
|
|
|
|
|
|
|
if (1 == context->rflag) {
|
|
|
|
/* set the according values to the newcomm */
|
|
|
|
context->newcomm->c_contextid = context->nextcid;
|
|
|
|
opal_pointer_array_set_item (&ompi_mpi_communicators, context->nextcid, context->newcomm);
|
|
|
|
|
|
|
|
ompi_comm_unregister_cid (context->comm->c_contextid);
|
|
|
|
|
|
|
|
/* done! */
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (1 == context->flag) {
|
|
|
|
/* we could use this cid, but other don't agree */
|
|
|
|
opal_pointer_array_set_item(&ompi_mpi_communicators, context->nextcid, NULL);
|
|
|
|
context->start = context->nextcid + 1; /* that's where we can start the next round */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* try again */
|
|
|
|
return ompi_comm_allreduce_getnextcid (request);
|
|
|
|
}
|
|
|
|
|
2004-09-21 22:39:06 +04:00
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
|
|
|
static void ompi_comm_reg_constructor (ompi_comm_reg_t *regcom)
|
|
|
|
{
|
|
|
|
regcom->cid=MPI_UNDEFINED;
|
|
|
|
}
|
2004-09-17 20:28:58 +04:00
|
|
|
|
2004-09-21 22:39:06 +04:00
|
|
|
static void ompi_comm_reg_destructor (ompi_comm_reg_t *regcom)
|
2004-05-21 23:36:19 +04:00
|
|
|
{
|
2004-09-21 22:39:06 +04:00
|
|
|
}
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2004-09-21 22:39:06 +04:00
|
|
|
void ompi_comm_reg_init (void)
|
|
|
|
{
|
2005-07-03 20:22:16 +04:00
|
|
|
OBJ_CONSTRUCT(&ompi_registered_comms, opal_list_t);
|
2008-09-09 16:57:45 +04:00
|
|
|
OBJ_CONSTRUCT(&ompi_cid_lock, opal_mutex_t);
|
2004-09-21 22:39:06 +04:00
|
|
|
}
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2004-09-21 22:39:06 +04:00
|
|
|
void ompi_comm_reg_finalize (void)
|
|
|
|
{
|
|
|
|
OBJ_DESTRUCT(&ompi_registered_comms);
|
2008-09-09 16:57:45 +04:00
|
|
|
OBJ_DESTRUCT(&ompi_cid_lock);
|
2004-09-21 22:39:06 +04:00
|
|
|
}
|
2004-05-21 23:36:19 +04:00
|
|
|
|
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_register_cid (uint32_t cid)
|
2004-09-21 22:39:06 +04:00
|
|
|
{
|
2007-07-17 04:33:27 +04:00
|
|
|
ompi_comm_reg_t *regcom;
|
2004-09-21 22:39:06 +04:00
|
|
|
ompi_comm_reg_t *newentry = OBJ_NEW(ompi_comm_reg_t);
|
2013-10-02 18:26:40 +04:00
|
|
|
bool registered = false;
|
2004-09-16 16:16:21 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
do {
|
|
|
|
/* Only one communicator function allowed in same time on the
|
|
|
|
* same communicator.
|
|
|
|
*/
|
|
|
|
OPAL_THREAD_LOCK(&ompi_cid_lock);
|
|
|
|
|
|
|
|
newentry->cid = cid;
|
|
|
|
if ( !(opal_list_is_empty (&ompi_registered_comms)) ) {
|
|
|
|
bool ok = true;
|
|
|
|
|
|
|
|
OPAL_LIST_FOREACH(regcom, &ompi_registered_comms, ompi_comm_reg_t) {
|
|
|
|
if ( regcom->cid > cid ) {
|
|
|
|
break;
|
|
|
|
}
|
2010-03-17 02:10:50 +03:00
|
|
|
#if OMPI_ENABLE_THREAD_MULTIPLE
|
2013-10-02 18:26:40 +04:00
|
|
|
if( regcom->cid == cid ) {
|
|
|
|
/**
|
|
|
|
* The MPI standard state that is the user responsability to
|
|
|
|
* schedule the global communications in order to avoid any
|
|
|
|
* kind of troubles. As, managing communicators involve several
|
|
|
|
* collective communications, we should enforce a sequential
|
|
|
|
* execution order. This test only allow one communicator
|
|
|
|
* creation function based on the same communicator.
|
|
|
|
*/
|
|
|
|
ok = false;
|
|
|
|
break;
|
|
|
|
}
|
2010-03-17 02:10:50 +03:00
|
|
|
#endif /* OMPI_ENABLE_THREAD_MULTIPLE */
|
2013-10-02 18:26:40 +04:00
|
|
|
}
|
|
|
|
if (ok) {
|
|
|
|
opal_list_insert_pos (&ompi_registered_comms, (opal_list_item_t *) regcom,
|
|
|
|
(opal_list_item_t *)newentry);
|
|
|
|
registered = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
opal_list_append (&ompi_registered_comms, (opal_list_item_t *)newentry);
|
|
|
|
registered = true;
|
2007-04-06 23:18:31 +04:00
|
|
|
}
|
2013-10-02 18:26:40 +04:00
|
|
|
|
|
|
|
/* drop the lock before trying again */
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_cid_lock);
|
|
|
|
} while (!registered);
|
2004-09-21 22:39:06 +04:00
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
2004-05-21 23:36:19 +04:00
|
|
|
}
|
|
|
|
|
2004-09-21 22:39:06 +04:00
|
|
|
static int ompi_comm_unregister_cid (uint32_t cid)
|
|
|
|
{
|
2007-09-11 17:23:46 +04:00
|
|
|
ompi_comm_reg_t *regcom;
|
2004-09-21 22:39:06 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
OPAL_THREAD_LOCK(&ompi_cid_lock);
|
|
|
|
|
|
|
|
OPAL_LIST_FOREACH(regcom, &ompi_registered_comms, ompi_comm_reg_t) {
|
2007-09-11 17:23:46 +04:00
|
|
|
if(regcom->cid == cid) {
|
2013-10-02 18:26:40 +04:00
|
|
|
opal_list_remove_item(&ompi_registered_comms, (opal_list_item_t *) regcom);
|
2007-09-11 21:59:40 +04:00
|
|
|
OBJ_RELEASE(regcom);
|
2007-09-11 17:23:46 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-10-02 18:26:40 +04:00
|
|
|
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_cid_lock);
|
|
|
|
|
2004-09-21 22:39:06 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t ompi_comm_lowest_cid (void)
|
|
|
|
{
|
|
|
|
ompi_comm_reg_t *regcom=NULL;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t *item=opal_list_get_first (&ompi_registered_comms);
|
2004-09-21 22:39:06 +04:00
|
|
|
|
|
|
|
regcom = (ompi_comm_reg_t *)item;
|
|
|
|
return regcom->cid;
|
|
|
|
}
|
2004-08-05 20:31:30 +04:00
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This routine serves two purposes:
|
|
|
|
* - the allreduce acts as a kind of Barrier,
|
2013-10-02 18:26:40 +04:00
|
|
|
* which avoids, that we have incoming fragments
|
2004-08-05 20:31:30 +04:00
|
|
|
* on the new communicator before everybody has set
|
|
|
|
* up the comm structure.
|
|
|
|
* - some components (e.g. the collective MagPIe component
|
|
|
|
* might want to generate new communicators and communicate
|
|
|
|
* using the new comm. Thus, it can just be called after
|
|
|
|
* the 'barrier'.
|
|
|
|
*
|
|
|
|
* The reason that this routine is in comm_cid and not in
|
|
|
|
* comm.c is, that this file contains the allreduce implementations
|
|
|
|
* which are required, and thus we avoid having duplicate code...
|
|
|
|
*/
|
2013-10-02 18:26:40 +04:00
|
|
|
int ompi_comm_activate ( ompi_communicator_t** newcomm,
|
so here is what happens:
in the v1.2 series the cid's could never go above the max. allowed for a
particular pml. Because of that, pml_add_comm never checked for the cid, and
in fact pml_add_comm was called in comm_set, which is *before* we knew the
cid.
in the v1.3 series (and trunk) we check now the cid to detect overflow, and
because of that pml_add_comm has been moved *after* the cid allocation
routine, namely into the comm_activate routine.
in the v1.2 series, the comm_activate contained a synchronization step of the
old communicator in order to prevent incoming fragments on the new
communicator, with the main problem being that the allreduce in the
communicator allocation finished at different times on different processes,
and thus, this scenario could and did really occur.
in the v1.3 series, the comm_activate does not contain the synchronization
step anymore, since we introduced the new queue for fragments with unknown
cid. The problem is however, that whether a fragment is known or not is
decided by using ompi_comm_lookup(), which will return something useful as
soon as the cid allocation finished, even before pml_add_comm has been
called. So there is a small time gap where we will not post a message into
queue for unknown cid's, but we can also not look up the process structure
belonging to the rank in that comm ( that is in pml_ob1_match_recv_frag or
something like that).
The current fix reintroduces the synchronization step in comm_activate, and
ensures that no fragment can be received for a new communicator before the
synchronization occurs , and thus comm_nextcid() and pml_add_comm has been
called. It seems to be the safest and easiest way for now. Welcome back, v1.2.
This commit was SVN r21970.
2009-09-17 18:37:02 +04:00
|
|
|
ompi_communicator_t* comm,
|
|
|
|
ompi_communicator_t* bridgecomm,
|
|
|
|
void* local_leader,
|
|
|
|
void* remote_leader,
|
|
|
|
int mode,
|
|
|
|
int send_first )
|
2004-08-05 20:31:30 +04:00
|
|
|
{
|
2008-11-05 00:58:06 +03:00
|
|
|
int ret = 0;
|
2004-08-05 20:31:30 +04:00
|
|
|
|
so here is what happens:
in the v1.2 series the cid's could never go above the max. allowed for a
particular pml. Because of that, pml_add_comm never checked for the cid, and
in fact pml_add_comm was called in comm_set, which is *before* we knew the
cid.
in the v1.3 series (and trunk) we check now the cid to detect overflow, and
because of that pml_add_comm has been moved *after* the cid allocation
routine, namely into the comm_activate routine.
in the v1.2 series, the comm_activate contained a synchronization step of the
old communicator in order to prevent incoming fragments on the new
communicator, with the main problem being that the allreduce in the
communicator allocation finished at different times on different processes,
and thus, this scenario could and did really occur.
in the v1.3 series, the comm_activate does not contain the synchronization
step anymore, since we introduced the new queue for fragments with unknown
cid. The problem is however, that whether a fragment is known or not is
decided by using ompi_comm_lookup(), which will return something useful as
soon as the cid allocation finished, even before pml_add_comm has been
called. So there is a small time gap where we will not post a message into
queue for unknown cid's, but we can also not look up the process structure
belonging to the rank in that comm ( that is in pml_ob1_match_recv_frag or
something like that).
The current fix reintroduces the synchronization step in comm_activate, and
ensures that no fragment can be received for a new communicator before the
synchronization occurs , and thus comm_nextcid() and pml_add_comm has been
called. It seems to be the safest and easiest way for now. Welcome back, v1.2.
This commit was SVN r21970.
2009-09-17 18:37:02 +04:00
|
|
|
int ok=0, gok=0;
|
|
|
|
ompi_comm_cid_allredfct* allredfnct;
|
|
|
|
|
|
|
|
/* Step 1: the barrier, after which it is allowed to
|
|
|
|
* send messages over the new communicator
|
|
|
|
*/
|
|
|
|
switch (mode)
|
2010-10-04 18:54:58 +04:00
|
|
|
{
|
so here is what happens:
in the v1.2 series the cid's could never go above the max. allowed for a
particular pml. Because of that, pml_add_comm never checked for the cid, and
in fact pml_add_comm was called in comm_set, which is *before* we knew the
cid.
in the v1.3 series (and trunk) we check now the cid to detect overflow, and
because of that pml_add_comm has been moved *after* the cid allocation
routine, namely into the comm_activate routine.
in the v1.2 series, the comm_activate contained a synchronization step of the
old communicator in order to prevent incoming fragments on the new
communicator, with the main problem being that the allreduce in the
communicator allocation finished at different times on different processes,
and thus, this scenario could and did really occur.
in the v1.3 series, the comm_activate does not contain the synchronization
step anymore, since we introduced the new queue for fragments with unknown
cid. The problem is however, that whether a fragment is known or not is
decided by using ompi_comm_lookup(), which will return something useful as
soon as the cid allocation finished, even before pml_add_comm has been
called. So there is a small time gap where we will not post a message into
queue for unknown cid's, but we can also not look up the process structure
belonging to the rank in that comm ( that is in pml_ob1_match_recv_frag or
something like that).
The current fix reintroduces the synchronization step in comm_activate, and
ensures that no fragment can be received for a new communicator before the
synchronization occurs , and thus comm_nextcid() and pml_add_comm has been
called. It seems to be the safest and easiest way for now. Welcome back, v1.2.
This commit was SVN r21970.
2009-09-17 18:37:02 +04:00
|
|
|
case OMPI_COMM_CID_INTRA:
|
|
|
|
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_intra;
|
|
|
|
break;
|
|
|
|
case OMPI_COMM_CID_INTER:
|
|
|
|
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_inter;
|
|
|
|
break;
|
|
|
|
case OMPI_COMM_CID_INTRA_BRIDGE:
|
|
|
|
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_intra_bridge;
|
|
|
|
break;
|
|
|
|
case OMPI_COMM_CID_INTRA_OOB:
|
|
|
|
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_intra_oob;
|
|
|
|
break;
|
2013-10-02 18:26:40 +04:00
|
|
|
case OMPI_COMM_CID_GROUP:
|
|
|
|
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_group;
|
|
|
|
break;
|
so here is what happens:
in the v1.2 series the cid's could never go above the max. allowed for a
particular pml. Because of that, pml_add_comm never checked for the cid, and
in fact pml_add_comm was called in comm_set, which is *before* we knew the
cid.
in the v1.3 series (and trunk) we check now the cid to detect overflow, and
because of that pml_add_comm has been moved *after* the cid allocation
routine, namely into the comm_activate routine.
in the v1.2 series, the comm_activate contained a synchronization step of the
old communicator in order to prevent incoming fragments on the new
communicator, with the main problem being that the allreduce in the
communicator allocation finished at different times on different processes,
and thus, this scenario could and did really occur.
in the v1.3 series, the comm_activate does not contain the synchronization
step anymore, since we introduced the new queue for fragments with unknown
cid. The problem is however, that whether a fragment is known or not is
decided by using ompi_comm_lookup(), which will return something useful as
soon as the cid allocation finished, even before pml_add_comm has been
called. So there is a small time gap where we will not post a message into
queue for unknown cid's, but we can also not look up the process structure
belonging to the rank in that comm ( that is in pml_ob1_match_recv_frag or
something like that).
The current fix reintroduces the synchronization step in comm_activate, and
ensures that no fragment can be received for a new communicator before the
synchronization occurs , and thus comm_nextcid() and pml_add_comm has been
called. It seems to be the safest and easiest way for now. Welcome back, v1.2.
This commit was SVN r21970.
2009-09-17 18:37:02 +04:00
|
|
|
default:
|
|
|
|
return MPI_UNDEFINED;
|
|
|
|
break;
|
2010-10-04 18:54:58 +04:00
|
|
|
}
|
so here is what happens:
in the v1.2 series the cid's could never go above the max. allowed for a
particular pml. Because of that, pml_add_comm never checked for the cid, and
in fact pml_add_comm was called in comm_set, which is *before* we knew the
cid.
in the v1.3 series (and trunk) we check now the cid to detect overflow, and
because of that pml_add_comm has been moved *after* the cid allocation
routine, namely into the comm_activate routine.
in the v1.2 series, the comm_activate contained a synchronization step of the
old communicator in order to prevent incoming fragments on the new
communicator, with the main problem being that the allreduce in the
communicator allocation finished at different times on different processes,
and thus, this scenario could and did really occur.
in the v1.3 series, the comm_activate does not contain the synchronization
step anymore, since we introduced the new queue for fragments with unknown
cid. The problem is however, that whether a fragment is known or not is
decided by using ompi_comm_lookup(), which will return something useful as
soon as the cid allocation finished, even before pml_add_comm has been
called. So there is a small time gap where we will not post a message into
queue for unknown cid's, but we can also not look up the process structure
belonging to the rank in that comm ( that is in pml_ob1_match_recv_frag or
something like that).
The current fix reintroduces the synchronization step in comm_activate, and
ensures that no fragment can be received for a new communicator before the
synchronization occurs , and thus comm_nextcid() and pml_add_comm has been
called. It seems to be the safest and easiest way for now. Welcome back, v1.2.
This commit was SVN r21970.
2009-09-17 18:37:02 +04:00
|
|
|
|
|
|
|
if (MPI_UNDEFINED != (*newcomm)->c_local_group->grp_my_rank) {
|
2010-10-04 18:54:58 +04:00
|
|
|
/* Initialize the PML stuff in the newcomm */
|
|
|
|
if ( OMPI_SUCCESS != (ret = MCA_PML_CALL(add_comm(*newcomm))) ) {
|
|
|
|
goto bail_on_error;
|
|
|
|
}
|
2013-10-02 18:26:40 +04:00
|
|
|
|
2010-10-04 18:54:58 +04:00
|
|
|
OMPI_COMM_SET_PML_ADDED(*newcomm);
|
so here is what happens:
in the v1.2 series the cid's could never go above the max. allowed for a
particular pml. Because of that, pml_add_comm never checked for the cid, and
in fact pml_add_comm was called in comm_set, which is *before* we knew the
cid.
in the v1.3 series (and trunk) we check now the cid to detect overflow, and
because of that pml_add_comm has been moved *after* the cid allocation
routine, namely into the comm_activate routine.
in the v1.2 series, the comm_activate contained a synchronization step of the
old communicator in order to prevent incoming fragments on the new
communicator, with the main problem being that the allreduce in the
communicator allocation finished at different times on different processes,
and thus, this scenario could and did really occur.
in the v1.3 series, the comm_activate does not contain the synchronization
step anymore, since we introduced the new queue for fragments with unknown
cid. The problem is however, that whether a fragment is known or not is
decided by using ompi_comm_lookup(), which will return something useful as
soon as the cid allocation finished, even before pml_add_comm has been
called. So there is a small time gap where we will not post a message into
queue for unknown cid's, but we can also not look up the process structure
belonging to the rank in that comm ( that is in pml_ob1_match_recv_frag or
something like that).
The current fix reintroduces the synchronization step in comm_activate, and
ensures that no fragment can be received for a new communicator before the
synchronization occurs , and thus comm_nextcid() and pml_add_comm has been
called. It seems to be the safest and easiest way for now. Welcome back, v1.2.
This commit was SVN r21970.
2009-09-17 18:37:02 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-21 17:46:26 +04:00
|
|
|
ret = (allredfnct)(&ok, &gok, 1, MPI_MIN, comm, bridgecomm,
|
|
|
|
local_leader, remote_leader, send_first );
|
|
|
|
if( OMPI_SUCCESS != ret ) {
|
2012-03-21 21:53:34 +04:00
|
|
|
goto bail_on_error;
|
2012-03-21 17:46:26 +04:00
|
|
|
}
|
so here is what happens:
in the v1.2 series the cid's could never go above the max. allowed for a
particular pml. Because of that, pml_add_comm never checked for the cid, and
in fact pml_add_comm was called in comm_set, which is *before* we knew the
cid.
in the v1.3 series (and trunk) we check now the cid to detect overflow, and
because of that pml_add_comm has been moved *after* the cid allocation
routine, namely into the comm_activate routine.
in the v1.2 series, the comm_activate contained a synchronization step of the
old communicator in order to prevent incoming fragments on the new
communicator, with the main problem being that the allreduce in the
communicator allocation finished at different times on different processes,
and thus, this scenario could and did really occur.
in the v1.3 series, the comm_activate does not contain the synchronization
step anymore, since we introduced the new queue for fragments with unknown
cid. The problem is however, that whether a fragment is known or not is
decided by using ompi_comm_lookup(), which will return something useful as
soon as the cid allocation finished, even before pml_add_comm has been
called. So there is a small time gap where we will not post a message into
queue for unknown cid's, but we can also not look up the process structure
belonging to the rank in that comm ( that is in pml_ob1_match_recv_frag or
something like that).
The current fix reintroduces the synchronization step in comm_activate, and
ensures that no fragment can be received for a new communicator before the
synchronization occurs , and thus comm_nextcid() and pml_add_comm has been
called. It seems to be the safest and easiest way for now. Welcome back, v1.2.
This commit was SVN r21970.
2009-09-17 18:37:02 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* Check to see if this process is in the new communicator.
|
|
|
|
*
|
|
|
|
* Specifically, this function is invoked by all proceses in the
|
|
|
|
* old communicator, regardless of whether they are in the new
|
|
|
|
* communicator or not. This is because it is far simpler to use
|
|
|
|
* MPI collective functions on the old communicator to determine
|
|
|
|
* some data for the new communicator (e.g., remote_leader) than
|
|
|
|
* to kludge up our own pseudo-collective routines over just the
|
|
|
|
* processes in the new communicator. Hence, *all* processes in
|
|
|
|
* the old communicator need to invoke this function.
|
|
|
|
*
|
|
|
|
* That being said, only processes in the new communicator need to
|
|
|
|
* select a coll module for the new communicator. More
|
|
|
|
* specifically, proceses who are not in the new communicator
|
|
|
|
* should *not* select a coll module -- for example,
|
|
|
|
* ompi_comm_rank(newcomm) returns MPI_UNDEFINED for processes who
|
|
|
|
* are not in the new communicator. This can cause errors in the
|
|
|
|
* selection / initialization of a coll module. Plus, it's
|
|
|
|
* wasteful -- processes in the new communicator will end up
|
|
|
|
* freeing the new communicator anyway, so we might as well leave
|
|
|
|
* the coll selection as NULL (the coll base comm unselect code
|
|
|
|
* handles that case properly).
|
|
|
|
*/
|
|
|
|
if (MPI_UNDEFINED == (*newcomm)->c_local_group->grp_my_rank) {
|
|
|
|
return OMPI_SUCCESS;
|
2007-03-27 06:06:42 +04:00
|
|
|
}
|
2004-08-05 20:31:30 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/* Let the collectives components fight over who will do
|
|
|
|
collective on this new comm. */
|
so here is what happens:
in the v1.2 series the cid's could never go above the max. allowed for a
particular pml. Because of that, pml_add_comm never checked for the cid, and
in fact pml_add_comm was called in comm_set, which is *before* we knew the
cid.
in the v1.3 series (and trunk) we check now the cid to detect overflow, and
because of that pml_add_comm has been moved *after* the cid allocation
routine, namely into the comm_activate routine.
in the v1.2 series, the comm_activate contained a synchronization step of the
old communicator in order to prevent incoming fragments on the new
communicator, with the main problem being that the allreduce in the
communicator allocation finished at different times on different processes,
and thus, this scenario could and did really occur.
in the v1.3 series, the comm_activate does not contain the synchronization
step anymore, since we introduced the new queue for fragments with unknown
cid. The problem is however, that whether a fragment is known or not is
decided by using ompi_comm_lookup(), which will return something useful as
soon as the cid allocation finished, even before pml_add_comm has been
called. So there is a small time gap where we will not post a message into
queue for unknown cid's, but we can also not look up the process structure
belonging to the rank in that comm ( that is in pml_ob1_match_recv_frag or
something like that).
The current fix reintroduces the synchronization step in comm_activate, and
ensures that no fragment can be received for a new communicator before the
synchronization occurs , and thus comm_nextcid() and pml_add_comm has been
called. It seems to be the safest and easiest way for now. Welcome back, v1.2.
This commit was SVN r21970.
2009-09-17 18:37:02 +04:00
|
|
|
if (OMPI_SUCCESS != (ret = mca_coll_base_comm_select(*newcomm))) {
|
2010-10-04 18:54:58 +04:00
|
|
|
goto bail_on_error;
|
2008-11-05 00:58:06 +03:00
|
|
|
}
|
2010-02-20 02:45:30 +03:00
|
|
|
|
|
|
|
/* For an inter communicator, we have to deal with the potential
|
|
|
|
* problem of what is happening if the local_comm that we created
|
|
|
|
* has a lower CID than the parent comm. This is not a problem
|
|
|
|
* as long as the user calls MPI_Comm_free on the inter communicator.
|
|
|
|
* However, if the communicators are not freed by the user but released
|
|
|
|
* by Open MPI in MPI_Finalize, we walk through the list of still available
|
|
|
|
* communicators and free them one by one. Thus, local_comm is freed before
|
|
|
|
* the actual inter-communicator. However, the local_comm pointer in the
|
|
|
|
* inter communicator will still contain the 'previous' address of the local_comm
|
|
|
|
* and thus this will lead to a segmentation violation. In order to prevent
|
|
|
|
* that from happening, we increase the reference counter local_comm
|
|
|
|
* by one if its CID is lower than the parent. We cannot increase however
|
|
|
|
* its reference counter if the CID of local_comm is larger than
|
|
|
|
* the CID of the inter communicators, since a regular MPI_Comm_free would
|
|
|
|
* leave in that the case the local_comm hanging around and thus we would not
|
|
|
|
* recycle CID's properly, which was the reason and the cause for this trouble.
|
|
|
|
*/
|
|
|
|
if ( OMPI_COMM_IS_INTER(*newcomm)) {
|
|
|
|
if ( OMPI_COMM_CID_IS_LOWER(*newcomm, comm)) {
|
2010-02-24 00:24:07 +03:00
|
|
|
OMPI_COMM_SET_EXTRA_RETAIN (*newcomm);
|
2010-02-20 02:45:30 +03:00
|
|
|
OBJ_RETAIN (*newcomm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-05 20:31:30 +04:00
|
|
|
return OMPI_SUCCESS;
|
2008-11-05 00:58:06 +03:00
|
|
|
|
|
|
|
bail_on_error:
|
|
|
|
OBJ_RELEASE(*newcomm);
|
|
|
|
*newcomm = MPI_COMM_NULL;
|
|
|
|
return ret;
|
2013-10-02 18:26:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Non-blocking version of ompi_comm_activate */
|
|
|
|
struct ompi_comm_activate_nb_context {
|
|
|
|
ompi_communicator_t **newcomm;
|
|
|
|
ompi_communicator_t *comm;
|
|
|
|
|
|
|
|
/* storage for activate barrier */
|
|
|
|
int ok;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int ompi_comm_activate_nb_complete (ompi_comm_request_t *request);
|
|
|
|
|
|
|
|
int ompi_comm_activate_nb (ompi_communicator_t **newcomm,
|
|
|
|
ompi_communicator_t *comm,
|
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
int mode, ompi_request_t **req)
|
|
|
|
{
|
|
|
|
struct ompi_comm_activate_nb_context *context;
|
|
|
|
ompi_comm_request_t *request;
|
|
|
|
ompi_request_t *subreq;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
request = ompi_comm_request_get ();
|
|
|
|
if (NULL == request) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
context = calloc (1, sizeof (*context));
|
|
|
|
if (NULL == context) {
|
|
|
|
ompi_comm_request_return (request);
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
context->newcomm = newcomm;
|
|
|
|
context->comm = comm;
|
|
|
|
|
|
|
|
request->context = context;
|
|
|
|
|
|
|
|
if (OMPI_COMM_CID_INTRA != mode && OMPI_COMM_CID_INTER != mode) {
|
|
|
|
return MPI_UNDEFINED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (MPI_UNDEFINED != (*newcomm)->c_local_group->grp_my_rank) {
|
|
|
|
/* Initialize the PML stuff in the newcomm */
|
|
|
|
if ( OMPI_SUCCESS != (ret = MCA_PML_CALL(add_comm(*newcomm))) ) {
|
|
|
|
OBJ_RELEASE(newcomm);
|
|
|
|
*newcomm = MPI_COMM_NULL;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
OMPI_COMM_SET_PML_ADDED(*newcomm);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Step 1: the barrier, after which it is allowed to
|
|
|
|
* send messages over the new communicator
|
|
|
|
*/
|
|
|
|
if (mode == OMPI_COMM_CID_INTRA) {
|
|
|
|
ret = ompi_comm_allreduce_intra_nb (&context->ok, &context->ok, 1, MPI_MIN,
|
|
|
|
context->comm, bridgecomm, &subreq);
|
|
|
|
} else {
|
|
|
|
ret = ompi_comm_allreduce_inter_nb (&context->ok, &context->ok, 1, MPI_MIN,
|
|
|
|
context->comm, bridgecomm, &subreq);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
ompi_comm_request_return (request);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ompi_comm_request_schedule_append (request, ompi_comm_activate_nb_complete, &subreq, 1);
|
|
|
|
ompi_comm_request_start (request);
|
|
|
|
|
|
|
|
*req = &request->super;
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ompi_comm_activate_nb_complete (ompi_comm_request_t *request)
|
|
|
|
{
|
|
|
|
struct ompi_comm_activate_nb_context *context =
|
|
|
|
(struct ompi_comm_activate_nb_context *) request->context;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check to see if this process is in the new communicator.
|
|
|
|
*
|
|
|
|
* Specifically, this function is invoked by all proceses in the
|
|
|
|
* old communicator, regardless of whether they are in the new
|
|
|
|
* communicator or not. This is because it is far simpler to use
|
|
|
|
* MPI collective functions on the old communicator to determine
|
|
|
|
* some data for the new communicator (e.g., remote_leader) than
|
|
|
|
* to kludge up our own pseudo-collective routines over just the
|
|
|
|
* processes in the new communicator. Hence, *all* processes in
|
|
|
|
* the old communicator need to invoke this function.
|
|
|
|
*
|
|
|
|
* That being said, only processes in the new communicator need to
|
|
|
|
* select a coll module for the new communicator. More
|
|
|
|
* specifically, proceses who are not in the new communicator
|
|
|
|
* should *not* select a coll module -- for example,
|
|
|
|
* ompi_comm_rank(newcomm) returns MPI_UNDEFINED for processes who
|
|
|
|
* are not in the new communicator. This can cause errors in the
|
|
|
|
* selection / initialization of a coll module. Plus, it's
|
|
|
|
* wasteful -- processes in the new communicator will end up
|
|
|
|
* freeing the new communicator anyway, so we might as well leave
|
|
|
|
* the coll selection as NULL (the coll base comm unselect code
|
|
|
|
* handles that case properly).
|
|
|
|
*/
|
|
|
|
if (MPI_UNDEFINED == (*context->newcomm)->c_local_group->grp_my_rank) {
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Let the collectives components fight over who will do
|
|
|
|
collective on this new comm. */
|
|
|
|
if (OMPI_SUCCESS != (ret = mca_coll_base_comm_select(*context->newcomm))) {
|
|
|
|
OBJ_RELEASE(*context->newcomm);
|
|
|
|
*context->newcomm = MPI_COMM_NULL;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For an inter communicator, we have to deal with the potential
|
|
|
|
* problem of what is happening if the local_comm that we created
|
|
|
|
* has a lower CID than the parent comm. This is not a problem
|
|
|
|
* as long as the user calls MPI_Comm_free on the inter communicator.
|
|
|
|
* However, if the communicators are not freed by the user but released
|
|
|
|
* by Open MPI in MPI_Finalize, we walk through the list of still available
|
|
|
|
* communicators and free them one by one. Thus, local_comm is freed before
|
|
|
|
* the actual inter-communicator. However, the local_comm pointer in the
|
|
|
|
* inter communicator will still contain the 'previous' address of the local_comm
|
|
|
|
* and thus this will lead to a segmentation violation. In order to prevent
|
|
|
|
* that from happening, we increase the reference counter local_comm
|
|
|
|
* by one if its CID is lower than the parent. We cannot increase however
|
|
|
|
* its reference counter if the CID of local_comm is larger than
|
|
|
|
* the CID of the inter communicators, since a regular MPI_Comm_free would
|
|
|
|
* leave in that the case the local_comm hanging around and thus we would not
|
|
|
|
* recycle CID's properly, which was the reason and the cause for this trouble.
|
|
|
|
*/
|
|
|
|
if (OMPI_COMM_IS_INTER(*context->newcomm)) {
|
|
|
|
if (OMPI_COMM_CID_IS_LOWER(*context->newcomm, context->comm)) {
|
|
|
|
OMPI_COMM_SET_EXTRA_RETAIN (*context->newcomm);
|
|
|
|
OBJ_RETAIN (*context->newcomm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* done */
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2004-08-05 20:31:30 +04:00
|
|
|
|
2004-08-04 02:07:45 +04:00
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
2004-05-21 23:36:19 +04:00
|
|
|
/* Arguments not used in this implementation:
|
2004-06-17 02:37:03 +04:00
|
|
|
* - bridgecomm
|
|
|
|
* - local_leader
|
|
|
|
* - remote_leader
|
2004-08-05 20:31:30 +04:00
|
|
|
* - send_first
|
2004-06-17 02:37:03 +04:00
|
|
|
*/
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_intra ( int *inbuf, int *outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
2004-08-04 02:07:45 +04:00
|
|
|
ompi_communicator_t *comm,
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
void* local_leader,
|
|
|
|
void* remote_leader,
|
2004-08-05 20:31:30 +04:00
|
|
|
int send_first )
|
2004-05-21 23:36:19 +04:00
|
|
|
{
|
2013-10-02 18:26:40 +04:00
|
|
|
return comm->c_coll.coll_allreduce ( inbuf, outbuf, count, MPI_INT, op, comm,
|
2007-08-19 07:37:49 +04:00
|
|
|
comm->c_coll.coll_allreduce_module );
|
2004-05-21 23:36:19 +04:00
|
|
|
}
|
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_intra_nb (int *inbuf, int *outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
|
|
|
ompi_communicator_t *comm,
|
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
ompi_request_t **req)
|
|
|
|
{
|
|
|
|
return comm->c_coll.coll_iallreduce (inbuf, outbuf, count, MPI_INT, op, comm,
|
|
|
|
req, comm->c_coll.coll_iallreduce_module);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-21 23:36:19 +04:00
|
|
|
/* Arguments not used in this implementation:
|
2004-06-17 02:37:03 +04:00
|
|
|
* - bridgecomm
|
|
|
|
* - local_leader
|
|
|
|
* - remote_leader
|
2004-08-05 20:31:30 +04:00
|
|
|
* - send_first
|
2004-06-17 02:37:03 +04:00
|
|
|
*/
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_inter ( int *inbuf, int *outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
2004-08-04 02:07:45 +04:00
|
|
|
ompi_communicator_t *intercomm,
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
void* local_leader,
|
|
|
|
void* remote_leader,
|
2004-08-05 20:31:30 +04:00
|
|
|
int send_first )
|
2004-05-21 23:36:19 +04:00
|
|
|
{
|
2004-08-04 02:07:45 +04:00
|
|
|
int local_rank, rsize;
|
2013-10-02 18:26:40 +04:00
|
|
|
int rc;
|
2004-08-04 02:07:45 +04:00
|
|
|
int *sbuf;
|
|
|
|
int *tmpbuf=NULL;
|
|
|
|
int *rcounts=NULL, scount=0;
|
|
|
|
int *rdisps=NULL;
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
if ( !OMPI_COMM_IS_INTER (intercomm)) {
|
2004-05-21 23:36:19 +04:00
|
|
|
return MPI_ERR_COMM;
|
|
|
|
}
|
|
|
|
|
2004-08-04 02:07:45 +04:00
|
|
|
/* Allocate temporary arrays */
|
|
|
|
rsize = ompi_comm_remote_size (intercomm);
|
2004-06-07 19:33:53 +04:00
|
|
|
local_rank = ompi_comm_rank ( intercomm );
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2004-08-04 02:07:45 +04:00
|
|
|
tmpbuf = (int *) malloc ( count * sizeof(int));
|
|
|
|
rdisps = (int *) calloc ( rsize, sizeof(int));
|
|
|
|
rcounts = (int *) calloc ( rsize, sizeof(int) );
|
2008-08-11 13:43:01 +04:00
|
|
|
if ( OPAL_UNLIKELY (NULL == tmpbuf || NULL == rdisps || NULL == rcounts)) {
|
|
|
|
rc = OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
goto exit;
|
2004-08-04 02:07:45 +04:00
|
|
|
}
|
2010-10-04 18:54:58 +04:00
|
|
|
|
2004-08-04 02:07:45 +04:00
|
|
|
/* Execute the inter-allreduce: the result of our group will
|
|
|
|
be in the buffer of the remote group */
|
2004-06-29 04:02:25 +04:00
|
|
|
rc = intercomm->c_coll.coll_allreduce ( inbuf, tmpbuf, count, MPI_INT,
|
2007-08-19 07:37:49 +04:00
|
|
|
op, intercomm,
|
|
|
|
intercomm->c_coll.coll_allreduce_module);
|
2004-06-07 19:33:53 +04:00
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( 0 == local_rank ) {
|
|
|
|
MPI_Request req;
|
|
|
|
|
2004-08-04 02:07:45 +04:00
|
|
|
/* for the allgatherv later */
|
|
|
|
scount = count;
|
|
|
|
|
|
|
|
/* local leader exchange their data and determine the overall result
|
|
|
|
for both groups */
|
2013-10-02 18:26:40 +04:00
|
|
|
rc = MCA_PML_CALL(irecv (outbuf, count, MPI_INT, 0,
|
2009-08-04 18:51:15 +04:00
|
|
|
OMPI_COMM_ALLREDUCE_TAG,
|
|
|
|
intercomm, &req));
|
2004-06-07 19:33:53 +04:00
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
goto exit;
|
|
|
|
}
|
2005-04-13 07:19:48 +04:00
|
|
|
rc = MCA_PML_CALL(send (tmpbuf, count, MPI_INT, 0,
|
2009-08-04 18:51:15 +04:00
|
|
|
OMPI_COMM_ALLREDUCE_TAG,
|
|
|
|
MCA_PML_BASE_SEND_STANDARD,
|
|
|
|
intercomm));
|
2004-06-07 19:33:53 +04:00
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
goto exit;
|
|
|
|
}
|
2009-08-04 18:51:15 +04:00
|
|
|
rc = ompi_request_wait ( &req, MPI_STATUS_IGNORE );
|
2004-06-07 19:33:53 +04:00
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_op_reduce (op, tmpbuf, outbuf, count, MPI_INT);
|
2004-05-21 23:36:19 +04:00
|
|
|
}
|
2010-10-04 18:54:58 +04:00
|
|
|
|
2004-08-04 02:07:45 +04:00
|
|
|
/* distribute the overall result to all processes in the other group.
|
|
|
|
Instead of using bcast, we are using here allgatherv, to avoid the
|
2013-10-02 18:26:40 +04:00
|
|
|
possible deadlock. Else, we need an algorithm to determine,
|
|
|
|
which group sends first in the inter-bcast and which receives
|
2004-08-04 02:07:45 +04:00
|
|
|
the result first.
|
|
|
|
*/
|
|
|
|
rcounts[0] = count;
|
|
|
|
sbuf = outbuf;
|
|
|
|
rc = intercomm->c_coll.coll_allgatherv (sbuf, scount, MPI_INT, outbuf,
|
2013-10-02 18:26:40 +04:00
|
|
|
rcounts, rdisps, MPI_INT,
|
2007-08-19 07:37:49 +04:00
|
|
|
intercomm,
|
|
|
|
intercomm->c_coll.coll_allgatherv_module);
|
2010-10-04 18:54:58 +04:00
|
|
|
|
2004-05-21 23:36:19 +04:00
|
|
|
exit:
|
|
|
|
if ( NULL != tmpbuf ) {
|
|
|
|
free ( tmpbuf );
|
|
|
|
}
|
2004-08-04 02:07:45 +04:00
|
|
|
if ( NULL != rcounts ) {
|
|
|
|
free ( rcounts );
|
|
|
|
}
|
|
|
|
if ( NULL != rdisps ) {
|
|
|
|
free ( rdisps );
|
|
|
|
}
|
2013-10-02 18:26:40 +04:00
|
|
|
|
2004-05-21 23:36:19 +04:00
|
|
|
return (rc);
|
|
|
|
}
|
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
/* Non-blocking version of ompi_comm_allreduce_inter */
|
|
|
|
struct ompi_comm_allreduce_inter_context {
|
|
|
|
int *inbuf;
|
|
|
|
int *outbuf;
|
|
|
|
int count;
|
|
|
|
struct ompi_op_t *op;
|
|
|
|
ompi_communicator_t *intercomm;
|
|
|
|
ompi_communicator_t *bridgecomm;
|
|
|
|
int *tmpbuf;
|
|
|
|
int *rcounts;
|
|
|
|
int *rdisps;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void ompi_comm_allreduce_inter_context_free (struct ompi_comm_allreduce_inter_context *context)
|
|
|
|
{
|
|
|
|
if (context->tmpbuf) {
|
|
|
|
free (context->tmpbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (context->rdisps) {
|
|
|
|
free (context->rdisps);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (context->rcounts) {
|
|
|
|
free (context->rcounts);
|
|
|
|
}
|
|
|
|
|
|
|
|
free (context);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ompi_comm_allreduce_inter_leader_exchange (ompi_comm_request_t *request);
|
|
|
|
static int ompi_comm_allreduce_inter_leader_reduce (ompi_comm_request_t *request);
|
|
|
|
static int ompi_comm_allreduce_inter_allgather (ompi_comm_request_t *request);
|
|
|
|
static int ompi_comm_allreduce_inter_allgather_complete (ompi_comm_request_t *request);
|
|
|
|
|
|
|
|
/* Arguments not used in this implementation:
|
|
|
|
* - bridgecomm
|
|
|
|
*/
|
|
|
|
static int ompi_comm_allreduce_inter_nb (int *inbuf, int *outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
|
|
|
ompi_communicator_t *intercomm,
|
|
|
|
ompi_communicator_t *bridgecomm,
|
|
|
|
ompi_request_t **req)
|
|
|
|
{
|
|
|
|
struct ompi_comm_allreduce_inter_context *context = NULL;
|
|
|
|
ompi_comm_request_t *request = NULL;
|
|
|
|
ompi_request_t *subreq;
|
|
|
|
int local_rank, rsize, rc;
|
|
|
|
|
|
|
|
if (!OMPI_COMM_IS_INTER (intercomm)) {
|
|
|
|
return MPI_ERR_COMM;
|
|
|
|
}
|
|
|
|
|
|
|
|
request = ompi_comm_request_get ();
|
|
|
|
if (NULL == request) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
context = calloc (1, sizeof (*context));
|
|
|
|
if (NULL == context) {
|
|
|
|
rc = OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
context->inbuf = inbuf;
|
|
|
|
context->outbuf = outbuf;
|
|
|
|
context->count = count;
|
|
|
|
context->op = op;
|
|
|
|
context->intercomm = intercomm;
|
|
|
|
context->bridgecomm = bridgecomm;
|
|
|
|
|
|
|
|
/* Allocate temporary arrays */
|
|
|
|
rsize = ompi_comm_remote_size (intercomm);
|
|
|
|
local_rank = ompi_comm_rank (intercomm);
|
|
|
|
|
|
|
|
context->tmpbuf = (int *) calloc (count, sizeof(int));
|
|
|
|
context->rdisps = (int *) calloc (rsize, sizeof(int));
|
|
|
|
context->rcounts = (int *) calloc (rsize, sizeof(int));
|
|
|
|
if (OPAL_UNLIKELY (NULL == context->tmpbuf || NULL == context->rdisps || NULL == context->rcounts)) {
|
|
|
|
rc = OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
request->context = context;
|
|
|
|
|
|
|
|
/* Execute the inter-allreduce: the result from the local will be in the buffer of the remote group
|
|
|
|
* and vise-versa. */
|
|
|
|
rc = intercomm->c_coll.coll_iallreduce (inbuf, context->tmpbuf, count, MPI_INT, op, intercomm,
|
|
|
|
&subreq, intercomm->c_coll.coll_iallreduce_module);
|
|
|
|
if (OMPI_SUCCESS != rc) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == local_rank) {
|
|
|
|
ompi_comm_request_schedule_append (request, ompi_comm_allreduce_inter_leader_exchange, &subreq, 1);
|
|
|
|
} else {
|
|
|
|
ompi_comm_request_schedule_append (request, ompi_comm_allreduce_inter_allgather, &subreq, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
ompi_comm_request_start (request);
|
|
|
|
*req = &request->super;
|
|
|
|
|
|
|
|
exit:
|
|
|
|
if (OMPI_SUCCESS != rc) {
|
|
|
|
if (context) {
|
|
|
|
ompi_comm_allreduce_inter_context_free (context);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (request) {
|
|
|
|
request->context = NULL;
|
|
|
|
ompi_comm_request_return (request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int ompi_comm_allreduce_inter_leader_exchange (ompi_comm_request_t *request)
|
|
|
|
{
|
|
|
|
struct ompi_comm_allreduce_inter_context *context =
|
|
|
|
(struct ompi_comm_allreduce_inter_context *) request->context;
|
|
|
|
ompi_request_t *subreqs[2];
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* local leader exchange their data and determine the overall result
|
|
|
|
for both groups */
|
|
|
|
rc = MCA_PML_CALL(irecv (context->outbuf, context->count, MPI_INT, 0, OMPI_COMM_ALLREDUCE_TAG,
|
|
|
|
context->intercomm, subreqs));
|
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = MCA_PML_CALL(isend (context->tmpbuf, context->count, MPI_INT, 0, OMPI_COMM_ALLREDUCE_TAG,
|
|
|
|
MCA_PML_BASE_SEND_STANDARD, context->intercomm, subreqs + 1));
|
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
ompi_comm_request_schedule_append (request, ompi_comm_allreduce_inter_leader_reduce, subreqs, 2);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
if (OMPI_SUCCESS != rc) {
|
|
|
|
ompi_comm_allreduce_inter_context_free (context);
|
|
|
|
request->context = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ompi_comm_allreduce_inter_leader_reduce (ompi_comm_request_t *request)
|
|
|
|
{
|
|
|
|
struct ompi_comm_allreduce_inter_context *context =
|
|
|
|
(struct ompi_comm_allreduce_inter_context *) request->context;
|
|
|
|
|
|
|
|
ompi_op_reduce (context->op, context->tmpbuf, context->outbuf, context->count, MPI_INT);
|
|
|
|
|
|
|
|
return ompi_comm_allreduce_inter_allgather (request);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int ompi_comm_allreduce_inter_allgather (ompi_comm_request_t *request)
|
|
|
|
{
|
|
|
|
struct ompi_comm_allreduce_inter_context *context =
|
|
|
|
(struct ompi_comm_allreduce_inter_context *) request->context;
|
|
|
|
ompi_request_t *subreq;
|
|
|
|
int scount = 0, rc;
|
|
|
|
|
|
|
|
/* distribute the overall result to all processes in the other group.
|
|
|
|
Instead of using bcast, we are using here allgatherv, to avoid the
|
|
|
|
possible deadlock. Else, we need an algorithm to determine,
|
|
|
|
which group sends first in the inter-bcast and which receives
|
|
|
|
the result first.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (0 != ompi_comm_rank (context->intercomm)) {
|
|
|
|
context->rcounts[0] = context->count;
|
|
|
|
} else {
|
|
|
|
scount = context->count;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = context->intercomm->c_coll.coll_iallgatherv (context->outbuf, scount, MPI_INT, context->outbuf,
|
|
|
|
context->rcounts, context->rdisps, MPI_INT,
|
|
|
|
context->intercomm, &subreq,
|
|
|
|
context->intercomm->c_coll.coll_iallgatherv_module);
|
|
|
|
if (OMPI_SUCCESS != rc) {
|
|
|
|
ompi_comm_allreduce_inter_context_free (context);
|
|
|
|
request->context = NULL;
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
ompi_comm_request_schedule_append (request, ompi_comm_allreduce_inter_allgather_complete, &subreq, 1);
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ompi_comm_allreduce_inter_allgather_complete (ompi_comm_request_t *request)
|
|
|
|
{
|
|
|
|
/* free this request's context */
|
|
|
|
ompi_comm_allreduce_inter_context_free (request->context);
|
|
|
|
/* prevent a double-free from the progress engine */
|
|
|
|
request->context = NULL;
|
|
|
|
|
|
|
|
/* done */
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-21 23:36:19 +04:00
|
|
|
/* Arguments not used in this implementation:
|
2004-08-05 20:31:30 +04:00
|
|
|
* - send_first
|
|
|
|
*/
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_intra_bridge (int *inbuf, int *outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
2004-08-04 02:07:45 +04:00
|
|
|
ompi_communicator_t *comm,
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_communicator_t *bcomm,
|
2004-08-05 20:31:30 +04:00
|
|
|
void* lleader, void* rleader,
|
|
|
|
int send_first )
|
2004-05-21 23:36:19 +04:00
|
|
|
{
|
|
|
|
int *tmpbuf=NULL;
|
|
|
|
int local_rank;
|
|
|
|
int i;
|
|
|
|
int rc;
|
2004-06-17 02:37:03 +04:00
|
|
|
int local_leader, remote_leader;
|
2010-10-04 18:54:58 +04:00
|
|
|
|
2004-06-17 02:37:03 +04:00
|
|
|
local_leader = (*((int*)lleader));
|
|
|
|
remote_leader = (*((int*)rleader));
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2009-02-24 20:17:33 +03:00
|
|
|
if ( &ompi_mpi_op_sum.op != op && &ompi_mpi_op_prod.op != op &&
|
|
|
|
&ompi_mpi_op_max.op != op && &ompi_mpi_op_min.op != op ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
return MPI_ERR_OP;
|
|
|
|
}
|
2013-10-02 18:26:40 +04:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
local_rank = ompi_comm_rank ( comm );
|
2004-05-21 23:36:19 +04:00
|
|
|
tmpbuf = (int *) malloc ( count * sizeof(int));
|
|
|
|
if ( NULL == tmpbuf ) {
|
2008-08-11 13:43:01 +04:00
|
|
|
rc = OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
goto exit;
|
2004-05-21 23:36:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Intercomm_create */
|
2004-06-29 04:02:25 +04:00
|
|
|
rc = comm->c_coll.coll_allreduce ( inbuf, tmpbuf, count, MPI_INT,
|
2007-08-19 07:37:49 +04:00
|
|
|
op, comm, comm->c_coll.coll_allreduce_module );
|
2004-06-07 19:33:53 +04:00
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (local_rank == local_leader ) {
|
|
|
|
MPI_Request req;
|
2013-10-02 18:26:40 +04:00
|
|
|
|
2005-04-13 07:19:48 +04:00
|
|
|
rc = MCA_PML_CALL(irecv ( outbuf, count, MPI_INT, remote_leader,
|
2013-10-02 18:26:40 +04:00
|
|
|
OMPI_COMM_ALLREDUCE_TAG,
|
2010-10-04 18:54:58 +04:00
|
|
|
bcomm, &req));
|
2004-06-07 19:33:53 +04:00
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
2013-10-02 18:26:40 +04:00
|
|
|
goto exit;
|
2004-05-21 23:36:19 +04:00
|
|
|
}
|
2013-10-02 18:26:40 +04:00
|
|
|
rc = MCA_PML_CALL(send (tmpbuf, count, MPI_INT, remote_leader,
|
2010-10-04 18:54:58 +04:00
|
|
|
OMPI_COMM_ALLREDUCE_TAG,
|
|
|
|
MCA_PML_BASE_SEND_STANDARD, bcomm));
|
2004-06-07 19:33:53 +04:00
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
goto exit;
|
|
|
|
}
|
2004-10-12 19:50:01 +04:00
|
|
|
rc = ompi_request_wait_all ( 1, &req, MPI_STATUS_IGNORE);
|
2004-06-07 19:33:53 +04:00
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2009-02-24 20:17:33 +03:00
|
|
|
if ( &ompi_mpi_op_max.op == op ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
for ( i = 0 ; i < count; i++ ) {
|
2010-10-04 18:54:58 +04:00
|
|
|
if (tmpbuf[i] > outbuf[i]) {
|
|
|
|
outbuf[i] = tmpbuf[i];
|
|
|
|
}
|
2004-05-21 23:36:19 +04:00
|
|
|
}
|
|
|
|
}
|
2009-02-24 20:17:33 +03:00
|
|
|
else if ( &ompi_mpi_op_min.op == op ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
for ( i = 0 ; i < count; i++ ) {
|
2010-10-04 18:54:58 +04:00
|
|
|
if (tmpbuf[i] < outbuf[i]) {
|
|
|
|
outbuf[i] = tmpbuf[i];
|
|
|
|
}
|
2004-05-21 23:36:19 +04:00
|
|
|
}
|
|
|
|
}
|
2009-02-24 20:17:33 +03:00
|
|
|
else if ( &ompi_mpi_op_sum.op == op ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
for ( i = 0 ; i < count; i++ ) {
|
|
|
|
outbuf[i] += tmpbuf[i];
|
|
|
|
}
|
|
|
|
}
|
2009-02-24 20:17:33 +03:00
|
|
|
else if ( &ompi_mpi_op_prod.op == op ) {
|
2004-05-21 23:36:19 +04:00
|
|
|
for ( i = 0 ; i < count; i++ ) {
|
|
|
|
outbuf[i] *= tmpbuf[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-04 18:54:58 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
rc = comm->c_coll.coll_bcast ( outbuf, count, MPI_INT, local_leader,
|
2007-08-19 07:37:49 +04:00
|
|
|
comm, comm->c_coll.coll_bcast_module );
|
2004-05-21 23:36:19 +04:00
|
|
|
|
|
|
|
exit:
|
|
|
|
if (NULL != tmpbuf ) {
|
|
|
|
free (tmpbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rc);
|
|
|
|
}
|
|
|
|
|
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 20:37:40 +04:00
|
|
|
typedef struct {
|
|
|
|
opal_buffer_t buf;
|
|
|
|
bool active;
|
|
|
|
} comm_cid_return_t;
|
|
|
|
|
|
|
|
static void comm_cid_recv(int status,
|
|
|
|
ompi_process_name_t* peer,
|
|
|
|
opal_buffer_t* buffer,
|
|
|
|
ompi_rml_tag_t tag,
|
|
|
|
void* cbdata)
|
|
|
|
{
|
|
|
|
comm_cid_return_t *rcid = (comm_cid_return_t*)cbdata;
|
|
|
|
|
|
|
|
opal_dss.copy_payload(&rcid->buf, buffer);
|
|
|
|
rcid->active = false;
|
|
|
|
}
|
|
|
|
|
2004-06-17 02:37:03 +04:00
|
|
|
/* Arguments not used in this implementation:
|
|
|
|
* - bridgecomm
|
|
|
|
*
|
2004-08-05 20:31:30 +04:00
|
|
|
* lleader is the local rank of root in comm
|
|
|
|
* rleader is the OOB contact information of the
|
|
|
|
* root processes in the other world.
|
2004-06-17 02:37:03 +04:00
|
|
|
*/
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_intra_oob (int *inbuf, int *outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
2004-08-04 02:07:45 +04:00
|
|
|
ompi_communicator_t *comm,
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_communicator_t *bridgecomm,
|
2004-08-05 20:31:30 +04:00
|
|
|
void* lleader, void* rleader,
|
|
|
|
int send_first )
|
2004-06-17 02:37:03 +04:00
|
|
|
{
|
|
|
|
int *tmpbuf=NULL;
|
|
|
|
int rc;
|
2004-08-05 20:31:30 +04:00
|
|
|
int local_leader, local_rank;
|
2013-01-28 03:25:10 +04:00
|
|
|
ompi_process_name_t *remote_leader=NULL;
|
|
|
|
int32_t size_count;
|
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 20:37:40 +04:00
|
|
|
comm_cid_return_t rcid;
|
2010-10-04 18:54:58 +04:00
|
|
|
|
2004-08-05 20:31:30 +04:00
|
|
|
local_leader = (*((int*)lleader));
|
2013-01-28 03:25:10 +04:00
|
|
|
remote_leader = (ompi_process_name_t*)rleader;
|
2005-07-06 00:59:35 +04:00
|
|
|
size_count = count;
|
2004-06-17 02:37:03 +04:00
|
|
|
|
2004-08-05 20:31:30 +04:00
|
|
|
local_rank = ompi_comm_rank ( comm );
|
2005-04-07 21:48:42 +04:00
|
|
|
tmpbuf = (int *) malloc ( count * sizeof(int));
|
2004-06-17 02:37:03 +04:00
|
|
|
if ( NULL == tmpbuf ) {
|
2008-08-11 13:43:01 +04:00
|
|
|
rc = OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
goto exit;
|
2004-06-17 02:37:03 +04:00
|
|
|
}
|
|
|
|
|
2004-08-05 20:31:30 +04:00
|
|
|
/* comm is an intra-communicator */
|
2007-08-19 07:37:49 +04:00
|
|
|
rc = comm->c_coll.coll_allreduce(inbuf,tmpbuf,count,MPI_INT,op, comm,
|
|
|
|
comm->c_coll.coll_allreduce_module);
|
2004-06-17 02:37:03 +04:00
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2013-10-02 18:26:40 +04:00
|
|
|
|
2004-06-17 02:37:03 +04:00
|
|
|
if (local_rank == local_leader ) {
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *sbuf;
|
2004-08-05 20:31:30 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
sbuf = OBJ_NEW(opal_buffer_t);
|
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 20:37:40 +04:00
|
|
|
|
2013-01-28 03:25:10 +04:00
|
|
|
if (OPAL_SUCCESS != (rc = opal_dss.pack(sbuf, tmpbuf, (int32_t)count, OPAL_INT))) {
|
2005-03-14 23:57:21 +03:00
|
|
|
goto exit;
|
|
|
|
}
|
2004-08-05 20:31:30 +04:00
|
|
|
|
2004-08-13 02:41:42 +04:00
|
|
|
if ( send_first ) {
|
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 20:37:40 +04:00
|
|
|
if (0 > (rc = ompi_rte_send_buffer_nb(remote_leader, sbuf,
|
|
|
|
OMPI_RML_TAG_COMM_CID_INTRA,
|
|
|
|
ompi_rte_send_cbfunc, NULL))) {
|
2008-06-18 07:15:56 +04:00
|
|
|
goto exit;
|
|
|
|
}
|
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 20:37:40 +04:00
|
|
|
OBJ_CONSTRUCT(&rcid.buf, opal_buffer_t);
|
|
|
|
rcid.active = true;
|
|
|
|
ompi_rte_recv_buffer_nb(remote_leader, OMPI_RML_TAG_COMM_CID_INTRA,
|
|
|
|
OMPI_RML_NON_PERSISTENT, comm_cid_recv, &rcid);
|
|
|
|
while (rcid.active) {
|
|
|
|
opal_progress();
|
2008-06-18 07:15:56 +04:00
|
|
|
}
|
2004-08-05 20:31:30 +04:00
|
|
|
}
|
|
|
|
else {
|
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 20:37:40 +04:00
|
|
|
OBJ_CONSTRUCT(&rcid.buf, opal_buffer_t);
|
|
|
|
rcid.active = true;
|
|
|
|
ompi_rte_recv_buffer_nb(remote_leader, OMPI_RML_TAG_COMM_CID_INTRA,
|
|
|
|
OMPI_RML_NON_PERSISTENT, comm_cid_recv, &rcid);
|
|
|
|
while (rcid.active) {
|
|
|
|
opal_progress();
|
2008-06-18 07:15:56 +04: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 20:37:40 +04:00
|
|
|
if (0 > (rc = ompi_rte_send_buffer_nb(remote_leader, sbuf,
|
|
|
|
OMPI_RML_TAG_COMM_CID_INTRA,
|
|
|
|
ompi_rte_send_cbfunc, NULL))) {
|
2008-06-18 07:15:56 +04:00
|
|
|
goto exit;
|
|
|
|
}
|
2004-08-05 20:31:30 +04: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 20:37:40 +04:00
|
|
|
if (OPAL_SUCCESS != (rc = opal_dss.unpack(&rcid.buf, outbuf, &size_count, OPAL_INT))) {
|
2005-03-14 23:57:21 +03:00
|
|
|
goto exit;
|
|
|
|
}
|
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 20:37:40 +04:00
|
|
|
OBJ_DESTRUCT(&rcid.buf);
|
2006-08-15 23:54:10 +04:00
|
|
|
count = (int)size_count;
|
2004-08-13 02:41:42 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
ompi_op_reduce (op, tmpbuf, outbuf, count, MPI_INT);
|
2004-06-17 02:37:03 +04:00
|
|
|
}
|
2010-10-04 18:54:58 +04:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
rc = comm->c_coll.coll_bcast (outbuf, count, MPI_INT,
|
2007-08-19 07:37:49 +04:00
|
|
|
local_leader, comm,
|
|
|
|
comm->c_coll.coll_bcast_module);
|
2004-06-17 02:37:03 +04:00
|
|
|
|
|
|
|
exit:
|
|
|
|
if (NULL != tmpbuf ) {
|
|
|
|
free (tmpbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rc);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2013-10-02 18:26:40 +04:00
|
|
|
static int ompi_comm_allreduce_group (int *inbuf, int* outbuf,
|
|
|
|
int count, struct ompi_op_t *op,
|
|
|
|
ompi_communicator_t *comm,
|
|
|
|
ompi_communicator_t *newcomm,
|
|
|
|
void* local_leader,
|
|
|
|
void* remote_leader,
|
|
|
|
int send_first)
|
|
|
|
{
|
|
|
|
ompi_group_t *group = newcomm->c_local_group;
|
|
|
|
int peers_group[3], peers_comm[3];
|
|
|
|
const int group_size = ompi_group_size (group);
|
|
|
|
const int group_rank = ompi_group_rank (group);
|
|
|
|
int tag = *((int *) local_leader);
|
|
|
|
int *tmp1;
|
2013-10-23 08:13:51 +04:00
|
|
|
int i, rc=OMPI_SUCCESS;
|
2013-10-02 18:26:40 +04:00
|
|
|
|
|
|
|
/* basic recursive doubling allreduce on the group */
|
|
|
|
peers_group[0] = group_rank ? ((group_rank - 1) >> 1) : MPI_PROC_NULL;
|
|
|
|
peers_group[1] = (group_rank * 2 + 1) < group_size ? group_rank * 2 + 1: MPI_PROC_NULL;
|
|
|
|
peers_group[2] = (group_rank * 2 + 2) < group_size ? group_rank * 2 + 2 : MPI_PROC_NULL;
|
|
|
|
|
|
|
|
/* translate the ranks into the ranks of the parent communicator */
|
|
|
|
ompi_group_translate_ranks (group, 3, peers_group, comm->c_local_group, peers_comm);
|
|
|
|
|
|
|
|
tmp1 = malloc (sizeof (int) * count);
|
|
|
|
|
|
|
|
/* reduce */
|
|
|
|
memmove (outbuf, inbuf, sizeof (int) * count);
|
|
|
|
|
|
|
|
for (i = 1 ; i < 3 ; ++i) {
|
|
|
|
if (MPI_PROC_NULL != peers_comm[i]) {
|
|
|
|
rc = MCA_PML_CALL(recv(tmp1, count, MPI_INT, peers_comm[i], tag, comm,
|
|
|
|
MPI_STATUS_IGNORE));
|
|
|
|
if (OMPI_SUCCESS != rc) {
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
/* this is integer reduction so we do not care about ordering */
|
|
|
|
ompi_op_reduce (op, tmp1, outbuf, count, MPI_INT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (MPI_PROC_NULL != peers_comm[0]) {
|
|
|
|
rc = MCA_PML_CALL(send(outbuf, count, MPI_INT, peers_comm[0],
|
|
|
|
tag, MCA_PML_BASE_SEND_STANDARD, comm));
|
|
|
|
if (OMPI_SUCCESS != rc) {
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = MCA_PML_CALL(recv(outbuf, count, MPI_INT, peers_comm[0],
|
|
|
|
tag, comm, MPI_STATUS_IGNORE));
|
|
|
|
if (OMPI_SUCCESS != rc) {
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* broadcast */
|
|
|
|
for (i = 1 ; i < 3 ; ++i) {
|
|
|
|
if (MPI_PROC_NULL != peers_comm[i]) {
|
|
|
|
rc = MCA_PML_CALL(send(outbuf, count, MPI_INT, peers_comm[i], tag,
|
|
|
|
MCA_PML_BASE_SEND_STANDARD, comm));
|
|
|
|
if (OMPI_SUCCESS != rc) {
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
free (tmp1);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
END_C_DECLS
|