2004-08-25 17:39:08 +00:00
|
|
|
/*
|
2004-11-22 01:38:40 +00: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 20:09:25 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-08-25 17:39:08 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
2004-10-20 01:03:09 +00:00
|
|
|
#include "ompi_config.h"
|
2005-03-14 20:57:21 +00:00
|
|
|
|
|
|
|
#include "mca/ns/ns.h"
|
|
|
|
|
2004-07-01 14:49:54 +00:00
|
|
|
#include "mca/oob/tcp/oob_tcp.h"
|
|
|
|
|
|
|
|
/*
|
2004-07-13 21:03:03 +00:00
|
|
|
* Similiar to unix readv(2)
|
2004-07-01 14:49:54 +00:00
|
|
|
*
|
2004-08-04 23:42:51 +00:00
|
|
|
* @param peer (IN) Opaque name of peer process or MCA_OOB_NAME_ANY for wildcard receive.
|
2004-07-01 14:49:54 +00:00
|
|
|
* @param msg (IN) Array of iovecs describing user buffers and lengths.
|
|
|
|
* @param types (IN) Parallel array to iovecs describing data type of each iovec element.
|
|
|
|
* @param count (IN) Number of elements in iovec array.
|
2004-08-02 21:24:00 +00:00
|
|
|
* @param tag (IN) User supplied tag for matching send/recv.
|
2004-07-15 19:08:54 +00:00
|
|
|
* @param flags (IN) May be MCA_OOB_PEEK to return up to the number of bytes provided in the
|
2004-07-01 14:49:54 +00:00
|
|
|
* iovec array without removing the message from the queue.
|
|
|
|
* @return OMPI error code (<0) on error or number of bytes actually received.
|
|
|
|
*/
|
2004-08-02 21:24:00 +00:00
|
|
|
int mca_oob_tcp_recv(
|
2005-03-14 20:57:21 +00:00
|
|
|
orte_process_name_t* peer,
|
2004-08-12 22:41:42 +00:00
|
|
|
struct iovec *iov,
|
2004-08-02 21:24:00 +00:00
|
|
|
int count,
|
2005-03-14 20:57:21 +00:00
|
|
|
int tag,
|
2004-08-02 21:24:00 +00:00
|
|
|
int flags)
|
2004-07-01 14:49:54 +00:00
|
|
|
{
|
2004-08-02 21:24:00 +00:00
|
|
|
mca_oob_tcp_msg_t *msg;
|
2004-10-09 21:20:04 +00:00
|
|
|
int i, rc = 0, size = 0;
|
2004-08-02 21:24:00 +00:00
|
|
|
|
2005-03-18 23:40:08 +00:00
|
|
|
if(mca_oob_tcp_component.tcp_debug > 3) {
|
2005-07-03 23:31:27 +00:00
|
|
|
opal_output(0, "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_recv: tag %d\n",
|
2005-03-14 20:57:21 +00:00
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name),
|
|
|
|
ORTE_NAME_ARGS(peer),
|
2004-09-01 23:07:40 +00:00
|
|
|
tag);
|
|
|
|
}
|
|
|
|
|
2004-07-15 19:08:54 +00:00
|
|
|
/* lock the tcp struct */
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-08-02 21:24:00 +00:00
|
|
|
|
|
|
|
/* check to see if a matching receive is on the list */
|
2004-09-01 23:07:40 +00:00
|
|
|
msg = mca_oob_tcp_msg_match_recv(peer, tag);
|
2004-08-02 21:24:00 +00:00
|
|
|
if(NULL != msg) {
|
|
|
|
|
2004-08-03 23:39:46 +00:00
|
|
|
if(msg->msg_rc < 0) {
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-08-02 21:24:00 +00:00
|
|
|
return msg->msg_rc;
|
2004-08-03 23:39:46 +00:00
|
|
|
}
|
2004-08-13 15:15:14 +00:00
|
|
|
|
|
|
|
/* if we are returning an allocated buffer - just take it from the message */
|
|
|
|
if(flags & MCA_OOB_ALLOC) {
|
2004-08-02 21:24:00 +00:00
|
|
|
|
2004-08-13 15:15:14 +00:00
|
|
|
if(NULL == iov || 0 == count) {
|
|
|
|
return OMPI_ERR_BAD_PARAM;
|
|
|
|
}
|
2005-01-26 00:20:35 +00:00
|
|
|
iov[0].iov_base = (ompi_iov_base_ptr_t)msg->msg_rwbuf;
|
2004-11-07 03:18:00 +00:00
|
|
|
iov[0].iov_len = msg->msg_hdr.msg_size;
|
2004-08-13 15:15:14 +00:00
|
|
|
msg->msg_rwbuf = NULL;
|
2004-11-20 19:12:43 +00:00
|
|
|
rc = msg->msg_hdr.msg_size;
|
|
|
|
|
2004-08-13 15:15:14 +00:00
|
|
|
} else {
|
|
|
|
|
|
|
|
/* if we are just doing peek, return bytes without dequeing message */
|
|
|
|
rc = mca_oob_tcp_msg_copy(msg, iov, count);
|
|
|
|
if(rc >= 0 && MCA_OOB_TRUNC & flags) {
|
|
|
|
rc = 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 03:59:06 +00:00
|
|
|
/* skip first iovec element which is the header */
|
|
|
|
for(i=1; i<msg->msg_rwcnt+1; i++)
|
2004-08-13 15:15:14 +00:00
|
|
|
rc += msg->msg_rwiov[i].iov_len;
|
|
|
|
}
|
|
|
|
if(MCA_OOB_PEEK & flags) {
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-08-13 15:15:14 +00:00
|
|
|
return rc;
|
|
|
|
}
|
2004-08-02 21:24:00 +00:00
|
|
|
}
|
2004-08-13 15:15:14 +00:00
|
|
|
|
2004-08-02 21:24:00 +00:00
|
|
|
/* otherwise dequeue the message and return to free list */
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_remove_item(&mca_oob_tcp_component.tcp_msg_recv, (opal_list_item_t *) msg);
|
2004-08-02 21:24:00 +00:00
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-08-02 21:24:00 +00:00
|
|
|
return rc;
|
2004-07-15 19:08:54 +00:00
|
|
|
}
|
2004-08-02 21:24:00 +00:00
|
|
|
|
|
|
|
/* the message has not already been received. So we add it to the receive queue */
|
|
|
|
MCA_OOB_TCP_MSG_ALLOC(msg, rc);
|
2004-07-15 19:08:54 +00:00
|
|
|
if(NULL == msg) {
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-08-02 21:24:00 +00:00
|
|
|
return rc;
|
2004-07-15 19:08:54 +00:00
|
|
|
}
|
2004-08-02 21:24:00 +00:00
|
|
|
|
|
|
|
/* determine overall size of user supplied buffer */
|
|
|
|
for(i = 0; i < count; i++) {
|
|
|
|
size += iov[i].iov_len;
|
|
|
|
}
|
|
|
|
|
2004-07-15 19:08:54 +00:00
|
|
|
/* fill in the struct */
|
2004-09-01 23:07:40 +00:00
|
|
|
msg->msg_hdr.msg_size = size;
|
|
|
|
msg->msg_hdr.msg_tag = tag;
|
2004-09-08 17:02:24 +00:00
|
|
|
msg->msg_hdr.msg_type = MCA_OOB_TCP_DATA;
|
2004-09-01 23:07:40 +00:00
|
|
|
msg->msg_hdr.msg_src = *peer;
|
2005-03-14 20:57:21 +00:00
|
|
|
if (NULL == orte_process_info.my_name) {
|
|
|
|
msg->msg_hdr.msg_dst = *MCA_OOB_NAME_ANY;
|
|
|
|
} else {
|
|
|
|
msg->msg_hdr.msg_dst = *orte_process_info.my_name;
|
|
|
|
}
|
2004-08-02 21:24:00 +00:00
|
|
|
msg->msg_type = MCA_OOB_TCP_POSTED;
|
|
|
|
msg->msg_rc = 0;
|
|
|
|
msg->msg_flags = flags;
|
|
|
|
msg->msg_uiov = iov;
|
|
|
|
msg->msg_ucnt = count;
|
2004-07-15 19:08:54 +00:00
|
|
|
msg->msg_cbfunc = NULL;
|
2004-08-02 21:24:00 +00:00
|
|
|
msg->msg_cbdata = NULL;
|
2004-07-15 19:08:54 +00:00
|
|
|
msg->msg_complete = false;
|
2004-08-02 21:24:00 +00:00
|
|
|
msg->msg_peer = *peer;
|
2004-08-04 14:33:02 +00:00
|
|
|
msg->msg_rwbuf = NULL;
|
|
|
|
msg->msg_rwiov = NULL;
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_append(&mca_oob_tcp_component.tcp_msg_post, (opal_list_item_t *) msg);
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-08-02 21:24:00 +00:00
|
|
|
|
|
|
|
/* wait for the receive to complete */
|
|
|
|
mca_oob_tcp_msg_wait(msg, &rc);
|
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
|
|
|
return rc;
|
2004-07-01 14:49:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Non-blocking version of mca_oob_recv().
|
|
|
|
*
|
2004-08-04 23:42:51 +00:00
|
|
|
* @param peer (IN) Opaque name of peer process or MCA_OOB_NAME_ANY for wildcard receive.
|
2004-07-01 14:49:54 +00:00
|
|
|
* @param msg (IN) Array of iovecs describing user buffers and lengths.
|
|
|
|
* @param count (IN) Number of elements in iovec array.
|
2004-08-02 21:24:00 +00:00
|
|
|
* @param tag (IN) User supplied tag for matching send/recv.
|
2004-07-15 19:08:54 +00:00
|
|
|
* @param flags (IN) May be MCA_OOB_PEEK to return up to size bytes of msg w/out removing it from the queue,
|
2004-07-01 14:49:54 +00:00
|
|
|
* @param cbfunc (IN) Callback function on recv completion.
|
|
|
|
* @param cbdata (IN) User data that is passed to callback function.
|
2004-08-02 21:24:00 +00:00
|
|
|
* @return OMPI error code (<0) on error.
|
2004-07-01 14:49:54 +00:00
|
|
|
*/
|
2004-08-02 21:24:00 +00:00
|
|
|
int mca_oob_tcp_recv_nb(
|
2005-03-14 20:57:21 +00:00
|
|
|
orte_process_name_t* peer,
|
2004-08-12 22:41:42 +00:00
|
|
|
struct iovec* iov,
|
2004-08-02 21:24:00 +00:00
|
|
|
int count,
|
|
|
|
int tag,
|
|
|
|
int flags,
|
|
|
|
mca_oob_callback_fn_t cbfunc,
|
|
|
|
void* cbdata)
|
2004-07-01 14:49:54 +00:00
|
|
|
{
|
2004-08-02 21:24:00 +00:00
|
|
|
mca_oob_tcp_msg_t *msg;
|
|
|
|
int i, rc, size = 0;
|
|
|
|
|
2004-07-15 19:08:54 +00:00
|
|
|
/* lock the tcp struct */
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-08-02 21:24:00 +00:00
|
|
|
|
|
|
|
/* check to see if a matching receive is on the list */
|
2004-09-01 23:07:40 +00:00
|
|
|
msg = mca_oob_tcp_msg_match_recv(peer, tag);
|
2004-08-02 21:24:00 +00:00
|
|
|
if(NULL != msg) {
|
|
|
|
|
2004-11-07 03:30:37 +00:00
|
|
|
if(msg->msg_rc < 0) {
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-11-07 03:30:37 +00:00
|
|
|
return msg->msg_rc;
|
|
|
|
}
|
2004-08-02 21:24:00 +00: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 03:59:06 +00:00
|
|
|
/* if we are returning an allocated buffer - just take it from the message */
|
|
|
|
if(flags & MCA_OOB_ALLOC) {
|
|
|
|
|
|
|
|
if(NULL == iov || 0 == count) {
|
2005-07-03 22:45:48 +00: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 03:59:06 +00:00
|
|
|
return OMPI_ERR_BAD_PARAM;
|
|
|
|
}
|
2005-01-26 00:20:35 +00:00
|
|
|
iov[0].iov_base = (ompi_iov_base_ptr_t)msg->msg_rwbuf;
|
2004-11-07 03:18:00 +00:00
|
|
|
iov[0].iov_len = 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 03:59:06 +00:00
|
|
|
msg->msg_rwbuf = NULL;
|
2004-11-20 19:12:43 +00:00
|
|
|
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 03:59:06 +00:00
|
|
|
} else {
|
|
|
|
|
|
|
|
/* if we are just doing peek, return bytes without dequeing message */
|
|
|
|
rc = mca_oob_tcp_msg_copy(msg, iov, count);
|
|
|
|
if(rc >= 0 && MCA_OOB_TRUNC & flags) {
|
|
|
|
rc = 0;
|
|
|
|
for(i=1; i<msg->msg_rwcnt+1; i++)
|
|
|
|
rc += msg->msg_rwiov[i].iov_len;
|
|
|
|
}
|
|
|
|
if(MCA_OOB_PEEK & flags) {
|
2005-07-03 22:45:48 +00: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 03:59:06 +00:00
|
|
|
cbfunc(rc, &msg->msg_peer, iov, count, tag, cbdata);
|
|
|
|
return 0;
|
|
|
|
}
|
2004-07-15 19:08:54 +00:00
|
|
|
}
|
2004-08-02 21:24:00 +00:00
|
|
|
|
|
|
|
/* otherwise dequeue the message and return to free list */
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_remove_item(&mca_oob_tcp_component.tcp_msg_recv, (opal_list_item_t *) msg);
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-09-01 23:07:40 +00:00
|
|
|
cbfunc(rc, &msg->msg_peer, iov, count, msg->msg_hdr.msg_tag, cbdata);
|
2004-08-02 21:24:00 +00:00
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
2004-11-20 19:12:43 +00:00
|
|
|
return rc;
|
2004-07-15 19:08:54 +00:00
|
|
|
}
|
2004-08-02 21:24:00 +00:00
|
|
|
|
|
|
|
/* the message has not already been received. So we add it to the receive queue */
|
|
|
|
MCA_OOB_TCP_MSG_ALLOC(msg, rc);
|
2004-07-15 19:08:54 +00:00
|
|
|
if(NULL == msg) {
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-08-02 21:24:00 +00:00
|
|
|
return rc;
|
2004-07-15 19:08:54 +00:00
|
|
|
}
|
2004-08-02 21:24:00 +00:00
|
|
|
|
|
|
|
/* determine overall size of user supplied buffer */
|
|
|
|
for(i = 0; i < count; i++) {
|
|
|
|
size += iov[i].iov_len;
|
|
|
|
}
|
|
|
|
|
2004-09-01 23:07:40 +00:00
|
|
|
/* fill in the header */
|
2005-03-14 20:57:21 +00:00
|
|
|
msg->msg_hdr.msg_src = *orte_process_info.my_name;
|
2004-09-01 23:07:40 +00:00
|
|
|
msg->msg_hdr.msg_dst = *peer;
|
|
|
|
msg->msg_hdr.msg_size = size;
|
|
|
|
msg->msg_hdr.msg_tag = tag;
|
2004-08-02 21:24:00 +00:00
|
|
|
msg->msg_type = MCA_OOB_TCP_POSTED;
|
|
|
|
msg->msg_rc = 0;
|
|
|
|
msg->msg_flags = flags;
|
|
|
|
msg->msg_uiov = iov;
|
|
|
|
msg->msg_ucnt = count;
|
2004-07-15 19:08:54 +00:00
|
|
|
msg->msg_cbfunc = cbfunc;
|
|
|
|
msg->msg_cbdata = cbdata;
|
|
|
|
msg->msg_complete = false;
|
2004-08-02 21:24:00 +00:00
|
|
|
msg->msg_peer = *peer;
|
2004-08-04 14:33:02 +00:00
|
|
|
msg->msg_rwbuf = NULL;
|
|
|
|
msg->msg_rwiov = NULL;
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_append(&mca_oob_tcp_component.tcp_msg_post, (opal_list_item_t *) msg);
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-08-02 21:24:00 +00:00
|
|
|
return 0;
|
2004-07-01 14:49:54 +00:00
|
|
|
}
|
|
|
|
|
2004-09-30 15:09:29 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Cancel non-blocking recv.
|
|
|
|
*
|
|
|
|
* @param peer (IN) Opaque name of peer process or MCA_OOB_NAME_ANY for wildcard receive.
|
|
|
|
* @param tag (IN) User supplied tag for matching send/recv.
|
|
|
|
* @return OMPI error code (<0) on error or number of bytes actually received.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_oob_tcp_recv_cancel(
|
2005-03-14 20:57:21 +00:00
|
|
|
orte_process_name_t* name,
|
2004-09-30 15:09:29 +00:00
|
|
|
int tag)
|
|
|
|
{
|
2005-03-14 20:57:21 +00:00
|
|
|
int matched = 0, cmpval1, cmpval2;
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_item_t *item, *next;
|
2004-09-30 15:09:29 +00:00
|
|
|
|
|
|
|
/* wait for any previously matched messages to be processed */
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2005-05-19 16:16:19 +00:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
2005-09-11 20:04:40 +00:00
|
|
|
if(opal_event_progress_thread() == false) {
|
2005-05-19 16:16:19 +00:00
|
|
|
while(mca_oob_tcp_component.tcp_match_count) {
|
2005-07-03 22:45:48 +00:00
|
|
|
opal_condition_wait(
|
2005-05-19 16:16:19 +00:00
|
|
|
&mca_oob_tcp_component.tcp_match_cond,
|
|
|
|
&mca_oob_tcp_component.tcp_match_lock);
|
|
|
|
}
|
2004-09-30 15:09:29 +00:00
|
|
|
}
|
2005-05-19 16:16:19 +00:00
|
|
|
#endif
|
2004-09-30 15:09:29 +00:00
|
|
|
|
|
|
|
/* remove any matching posted receives */
|
2005-07-03 16:22:16 +00:00
|
|
|
for(item = opal_list_get_first(&mca_oob_tcp_component.tcp_msg_post);
|
|
|
|
item != opal_list_get_end(&mca_oob_tcp_component.tcp_msg_post);
|
2004-09-30 15:09:29 +00:00
|
|
|
item = next) {
|
|
|
|
mca_oob_tcp_msg_t* msg = (mca_oob_tcp_msg_t*)item;
|
2005-07-03 16:22:16 +00:00
|
|
|
next = opal_list_get_next(item);
|
2004-09-30 15:09:29 +00:00
|
|
|
|
2005-03-14 20:57:21 +00:00
|
|
|
cmpval1 = orte_ns.compare(ORTE_NS_CMP_ALL, name, MCA_OOB_NAME_ANY);
|
|
|
|
cmpval2 = orte_ns.compare(ORTE_NS_CMP_ALL, &msg->msg_peer, name);
|
|
|
|
if ((0 == cmpval1) || (0 == cmpval2)) {
|
|
|
|
if (msg->msg_hdr.msg_tag == tag) {
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_remove_item(&mca_oob_tcp_component.tcp_msg_post, &msg->super);
|
2004-09-30 15:09:29 +00:00
|
|
|
MCA_OOB_TCP_MSG_RETURN(msg);
|
|
|
|
matched++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
|
2004-09-30 15:09:29 +00:00
|
|
|
return (matched > 0) ? OMPI_SUCCESS : OMPI_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|