2012-04-25 00:19:06 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2005-05-24 02:06:50 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2014-07-03 04:34:44 +04:00
|
|
|
* Copyright (c) 2004-2014 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-05-24 02:06:50 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2009-07-17 18:54:18 +04:00
|
|
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
2012-02-24 06:13:33 +04:00
|
|
|
* Copyright (c) 2011-2012 NVIDIA Corporation. All rights reserved.
|
2015-02-19 23:41:41 +03:00
|
|
|
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights
|
2012-04-25 00:19:15 +04:00
|
|
|
* reserved.
|
2005-05-24 02:06:50 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
2006-06-26 23:00:37 +04:00
|
|
|
|
2005-05-24 02:22:20 +04:00
|
|
|
#ifndef OMPI_PML_OB1_SEND_REQUEST_H
|
|
|
|
#define OMPI_PML_OB1_SEND_REQUEST_H
|
2005-05-24 02:06:50 +04:00
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
#include "opal/datatype/opal_convertor.h"
|
|
|
|
#include "opal/mca/mpool/base/base.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/pml/base/pml_base_sendreq.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
#include "pml_ob1_comm.h"
|
2005-06-01 18:34:22 +04:00
|
|
|
#include "pml_ob1_hdr.h"
|
2005-09-13 02:28:23 +04:00
|
|
|
#include "pml_ob1_rdma.h"
|
2006-07-20 18:44:35 +04:00
|
|
|
#include "pml_ob1_rdmafrag.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/bml/bml.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2007-07-11 03:45:23 +04:00
|
|
|
BEGIN_C_DECLS
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2006-07-20 18:44:35 +04:00
|
|
|
typedef enum {
|
|
|
|
MCA_PML_OB1_SEND_PENDING_NONE,
|
|
|
|
MCA_PML_OB1_SEND_PENDING_SCHEDULE,
|
|
|
|
MCA_PML_OB1_SEND_PENDING_START
|
|
|
|
} mca_pml_ob1_send_pending_t;
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
struct mca_pml_ob1_send_request_t {
|
|
|
|
mca_pml_base_send_request_t req_send;
|
2005-09-13 02:28:23 +04:00
|
|
|
mca_bml_base_endpoint_t* req_endpoint;
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
opal_ptr_t req_recv;
|
2005-12-06 21:27:56 +03:00
|
|
|
int32_t req_state;
|
|
|
|
int32_t req_lock;
|
2007-06-03 12:30:07 +04:00
|
|
|
bool req_throttle_sends;
|
2005-06-09 07:11:51 +04:00
|
|
|
size_t req_pipeline_depth;
|
2005-06-09 00:37:19 +04:00
|
|
|
size_t req_bytes_delivered;
|
2005-09-13 02:28:23 +04:00
|
|
|
uint32_t req_rdma_cnt;
|
2006-07-20 18:44:35 +04:00
|
|
|
mca_pml_ob1_send_pending_t req_pending;
|
2007-06-03 12:30:07 +04:00
|
|
|
opal_mutex_t req_send_range_lock;
|
|
|
|
opal_list_t req_send_ranges;
|
2015-01-06 18:45:08 +03:00
|
|
|
mca_pml_ob1_rdma_frag_t *rdma_frag;
|
2007-07-01 15:34:23 +04:00
|
|
|
mca_pml_ob1_com_btl_t req_rdma[1];
|
2005-05-24 02:06:50 +04:00
|
|
|
};
|
|
|
|
typedef struct mca_pml_ob1_send_request_t mca_pml_ob1_send_request_t;
|
|
|
|
|
|
|
|
OBJ_CLASS_DECLARATION(mca_pml_ob1_send_request_t);
|
|
|
|
|
2007-06-03 12:30:07 +04:00
|
|
|
struct mca_pml_ob1_send_range_t {
|
2015-02-19 23:41:41 +03:00
|
|
|
opal_free_list_item_t base;
|
2007-06-07 15:24:24 +04:00
|
|
|
uint64_t range_send_offset;
|
|
|
|
uint64_t range_send_length;
|
2007-07-01 15:34:23 +04:00
|
|
|
int range_btl_idx;
|
|
|
|
int range_btl_cnt;
|
|
|
|
mca_pml_ob1_com_btl_t range_btls[1];
|
2007-06-03 12:30:07 +04:00
|
|
|
};
|
|
|
|
typedef struct mca_pml_ob1_send_range_t mca_pml_ob1_send_range_t;
|
|
|
|
OBJ_CLASS_DECLARATION(mca_pml_ob1_send_range_t);
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2007-08-30 16:10:04 +04:00
|
|
|
static inline bool lock_send_request(mca_pml_ob1_send_request_t *sendreq)
|
|
|
|
{
|
|
|
|
return OPAL_THREAD_ADD32(&sendreq->req_lock, 1) == 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool unlock_send_request(mca_pml_ob1_send_request_t *sendreq)
|
|
|
|
{
|
|
|
|
return OPAL_THREAD_ADD32(&sendreq->req_lock, -1) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
add_request_to_send_pending(mca_pml_ob1_send_request_t* sendreq,
|
2008-09-30 19:47:43 +04:00
|
|
|
const mca_pml_ob1_send_pending_t type,
|
|
|
|
const bool append)
|
2007-08-30 16:10:04 +04:00
|
|
|
{
|
|
|
|
opal_list_item_t *item = (opal_list_item_t*)sendreq;
|
|
|
|
|
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
|
|
|
sendreq->req_pending = type;
|
|
|
|
if(append)
|
|
|
|
opal_list_append(&mca_pml_ob1.send_pending, item);
|
|
|
|
else
|
|
|
|
opal_list_prepend(&mca_pml_ob1.send_pending, item);
|
|
|
|
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline mca_pml_ob1_send_request_t*
|
|
|
|
get_request_from_send_pending(mca_pml_ob1_send_pending_t *type)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_send_request_t *sendreq;
|
|
|
|
|
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
|
|
|
sendreq = (mca_pml_ob1_send_request_t*)
|
|
|
|
opal_list_remove_first(&mca_pml_ob1.send_pending);
|
|
|
|
if(sendreq) {
|
|
|
|
*type = sendreq->req_pending;
|
|
|
|
sendreq->req_pending = MCA_PML_OB1_SEND_PENDING_NONE;
|
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock);
|
|
|
|
|
|
|
|
return sendreq;
|
|
|
|
}
|
|
|
|
|
2007-07-11 02:16:38 +04:00
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_ALLOC( comm, \
|
|
|
|
dst, \
|
2013-07-04 12:34:37 +04:00
|
|
|
sendreq) \
|
2007-07-11 02:16:38 +04:00
|
|
|
{ \
|
|
|
|
ompi_proc_t *proc = ompi_comm_peer_lookup( comm, dst ); \
|
|
|
|
\
|
|
|
|
if( OPAL_LIKELY(NULL != proc) ) { \
|
2015-02-19 23:41:41 +03:00
|
|
|
sendreq = (mca_pml_ob1_send_request_t*) \
|
|
|
|
opal_free_list_wait (&mca_pml_base_send_requests); \
|
2007-07-11 02:16:38 +04:00
|
|
|
sendreq->req_send.req_base.req_proc = proc; \
|
|
|
|
} \
|
|
|
|
}
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
|
2007-07-11 02:16:38 +04:00
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_INIT( sendreq, \
|
|
|
|
buf, \
|
|
|
|
count, \
|
|
|
|
datatype, \
|
|
|
|
dst, \
|
|
|
|
tag, \
|
|
|
|
comm, \
|
|
|
|
sendmode, \
|
|
|
|
persistent) \
|
|
|
|
{ \
|
2014-01-21 19:16:21 +04:00
|
|
|
MCA_PML_BASE_SEND_REQUEST_INIT(&(sendreq)->req_send, \
|
2007-07-11 02:16:38 +04:00
|
|
|
buf, \
|
|
|
|
count, \
|
|
|
|
datatype, \
|
|
|
|
dst, \
|
|
|
|
tag, \
|
|
|
|
comm, \
|
|
|
|
sendmode, \
|
2009-03-24 22:12:53 +03:00
|
|
|
persistent, \
|
2009-04-10 20:36:20 +04:00
|
|
|
0); /* convertor_flags */ \
|
2008-05-11 16:40:55 +04:00
|
|
|
(sendreq)->req_recv.pval = NULL; \
|
2007-07-11 02:16:38 +04:00
|
|
|
}
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2013-04-05 05:40:11 +04:00
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_RESET(sendreq) \
|
2014-01-21 19:16:21 +04:00
|
|
|
if ((sendreq)->req_send.req_bytes_packed > 0) { \
|
2013-04-05 05:40:11 +04:00
|
|
|
size_t _position = 0; \
|
2014-01-21 19:16:21 +04:00
|
|
|
opal_convertor_set_position(&(sendreq)->req_send.req_base.req_convertor, \
|
2013-04-05 05:40:11 +04:00
|
|
|
&_position); \
|
|
|
|
assert( 0 == _position ); \
|
|
|
|
}
|
2005-06-17 22:25:44 +04:00
|
|
|
|
2015-01-06 18:45:08 +03:00
|
|
|
static inline void mca_pml_ob1_free_rdma_resources (mca_pml_ob1_send_request_t* sendreq)
|
2006-07-20 18:44:35 +04:00
|
|
|
{
|
|
|
|
size_t r;
|
|
|
|
|
|
|
|
/* return mpool resources */
|
|
|
|
for(r = 0; r < sendreq->req_rdma_cnt; r++) {
|
2015-01-06 18:45:08 +03:00
|
|
|
struct mca_btl_base_registration_handle_t *handle = sendreq->req_rdma[r].btl_reg;
|
|
|
|
mca_bml_base_btl_t *bml_btl = sendreq->req_rdma[r].bml_btl;
|
|
|
|
|
|
|
|
if (NULL != handle) {
|
|
|
|
mca_bml_base_deregister_mem (bml_btl, handle);
|
|
|
|
sendreq->req_rdma[r].btl_reg = NULL;
|
2006-07-20 18:44:35 +04:00
|
|
|
}
|
2006-10-17 09:01:47 +04:00
|
|
|
}
|
|
|
|
sendreq->req_rdma_cnt = 0;
|
2006-07-20 18:44:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
/**
|
|
|
|
* Start a send request.
|
|
|
|
*/
|
|
|
|
|
2006-07-20 18:44:35 +04:00
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_START(sendreq, rc) \
|
|
|
|
do { \
|
|
|
|
rc = mca_pml_ob1_send_request_start(sendreq); \
|
|
|
|
} while (0)
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2014-01-21 19:16:21 +04:00
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_START_W_SEQ(sendreq, endpoint, seq, rc) \
|
|
|
|
do { \
|
|
|
|
rc = mca_pml_ob1_send_request_start_seq (sendreq, endpoint, seq); \
|
|
|
|
} while (0)
|
|
|
|
|
2005-06-17 22:25:44 +04:00
|
|
|
|
2005-06-10 00:16:33 +04:00
|
|
|
/*
|
2005-09-15 22:47:59 +04:00
|
|
|
* Mark a send request as completed at the MPI level.
|
|
|
|
*/
|
|
|
|
|
2008-05-30 07:58:39 +04:00
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_MPI_COMPLETE(sendreq, with_signal) \
|
|
|
|
do { \
|
|
|
|
(sendreq)->req_send.req_base.req_ompi.req_status.MPI_SOURCE = \
|
|
|
|
(sendreq)->req_send.req_base.req_comm->c_my_rank; \
|
|
|
|
(sendreq)->req_send.req_base.req_ompi.req_status.MPI_TAG = \
|
|
|
|
(sendreq)->req_send.req_base.req_tag; \
|
|
|
|
(sendreq)->req_send.req_base.req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; \
|
2010-07-22 00:07:00 +04:00
|
|
|
(sendreq)->req_send.req_base.req_ompi.req_status._ucount = \
|
|
|
|
(sendreq)->req_send.req_bytes_packed; \
|
2008-05-30 07:58:39 +04:00
|
|
|
ompi_request_complete( &((sendreq)->req_send.req_base.req_ompi), (with_signal) ); \
|
|
|
|
\
|
|
|
|
PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_COMPLETE, \
|
|
|
|
&(sendreq->req_send.req_base), PERUSE_SEND); \
|
2005-09-15 22:47:59 +04:00
|
|
|
} while(0)
|
|
|
|
|
2007-08-30 16:08:33 +04:00
|
|
|
/*
|
|
|
|
* Release resources associated with a request
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define MCA_PML_OB1_SEND_REQUEST_RETURN(sendreq) \
|
|
|
|
do { \
|
2015-01-06 18:45:08 +03:00
|
|
|
/* Let the base handle the reference counts */ \
|
|
|
|
MCA_PML_BASE_SEND_REQUEST_FINI((&(sendreq)->req_send)); \
|
|
|
|
if (sendreq->rdma_frag) { \
|
|
|
|
MCA_PML_OB1_RDMA_FRAG_RETURN (sendreq->rdma_frag); \
|
|
|
|
sendreq->rdma_frag = NULL; \
|
|
|
|
} \
|
2015-02-19 23:41:41 +03:00
|
|
|
opal_free_list_return ( &mca_pml_base_send_requests, \
|
|
|
|
(opal_free_list_item_t*)sendreq); \
|
2007-08-30 16:08:33 +04:00
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
2005-09-15 22:47:59 +04:00
|
|
|
/*
|
|
|
|
* The PML has completed a send request. Note that this request
|
|
|
|
* may have been orphaned by the user or have already completed
|
2007-08-30 16:08:33 +04:00
|
|
|
* at the MPI level.
|
|
|
|
* This function will never be called directly from the upper level, as it
|
|
|
|
* should only be an internal call to the PML.
|
|
|
|
*
|
2005-06-10 00:16:33 +04:00
|
|
|
*/
|
2009-02-28 17:15:34 +03:00
|
|
|
static inline void
|
2007-08-30 16:08:33 +04:00
|
|
|
send_request_pml_complete(mca_pml_ob1_send_request_t *sendreq)
|
|
|
|
{
|
|
|
|
assert(false == sendreq->req_send.req_base.req_pml_complete);
|
|
|
|
|
|
|
|
if(sendreq->req_send.req_bytes_packed > 0) {
|
|
|
|
PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_XFER_END,
|
2009-08-05 07:12:33 +04:00
|
|
|
&(sendreq->req_send.req_base), PERUSE_SEND);
|
2007-08-30 16:08:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* return mpool resources */
|
|
|
|
mca_pml_ob1_free_rdma_resources(sendreq);
|
|
|
|
|
|
|
|
if (sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED &&
|
2008-07-17 08:50:39 +04:00
|
|
|
sendreq->req_send.req_addr != sendreq->req_send.req_base.req_addr) {
|
|
|
|
mca_pml_base_bsend_request_fini((ompi_request_t*)sendreq);
|
2007-08-30 16:08:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
|
|
|
if(false == sendreq->req_send.req_base.req_ompi.req_complete) {
|
|
|
|
/* Should only be called for long messages (maybe synchronous) */
|
2008-05-30 07:58:39 +04:00
|
|
|
MCA_PML_OB1_SEND_REQUEST_MPI_COMPLETE(sendreq, true);
|
2014-06-10 20:24:13 +04:00
|
|
|
} else {
|
|
|
|
if( MPI_SUCCESS != sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR ) {
|
2014-07-03 04:34:44 +04:00
|
|
|
ompi_mpi_abort(&ompi_mpi_comm_world.comm, MPI_ERR_REQUEST);
|
2014-06-10 20:24:13 +04:00
|
|
|
}
|
2007-08-30 16:08:33 +04:00
|
|
|
}
|
|
|
|
sendreq->req_send.req_base.req_pml_complete = true;
|
|
|
|
|
|
|
|
if(sendreq->req_send.req_base.req_free_called) {
|
2008-02-18 20:39:30 +03:00
|
|
|
MCA_PML_OB1_SEND_REQUEST_RETURN(sendreq);
|
2007-08-30 16:08:33 +04:00
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* returns true if request was completed on PML level */
|
2009-02-28 17:15:34 +03:00
|
|
|
static inline bool
|
2007-08-30 16:08:33 +04:00
|
|
|
send_request_pml_complete_check(mca_pml_ob1_send_request_t *sendreq)
|
|
|
|
{
|
2011-03-19 00:36:35 +03:00
|
|
|
#if OPAL_ENABLE_MULTI_THREADS
|
2007-08-30 16:08:33 +04:00
|
|
|
opal_atomic_rmb();
|
2009-06-09 03:55:52 +04:00
|
|
|
#endif
|
2007-08-30 16:08:33 +04:00
|
|
|
/* if no more events are expected for the request and the whole message is
|
|
|
|
* already sent and send fragment scheduling isn't running in another
|
|
|
|
* thread then complete the request on PML level. From now on, if user
|
|
|
|
* called free on this request, the request structure can be reused for
|
|
|
|
* another request or if the request is persistent it can be restarted */
|
|
|
|
if(sendreq->req_state == 0 &&
|
|
|
|
sendreq->req_bytes_delivered >= sendreq->req_send.req_bytes_packed
|
2007-08-30 16:10:04 +04:00
|
|
|
&& lock_send_request(sendreq)) {
|
2007-08-30 16:08:33 +04:00
|
|
|
send_request_pml_complete(sendreq);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
|
2006-07-20 18:44:35 +04:00
|
|
|
/**
|
|
|
|
* Schedule additional fragments
|
|
|
|
*/
|
2007-08-30 16:10:04 +04:00
|
|
|
int
|
2007-09-12 11:08:38 +04:00
|
|
|
mca_pml_ob1_send_request_schedule_once(mca_pml_ob1_send_request_t*);
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
mca_pml_ob1_send_request_schedule_exclusive(mca_pml_ob1_send_request_t* sendreq)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
do {
|
|
|
|
rc = mca_pml_ob1_send_request_schedule_once(sendreq);
|
2012-04-06 18:23:13 +04:00
|
|
|
if(rc == OMPI_ERR_OUT_OF_RESOURCE)
|
2007-09-12 11:08:38 +04:00
|
|
|
break;
|
|
|
|
} while(!unlock_send_request(sendreq));
|
|
|
|
|
|
|
|
if(OMPI_SUCCESS == rc)
|
|
|
|
send_request_pml_complete_check(sendreq);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
2006-07-20 18:44:35 +04:00
|
|
|
|
2007-08-30 16:10:04 +04:00
|
|
|
static inline void
|
|
|
|
mca_pml_ob1_send_request_schedule(mca_pml_ob1_send_request_t* sendreq)
|
2006-07-20 18:44:35 +04:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Only allow one thread in this routine for a given request.
|
|
|
|
* However, we cannot block callers on a mutex, so simply keep track
|
|
|
|
* of the number of times the routine has been called and run through
|
|
|
|
* the scheduling logic once for every call.
|
|
|
|
*/
|
|
|
|
|
2007-08-30 16:10:04 +04:00
|
|
|
if(!lock_send_request(sendreq))
|
|
|
|
return;
|
|
|
|
|
2007-09-12 11:08:38 +04:00
|
|
|
mca_pml_ob1_send_request_schedule_exclusive(sendreq);
|
2006-07-20 18:44:35 +04:00
|
|
|
}
|
2005-07-18 22:54:25 +04:00
|
|
|
|
2013-11-01 16:19:40 +04:00
|
|
|
#if OPAL_CUDA_SUPPORT
|
2012-02-24 06:13:33 +04:00
|
|
|
int mca_pml_ob1_send_request_start_cuda(
|
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
|
|
|
mca_bml_base_btl_t* bml_btl,
|
|
|
|
size_t size);
|
2013-11-01 16:19:40 +04:00
|
|
|
#endif /* OPAL_CUDA_SUPPORT */
|
2012-02-24 06:13:33 +04:00
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
/**
|
2005-07-19 01:22:55 +04:00
|
|
|
* Start the specified request
|
2005-06-01 18:34:22 +04:00
|
|
|
*/
|
|
|
|
|
2005-09-14 21:08:08 +04:00
|
|
|
int mca_pml_ob1_send_request_start_buffered(
|
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
2005-09-15 22:47:59 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl,
|
|
|
|
size_t size);
|
2005-09-14 21:08:08 +04:00
|
|
|
|
2005-08-13 01:33:01 +04:00
|
|
|
int mca_pml_ob1_send_request_start_copy(
|
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
2005-09-15 22:47:59 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl,
|
|
|
|
size_t size);
|
2005-08-13 01:33:01 +04:00
|
|
|
|
|
|
|
int mca_pml_ob1_send_request_start_prepare(
|
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
2005-09-15 22:47:59 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl,
|
|
|
|
size_t size);
|
|
|
|
|
|
|
|
int mca_pml_ob1_send_request_start_rdma(
|
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
|
|
|
mca_bml_base_btl_t* bml_btl,
|
|
|
|
size_t size);
|
|
|
|
|
|
|
|
int mca_pml_ob1_send_request_start_rndv(
|
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
|
|
|
mca_bml_base_btl_t* bml_btl,
|
2005-11-11 18:33:25 +03:00
|
|
|
size_t size,
|
|
|
|
int flags);
|
2005-06-01 18:34:22 +04:00
|
|
|
|
2007-07-11 03:45:23 +04:00
|
|
|
static inline int
|
|
|
|
mca_pml_ob1_send_request_start_btl( mca_pml_ob1_send_request_t* sendreq,
|
|
|
|
mca_bml_base_btl_t* bml_btl )
|
2006-07-20 18:44:35 +04:00
|
|
|
{
|
|
|
|
size_t size = sendreq->req_send.req_bytes_packed;
|
2008-10-01 01:02:37 +04:00
|
|
|
mca_btl_base_module_t* btl = bml_btl->btl;
|
|
|
|
size_t eager_limit = btl->btl_eager_limit - sizeof(mca_pml_ob1_hdr_t);
|
2006-07-20 18:44:35 +04:00
|
|
|
int rc;
|
|
|
|
|
2013-12-06 18:35:10 +04:00
|
|
|
#if OPAL_CUDA_GDR_SUPPORT
|
2013-11-13 17:22:39 +04:00
|
|
|
if (btl->btl_cuda_eager_limit && (sendreq->req_send.req_base.req_convertor.flags & CONVERTOR_CUDA)) {
|
|
|
|
eager_limit = btl->btl_cuda_eager_limit - sizeof(mca_pml_ob1_hdr_t);
|
|
|
|
}
|
2013-12-06 18:35:10 +04:00
|
|
|
#endif /* OPAL_CUDA_GDR_SUPPORT */
|
2013-11-13 17:22:39 +04:00
|
|
|
|
2007-07-11 03:45:23 +04:00
|
|
|
if( OPAL_LIKELY(size <= eager_limit) ) {
|
2006-07-20 18:44:35 +04:00
|
|
|
switch(sendreq->req_send.req_send_mode) {
|
|
|
|
case MCA_PML_BASE_SEND_SYNCHRONOUS:
|
|
|
|
rc = mca_pml_ob1_send_request_start_rndv(sendreq, bml_btl, size, 0);
|
|
|
|
break;
|
|
|
|
case MCA_PML_BASE_SEND_BUFFERED:
|
|
|
|
rc = mca_pml_ob1_send_request_start_copy(sendreq, bml_btl, size);
|
|
|
|
break;
|
|
|
|
case MCA_PML_BASE_SEND_COMPLETE:
|
|
|
|
rc = mca_pml_ob1_send_request_start_prepare(sendreq, bml_btl, size);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (size != 0 && bml_btl->btl_flags & MCA_BTL_FLAGS_SEND_INPLACE) {
|
|
|
|
rc = mca_pml_ob1_send_request_start_prepare(sendreq, bml_btl, size);
|
|
|
|
} else {
|
|
|
|
rc = mca_pml_ob1_send_request_start_copy(sendreq, bml_btl, size);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
2008-09-30 19:47:43 +04:00
|
|
|
size = eager_limit;
|
2008-10-01 01:02:37 +04:00
|
|
|
if(OPAL_UNLIKELY(btl->btl_rndv_eager_limit < eager_limit))
|
|
|
|
size = btl->btl_rndv_eager_limit;
|
2006-07-20 18:44:35 +04:00
|
|
|
if(sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED) {
|
|
|
|
rc = mca_pml_ob1_send_request_start_buffered(sendreq, bml_btl, size);
|
|
|
|
} else if
|
- Split the datatype engine into two parts: an MPI specific part in
OMPI
and a language agnostic part in OPAL. The convertor is completely
moved into OPAL. This offers several benefits as described in RFC
http://www.open-mpi.org/community/lists/devel/2009/07/6387.php
namely:
- Fewer basic types (int* and float* types, boolean and wchar
- Fixing naming scheme to ompi-nomenclature.
- Usability outside of the ompi-layer.
- Due to the fixed nature of simple opal types, their information is
completely
known at compile time and therefore constified
- With fewer datatypes (22), the actual sizes of bit-field types may be
reduced
from 64 to 32 bits, allowing reorganizing the opal_datatype
structure, eliminating holes and keeping data required in convertor
(upon send/recv) in one cacheline...
This has implications to the convertor-datastructure and other parts
of the code.
- Several performance tests have been run, the netpipe latency does not
change with
this patch on Linux/x86-64 on the smoky cluster.
- Extensive tests have been done to verify correctness (no new
regressions) using:
1. mpi_test_suite on linux/x86-64 using clean ompi-trunk and
ompi-ddt:
a. running both trunk and ompi-ddt resulted in no differences
(except for MPI_SHORT_INT and MPI_TYPE_MIX_LB_UB do now run
correctly).
b. with --enable-memchecker and running under valgrind (one buglet
when run with static found in test-suite, commited)
2. ibm testsuite on linux/x86-64 using clean ompi-trunk and ompi-ddt:
all passed (except for the dynamic/ tests failed!! as trunk/MTT)
3. compilation and usage of HDF5 tests on Jaguar using PGI and
PathScale compilers.
4. compilation and usage on Scicortex.
- Please note, that for the heterogeneous case, (-m32 compiled
binaries/ompi), neither
ompi-trunk, nor ompi-ddt branch would successfully launch.
This commit was SVN r21641.
2009-07-13 08:56:31 +04:00
|
|
|
(opal_convertor_need_buffers(&sendreq->req_send.req_base.req_convertor) == false) {
|
2007-03-31 02:02:45 +04:00
|
|
|
unsigned char *base;
|
- Split the datatype engine into two parts: an MPI specific part in
OMPI
and a language agnostic part in OPAL. The convertor is completely
moved into OPAL. This offers several benefits as described in RFC
http://www.open-mpi.org/community/lists/devel/2009/07/6387.php
namely:
- Fewer basic types (int* and float* types, boolean and wchar
- Fixing naming scheme to ompi-nomenclature.
- Usability outside of the ompi-layer.
- Due to the fixed nature of simple opal types, their information is
completely
known at compile time and therefore constified
- With fewer datatypes (22), the actual sizes of bit-field types may be
reduced
from 64 to 32 bits, allowing reorganizing the opal_datatype
structure, eliminating holes and keeping data required in convertor
(upon send/recv) in one cacheline...
This has implications to the convertor-datastructure and other parts
of the code.
- Several performance tests have been run, the netpipe latency does not
change with
this patch on Linux/x86-64 on the smoky cluster.
- Extensive tests have been done to verify correctness (no new
regressions) using:
1. mpi_test_suite on linux/x86-64 using clean ompi-trunk and
ompi-ddt:
a. running both trunk and ompi-ddt resulted in no differences
(except for MPI_SHORT_INT and MPI_TYPE_MIX_LB_UB do now run
correctly).
b. with --enable-memchecker and running under valgrind (one buglet
when run with static found in test-suite, commited)
2. ibm testsuite on linux/x86-64 using clean ompi-trunk and ompi-ddt:
all passed (except for the dynamic/ tests failed!! as trunk/MTT)
3. compilation and usage of HDF5 tests on Jaguar using PGI and
PathScale compilers.
4. compilation and usage on Scicortex.
- Please note, that for the heterogeneous case, (-m32 compiled
binaries/ompi), neither
ompi-trunk, nor ompi-ddt branch would successfully launch.
This commit was SVN r21641.
2009-07-13 08:56:31 +04:00
|
|
|
opal_convertor_get_current_pointer( &sendreq->req_send.req_base.req_convertor, (void**)&base );
|
2013-09-18 04:07:58 +04:00
|
|
|
|
2006-10-20 07:57:44 +04:00
|
|
|
if( 0 != (sendreq->req_rdma_cnt = (uint32_t)mca_pml_ob1_rdma_btls(
|
2007-07-11 03:45:23 +04:00
|
|
|
sendreq->req_endpoint,
|
|
|
|
base,
|
|
|
|
sendreq->req_send.req_bytes_packed,
|
|
|
|
sendreq->req_rdma))) {
|
2006-07-20 18:44:35 +04:00
|
|
|
rc = mca_pml_ob1_send_request_start_rdma(sendreq, bml_btl,
|
2007-07-11 03:45:23 +04:00
|
|
|
sendreq->req_send.req_bytes_packed);
|
|
|
|
if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) {
|
2006-07-20 18:44:35 +04:00
|
|
|
mca_pml_ob1_free_rdma_resources(sendreq);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
rc = mca_pml_ob1_send_request_start_rndv(sendreq, bml_btl, size,
|
2007-07-11 03:45:23 +04:00
|
|
|
MCA_PML_OB1_HDR_FLAGS_CONTIG);
|
2006-07-20 18:44:35 +04:00
|
|
|
}
|
|
|
|
} else {
|
2013-11-01 16:19:40 +04:00
|
|
|
#if OPAL_CUDA_SUPPORT
|
2011-08-04 14:15:45 +04:00
|
|
|
if (sendreq->req_send.req_base.req_convertor.flags & CONVERTOR_CUDA) {
|
2012-02-24 06:13:33 +04:00
|
|
|
return mca_pml_ob1_send_request_start_cuda(sendreq, bml_btl, size);
|
2011-08-04 14:15:45 +04:00
|
|
|
}
|
2013-11-01 16:19:40 +04:00
|
|
|
#endif /* OPAL_CUDA_SUPPORT */
|
2006-07-20 18:44:35 +04:00
|
|
|
rc = mca_pml_ob1_send_request_start_rndv(sendreq, bml_btl, size, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2007-07-11 03:45:23 +04:00
|
|
|
static inline int
|
2014-01-21 19:16:21 +04:00
|
|
|
mca_pml_ob1_send_request_start_seq (mca_pml_ob1_send_request_t* sendreq, mca_bml_base_endpoint_t* endpoint, int32_t seqn)
|
|
|
|
{
|
2006-10-18 20:11:50 +04:00
|
|
|
sendreq->req_endpoint = endpoint;
|
|
|
|
sendreq->req_state = 0;
|
2007-08-30 16:08:33 +04:00
|
|
|
sendreq->req_lock = 0;
|
2006-07-20 18:44:35 +04:00
|
|
|
sendreq->req_pipeline_depth = 0;
|
|
|
|
sendreq->req_bytes_delivered = 0;
|
|
|
|
sendreq->req_pending = MCA_PML_OB1_SEND_PENDING_NONE;
|
2014-01-21 19:16:21 +04:00
|
|
|
sendreq->req_send.req_base.req_sequence = seqn;
|
2006-07-20 18:44:35 +04:00
|
|
|
|
|
|
|
MCA_PML_BASE_SEND_START( &sendreq->req_send.req_base );
|
|
|
|
|
2014-01-21 19:16:21 +04:00
|
|
|
for(size_t i = 0; i < mca_bml_base_btl_array_get_size(&endpoint->btl_eager); i++) {
|
2006-07-20 18:44:35 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* select a btl */
|
|
|
|
bml_btl = mca_bml_base_btl_array_get_next(&endpoint->btl_eager);
|
|
|
|
rc = mca_pml_ob1_send_request_start_btl(sendreq, bml_btl);
|
2012-04-06 18:23:13 +04:00
|
|
|
if( OPAL_LIKELY(OMPI_ERR_OUT_OF_RESOURCE != rc) )
|
2006-07-20 18:44:35 +04:00
|
|
|
return rc;
|
|
|
|
}
|
2007-08-30 16:10:04 +04:00
|
|
|
add_request_to_send_pending(sendreq, MCA_PML_OB1_SEND_PENDING_START, true);
|
2006-07-20 18:44:35 +04:00
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2014-01-21 19:16:21 +04:00
|
|
|
static inline int
|
|
|
|
mca_pml_ob1_send_request_start( mca_pml_ob1_send_request_t* sendreq )
|
|
|
|
{
|
|
|
|
mca_bml_base_endpoint_t* endpoint = (mca_bml_base_endpoint_t*)
|
|
|
|
sendreq->req_send.req_base.req_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML];
|
|
|
|
mca_pml_ob1_comm_t* comm = sendreq->req_send.req_base.req_comm->c_pml_comm;
|
|
|
|
int32_t seqn;
|
|
|
|
|
|
|
|
if (OPAL_UNLIKELY(NULL == endpoint)) {
|
|
|
|
return OMPI_ERR_UNREACH;
|
|
|
|
}
|
|
|
|
|
|
|
|
seqn = OPAL_THREAD_ADD32(&comm->procs[sendreq->req_send.req_base.req_peer].send_sequence, 1);
|
|
|
|
|
|
|
|
return mca_pml_ob1_send_request_start_seq (sendreq, endpoint, seqn);
|
|
|
|
}
|
|
|
|
|
2005-06-09 07:11:51 +04:00
|
|
|
/**
|
2005-07-19 01:22:55 +04:00
|
|
|
* Initiate a put scheduled by the receiver.
|
2005-06-09 07:11:51 +04:00
|
|
|
*/
|
|
|
|
|
2007-07-11 03:45:23 +04:00
|
|
|
void mca_pml_ob1_send_request_put( mca_pml_ob1_send_request_t* sendreq,
|
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
mca_pml_ob1_rdma_hdr_t* hdr );
|
2005-06-09 07:11:51 +04:00
|
|
|
|
2006-10-29 12:12:24 +03:00
|
|
|
int mca_pml_ob1_send_request_put_frag(mca_pml_ob1_rdma_frag_t* frag);
|
|
|
|
|
|
|
|
/* This function tries to continue sendreq that was stuck because of resource
|
|
|
|
* unavailability. A sendreq may be added to send_pending list if there is no
|
|
|
|
* resource to send initial packet or there is not resource to schedule data
|
|
|
|
* for sending. The reason the sendreq was added to the list is stored inside
|
|
|
|
* sendreq struct and appropriate operation is retried when resource became
|
|
|
|
* available. bml_btl passed to the function doesn't represents sendreq
|
|
|
|
* destination, it represents BTL on which resource was freed, so only this BTL
|
|
|
|
* should be considered for sending packets */
|
|
|
|
void mca_pml_ob1_send_request_process_pending(mca_bml_base_btl_t *bml_btl);
|
2006-07-20 18:44:35 +04:00
|
|
|
|
2007-07-11 02:16:38 +04:00
|
|
|
void mca_pml_ob1_send_request_copy_in_out(mca_pml_ob1_send_request_t *sendreq,
|
2007-06-03 12:30:07 +04:00
|
|
|
uint64_t send_offset, uint64_t send_length);
|
2007-07-11 02:16:38 +04:00
|
|
|
|
|
|
|
END_C_DECLS
|
|
|
|
|
2008-05-30 07:58:39 +04:00
|
|
|
#endif /* OMPI_PML_OB1_SEND_REQUEST_H */
|