2004-08-25 21:39:08 +04:00
|
|
|
/*
|
2007-03-17 02:11:45 +03:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2007-06-14 08:38:06 +04:00
|
|
|
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
Fix a number of OOB issues:
* Remove the connect() timeout code, as it had some nasty race conditions
when connections were established as the trigger was firing. A better
solution has been found for the cluster where this was needed, so just
removing it was easiest.
* When a fatal error (too many connection failures) occurs, set an error
on messages in the queue even if there isn't an active message. The
first message to any peer will be queued without being active (and
so will all subsequent messages until the connection is established),
and the orteds will hang until that first message completes. So if
an orted can never contact it's peer, it will never exit and just sit
waiting for that message to complete.
* Cover an interesting RST condition in the connect code. A connection
can complete the three-way handshake, the connector can even send
some data, but the server side will drop the connection because it
can't move it from the half-connected to fully-connected state because
of space shortage in the listen backlog queue. This causes a RST to
be received first time that recv() is called, which will be when waiting
for the remote side of the OOB ack. In this case, transition the
connection back into a CLOSED state and try to connect again.
* Add levels of debugging, rather than all or nothing, each building on
the previous level. 0 (default) is hard errors. 1 is connection
error debugging info. 2 is all connection info. 3 is more state
info. 4 includes all message info.
* Add some hopefully useful comments
This commit was SVN r14261.
2007-04-08 02:33:30 +04:00
|
|
|
* Copyright (c) 2006-2007 Los Alamos National Security, LLC.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-08-25 21:39:08 +04:00
|
|
|
* $HEADER$
|
2006-03-11 06:09:24 +03:00
|
|
|
*
|
|
|
|
* In windows, many of the socket functions return an EWOULDBLOCK
|
|
|
|
* instead of \ things like EAGAIN, EINPROGRESS, etc. It has been
|
|
|
|
* verified that this will \ not conflict with other error codes that
|
|
|
|
* are returned by these functions \ under UNIX/Linux environments
|
2004-08-25 21:39:08 +04:00
|
|
|
*/
|
2006-03-11 06:09:24 +03:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte_config.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/constants.h"
|
|
|
|
|
2006-08-15 00:14:44 +04:00
|
|
|
#include "opal/opal_socket_errno.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2008-03-06 01:44:35 +03:00
|
|
|
#include "opal/class/opal_hash_table.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/util/name_fns.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/mca/routed/routed.h"
|
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/mca/oob/tcp/oob_tcp.h"
|
|
|
|
#include "orte/mca/oob/tcp/oob_tcp_msg.h"
|
2004-07-13 02:46:57 +04:00
|
|
|
|
|
|
|
|
|
|
|
static void mca_oob_tcp_msg_construct(mca_oob_tcp_msg_t*);
|
|
|
|
static void mca_oob_tcp_msg_destruct(mca_oob_tcp_msg_t*);
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
static void mca_oob_tcp_msg_ident(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* peer);
|
|
|
|
static bool mca_oob_tcp_msg_recv(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* peer);
|
2004-09-08 21:02:24 +04:00
|
|
|
static void mca_oob_tcp_msg_data(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* peer);
|
|
|
|
static void mca_oob_tcp_msg_ping(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* peer);
|
2004-07-13 02:46:57 +04:00
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(
|
|
|
|
mca_oob_tcp_msg_t,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t,
|
2004-07-13 02:46:57 +04:00
|
|
|
mca_oob_tcp_msg_construct,
|
|
|
|
mca_oob_tcp_msg_destruct);
|
|
|
|
|
|
|
|
|
|
|
|
static void mca_oob_tcp_msg_construct(mca_oob_tcp_msg_t* msg)
|
|
|
|
{
|
2005-07-04 02:45:48 +04:00
|
|
|
OBJ_CONSTRUCT(&msg->msg_lock, opal_mutex_t);
|
|
|
|
OBJ_CONSTRUCT(&msg->msg_condition, opal_condition_t);
|
2004-07-13 02:46:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void mca_oob_tcp_msg_destruct(mca_oob_tcp_msg_t* msg)
|
|
|
|
{
|
2004-07-15 17:51:40 +04:00
|
|
|
OBJ_DESTRUCT(&msg->msg_lock);
|
|
|
|
OBJ_DESTRUCT(&msg->msg_condition);
|
2004-07-13 02:46:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-10 03:07:53 +04:00
|
|
|
/*
|
2004-07-13 02:46:57 +04:00
|
|
|
* Wait for a msg to complete.
|
|
|
|
* @param msg (IN) Message to wait on.
|
2004-08-03 01:24:00 +04:00
|
|
|
* @param rc (OUT) Return code (number of bytes read on success or error code on failure).
|
2006-02-12 04:33:29 +03:00
|
|
|
* @retval ORTE_SUCCESS or error code on failure.
|
2004-07-13 02:46:57 +04:00
|
|
|
*/
|
|
|
|
|
2004-08-03 01:24:00 +04:00
|
|
|
int mca_oob_tcp_msg_wait(mca_oob_tcp_msg_t* msg, int* rc)
|
2004-07-13 02:46:57 +04:00
|
|
|
{
|
2005-02-16 20:42:07 +03:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&msg->msg_lock);
|
2004-08-28 05:34:48 +04:00
|
|
|
while(msg->msg_complete == false) {
|
2005-07-04 03:09:55 +04:00
|
|
|
if(opal_event_progress_thread()) {
|
2004-08-31 06:57:39 +04:00
|
|
|
int rc;
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&msg->msg_lock);
|
2006-04-06 16:58:09 +04:00
|
|
|
rc = opal_event_loop(OPAL_EVLOOP_ONCE);
|
|
|
|
assert(rc >= 0);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&msg->msg_lock);
|
2004-08-28 05:34:48 +04:00
|
|
|
} else {
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_condition_wait(&msg->msg_condition, &msg->msg_lock);
|
2004-08-28 05:34:48 +04:00
|
|
|
}
|
|
|
|
}
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&msg->msg_lock);
|
2004-08-28 05:34:48 +04:00
|
|
|
|
|
|
|
#else
|
2004-08-03 01:24:00 +04:00
|
|
|
/* wait for message to complete */
|
2006-04-07 22:13:35 +04:00
|
|
|
while(msg->msg_complete == false) {
|
|
|
|
/* msg_wait() is used in the "barrier" at the completion of
|
|
|
|
MPI_FINALIZE, during which time BTLs may still need to
|
|
|
|
progress pending outgoing communication, so we need to
|
|
|
|
call opal_progress() here to make sure that communication
|
|
|
|
gets pushed out so others can enter finalize (and send us
|
|
|
|
the message we're here waiting for). However, if we're
|
|
|
|
in a callback from the event library that was triggered
|
|
|
|
from a call to opal_progress(), opal_progress() will
|
|
|
|
think another thread is already progressing the event
|
|
|
|
engine (in the case of mpi threads enabled) and not
|
|
|
|
progress the engine, meaning we'll never receive our
|
|
|
|
message. So we also need to progress the event library
|
|
|
|
expicitly. We use EVLOOP_NONBLOCK so that we can
|
|
|
|
progress both the registered callbacks and the event
|
|
|
|
library, as EVLOOP_ONCE may block for a short period of
|
|
|
|
time. */
|
2006-03-29 02:09:40 +04:00
|
|
|
opal_progress();
|
2006-04-07 22:13:35 +04:00
|
|
|
opal_event_loop(OPAL_EVLOOP_NONBLOCK);
|
2007-03-17 02:11:45 +03:00
|
|
|
OPAL_CR_TEST_CHECKPOINT_READY();
|
2006-04-07 22:13:35 +04:00
|
|
|
}
|
2004-08-28 05:34:48 +04:00
|
|
|
#endif
|
2004-08-03 01:24:00 +04:00
|
|
|
|
|
|
|
/* return status */
|
|
|
|
if(NULL != rc) {
|
|
|
|
*rc = msg->msg_rc;
|
|
|
|
}
|
2006-02-12 04:33:29 +03:00
|
|
|
return ORTE_SUCCESS;
|
2004-07-13 02:46:57 +04:00
|
|
|
}
|
|
|
|
|
2004-09-08 21:02:24 +04:00
|
|
|
/*
|
|
|
|
* Wait up to a timeout for the message to complete.
|
|
|
|
* @param msg (IN) Message to wait on.
|
|
|
|
* @param rc (OUT) Return code (number of bytes read on success or error code on failure).
|
2006-02-12 04:33:29 +03:00
|
|
|
* @retval ORTE_SUCCESS or error code on failure.
|
2004-09-08 21:02:24 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_oob_tcp_msg_timedwait(mca_oob_tcp_msg_t* msg, int* rc, struct timespec* abstime)
|
|
|
|
{
|
|
|
|
struct timeval tv;
|
|
|
|
uint32_t secs = abstime->tv_sec;
|
|
|
|
uint32_t usecs = abstime->tv_nsec * 1000;
|
|
|
|
gettimeofday(&tv,NULL);
|
|
|
|
|
2005-02-16 20:42:07 +03:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&msg->msg_lock);
|
2004-09-08 21:02:24 +04:00
|
|
|
while(msg->msg_complete == false &&
|
2004-11-21 20:20:42 +03:00
|
|
|
((uint32_t)tv.tv_sec <= secs ||
|
|
|
|
((uint32_t)tv.tv_sec == secs && (uint32_t)tv.tv_usec < usecs))) {
|
2005-07-04 03:09:55 +04:00
|
|
|
if(opal_event_progress_thread()) {
|
2004-09-08 21:02:24 +04:00
|
|
|
int rc;
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&msg->msg_lock);
|
2006-04-06 18:31:38 +04:00
|
|
|
rc = opal_event_loop(OPAL_EVLOOP_ONCE);
|
|
|
|
assert(rc >= 0);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&msg->msg_lock);
|
2004-09-08 21:02:24 +04:00
|
|
|
} else {
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_condition_timedwait(&msg->msg_condition, &msg->msg_lock, abstime);
|
2004-09-08 21:02:24 +04:00
|
|
|
}
|
2004-09-14 12:06:00 +04:00
|
|
|
gettimeofday(&tv,NULL);
|
2004-09-08 21:02:24 +04:00
|
|
|
}
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&msg->msg_lock);
|
2004-09-08 21:02:24 +04:00
|
|
|
#else
|
|
|
|
/* wait for message to complete */
|
|
|
|
while(msg->msg_complete == false &&
|
2004-11-20 22:12:43 +03:00
|
|
|
((uint32_t)tv.tv_sec <= secs ||
|
|
|
|
((uint32_t)tv.tv_sec == secs && (uint32_t)tv.tv_usec < usecs))) {
|
2006-04-07 22:13:35 +04:00
|
|
|
/* see comment in tcp_msg_wait, above */
|
2006-03-29 02:09:40 +04:00
|
|
|
opal_progress();
|
2006-04-07 22:13:35 +04:00
|
|
|
opal_event_loop(OPAL_EVLOOP_NONBLOCK);
|
2004-09-14 12:06:00 +04:00
|
|
|
gettimeofday(&tv,NULL);
|
2004-09-08 21:02:24 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* return status */
|
|
|
|
if(NULL != rc) {
|
|
|
|
*rc = msg->msg_rc;
|
|
|
|
}
|
|
|
|
if(msg->msg_rc < 0)
|
|
|
|
return msg->msg_rc;
|
2006-02-12 04:33:29 +03:00
|
|
|
return (msg->msg_complete ? ORTE_SUCCESS : ORTE_ERR_TIMEOUT);
|
2004-09-08 21:02:24 +04:00
|
|
|
}
|
|
|
|
|
2004-08-10 03:07:53 +04:00
|
|
|
/*
|
2004-07-13 02:46:57 +04:00
|
|
|
* Signal that a message has completed.
|
|
|
|
* @param msg (IN) Message to wait on.
|
2004-07-15 17:51:40 +04:00
|
|
|
* @param peer (IN) the peer of the message
|
2006-02-12 04:33:29 +03:00
|
|
|
* @retval ORTE_SUCCESS or error code on failure.
|
2004-07-13 02:46:57 +04:00
|
|
|
*/
|
2005-03-14 23:57:21 +03:00
|
|
|
int mca_oob_tcp_msg_complete(mca_oob_tcp_msg_t* msg, orte_process_name_t * peer)
|
2004-07-13 02:46:57 +04:00
|
|
|
{
|
2005-10-25 17:48:08 +04:00
|
|
|
OPAL_THREAD_LOCK(&msg->msg_lock);
|
2004-07-15 17:51:40 +04:00
|
|
|
msg->msg_complete = true;
|
|
|
|
if(NULL != msg->msg_cbfunc) {
|
2005-10-25 17:48:08 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&msg->msg_lock);
|
|
|
|
|
2007-06-14 08:38:06 +04:00
|
|
|
#if defined(__WINDOWS__)
|
|
|
|
/**
|
2007-06-15 02:35:38 +04:00
|
|
|
* In order to be able to generate TCP events recursively, Windows need
|
2007-06-14 08:38:06 +04:00
|
|
|
* to get out of the callback attached to a specific socket. Therefore,
|
|
|
|
* as our OOB allow to block on a connection from a callback on the same
|
|
|
|
* connection, we have to trigger the completion callbacks outside of the
|
|
|
|
* OOB callbacks. We add them to the completed list here, and the progress
|
|
|
|
* engine will call our progress function later once all socket related
|
2007-06-15 02:35:38 +04:00
|
|
|
* events have been processed.
|
2007-06-14 08:38:06 +04:00
|
|
|
*/
|
2007-07-20 05:34:02 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
|
|
|
opal_list_append(&mca_oob_tcp_component.tcp_msg_completed, (opal_list_item_t*)msg);
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
|
|
|
return ORTE_SUCCESS;
|
2007-06-14 08:38:06 +04:00
|
|
|
#else
|
2007-07-20 05:34:02 +04:00
|
|
|
|
|
|
|
/* post to a global list of completed messages */
|
|
|
|
if ((msg->msg_flags & ORTE_RML_FLAG_RECURSIVE_CALLBACK) == 0) {
|
|
|
|
int size;
|
|
|
|
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
|
|
|
opal_list_append(&mca_oob_tcp_component.tcp_msg_completed, (opal_list_item_t*)msg);
|
|
|
|
size = opal_list_get_size(&mca_oob_tcp_component.tcp_msg_completed);
|
2005-10-25 17:48:08 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
2007-07-20 05:34:02 +04:00
|
|
|
if(size > 1) {
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
2005-10-25 17:48:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* invoke message callback */
|
2004-09-02 03:07:40 +04:00
|
|
|
msg->msg_cbfunc(msg->msg_rc, peer, msg->msg_uiov, msg->msg_ucnt, msg->msg_hdr.msg_tag, msg->msg_cbdata);
|
2005-10-25 17:48:08 +04:00
|
|
|
|
2007-07-20 05:34:02 +04:00
|
|
|
/* dispatch any completed events */
|
|
|
|
if ((msg->msg_flags & ORTE_RML_FLAG_RECURSIVE_CALLBACK) == 0) {
|
2007-07-25 07:55:34 +04:00
|
|
|
opal_list_item_t* item;
|
|
|
|
|
2005-10-25 17:48:08 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
2007-07-20 05:34:02 +04:00
|
|
|
opal_list_remove_item(&mca_oob_tcp_component.tcp_msg_completed, (opal_list_item_t*)msg);
|
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
|
|
|
while(NULL !=
|
|
|
|
(item = opal_list_remove_first(&mca_oob_tcp_component.tcp_msg_completed))) {
|
|
|
|
msg = (mca_oob_tcp_msg_t*)item;
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
|
|
|
msg->msg_cbfunc(
|
|
|
|
msg->msg_rc,
|
|
|
|
&msg->msg_peer,
|
|
|
|
msg->msg_uiov,
|
|
|
|
msg->msg_ucnt,
|
|
|
|
msg->msg_hdr.msg_tag,
|
|
|
|
msg->msg_cbdata);
|
|
|
|
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
|
|
|
} else {
|
2005-10-31 19:21:11 +03:00
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
2005-10-25 17:48:08 +04:00
|
|
|
}
|
2007-06-14 08:38:06 +04:00
|
|
|
#endif /* defined(__WINDOWS__) */
|
2004-07-15 17:51:40 +04:00
|
|
|
} else {
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_condition_broadcast(&msg->msg_condition);
|
2005-10-25 17:48:08 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&msg->msg_lock);
|
2004-07-15 17:51:40 +04:00
|
|
|
}
|
2006-02-12 04:33:29 +03:00
|
|
|
return ORTE_SUCCESS;
|
2004-07-13 02:46:57 +04:00
|
|
|
}
|
|
|
|
|
2004-07-15 23:08:54 +04:00
|
|
|
/*
|
2004-07-15 17:51:40 +04:00
|
|
|
* The function that actually sends the data!
|
|
|
|
* @param msg a pointer to the message to send
|
|
|
|
* @param peer the peer we are sending to
|
|
|
|
* @retval true if the entire message has been sent
|
|
|
|
* @retval false if the entire message has not been sent
|
|
|
|
*/
|
2004-07-15 23:08:54 +04:00
|
|
|
bool mca_oob_tcp_msg_send_handler(mca_oob_tcp_msg_t* msg, struct mca_oob_tcp_peer_t * peer)
|
2004-07-15 17:51:40 +04:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
while(1) {
|
2004-08-03 01:24:00 +04:00
|
|
|
rc = writev(peer->peer_sd, msg->msg_rwptr, msg->msg_rwnum);
|
|
|
|
if(rc < 0) {
|
2006-08-15 00:14:44 +04:00
|
|
|
if(opal_socket_errno == EINTR)
|
2004-07-15 17:51:40 +04:00
|
|
|
continue;
|
2005-01-20 03:40:22 +03:00
|
|
|
/* In windows, many of the socket functions return an EWOULDBLOCK instead of \
|
|
|
|
things like EAGAIN, EINPROGRESS, etc. It has been verified that this will \
|
|
|
|
not conflict with other error codes that are returned by these functions \
|
|
|
|
under UNIX/Linux environments */
|
2006-08-15 00:14:44 +04:00
|
|
|
else if (opal_socket_errno == EAGAIN || opal_socket_errno == EWOULDBLOCK)
|
2004-07-15 17:51:40 +04:00
|
|
|
return false;
|
|
|
|
else {
|
2007-07-20 06:34:29 +04:00
|
|
|
opal_output(0, "%s-%s mca_oob_tcp_msg_send_handler: writev failed: %s (%d)",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2007-07-20 06:34:29 +04:00
|
|
|
ORTE_NAME_PRINT(&(peer->peer_name)),
|
2006-12-14 21:20:43 +03:00
|
|
|
strerror(opal_socket_errno),
|
2006-08-15 00:14:44 +04:00
|
|
|
opal_socket_errno);
|
2004-08-03 01:24:00 +04:00
|
|
|
mca_oob_tcp_peer_close(peer);
|
2006-02-12 04:33:29 +03:00
|
|
|
msg->msg_rc = ORTE_ERR_CONNECTION_FAILED;
|
2005-03-14 23:57:21 +03:00
|
|
|
return true;
|
2004-07-15 17:51:40 +04:00
|
|
|
}
|
|
|
|
}
|
2004-08-03 01:24:00 +04:00
|
|
|
|
|
|
|
msg->msg_rc += rc;
|
|
|
|
do {/* while there is still more iovecs to write */
|
2004-11-20 22:12:43 +03:00
|
|
|
if(rc < (int)msg->msg_rwptr->iov_len) {
|
2004-07-15 17:51:40 +04:00
|
|
|
msg->msg_rwptr->iov_len -= rc;
|
2005-01-26 03:20:35 +03:00
|
|
|
msg->msg_rwptr->iov_base = (ompi_iov_base_ptr_t)((char *) msg->msg_rwptr->iov_base + rc);
|
2004-07-15 17:51:40 +04:00
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
rc -= msg->msg_rwptr->iov_len;
|
2004-08-03 01:24:00 +04:00
|
|
|
(msg->msg_rwnum)--;
|
2004-07-15 17:51:40 +04:00
|
|
|
(msg->msg_rwptr)++;
|
2004-08-03 01:24:00 +04:00
|
|
|
if(0 == msg->msg_rwnum) {
|
2004-07-15 17:51:40 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2007-04-12 09:01:29 +04:00
|
|
|
} while(1);
|
2004-07-15 17:51:40 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-10 03:07:53 +04:00
|
|
|
/*
|
2004-08-03 01:24:00 +04:00
|
|
|
* Receives message data.
|
2007-06-13 02:47:14 +04:00
|
|
|
* @param msg the message to be received into
|
2007-04-12 09:01:29 +04:00
|
|
|
* @param peer the peer to receive from
|
2004-08-03 01:24:00 +04:00
|
|
|
* @retval true if the whole message was received
|
|
|
|
* @retval false if the whole message was not received
|
2004-07-15 17:51:40 +04:00
|
|
|
*/
|
2004-07-15 23:08:54 +04:00
|
|
|
bool mca_oob_tcp_msg_recv_handler(mca_oob_tcp_msg_t* msg, struct mca_oob_tcp_peer_t * peer)
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
{
|
|
|
|
/* has entire header been received */
|
|
|
|
if(msg->msg_rwptr == msg->msg_rwiov) {
|
|
|
|
if(mca_oob_tcp_msg_recv(msg, peer) == false)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/* allocate a buffer for the receive */
|
|
|
|
MCA_OOB_TCP_HDR_NTOH(&msg->msg_hdr);
|
|
|
|
if(msg->msg_hdr.msg_size > 0) {
|
|
|
|
msg->msg_rwbuf = malloc(msg->msg_hdr.msg_size);
|
|
|
|
if(NULL == msg->msg_rwbuf) {
|
2007-07-20 06:34:29 +04:00
|
|
|
opal_output(0, "%s-%s mca_oob_tcp_msg_recv_handler: malloc(%d) failed\n",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2007-07-20 06:34:29 +04:00
|
|
|
ORTE_NAME_PRINT(&(peer->peer_name)),
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
msg->msg_hdr.msg_size);
|
|
|
|
mca_oob_tcp_peer_close(peer);
|
|
|
|
return false;
|
|
|
|
}
|
2005-01-26 03:20:35 +03:00
|
|
|
msg->msg_rwiov[1].iov_base = (ompi_iov_base_ptr_t)msg->msg_rwbuf;
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
msg->msg_rwiov[1].iov_len = msg->msg_hdr.msg_size;
|
|
|
|
msg->msg_rwnum = 1;
|
2005-03-14 23:57:21 +03:00
|
|
|
} else {
|
|
|
|
msg->msg_rwiov[1].iov_base = NULL;
|
|
|
|
msg->msg_rwiov[1].iov_len = 0;
|
|
|
|
msg->msg_rwnum = 0;
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
}
|
2007-04-25 23:08:07 +04:00
|
|
|
if (mca_oob_tcp_component.tcp_debug >= OOB_TCP_DEBUG_INFO) {
|
These changes were mostly captured in a prior RFC (except for #2 below) and are aimed specifically at improving startup performance and setting up the remaining modifications described in that RFC.
The commit has been tested for C/R and Cray operations, and on Odin (SLURM, rsh) and RoadRunner (TM). I tried to update all environments, but obviously could not test them. I know that Windows needs some work, and have highlighted what is know to be needed in the odls process component.
This represents a lot of work by Brian, Tim P, Josh, and myself, with much advice from Jeff and others. For posterity, I have appended a copy of the email describing the work that was done:
As we have repeatedly noted, the modex operation in MPI_Init is the single greatest consumer of time during startup. To-date, we have executed that operation as an ORTE stage gate that held the process until a startup message containing all required modex (and OOB contact info - see #3 below) info could be sent to it. Each process would send its data to the HNP's registry, which assembled and sent the message when all processes had reported in.
In addition, ORTE had taken responsibility for monitoring process status as it progressed through a series of "stage gates". The process reported its status at each gate, and ORTE would then send a "release" message once all procs had reported in.
The incoming changes revamp these procedures in three ways:
1. eliminating the ORTE stage gate system and cleanly delineating responsibility between the OMPI and ORTE layers for MPI init/finalize. The modex stage gate (STG1) has been replaced by a collective operation in the modex itself that performs an allgather on the required modex info. The allgather is implemented using the orte_grpcomm framework since the BTL's are not active at that point. At the moment, the grpcomm framework only has a "basic" component analogous to OMPI's "basic" coll framework - I would recommend that the MPI team create additional, more advanced components to improve performance of this step.
The other stage gates have been replaced by orte_grpcomm barrier functions. We tried to use MPI barriers instead (since the BTL's are active at that point), but - as we discussed on the telecon - these are not currently true barriers so the job would hang when we fell through while messages were still in process. Note that the grpcomm barrier doesn't actually resolve that problem, but Brian has pointed out that we are unlikely to ever see it violated. Again, you might want to spend a little time on an advanced barrier algorithm as the one in "basic" is very simplistic.
Summarizing this change: ORTE no longer tracks process state nor has direct responsibility for synchronizing jobs. This is now done via collective operations within the MPI layer, albeit using ORTE collective communication services. I -strongly- urge the MPI team to implement advanced collective algorithms to improve the performance of this critical procedure.
2. reducing the volume of data exchanged during modex. Data in the modex consisted of the process name, the name of the node where that process is located (expressed as a string), plus a string representation of all contact info. The nodename was required in order for the modex to determine if the process was local or not - in addition, some people like to have it to print pretty error messages when a connection failed.
The size of this data has been reduced in three ways:
(a) reducing the size of the process name itself. The process name consisted of two 32-bit fields for the jobid and vpid. This is far larger than any current system, or system likely to exist in the near future, can support. Accordingly, the default size of these fields has been reduced to 16-bits, which means you can have 32k procs in each of 32k jobs. Since the daemons must have a vpid, and we require one daemon/node, this also restricts the default configuration to 32k nodes.
To support any future "mega-clusters", a configuration option --enable-jumbo-apps has been added. This option increases the jobid and vpid field sizes to 32-bits. Someday, if necessary, someone can add yet another option to increase them to 64-bits, I suppose.
(b) replacing the string nodename with an integer nodeid. Since we have one daemon/node, the nodeid corresponds to the local daemon's vpid. This replaces an often lengthy string with only 2 (or at most 4) bytes, a substantial reduction.
(c) when the mca param requesting that nodenames be sent to support pretty error messages, a second mca param is now used to request FQDN - otherwise, the domain name is stripped (by default) from the message to save space. If someone wants to combine those into a single param somehow (perhaps with an argument?), they are welcome to do so - I didn't want to alter what people are already using.
While these may seem like small savings, they actually amount to a significant impact when aggregated across the entire modex operation. Since every proc must receive the modex data regardless of the collective used to send it, just reducing the size of the process name removes nearly 400MBytes of communication from a 32k proc job (admittedly, much of this comm may occur in parallel). So it does add up pretty quickly.
3. routing RML messages to reduce connections. The default messaging system remains point-to-point - i.e., each proc opens a socket to every proc it communicates with and sends its messages directly. A new option uses the orteds as routers - i.e., each proc only opens a single socket to its local orted. All messages are sent from the proc to the orted, which forwards the message to the orted on the node where the intended recipient proc is located - that orted then forwards the message to its local proc (the recipient). This greatly reduces the connection storm we have encountered during startup.
It also has the benefit of removing the sharing of every proc's OOB contact with every other proc. The orted routing tables are populated during launch since every orted gets a map of where every proc is being placed. Each proc, therefore, only needs to know the contact info for its local daemon, which is passed in via the environment when the proc is fork/exec'd by the daemon. This alone removes ~50 bytes/process of communication that was in the current STG1 startup message - so for our 32k proc job, this saves us roughly 32k*50 = 1.6MBytes sent to 32k procs = 51GBytes of messaging.
Note that you can use the new routing method by specifying -mca routed tree - if you so desire. This mode will become the default at some point in the future.
There are a few minor additional changes in the commit that I'll just note in passing:
* propagation of command line mca params to the orteds - fixes ticket #1073. See note there for details.
* requiring of "finalize" prior to "exit" for MPI procs - fixes ticket #1144. See note there for details.
* cleanup of some stale header files
This commit was SVN r16364.
2007-10-05 23:48:23 +04:00
|
|
|
opal_output(0, "%s-%s (origin: %s) mca_oob_tcp_msg_recv_handler: size %lu\n",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2007-07-20 06:34:29 +04:00
|
|
|
ORTE_NAME_PRINT(&(peer->peer_name)),
|
These changes were mostly captured in a prior RFC (except for #2 below) and are aimed specifically at improving startup performance and setting up the remaining modifications described in that RFC.
The commit has been tested for C/R and Cray operations, and on Odin (SLURM, rsh) and RoadRunner (TM). I tried to update all environments, but obviously could not test them. I know that Windows needs some work, and have highlighted what is know to be needed in the odls process component.
This represents a lot of work by Brian, Tim P, Josh, and myself, with much advice from Jeff and others. For posterity, I have appended a copy of the email describing the work that was done:
As we have repeatedly noted, the modex operation in MPI_Init is the single greatest consumer of time during startup. To-date, we have executed that operation as an ORTE stage gate that held the process until a startup message containing all required modex (and OOB contact info - see #3 below) info could be sent to it. Each process would send its data to the HNP's registry, which assembled and sent the message when all processes had reported in.
In addition, ORTE had taken responsibility for monitoring process status as it progressed through a series of "stage gates". The process reported its status at each gate, and ORTE would then send a "release" message once all procs had reported in.
The incoming changes revamp these procedures in three ways:
1. eliminating the ORTE stage gate system and cleanly delineating responsibility between the OMPI and ORTE layers for MPI init/finalize. The modex stage gate (STG1) has been replaced by a collective operation in the modex itself that performs an allgather on the required modex info. The allgather is implemented using the orte_grpcomm framework since the BTL's are not active at that point. At the moment, the grpcomm framework only has a "basic" component analogous to OMPI's "basic" coll framework - I would recommend that the MPI team create additional, more advanced components to improve performance of this step.
The other stage gates have been replaced by orte_grpcomm barrier functions. We tried to use MPI barriers instead (since the BTL's are active at that point), but - as we discussed on the telecon - these are not currently true barriers so the job would hang when we fell through while messages were still in process. Note that the grpcomm barrier doesn't actually resolve that problem, but Brian has pointed out that we are unlikely to ever see it violated. Again, you might want to spend a little time on an advanced barrier algorithm as the one in "basic" is very simplistic.
Summarizing this change: ORTE no longer tracks process state nor has direct responsibility for synchronizing jobs. This is now done via collective operations within the MPI layer, albeit using ORTE collective communication services. I -strongly- urge the MPI team to implement advanced collective algorithms to improve the performance of this critical procedure.
2. reducing the volume of data exchanged during modex. Data in the modex consisted of the process name, the name of the node where that process is located (expressed as a string), plus a string representation of all contact info. The nodename was required in order for the modex to determine if the process was local or not - in addition, some people like to have it to print pretty error messages when a connection failed.
The size of this data has been reduced in three ways:
(a) reducing the size of the process name itself. The process name consisted of two 32-bit fields for the jobid and vpid. This is far larger than any current system, or system likely to exist in the near future, can support. Accordingly, the default size of these fields has been reduced to 16-bits, which means you can have 32k procs in each of 32k jobs. Since the daemons must have a vpid, and we require one daemon/node, this also restricts the default configuration to 32k nodes.
To support any future "mega-clusters", a configuration option --enable-jumbo-apps has been added. This option increases the jobid and vpid field sizes to 32-bits. Someday, if necessary, someone can add yet another option to increase them to 64-bits, I suppose.
(b) replacing the string nodename with an integer nodeid. Since we have one daemon/node, the nodeid corresponds to the local daemon's vpid. This replaces an often lengthy string with only 2 (or at most 4) bytes, a substantial reduction.
(c) when the mca param requesting that nodenames be sent to support pretty error messages, a second mca param is now used to request FQDN - otherwise, the domain name is stripped (by default) from the message to save space. If someone wants to combine those into a single param somehow (perhaps with an argument?), they are welcome to do so - I didn't want to alter what people are already using.
While these may seem like small savings, they actually amount to a significant impact when aggregated across the entire modex operation. Since every proc must receive the modex data regardless of the collective used to send it, just reducing the size of the process name removes nearly 400MBytes of communication from a 32k proc job (admittedly, much of this comm may occur in parallel). So it does add up pretty quickly.
3. routing RML messages to reduce connections. The default messaging system remains point-to-point - i.e., each proc opens a socket to every proc it communicates with and sends its messages directly. A new option uses the orteds as routers - i.e., each proc only opens a single socket to its local orted. All messages are sent from the proc to the orted, which forwards the message to the orted on the node where the intended recipient proc is located - that orted then forwards the message to its local proc (the recipient). This greatly reduces the connection storm we have encountered during startup.
It also has the benefit of removing the sharing of every proc's OOB contact with every other proc. The orted routing tables are populated during launch since every orted gets a map of where every proc is being placed. Each proc, therefore, only needs to know the contact info for its local daemon, which is passed in via the environment when the proc is fork/exec'd by the daemon. This alone removes ~50 bytes/process of communication that was in the current STG1 startup message - so for our 32k proc job, this saves us roughly 32k*50 = 1.6MBytes sent to 32k procs = 51GBytes of messaging.
Note that you can use the new routing method by specifying -mca routed tree - if you so desire. This mode will become the default at some point in the future.
There are a few minor additional changes in the commit that I'll just note in passing:
* propagation of command line mca params to the orteds - fixes ticket #1073. See note there for details.
* requiring of "finalize" prior to "exit" for MPI procs - fixes ticket #1144. See note there for details.
* cleanup of some stale header files
This commit was SVN r16364.
2007-10-05 23:48:23 +04:00
|
|
|
ORTE_NAME_PRINT(&(msg->msg_hdr.msg_origin)),
|
2007-04-12 09:01:29 +04:00
|
|
|
(unsigned long)(msg->msg_hdr.msg_size) );
|
|
|
|
}
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* do the right thing based on the message type */
|
|
|
|
switch(msg->msg_hdr.msg_type) {
|
|
|
|
case MCA_OOB_TCP_IDENT:
|
|
|
|
/* done - there is nothing else to receive */
|
|
|
|
return true;
|
2004-09-08 21:02:24 +04:00
|
|
|
case MCA_OOB_TCP_PING:
|
|
|
|
/* done - there is nothing else to receive */
|
|
|
|
return true;
|
|
|
|
case MCA_OOB_TCP_DATA:
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
/* finish receiving message */
|
|
|
|
return mca_oob_tcp_msg_recv(msg, peer);
|
|
|
|
default:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Process the current iovec
|
|
|
|
*/
|
|
|
|
|
|
|
|
static bool mca_oob_tcp_msg_recv(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* peer)
|
2004-07-15 17:51:40 +04:00
|
|
|
{
|
|
|
|
int rc;
|
2005-03-14 23:57:21 +03:00
|
|
|
while(msg->msg_rwnum) {
|
2004-08-03 01:24:00 +04:00
|
|
|
rc = readv(peer->peer_sd, msg->msg_rwptr, msg->msg_rwnum);
|
2004-08-28 05:15:19 +04:00
|
|
|
if(rc < 0) {
|
2006-08-15 00:14:44 +04:00
|
|
|
if(opal_socket_errno == EINTR)
|
2004-07-15 17:51:40 +04:00
|
|
|
continue;
|
2005-01-20 03:40:22 +03:00
|
|
|
/* In windows, many of the socket functions return an EWOULDBLOCK instead of \
|
|
|
|
things like EAGAIN, EINPROGRESS, etc. It has been verified that this will \
|
|
|
|
not conflict with other error codes that are returned by these functions \
|
|
|
|
under UNIX/Linux environments */
|
2006-08-15 00:14:44 +04:00
|
|
|
else if (opal_socket_errno == EAGAIN || opal_socket_errno == EWOULDBLOCK)
|
2004-07-15 17:51:40 +04:00
|
|
|
return false;
|
2007-07-20 06:34:29 +04:00
|
|
|
opal_output(0, "%s-%s mca_oob_tcp_msg_recv: readv failed: %s (%d)",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2007-07-20 06:34:29 +04:00
|
|
|
ORTE_NAME_PRINT(&(peer->peer_name)),
|
2007-04-12 09:01:29 +04:00
|
|
|
strerror(opal_socket_errno),
|
|
|
|
opal_socket_errno);
|
|
|
|
mca_oob_tcp_peer_close(peer);
|
2007-07-20 05:34:02 +04:00
|
|
|
if (NULL != mca_oob_tcp.oob_exception_callback) {
|
|
|
|
mca_oob_tcp.oob_exception_callback(&peer->peer_name, ORTE_RML_PEER_DISCONNECTED);
|
|
|
|
}
|
2007-04-12 09:01:29 +04:00
|
|
|
return false;
|
2004-08-28 05:15:19 +04:00
|
|
|
} else if (rc == 0) {
|
Fix a number of OOB issues:
* Remove the connect() timeout code, as it had some nasty race conditions
when connections were established as the trigger was firing. A better
solution has been found for the cluster where this was needed, so just
removing it was easiest.
* When a fatal error (too many connection failures) occurs, set an error
on messages in the queue even if there isn't an active message. The
first message to any peer will be queued without being active (and
so will all subsequent messages until the connection is established),
and the orteds will hang until that first message completes. So if
an orted can never contact it's peer, it will never exit and just sit
waiting for that message to complete.
* Cover an interesting RST condition in the connect code. A connection
can complete the three-way handshake, the connector can even send
some data, but the server side will drop the connection because it
can't move it from the half-connected to fully-connected state because
of space shortage in the listen backlog queue. This causes a RST to
be received first time that recv() is called, which will be when waiting
for the remote side of the OOB ack. In this case, transition the
connection back into a CLOSED state and try to connect again.
* Add levels of debugging, rather than all or nothing, each building on
the previous level. 0 (default) is hard errors. 1 is connection
error debugging info. 2 is all connection info. 3 is more state
info. 4 includes all message info.
* Add some hopefully useful comments
This commit was SVN r14261.
2007-04-08 02:33:30 +04:00
|
|
|
if(mca_oob_tcp_component.tcp_debug >= OOB_TCP_DEBUG_CONNECT_FAIL) {
|
2007-07-20 06:34:29 +04:00
|
|
|
opal_output(0, "%s-%s mca_oob_tcp_msg_recv: peer closed connection",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2007-07-20 06:34:29 +04:00
|
|
|
ORTE_NAME_PRINT(&(peer->peer_name)));
|
2004-09-08 21:02:24 +04:00
|
|
|
}
|
2004-08-28 05:15:19 +04:00
|
|
|
mca_oob_tcp_peer_close(peer);
|
2007-07-20 05:34:02 +04:00
|
|
|
if (NULL != mca_oob_tcp.oob_exception_callback) {
|
|
|
|
mca_oob_tcp.oob_exception_callback(&peer->peer_name, ORTE_RML_PEER_DISCONNECTED);
|
|
|
|
}
|
2004-08-28 05:15:19 +04:00
|
|
|
return false;
|
2004-07-15 17:51:40 +04:00
|
|
|
}
|
2004-08-03 01:24:00 +04:00
|
|
|
|
2004-07-15 17:51:40 +04:00
|
|
|
do {
|
2004-11-20 22:12:43 +03:00
|
|
|
if(rc < (int)msg->msg_rwptr->iov_len) {
|
2004-07-15 17:51:40 +04:00
|
|
|
msg->msg_rwptr->iov_len -= rc;
|
2005-01-26 03:20:35 +03:00
|
|
|
msg->msg_rwptr->iov_base = (ompi_iov_base_ptr_t)((char *) msg->msg_rwptr->iov_base + rc);
|
2004-07-15 17:51:40 +04:00
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
rc -= msg->msg_rwptr->iov_len;
|
2004-08-03 01:24:00 +04:00
|
|
|
(msg->msg_rwnum)--;
|
2004-07-15 17:51:40 +04:00
|
|
|
(msg->msg_rwptr)++;
|
2004-08-03 01:24:00 +04:00
|
|
|
if(0 == msg->msg_rwnum) {
|
2007-04-12 09:01:29 +04:00
|
|
|
assert( 0 == rc );
|
2004-07-15 17:51:40 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2007-04-12 09:01:29 +04:00
|
|
|
} while(1);
|
2004-08-03 01:24:00 +04:00
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
return true;
|
2004-08-03 01:24:00 +04:00
|
|
|
}
|
|
|
|
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
/**
|
|
|
|
* Process a completed message.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void mca_oob_tcp_msg_recv_complete(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* peer)
|
|
|
|
{
|
|
|
|
switch(msg->msg_hdr.msg_type) {
|
|
|
|
case MCA_OOB_TCP_IDENT:
|
|
|
|
mca_oob_tcp_msg_ident(msg,peer);
|
|
|
|
break;
|
2004-09-08 21:02:24 +04:00
|
|
|
case MCA_OOB_TCP_PING:
|
|
|
|
mca_oob_tcp_msg_ping(msg,peer);
|
|
|
|
break;
|
|
|
|
case MCA_OOB_TCP_DATA:
|
|
|
|
mca_oob_tcp_msg_data(msg,peer);
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
break;
|
|
|
|
default:
|
2007-07-20 06:34:29 +04:00
|
|
|
opal_output(0, "%s mca_oob_tcp_msg_recv_complete: invalid message type: %d from peer %s\n",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), msg->msg_hdr.msg_type,
|
2007-07-20 06:34:29 +04:00
|
|
|
ORTE_NAME_PRINT(&peer->peer_name));
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
Bring over the update to terminate orteds that are generated by a dynamic spawn such as comm_spawn. This introduces the concept of a job "family" - i.e., jobs that have a parent/child relationship. Comm_spawn'ed jobs have a parent (the one that spawned them). We track that relationship throughout the lineage - i.e., if a comm_spawned job in turn calls comm_spawn, then it has a parent (the one that spawned it) and a "root" job (the original job that started things).
Accordingly, there are new APIs to the name service to support the ability to get a job's parent, root, immediate children, and all its descendants. In addition, the terminate_job, terminate_orted, and signal_job APIs for the PLS have been modified to accept attributes that define the extent of their actions. For example, doing a "terminate_job" with an attribute of ORTE_NS_INCLUDE_DESCENDANTS will terminate the given jobid AND all jobs that descended from it.
I have tested this capability on a MacBook under rsh, Odin under SLURM, and LANL's Flash (bproc). It worked successfully on non-MPI jobs (both simple and including a spawn), and MPI jobs (again, both simple and with a spawn).
This commit was SVN r12597.
2006-11-14 22:34:59 +03:00
|
|
|
* Process an ident message. In this case, we insist that the two process names
|
|
|
|
* exactly match - hence, we use the orte_ns.compare_fields function, which
|
|
|
|
* checks each field in a literal manner (i.e., no wildcards).
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_oob_tcp_msg_ident(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* peer)
|
|
|
|
{
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_process_name_t src = msg->msg_hdr.msg_src;
|
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
2008-02-28 04:57:57 +03:00
|
|
|
if (orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &peer->peer_name, &src) != OPAL_EQUAL) {
|
2008-03-06 01:44:35 +03:00
|
|
|
opal_hash_table_remove_value_uint64(&mca_oob_tcp_component.tcp_peers,
|
|
|
|
orte_util_hash_name(&peer->peer_name));
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
peer->peer_name = src;
|
2008-03-06 01:44:35 +03:00
|
|
|
opal_hash_table_set_value_uint64(&mca_oob_tcp_component.tcp_peers,
|
|
|
|
orte_util_hash_name(&peer->peer_name), peer);
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
}
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
}
|
|
|
|
|
2004-09-08 21:02:24 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Process a ping message.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_oob_tcp_msg_ping(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* peer)
|
|
|
|
{
|
|
|
|
/* for now - we dont do anything - may want to send back a response at some poing */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
/*
|
|
|
|
* Progress a completed recv:
|
|
|
|
* (1) signal a posted recv as complete
|
|
|
|
* (2) queue an unexpected message in the recv list
|
|
|
|
*/
|
|
|
|
|
2004-09-08 21:02:24 +04:00
|
|
|
static void mca_oob_tcp_msg_data(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* peer)
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
{
|
|
|
|
/* attempt to match unexpected message to a posted recv */
|
|
|
|
mca_oob_tcp_msg_t* post;
|
2008-02-28 04:57:57 +03:00
|
|
|
int rc;
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-11-20 22:12:43 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_JOB_FAMILY(msg->msg_hdr.msg_origin.jobid) !=
|
|
|
|
ORTE_JOB_FAMILY(ORTE_PROC_MY_NAME->jobid)) {
|
|
|
|
/* this message came from a different job family, so we may
|
|
|
|
* not know how to route any reply back to the originator. Update
|
|
|
|
* our route so we can dynamically build the routing table
|
|
|
|
*/
|
|
|
|
/* if the origin and the src are the same, then we don't need to do
|
|
|
|
* this - update_route was already called when the connection was
|
|
|
|
* established in oob_tcp_peer
|
|
|
|
*/
|
|
|
|
if (OPAL_EQUAL != orte_util_compare_name_fields(ORTE_NS_CMP_ALL,
|
|
|
|
&(msg->msg_hdr.msg_origin),
|
|
|
|
&(msg->msg_hdr.msg_src))) {
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_routed.update_route(&(msg->msg_hdr.msg_origin),
|
|
|
|
&(msg->msg_hdr.msg_src)))) {
|
|
|
|
/* Nothing we can do about errors here as we definitely want
|
|
|
|
* the receive to complete, but at least bark loudly
|
|
|
|
*/
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-21 02:06:11 +04:00
|
|
|
/* match msg against posted receives */
|
These changes were mostly captured in a prior RFC (except for #2 below) and are aimed specifically at improving startup performance and setting up the remaining modifications described in that RFC.
The commit has been tested for C/R and Cray operations, and on Odin (SLURM, rsh) and RoadRunner (TM). I tried to update all environments, but obviously could not test them. I know that Windows needs some work, and have highlighted what is know to be needed in the odls process component.
This represents a lot of work by Brian, Tim P, Josh, and myself, with much advice from Jeff and others. For posterity, I have appended a copy of the email describing the work that was done:
As we have repeatedly noted, the modex operation in MPI_Init is the single greatest consumer of time during startup. To-date, we have executed that operation as an ORTE stage gate that held the process until a startup message containing all required modex (and OOB contact info - see #3 below) info could be sent to it. Each process would send its data to the HNP's registry, which assembled and sent the message when all processes had reported in.
In addition, ORTE had taken responsibility for monitoring process status as it progressed through a series of "stage gates". The process reported its status at each gate, and ORTE would then send a "release" message once all procs had reported in.
The incoming changes revamp these procedures in three ways:
1. eliminating the ORTE stage gate system and cleanly delineating responsibility between the OMPI and ORTE layers for MPI init/finalize. The modex stage gate (STG1) has been replaced by a collective operation in the modex itself that performs an allgather on the required modex info. The allgather is implemented using the orte_grpcomm framework since the BTL's are not active at that point. At the moment, the grpcomm framework only has a "basic" component analogous to OMPI's "basic" coll framework - I would recommend that the MPI team create additional, more advanced components to improve performance of this step.
The other stage gates have been replaced by orte_grpcomm barrier functions. We tried to use MPI barriers instead (since the BTL's are active at that point), but - as we discussed on the telecon - these are not currently true barriers so the job would hang when we fell through while messages were still in process. Note that the grpcomm barrier doesn't actually resolve that problem, but Brian has pointed out that we are unlikely to ever see it violated. Again, you might want to spend a little time on an advanced barrier algorithm as the one in "basic" is very simplistic.
Summarizing this change: ORTE no longer tracks process state nor has direct responsibility for synchronizing jobs. This is now done via collective operations within the MPI layer, albeit using ORTE collective communication services. I -strongly- urge the MPI team to implement advanced collective algorithms to improve the performance of this critical procedure.
2. reducing the volume of data exchanged during modex. Data in the modex consisted of the process name, the name of the node where that process is located (expressed as a string), plus a string representation of all contact info. The nodename was required in order for the modex to determine if the process was local or not - in addition, some people like to have it to print pretty error messages when a connection failed.
The size of this data has been reduced in three ways:
(a) reducing the size of the process name itself. The process name consisted of two 32-bit fields for the jobid and vpid. This is far larger than any current system, or system likely to exist in the near future, can support. Accordingly, the default size of these fields has been reduced to 16-bits, which means you can have 32k procs in each of 32k jobs. Since the daemons must have a vpid, and we require one daemon/node, this also restricts the default configuration to 32k nodes.
To support any future "mega-clusters", a configuration option --enable-jumbo-apps has been added. This option increases the jobid and vpid field sizes to 32-bits. Someday, if necessary, someone can add yet another option to increase them to 64-bits, I suppose.
(b) replacing the string nodename with an integer nodeid. Since we have one daemon/node, the nodeid corresponds to the local daemon's vpid. This replaces an often lengthy string with only 2 (or at most 4) bytes, a substantial reduction.
(c) when the mca param requesting that nodenames be sent to support pretty error messages, a second mca param is now used to request FQDN - otherwise, the domain name is stripped (by default) from the message to save space. If someone wants to combine those into a single param somehow (perhaps with an argument?), they are welcome to do so - I didn't want to alter what people are already using.
While these may seem like small savings, they actually amount to a significant impact when aggregated across the entire modex operation. Since every proc must receive the modex data regardless of the collective used to send it, just reducing the size of the process name removes nearly 400MBytes of communication from a 32k proc job (admittedly, much of this comm may occur in parallel). So it does add up pretty quickly.
3. routing RML messages to reduce connections. The default messaging system remains point-to-point - i.e., each proc opens a socket to every proc it communicates with and sends its messages directly. A new option uses the orteds as routers - i.e., each proc only opens a single socket to its local orted. All messages are sent from the proc to the orted, which forwards the message to the orted on the node where the intended recipient proc is located - that orted then forwards the message to its local proc (the recipient). This greatly reduces the connection storm we have encountered during startup.
It also has the benefit of removing the sharing of every proc's OOB contact with every other proc. The orted routing tables are populated during launch since every orted gets a map of where every proc is being placed. Each proc, therefore, only needs to know the contact info for its local daemon, which is passed in via the environment when the proc is fork/exec'd by the daemon. This alone removes ~50 bytes/process of communication that was in the current STG1 startup message - so for our 32k proc job, this saves us roughly 32k*50 = 1.6MBytes sent to 32k procs = 51GBytes of messaging.
Note that you can use the new routing method by specifying -mca routed tree - if you so desire. This mode will become the default at some point in the future.
There are a few minor additional changes in the commit that I'll just note in passing:
* propagation of command line mca params to the orteds - fixes ticket #1073. See note there for details.
* requiring of "finalize" prior to "exit" for MPI procs - fixes ticket #1144. See note there for details.
* cleanup of some stale header files
This commit was SVN r16364.
2007-10-05 23:48:23 +04:00
|
|
|
post = mca_oob_tcp_msg_match_post(&msg->msg_hdr.msg_origin, msg->msg_hdr.msg_tag);
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
if(NULL != post) {
|
2005-10-21 02:06:11 +04:00
|
|
|
|
2007-07-20 05:34:02 +04:00
|
|
|
if(NULL == post->msg_uiov || 0 == post->msg_ucnt) {
|
|
|
|
opal_output(0, "msg_data returning bad param");
|
|
|
|
post->msg_rc = ORTE_ERR_BAD_PARAM;
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
} else {
|
|
|
|
/* copy msg data into posted recv */
|
2007-07-20 05:34:02 +04:00
|
|
|
if (post->msg_flags & ORTE_RML_ALLOC) msg->msg_flags |= ORTE_RML_ALLOC;
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
post->msg_rc = mca_oob_tcp_msg_copy(msg, post->msg_uiov, post->msg_ucnt);
|
2007-07-20 05:34:02 +04:00
|
|
|
if(post->msg_flags & ORTE_RML_TRUNC) {
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
int i, size = 0;
|
|
|
|
for(i=1; i<msg->msg_rwcnt+1; i++)
|
|
|
|
size += msg->msg_rwiov[i].iov_len;
|
|
|
|
post->msg_rc = size;
|
|
|
|
}
|
|
|
|
}
|
2005-10-21 02:06:11 +04:00
|
|
|
|
2007-07-20 05:34:02 +04:00
|
|
|
if(post->msg_flags & ORTE_RML_PEEK) {
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
/* will need message for actual receive */
|
2006-07-18 01:51:50 +04:00
|
|
|
opal_list_append(&mca_oob_tcp_component.tcp_msg_recv, &msg->super.super);
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
} else {
|
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
|
|
|
}
|
2004-09-30 19:09:29 +04:00
|
|
|
mca_oob_tcp_component.tcp_match_count++;
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-09-30 19:09:29 +04:00
|
|
|
|
2007-07-20 05:34:02 +04:00
|
|
|
if(post->msg_flags & ORTE_RML_PERSISTENT) {
|
2005-10-21 02:06:11 +04:00
|
|
|
post->msg_cbfunc(
|
|
|
|
post->msg_rc,
|
|
|
|
&peer->peer_name,
|
|
|
|
post->msg_uiov,
|
|
|
|
post->msg_ucnt,
|
|
|
|
post->msg_hdr.msg_tag,
|
|
|
|
post->msg_cbdata);
|
|
|
|
} else {
|
These changes were mostly captured in a prior RFC (except for #2 below) and are aimed specifically at improving startup performance and setting up the remaining modifications described in that RFC.
The commit has been tested for C/R and Cray operations, and on Odin (SLURM, rsh) and RoadRunner (TM). I tried to update all environments, but obviously could not test them. I know that Windows needs some work, and have highlighted what is know to be needed in the odls process component.
This represents a lot of work by Brian, Tim P, Josh, and myself, with much advice from Jeff and others. For posterity, I have appended a copy of the email describing the work that was done:
As we have repeatedly noted, the modex operation in MPI_Init is the single greatest consumer of time during startup. To-date, we have executed that operation as an ORTE stage gate that held the process until a startup message containing all required modex (and OOB contact info - see #3 below) info could be sent to it. Each process would send its data to the HNP's registry, which assembled and sent the message when all processes had reported in.
In addition, ORTE had taken responsibility for monitoring process status as it progressed through a series of "stage gates". The process reported its status at each gate, and ORTE would then send a "release" message once all procs had reported in.
The incoming changes revamp these procedures in three ways:
1. eliminating the ORTE stage gate system and cleanly delineating responsibility between the OMPI and ORTE layers for MPI init/finalize. The modex stage gate (STG1) has been replaced by a collective operation in the modex itself that performs an allgather on the required modex info. The allgather is implemented using the orte_grpcomm framework since the BTL's are not active at that point. At the moment, the grpcomm framework only has a "basic" component analogous to OMPI's "basic" coll framework - I would recommend that the MPI team create additional, more advanced components to improve performance of this step.
The other stage gates have been replaced by orte_grpcomm barrier functions. We tried to use MPI barriers instead (since the BTL's are active at that point), but - as we discussed on the telecon - these are not currently true barriers so the job would hang when we fell through while messages were still in process. Note that the grpcomm barrier doesn't actually resolve that problem, but Brian has pointed out that we are unlikely to ever see it violated. Again, you might want to spend a little time on an advanced barrier algorithm as the one in "basic" is very simplistic.
Summarizing this change: ORTE no longer tracks process state nor has direct responsibility for synchronizing jobs. This is now done via collective operations within the MPI layer, albeit using ORTE collective communication services. I -strongly- urge the MPI team to implement advanced collective algorithms to improve the performance of this critical procedure.
2. reducing the volume of data exchanged during modex. Data in the modex consisted of the process name, the name of the node where that process is located (expressed as a string), plus a string representation of all contact info. The nodename was required in order for the modex to determine if the process was local or not - in addition, some people like to have it to print pretty error messages when a connection failed.
The size of this data has been reduced in three ways:
(a) reducing the size of the process name itself. The process name consisted of two 32-bit fields for the jobid and vpid. This is far larger than any current system, or system likely to exist in the near future, can support. Accordingly, the default size of these fields has been reduced to 16-bits, which means you can have 32k procs in each of 32k jobs. Since the daemons must have a vpid, and we require one daemon/node, this also restricts the default configuration to 32k nodes.
To support any future "mega-clusters", a configuration option --enable-jumbo-apps has been added. This option increases the jobid and vpid field sizes to 32-bits. Someday, if necessary, someone can add yet another option to increase them to 64-bits, I suppose.
(b) replacing the string nodename with an integer nodeid. Since we have one daemon/node, the nodeid corresponds to the local daemon's vpid. This replaces an often lengthy string with only 2 (or at most 4) bytes, a substantial reduction.
(c) when the mca param requesting that nodenames be sent to support pretty error messages, a second mca param is now used to request FQDN - otherwise, the domain name is stripped (by default) from the message to save space. If someone wants to combine those into a single param somehow (perhaps with an argument?), they are welcome to do so - I didn't want to alter what people are already using.
While these may seem like small savings, they actually amount to a significant impact when aggregated across the entire modex operation. Since every proc must receive the modex data regardless of the collective used to send it, just reducing the size of the process name removes nearly 400MBytes of communication from a 32k proc job (admittedly, much of this comm may occur in parallel). So it does add up pretty quickly.
3. routing RML messages to reduce connections. The default messaging system remains point-to-point - i.e., each proc opens a socket to every proc it communicates with and sends its messages directly. A new option uses the orteds as routers - i.e., each proc only opens a single socket to its local orted. All messages are sent from the proc to the orted, which forwards the message to the orted on the node where the intended recipient proc is located - that orted then forwards the message to its local proc (the recipient). This greatly reduces the connection storm we have encountered during startup.
It also has the benefit of removing the sharing of every proc's OOB contact with every other proc. The orted routing tables are populated during launch since every orted gets a map of where every proc is being placed. Each proc, therefore, only needs to know the contact info for its local daemon, which is passed in via the environment when the proc is fork/exec'd by the daemon. This alone removes ~50 bytes/process of communication that was in the current STG1 startup message - so for our 32k proc job, this saves us roughly 32k*50 = 1.6MBytes sent to 32k procs = 51GBytes of messaging.
Note that you can use the new routing method by specifying -mca routed tree - if you so desire. This mode will become the default at some point in the future.
There are a few minor additional changes in the commit that I'll just note in passing:
* propagation of command line mca params to the orteds - fixes ticket #1073. See note there for details.
* requiring of "finalize" prior to "exit" for MPI procs - fixes ticket #1144. See note there for details.
* cleanup of some stale header files
This commit was SVN r16364.
2007-10-05 23:48:23 +04:00
|
|
|
mca_oob_tcp_msg_complete(post, &msg->msg_hdr.msg_origin);
|
2005-10-21 02:06:11 +04:00
|
|
|
}
|
2004-09-30 19:09:29 +04:00
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-09-30 19:09:29 +04:00
|
|
|
if(--mca_oob_tcp_component.tcp_match_count == 0)
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_condition_signal(&mca_oob_tcp_component.tcp_match_cond);
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-09-30 19:09:29 +04:00
|
|
|
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
} else {
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&mca_oob_tcp_component.tcp_msg_recv, (opal_list_item_t*)msg);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-10 03:07:53 +04:00
|
|
|
/*
|
2004-08-03 01:24:00 +04:00
|
|
|
* Called to copy the results of a message into user supplied iovec array.
|
|
|
|
* @param msg (IN) Message send that is in progress.
|
|
|
|
* @param iov (IN) Iovec array of user supplied buffers.
|
|
|
|
* @retval count Number of elements in iovec array.
|
|
|
|
*/
|
|
|
|
|
2004-08-13 02:41:42 +04:00
|
|
|
int mca_oob_tcp_msg_copy(mca_oob_tcp_msg_t* msg, struct iovec* iov, int count)
|
2004-08-03 01:24:00 +04:00
|
|
|
{
|
2007-07-20 05:34:02 +04:00
|
|
|
int i, ret = 0;
|
|
|
|
unsigned char* src_ptr = (unsigned char*) msg->msg_rwbuf;
|
2006-04-27 18:27:02 +04:00
|
|
|
size_t src_len = msg->msg_hdr.msg_size;
|
2007-07-20 05:34:02 +04:00
|
|
|
|
|
|
|
for (i = 0 ; i < count ; i++) {
|
|
|
|
if ((msg->msg_flags & ORTE_RML_ALLOC) && (i == count - 1)) {
|
|
|
|
if (i == 0) {
|
2007-09-11 20:24:23 +04:00
|
|
|
iov[i].iov_base = (IOVBASE_TYPE *) src_ptr;
|
2007-07-20 05:34:02 +04:00
|
|
|
iov[i].iov_len = src_len;
|
|
|
|
msg->msg_rwbuf = NULL;
|
|
|
|
} else {
|
2007-09-11 20:24:23 +04:00
|
|
|
iov[i].iov_base = (IOVBASE_TYPE *) malloc(src_len);
|
2007-07-20 05:34:02 +04:00
|
|
|
iov[i].iov_len = src_len;
|
|
|
|
memcpy(iov[i].iov_base, src_ptr, src_len);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (iov[i].iov_len > src_len) {
|
|
|
|
memcpy(iov[i].iov_base, src_ptr, src_len);
|
|
|
|
iov[i].iov_len = src_len;
|
|
|
|
} else {
|
|
|
|
memcpy(iov[i].iov_base, src_ptr, iov[i].iov_len);
|
2004-08-03 01:24:00 +04:00
|
|
|
}
|
|
|
|
}
|
2007-07-20 05:34:02 +04:00
|
|
|
|
|
|
|
ret += iov[i].iov_len;
|
|
|
|
src_len -= iov[i].iov_len;
|
|
|
|
src_ptr += iov[i].iov_len;
|
|
|
|
|
|
|
|
if (0 == src_len) break;
|
2004-07-15 17:51:40 +04:00
|
|
|
}
|
2007-07-20 05:34:02 +04:00
|
|
|
|
|
|
|
return ret;
|
2004-07-15 17:51:40 +04:00
|
|
|
}
|
|
|
|
|
2004-08-10 03:07:53 +04:00
|
|
|
/*
|
2004-08-03 01:24:00 +04:00
|
|
|
* Match name to a message that has been received asynchronously (unexpected).
|
|
|
|
*
|
|
|
|
* @param name (IN) Name associated with peer or wildcard to match first posted recv.
|
|
|
|
* @return msg Matched message or NULL.
|
|
|
|
*
|
|
|
|
* Note - this routine requires the caller to be holding the module lock.
|
|
|
|
*/
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
mca_oob_tcp_msg_t* mca_oob_tcp_msg_match_recv(orte_process_name_t* name, int tag)
|
2004-08-03 01:24:00 +04:00
|
|
|
{
|
|
|
|
mca_oob_tcp_msg_t* msg;
|
2005-07-03 20:22:16 +04:00
|
|
|
for(msg = (mca_oob_tcp_msg_t*) opal_list_get_first(&mca_oob_tcp_component.tcp_msg_recv);
|
|
|
|
msg != (mca_oob_tcp_msg_t*) opal_list_get_end(&mca_oob_tcp_component.tcp_msg_recv);
|
|
|
|
msg = (mca_oob_tcp_msg_t*) opal_list_get_next(msg)) {
|
2004-08-03 01:24:00 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if(OPAL_EQUAL == opal_dss.compare(name, &msg->msg_hdr.msg_origin, ORTE_NAME)) {
|
2005-03-14 23:57:21 +03:00
|
|
|
if (tag == msg->msg_hdr.msg_tag) {
|
2004-08-03 01:24:00 +04:00
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-08-10 03:07:53 +04:00
|
|
|
/*
|
2004-08-03 01:24:00 +04:00
|
|
|
* Match name to a posted recv request.
|
|
|
|
*
|
|
|
|
* @param name (IN) Name associated with peer or wildcard to match first posted recv.
|
|
|
|
* @return msg Matched message or NULL.
|
|
|
|
*
|
|
|
|
* Note - this routine requires the caller to be holding the module lock.
|
|
|
|
*/
|
|
|
|
|
2005-03-22 03:31:17 +03:00
|
|
|
mca_oob_tcp_msg_t* mca_oob_tcp_msg_match_post(orte_process_name_t* name, int tag)
|
2004-08-03 01:24:00 +04:00
|
|
|
{
|
|
|
|
mca_oob_tcp_msg_t* msg;
|
2005-07-03 20:22:16 +04:00
|
|
|
for(msg = (mca_oob_tcp_msg_t*) opal_list_get_first(&mca_oob_tcp_component.tcp_msg_post);
|
|
|
|
msg != (mca_oob_tcp_msg_t*) opal_list_get_end(&mca_oob_tcp_component.tcp_msg_post);
|
|
|
|
msg = (mca_oob_tcp_msg_t*) opal_list_get_next(msg)) {
|
2004-08-03 01:24:00 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if(OPAL_EQUAL == opal_dss.compare(name, &msg->msg_peer, ORTE_NAME)) {
|
2005-03-14 23:57:21 +03:00
|
|
|
if (msg->msg_hdr.msg_tag == tag) {
|
2007-07-20 05:34:02 +04:00
|
|
|
if((msg->msg_flags & ORTE_RML_PERSISTENT) == 0) {
|
2006-07-18 01:51:50 +04:00
|
|
|
opal_list_remove_item(&mca_oob_tcp_component.tcp_msg_post, &msg->super.super);
|
2004-08-03 01:24:00 +04:00
|
|
|
}
|
2005-10-21 02:06:11 +04:00
|
|
|
return msg;
|
2004-08-03 01:24:00 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|