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.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
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-02-12 04:33:29 +03:00
|
|
|
#include "orte_config.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/mca/ns/ns_types.h"
|
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
|
|
|
#include "orte/util/proc_info.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/mca/oob/tcp/oob_tcp.h"
|
2004-07-01 18:49:54 +04:00
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
static int mca_oob_tcp_send_self(
|
|
|
|
mca_oob_tcp_peer_t* peer,
|
|
|
|
mca_oob_tcp_msg_t* msg,
|
|
|
|
struct iovec* iov,
|
|
|
|
int count)
|
|
|
|
{
|
|
|
|
unsigned char *ptr;
|
|
|
|
int size = 0;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
for(rc = 0; rc < count; rc++) {
|
|
|
|
size += iov[rc].iov_len;
|
|
|
|
}
|
|
|
|
msg->msg_rwbuf = malloc(size);
|
|
|
|
if(NULL == msg->msg_rwbuf) {
|
2006-02-12 04:33:29 +03:00
|
|
|
return ORTE_ERR_OUT_OF_RESOURCE;
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
2005-01-26 03:20:35 +03:00
|
|
|
ptr = (unsigned char *)msg->msg_rwbuf;
|
2004-11-20 22:12:43 +03:00
|
|
|
for(rc = 0; rc < count; rc++) {
|
|
|
|
memcpy(ptr, iov[rc].iov_base, iov[rc].iov_len);
|
|
|
|
ptr += iov[rc].iov_len;
|
|
|
|
}
|
|
|
|
msg->msg_hdr.msg_size = size;
|
2005-06-02 21:03:08 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copied original buffer - so local send completion.
|
|
|
|
*/
|
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_mutex_lock(&msg->msg_lock);
|
2005-06-02 21:03:08 +04:00
|
|
|
msg->msg_complete = true;
|
|
|
|
if(NULL != msg->msg_cbfunc) {
|
|
|
|
msg->msg_cbfunc(
|
|
|
|
ORTE_SUCCESS,
|
|
|
|
&peer->peer_name,
|
|
|
|
msg->msg_uiov,
|
|
|
|
msg->msg_ucnt,
|
|
|
|
msg->msg_hdr.msg_tag,
|
|
|
|
msg->msg_cbdata);
|
|
|
|
} else {
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_condition_broadcast(&msg->msg_condition);
|
2005-06-02 21:03:08 +04:00
|
|
|
}
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_mutex_unlock(&msg->msg_lock);
|
2005-06-02 21:03:08 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Attempt to match against posted receive
|
|
|
|
*/
|
2004-11-20 22:12:43 +03:00
|
|
|
mca_oob_tcp_msg_recv_complete(msg, peer);
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2004-07-01 18:49:54 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Non-blocking version of mca_oob_send().
|
|
|
|
*
|
|
|
|
* @param peer (IN) Opaque name of peer process.
|
|
|
|
* @param msg (IN) Array of iovecs describing user buffers and lengths.
|
|
|
|
* @param count (IN) Number of elements in iovec array.
|
|
|
|
* @param flags (IN) Currently unused.
|
|
|
|
* @param cbfunc (IN) Callback function on send completion.
|
|
|
|
* @param cbdata (IN) User data that is passed to callback function.
|
|
|
|
* @return OMPI error code (<0) on error number of bytes actually sent.
|
|
|
|
*
|
|
|
|
*/
|
2004-07-13 02:46:57 +04:00
|
|
|
int mca_oob_tcp_send_nb(
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_process_name_t* name,
|
2004-08-13 02:41:42 +04:00
|
|
|
struct iovec* iov,
|
2004-07-13 02:46:57 +04:00
|
|
|
int count,
|
2004-08-03 01:24:00 +04:00
|
|
|
int tag,
|
2004-07-13 02:46:57 +04:00
|
|
|
int flags,
|
2007-07-20 05:34:02 +04:00
|
|
|
orte_rml_callback_fn_t cbfunc,
|
2004-07-13 02:46:57 +04:00
|
|
|
void* cbdata)
|
2004-07-01 18:49:54 +04:00
|
|
|
{
|
2004-09-02 03:07:40 +04:00
|
|
|
mca_oob_tcp_peer_t* peer = mca_oob_tcp_peer_lookup(name);
|
2004-07-13 02:46:57 +04:00
|
|
|
mca_oob_tcp_msg_t* msg;
|
2004-08-03 01:24:00 +04:00
|
|
|
int size;
|
2004-07-13 02:46:57 +04:00
|
|
|
int rc;
|
2004-08-03 01:24:00 +04:00
|
|
|
|
2004-07-13 02:46:57 +04:00
|
|
|
if(NULL == peer)
|
2006-02-12 04:33:29 +03:00
|
|
|
return ORTE_ERR_UNREACH;
|
2004-07-13 02:46:57 +04:00
|
|
|
|
|
|
|
MCA_OOB_TCP_MSG_ALLOC(msg, rc);
|
2007-03-17 02:11:45 +03:00
|
|
|
if(NULL == msg) {
|
2004-07-13 02:46:57 +04:00
|
|
|
return rc;
|
2007-03-17 02:11:45 +03:00
|
|
|
}
|
2004-07-13 02:46:57 +04:00
|
|
|
|
2004-07-15 17:51:40 +04:00
|
|
|
/* calculate the size of the message */
|
2004-08-03 01:24:00 +04:00
|
|
|
size = 0;
|
2004-07-15 17:51:40 +04:00
|
|
|
for(rc = 0; rc < count; rc++) {
|
2004-08-03 01:24:00 +04:00
|
|
|
size += iov[rc].iov_len;
|
2004-07-15 17:51:40 +04:00
|
|
|
}
|
2007-04-12 09:01:29 +04:00
|
|
|
|
|
|
|
if(mca_oob_tcp_component.tcp_debug >= OOB_TCP_DEBUG_ALL) {
|
2007-07-20 05:10:34 +04:00
|
|
|
opal_output(0, "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_send_nb: tag %d size %lu\n",
|
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name),
|
|
|
|
ORTE_NAME_ARGS(&(peer->peer_name)),
|
2007-04-12 09:01:29 +04:00
|
|
|
tag, (unsigned long)size );
|
|
|
|
}
|
|
|
|
|
2004-07-15 17:51:40 +04:00
|
|
|
/* turn the size to network byte order so there will be no problems */
|
2004-09-08 21:02:24 +04:00
|
|
|
msg->msg_hdr.msg_type = MCA_OOB_TCP_DATA;
|
2004-09-02 03:07:40 +04:00
|
|
|
msg->msg_hdr.msg_size = size;
|
|
|
|
msg->msg_hdr.msg_tag = tag;
|
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
|
|
|
if (NULL == orte_process_info.my_name) {
|
|
|
|
msg->msg_hdr.msg_src = *ORTE_NAME_INVALID;
|
|
|
|
} else {
|
|
|
|
msg->msg_hdr.msg_src = *orte_process_info.my_name;
|
|
|
|
}
|
2004-09-02 03:07:40 +04:00
|
|
|
msg->msg_hdr.msg_dst = *name;
|
2004-07-15 17:51:40 +04:00
|
|
|
|
|
|
|
/* create one additional iovect that will hold the size of the message */
|
2004-08-03 01:24:00 +04:00
|
|
|
msg->msg_type = MCA_OOB_TCP_POSTED;
|
|
|
|
msg->msg_rc = 0;
|
|
|
|
msg->msg_flags = flags;
|
|
|
|
msg->msg_uiov = iov;
|
|
|
|
msg->msg_ucnt = count;
|
|
|
|
msg->msg_rwiov = mca_oob_tcp_msg_iov_alloc(msg,count+1);
|
2005-01-26 03:20:35 +03:00
|
|
|
msg->msg_rwiov[0].iov_base = (ompi_iov_base_ptr_t)(&msg->msg_hdr);
|
2004-08-03 01:24:00 +04:00
|
|
|
msg->msg_rwiov[0].iov_len = sizeof(msg->msg_hdr);
|
|
|
|
msg->msg_rwptr = msg->msg_rwiov;
|
|
|
|
msg->msg_rwcnt = msg->msg_rwnum = count + 1;
|
|
|
|
memcpy(msg->msg_rwiov+1, msg->msg_uiov, sizeof(struct iovec)*msg->msg_ucnt);
|
|
|
|
msg->msg_rwbuf = NULL;
|
2004-07-13 02:46:57 +04:00
|
|
|
msg->msg_cbfunc = cbfunc;
|
|
|
|
msg->msg_cbdata = cbdata;
|
|
|
|
msg->msg_complete = false;
|
2004-08-03 01:24:00 +04:00
|
|
|
msg->msg_peer = peer->peer_name;
|
2004-07-15 17:51:40 +04:00
|
|
|
|
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
|
|
|
if (ORTE_EQUAL == mca_oob_tcp_process_name_compare(name, orte_process_info.my_name)) { /* local delivery */
|
2007-03-17 02:11:45 +03:00
|
|
|
rc = mca_oob_tcp_send_self(peer,msg,iov,count);
|
2007-07-12 23:53:18 +04:00
|
|
|
if (rc < 0 ) {
|
|
|
|
return rc;
|
|
|
|
} else if (size == rc) {
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
} else {
|
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
2004-11-20 22:12:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MCA_OOB_TCP_HDR_HTON(&msg->msg_hdr);
|
2004-07-13 02:46:57 +04:00
|
|
|
rc = mca_oob_tcp_peer_send(peer, msg);
|
2006-02-12 04:33:29 +03:00
|
|
|
if(rc != ORTE_SUCCESS) {
|
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start.
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system.
Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed.
Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief.
With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn.
Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put".
This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
|
|
|
if (rc != ORTE_ERR_ADDRESSEE_UNKNOWN) {
|
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
|
|
|
}
|
2004-07-13 02:46:57 +04:00
|
|
|
return rc;
|
|
|
|
}
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
return ORTE_SUCCESS;
|
2004-07-01 18:49:54 +04:00
|
|
|
}
|
|
|
|
|