2011-07-26 08:36:21 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
|
2013-07-04 12:34:37 +04:00
|
|
|
* Copyright (c) 2013 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2011-07-26 08:36:21 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include "mtl_mxm.h"
|
|
|
|
#include "mtl_mxm_types.h"
|
|
|
|
|
2012-07-25 17:26:40 +04:00
|
|
|
#include "ompi/message/message.h"
|
2011-07-26 08:36:21 +04:00
|
|
|
#include "ompi/communicator/communicator.h"
|
|
|
|
|
|
|
|
int ompi_mtl_mxm_iprobe(struct mca_mtl_base_module_t* mtl,
|
|
|
|
struct ompi_communicator_t *comm, int src, int tag,
|
|
|
|
int *flag, struct ompi_status_public_t *status)
|
|
|
|
{
|
|
|
|
mxm_error_t err;
|
2011-08-02 18:30:11 +04:00
|
|
|
mxm_recv_req_t req;
|
2011-07-26 08:36:21 +04:00
|
|
|
|
2012-03-10 02:11:14 +04:00
|
|
|
req.base.state = MXM_REQ_NEW;
|
|
|
|
ompi_mtl_mxm_set_recv_envelope(&req, comm, src, tag);
|
2011-07-26 08:36:21 +04:00
|
|
|
|
2012-07-24 15:48:18 +04:00
|
|
|
err = mxm_req_probe(&req);
|
2011-07-26 08:36:21 +04:00
|
|
|
if (MXM_OK == err) {
|
|
|
|
*flag = 1;
|
|
|
|
if (MPI_STATUS_IGNORE != status) {
|
2012-04-09 20:02:05 +04:00
|
|
|
ompi_mtl_mxm_to_mpi_status(err, status);
|
2012-01-30 14:37:37 +04:00
|
|
|
status->MPI_SOURCE = req.completion.sender_imm;
|
2011-07-26 08:36:21 +04:00
|
|
|
status->MPI_TAG = req.completion.sender_tag;
|
2012-02-21 23:55:16 +04:00
|
|
|
status->_ucount = req.completion.sender_len;
|
2011-07-26 08:36:21 +04:00
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
} else if (MXM_ERR_NO_MESSAGE == err) {
|
|
|
|
*flag = 0;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
} else {
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
}
|
2012-03-26 23:27:03 +04:00
|
|
|
|
|
|
|
|
|
|
|
int ompi_mtl_mxm_improbe(struct mca_mtl_base_module_t *mtl,
|
|
|
|
struct ompi_communicator_t *comm,
|
|
|
|
int src,
|
|
|
|
int tag,
|
|
|
|
int *matched,
|
|
|
|
struct ompi_message_t **message,
|
|
|
|
struct ompi_status_public_t *status)
|
|
|
|
{
|
2012-07-25 17:26:40 +04:00
|
|
|
mxm_error_t err;
|
|
|
|
mxm_recv_req_t req;
|
|
|
|
|
|
|
|
ompi_free_list_item_t *item;
|
|
|
|
ompi_mtl_mxm_message_t *msgp;
|
|
|
|
|
2013-07-09 02:07:52 +04:00
|
|
|
OMPI_FREE_LIST_WAIT_MT(&mca_mtl_mxm_component.mxm_messages, item);
|
2013-07-04 12:34:37 +04:00
|
|
|
if (OPAL_UNLIKELY(NULL == item)) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2012-07-25 17:26:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
msgp = (ompi_mtl_mxm_message_t *) item;
|
|
|
|
|
|
|
|
req.base.state = MXM_REQ_NEW;
|
|
|
|
ompi_mtl_mxm_set_recv_envelope(&req, comm, src, tag);
|
|
|
|
|
|
|
|
msgp->mq = req.base.mq;
|
|
|
|
msgp->conn = req.base.conn;
|
|
|
|
msgp->tag = req.tag;
|
|
|
|
msgp->tag_mask = req.tag_mask;
|
|
|
|
|
|
|
|
err = mxm_req_mprobe(&req, &msgp->mxm_msg);
|
|
|
|
if (MXM_OK == err) {
|
|
|
|
if (MPI_STATUS_IGNORE != status) {
|
|
|
|
*matched = 1;
|
|
|
|
ompi_mtl_mxm_to_mpi_status(err, status);
|
|
|
|
status->MPI_SOURCE = req.completion.sender_imm;
|
|
|
|
status->MPI_TAG = req.completion.sender_tag;
|
|
|
|
status->_ucount = req.completion.sender_len;
|
|
|
|
} else{
|
|
|
|
*matched = 0;
|
|
|
|
*message = MPI_MESSAGE_NULL;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
} else if (MXM_ERR_NO_MESSAGE == err) {
|
|
|
|
*matched = 0;
|
|
|
|
*message = MPI_MESSAGE_NULL;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
} else {
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
(*message) = ompi_message_alloc();
|
|
|
|
if (OPAL_UNLIKELY(NULL == (*message))) {
|
|
|
|
*matched = 0;
|
|
|
|
*message = MPI_MESSAGE_NULL;
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
(*message)->comm = comm;
|
|
|
|
(*message)->req_ptr = msgp;
|
|
|
|
(*message)->peer = status->MPI_SOURCE;
|
|
|
|
(*message)->count = status->_ucount;
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
2012-03-26 23:27:03 +04:00
|
|
|
}
|