2004-08-25 21:39:08 +04:00
|
|
|
/*
|
2004-11-22 04:38:40 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* 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.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-08-25 21:39:08 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
2004-10-20 05:03:09 +04:00
|
|
|
#include "ompi_config.h"
|
2005-01-20 03:03:23 +03:00
|
|
|
#include "include/ompi_socket_errno.h"
|
2004-07-15 23:08:54 +04:00
|
|
|
#include "mca/oob/tcp/oob_tcp.h"
|
|
|
|
#include "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
|
|
|
|
2005-01-20 03:03:23 +03:00
|
|
|
#define IMPORTANT_WINDOWS_COMMENT() \
|
|
|
|
/* 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-07-13 02:46:57 +04:00
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(
|
|
|
|
mca_oob_tcp_msg_t,
|
|
|
|
ompi_list_item_t,
|
|
|
|
mca_oob_tcp_msg_construct,
|
|
|
|
mca_oob_tcp_msg_destruct);
|
|
|
|
|
|
|
|
|
|
|
|
static void mca_oob_tcp_msg_construct(mca_oob_tcp_msg_t* msg)
|
|
|
|
{
|
2004-07-15 17:51:40 +04:00
|
|
|
OBJ_CONSTRUCT(&msg->msg_lock, ompi_mutex_t);
|
|
|
|
OBJ_CONSTRUCT(&msg->msg_condition, ompi_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).
|
2004-07-13 02:46:57 +04:00
|
|
|
* @retval OMPI_SUCCESS or error code on failure.
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
{
|
2004-08-28 05:34:48 +04:00
|
|
|
#if OMPI_HAVE_THREADS
|
|
|
|
OMPI_THREAD_LOCK(&msg->msg_lock);
|
|
|
|
while(msg->msg_complete == false) {
|
|
|
|
if(ompi_event_progress_thread()) {
|
2004-08-31 06:57:39 +04:00
|
|
|
int rc;
|
2004-08-28 05:34:48 +04:00
|
|
|
OMPI_THREAD_UNLOCK(&msg->msg_lock);
|
2004-08-31 06:57:39 +04:00
|
|
|
rc = ompi_event_loop(OMPI_EVLOOP_ONCE);
|
2004-12-09 23:54:31 +03:00
|
|
|
assert(rc >= 0);
|
2004-08-28 05:34:48 +04:00
|
|
|
OMPI_THREAD_LOCK(&msg->msg_lock);
|
|
|
|
} else {
|
|
|
|
ompi_condition_wait(&msg->msg_condition, &msg->msg_lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OMPI_THREAD_UNLOCK(&msg->msg_lock);
|
|
|
|
|
|
|
|
#else
|
2004-08-03 01:24:00 +04:00
|
|
|
/* wait for message to complete */
|
2004-08-28 05:15:19 +04:00
|
|
|
while(msg->msg_complete == false)
|
|
|
|
ompi_event_loop(OMPI_EVLOOP_ONCE);
|
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;
|
|
|
|
}
|
|
|
|
return OMPI_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).
|
|
|
|
* @retval OMPI_SUCCESS or error code on failure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
#if OMPI_HAVE_THREADS
|
|
|
|
OMPI_THREAD_LOCK(&msg->msg_lock);
|
|
|
|
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))) {
|
2004-09-08 21:02:24 +04:00
|
|
|
if(ompi_event_progress_thread()) {
|
|
|
|
int rc;
|
|
|
|
OMPI_THREAD_UNLOCK(&msg->msg_lock);
|
|
|
|
rc = ompi_event_loop(OMPI_EVLOOP_ONCE);
|
2004-12-09 23:54:31 +03:00
|
|
|
assert(rc >= 0);
|
2004-09-08 21:02:24 +04:00
|
|
|
OMPI_THREAD_LOCK(&msg->msg_lock);
|
|
|
|
} else {
|
|
|
|
ompi_condition_timedwait(&msg->msg_condition, &msg->msg_lock, abstime);
|
|
|
|
}
|
2004-09-14 12:06:00 +04:00
|
|
|
gettimeofday(&tv,NULL);
|
2004-09-08 21:02:24 +04:00
|
|
|
}
|
|
|
|
OMPI_THREAD_UNLOCK(&msg->msg_lock);
|
|
|
|
#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))) {
|
2004-09-08 21:02:24 +04:00
|
|
|
ompi_event_loop(OMPI_EVLOOP_ONCE);
|
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;
|
|
|
|
return (msg->msg_complete ? OMPI_SUCCESS : OMPI_ERR_TIMEOUT);
|
|
|
|
}
|
|
|
|
|
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
|
2004-07-13 02:46:57 +04:00
|
|
|
* @retval OMPI_SUCCESS or error code on failure.
|
|
|
|
*/
|
2004-07-15 23:08:54 +04:00
|
|
|
int mca_oob_tcp_msg_complete(mca_oob_tcp_msg_t* msg, ompi_process_name_t * peer)
|
2004-07-13 02:46:57 +04:00
|
|
|
{
|
2004-07-15 17:51:40 +04:00
|
|
|
ompi_mutex_lock(&msg->msg_lock);
|
|
|
|
msg->msg_complete = true;
|
|
|
|
if(NULL != msg->msg_cbfunc) {
|
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);
|
2004-07-15 17:51:40 +04:00
|
|
|
ompi_mutex_unlock(&msg->msg_lock);
|
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
|
|
|
} else {
|
|
|
|
ompi_condition_broadcast(&msg->msg_condition);
|
|
|
|
ompi_mutex_unlock(&msg->msg_lock);
|
|
|
|
}
|
2004-07-13 02:46:57 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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) {
|
2005-01-20 03:03:23 +03:00
|
|
|
if(ompi_socket_errno == EINTR)
|
2004-07-15 17:51:40 +04:00
|
|
|
continue;
|
2005-01-20 03:03:23 +03:00
|
|
|
IMPORTANT_WINDOWS_COMMENT();
|
|
|
|
else if (ompi_socket_errno == EAGAIN || ompi_socket_errno == EWOULDBLOCK)
|
2004-07-15 17:51:40 +04:00
|
|
|
return false;
|
|
|
|
else {
|
2005-01-20 03:03:23 +03:00
|
|
|
ompi_output(0, "[%d,%d,%d]-[%d,%d,%d] mca_oob_tcp_msg_send_handler: writev failed with errno=%d",
|
2004-09-09 23:21:34 +04:00
|
|
|
OMPI_NAME_ARGS(mca_oob_name_self),
|
|
|
|
OMPI_NAME_ARGS(peer->peer_name),
|
2005-01-20 03:03:23 +03:00
|
|
|
ompi_socket_errno);
|
2004-08-03 01:24:00 +04:00
|
|
|
mca_oob_tcp_peer_close(peer);
|
2004-07-15 17:51:40 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
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;
|
|
|
|
msg->msg_rwptr->iov_base = (void *) ((char *) msg->msg_rwptr->iov_base + rc);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2004-08-03 01:24:00 +04:00
|
|
|
} while(msg->msg_rwnum);
|
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.
|
2004-07-15 17:51:40 +04:00
|
|
|
* @param msg the message to be recieved into
|
|
|
|
* @param peer the peer to recieve 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) {
|
|
|
|
ompi_output(0, "[%d,%d,%d]-[%d,%d,%d] mca_oob_tcp_msg_recv_handler: malloc(%d) failed\n",
|
2004-09-09 23:21:34 +04:00
|
|
|
OMPI_NAME_ARGS(mca_oob_name_self),
|
|
|
|
OMPI_NAME_ARGS(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;
|
|
|
|
}
|
|
|
|
msg->msg_rwiov[1].iov_base = msg->msg_rwbuf;
|
|
|
|
msg->msg_rwiov[1].iov_len = msg->msg_hdr.msg_size;
|
|
|
|
msg->msg_rwnum = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
while(1) {
|
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) {
|
2005-01-20 03:03:23 +03:00
|
|
|
if(ompi_socket_errno == EINTR)
|
2004-07-15 17:51:40 +04:00
|
|
|
continue;
|
2005-01-20 03:03:23 +03:00
|
|
|
IMPORTANT_WINDOWS_COMMENT();
|
|
|
|
else if (ompi_socket_errno == EAGAIN || ompi_socket_errno == EWOULDBLOCK)
|
2004-07-15 17:51:40 +04:00
|
|
|
return false;
|
|
|
|
else {
|
2005-01-20 03:03:23 +03:00
|
|
|
ompi_output(0, "[%d,%d,%d]-[%d,%d,%d] mca_oob_tcp_msg_recv: readv failed with errno=%d",
|
2004-09-09 23:21:34 +04:00
|
|
|
OMPI_NAME_ARGS(mca_oob_name_self),
|
|
|
|
OMPI_NAME_ARGS(peer->peer_name),
|
2005-01-20 03:03:23 +03:00
|
|
|
ompi_socket_errno);
|
2004-08-03 01:24:00 +04:00
|
|
|
mca_oob_tcp_peer_close(peer);
|
2004-07-15 17:51:40 +04:00
|
|
|
return false;
|
|
|
|
}
|
2004-08-28 05:15:19 +04:00
|
|
|
} else if (rc == 0) {
|
2004-09-08 21:02:24 +04:00
|
|
|
if(mca_oob_tcp_component.tcp_debug > 3) {
|
|
|
|
ompi_output(0, "[%d,%d,%d]-[%d,%d,%d] mca_oob_tcp_msg_recv: peer closed connection",
|
2004-09-09 23:21:34 +04:00
|
|
|
OMPI_NAME_ARGS(mca_oob_name_self),
|
|
|
|
OMPI_NAME_ARGS(peer->peer_name),
|
2005-01-20 03:03:23 +03:00
|
|
|
ompi_socket_errno);
|
2004-09-08 21:02:24 +04:00
|
|
|
}
|
2004-08-28 05:15:19 +04:00
|
|
|
mca_oob_tcp_peer_close(peer);
|
|
|
|
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;
|
|
|
|
msg->msg_rwptr->iov_base = (void *) ((char *) msg->msg_rwptr->iov_base + rc);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2004-08-03 01:24:00 +04:00
|
|
|
} while(msg->msg_rwnum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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:
|
|
|
|
ompi_output(0, "[%d,%d,%d] mca_oob_tcp_msg_recv_complete: invalid message type: %d\n",
|
2004-09-09 23:21:34 +04:00
|
|
|
OMPI_NAME_ARGS(mca_oob_name_self), msg->msg_hdr.msg_type);
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Process an ident message.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_oob_tcp_msg_ident(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* peer)
|
|
|
|
{
|
|
|
|
ompi_process_name_t src = msg->msg_hdr.msg_src;
|
|
|
|
OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
2004-11-20 22:12:43 +03:00
|
|
|
if(ompi_name_server.compare(OMPI_NS_CMP_ALL, &peer->peer_name, &src) != 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
|
|
|
ompi_rb_tree_delete(&mca_oob_tcp_component.tcp_peer_tree, &peer->peer_name);
|
|
|
|
peer->peer_name = src;
|
|
|
|
ompi_rb_tree_insert(&mca_oob_tcp_component.tcp_peer_tree, &peer->peer_name, peer);
|
|
|
|
}
|
|
|
|
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-11-20 22:12:43 +03:00
|
|
|
|
|
|
|
/* queue of posted receives is stored in network byte order -
|
|
|
|
* the message header has already been converted back to host -
|
|
|
|
* so must convert back to network to match.
|
|
|
|
*/
|
2004-12-09 23:54:31 +03:00
|
|
|
post = mca_oob_tcp_msg_match_post(&peer->peer_name, msg->msg_hdr.msg_tag, true);
|
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) {
|
|
|
|
|
|
|
|
if(post->msg_flags & MCA_OOB_ALLOC) {
|
|
|
|
|
|
|
|
/* set the users iovec struct to point to pre-allocated buffer */
|
|
|
|
if(NULL == post->msg_uiov || 0 == post->msg_ucnt) {
|
|
|
|
post->msg_rc = OMPI_ERR_BAD_PARAM;
|
|
|
|
} else {
|
|
|
|
/* first iovec of recv message contains the header -
|
|
|
|
* subsequent contain user data
|
|
|
|
*/
|
2004-11-07 06:18:00 +03:00
|
|
|
post->msg_uiov[0].iov_base = msg->msg_rwbuf;
|
|
|
|
post->msg_uiov[0].iov_len = msg->msg_hdr.msg_size;
|
2004-11-20 22:12:43 +03:00
|
|
|
post->msg_rc = 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
|
|
|
msg->msg_rwbuf = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* copy msg data into posted recv */
|
|
|
|
post->msg_rc = mca_oob_tcp_msg_copy(msg, post->msg_uiov, post->msg_ucnt);
|
|
|
|
if(post->msg_flags & MCA_OOB_TRUNC) {
|
|
|
|
int i, size = 0;
|
|
|
|
for(i=1; i<msg->msg_rwcnt+1; i++)
|
|
|
|
size += msg->msg_rwiov[i].iov_len;
|
|
|
|
post->msg_rc = size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(post->msg_flags & MCA_OOB_PEEK) {
|
|
|
|
/* will need message for actual receive */
|
|
|
|
ompi_list_append(&mca_oob_tcp_component.tcp_msg_recv, &msg->super);
|
|
|
|
} else {
|
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
|
|
|
}
|
2004-09-30 19:09:29 +04:00
|
|
|
mca_oob_tcp_component.tcp_match_count++;
|
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
|
|
|
OMPI_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
|
|
|
mca_oob_tcp_msg_complete(post, &peer->peer_name);
|
2004-09-30 19:09:29 +04:00
|
|
|
|
|
|
|
OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_match_lock);
|
|
|
|
if(--mca_oob_tcp_component.tcp_match_count == 0)
|
|
|
|
ompi_condition_signal(&mca_oob_tcp_component.tcp_match_cond);
|
|
|
|
OMPI_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
|
|
|
} else {
|
|
|
|
ompi_list_append(&mca_oob_tcp_component.tcp_msg_recv, (ompi_list_item_t*)msg);
|
|
|
|
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
int i;
|
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
|
|
|
struct iovec *src = msg->msg_rwiov+1;
|
2004-08-13 02:41:42 +04:00
|
|
|
struct iovec *dst = iov;
|
2004-08-03 01:24:00 +04:00
|
|
|
unsigned char* src_ptr = (unsigned char*)src->iov_base;
|
|
|
|
size_t src_len = src->iov_len;
|
|
|
|
int src_cnt = 0;
|
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
for(i=0; i<count; i++) {
|
|
|
|
unsigned char* dst_ptr = (unsigned char*)dst->iov_base;
|
|
|
|
size_t dst_len = dst->iov_len;
|
|
|
|
while(dst_len > 0) {
|
|
|
|
size_t len = (dst_len <= src_len) ? dst_len : src_len;
|
|
|
|
memcpy(dst_ptr, src_ptr, len);
|
|
|
|
rc += len;
|
|
|
|
dst_ptr += len;
|
|
|
|
dst_len -= len;
|
|
|
|
src_ptr += len;
|
|
|
|
src_len -= len;
|
|
|
|
if(src_len == 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
|
|
|
if(++src_cnt == msg->msg_rwcnt)
|
2004-08-03 01:24:00 +04:00
|
|
|
return rc;
|
|
|
|
src++;
|
2004-08-28 06:02:31 +04:00
|
|
|
src_ptr = (unsigned char*)src->iov_base;
|
2004-08-03 01:24:00 +04:00
|
|
|
src_len = src->iov_len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dst++;
|
2004-07-15 17:51:40 +04:00
|
|
|
}
|
2004-08-03 01:24:00 +04:00
|
|
|
return rc;
|
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.
|
|
|
|
*/
|
|
|
|
|
2004-08-13 02:41:42 +04:00
|
|
|
mca_oob_tcp_msg_t* mca_oob_tcp_msg_match_recv(ompi_process_name_t* name, int tag)
|
2004-08-03 01:24:00 +04:00
|
|
|
{
|
|
|
|
mca_oob_tcp_msg_t* msg;
|
|
|
|
for(msg = (mca_oob_tcp_msg_t*) ompi_list_get_first(&mca_oob_tcp_component.tcp_msg_recv);
|
|
|
|
msg != (mca_oob_tcp_msg_t*) ompi_list_get_end(&mca_oob_tcp_component.tcp_msg_recv);
|
|
|
|
msg = (mca_oob_tcp_msg_t*) ompi_list_get_next(msg)) {
|
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
if((0 == ompi_name_server.compare(OMPI_NS_CMP_ALL, name,MCA_OOB_NAME_ANY) ||
|
|
|
|
(0 == ompi_name_server.compare(OMPI_NS_CMP_ALL, name, &msg->msg_peer)))) {
|
2004-08-03 01:24:00 +04:00
|
|
|
if (tag == MCA_OOB_TAG_ANY || tag == msg->msg_hdr.msg_tag) {
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2004-08-13 02:41:42 +04:00
|
|
|
mca_oob_tcp_msg_t* mca_oob_tcp_msg_match_post(ompi_process_name_t* name, int tag, bool peek)
|
2004-08-03 01:24:00 +04:00
|
|
|
{
|
|
|
|
mca_oob_tcp_msg_t* msg;
|
|
|
|
for(msg = (mca_oob_tcp_msg_t*) ompi_list_get_first(&mca_oob_tcp_component.tcp_msg_post);
|
|
|
|
msg != (mca_oob_tcp_msg_t*) ompi_list_get_end(&mca_oob_tcp_component.tcp_msg_post);
|
|
|
|
msg = (mca_oob_tcp_msg_t*) ompi_list_get_next(msg)) {
|
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
if((0 == ompi_name_server.compare(OMPI_NS_CMP_ALL, &msg->msg_peer,MCA_OOB_NAME_ANY) ||
|
|
|
|
(0 == ompi_name_server.compare(OMPI_NS_CMP_ALL, &msg->msg_peer,name)))) {
|
2004-08-03 01:24:00 +04:00
|
|
|
if (msg->msg_hdr.msg_tag == MCA_OOB_TAG_ANY || msg->msg_hdr.msg_tag == tag) {
|
|
|
|
if((msg->msg_flags & MCA_OOB_PEEK) == 0 || peek) {
|
|
|
|
ompi_list_remove_item(&mca_oob_tcp_component.tcp_msg_post, &msg->super);
|
|
|
|
return msg;
|
|
|
|
} else {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|