1
1

* Make triggered protocol only work for non-wildcard receives

* Always encode length in header data to make probe work
* General send/receive cleanups
* Implement iprobe

This commit was SVN r25197.
Этот коммит содержится в:
Brian Barrett 2011-09-27 22:45:00 +00:00
родитель 77c560be42
Коммит 211b5c7824
8 изменённых файлов: 303 добавлений и 203 удалений

Просмотреть файл

@ -104,8 +104,6 @@ ompi_mtl_portals4_add_procs(struct mca_mtl_base_module_t *mtl,
}
mtl_peer_data[i]->ptl_proc = *id;
mtl_peer_data[i]->send_count = 0;
mtl_peer_data[i]->recv_count = 0;
}
return OMPI_SUCCESS;
@ -163,7 +161,7 @@ ompi_mtl_portals4_progress(void)
{
int count = 0, ret;
ptl_event_t ev;
ompi_mtl_portals4_request_t *ptl_request;
ompi_mtl_portals4_base_request_t *ptl_request;
while (true) {
ret = PtlEQGet(ompi_mtl_portals4.eq_h, &ev);

Просмотреть файл

@ -57,6 +57,9 @@ struct mca_mtl_portals4_module_t {
opal_list_t recv_short_blocks;
/* note: this isn't entirely accurate... it's really long op count */
uint32_t opcount;
enum { eager, rndv, triggered } protocol;
};
typedef struct mca_mtl_portals4_module_t mca_mtl_portals4_module_t;
@ -136,6 +139,14 @@ extern mca_mtl_portals4_module_t ompi_mtl_portals4;
#define PTL_GET_TAG(match_bits) ((int)(match_bits & PTL_TAG_MASK))
#define PTL_GET_SOURCE(match_bits) ((int)((match_bits & PTL_SOURCE_MASK) >> 32))
#define MTL_PORTALS4_SET_HDR_DATA(hdr_data, opcount, length) \
{ \
hdr_data = ((length << 16) | (opcount & 0xFFFF)); \
}
#define MTL_PORTALS4_GET_LENGTH(hdr_data) (hdr_data >> 16)
/* MTL interface functions */
extern int ompi_mtl_portals4_finalize(struct mca_mtl_base_module_t *mtl);

Просмотреть файл

@ -22,8 +22,6 @@
struct mca_mtl_base_endpoint_t {
ptl_process_t ptl_proc;
int32_t send_count;
int32_t recv_count;
};
typedef struct mca_mtl_base_endpoint_t mca_mtl_base_endpoint_t;

Просмотреть файл

@ -19,8 +19,32 @@
#include "ompi_config.h"
#include "ompi/communicator/communicator.h"
#include "mtl_portals4.h"
#include "mtl_portals4_request.h"
#include "mtl_portals4_endpoint.h"
static int
completion_fn(ptl_event_t *ev, ompi_mtl_portals4_base_request_t *ptl_base_request)
{
ompi_mtl_portals4_probe_request_t *ptl_request =
(ompi_mtl_portals4_probe_request_t*) ptl_base_request;
if (ev->ni_fail_type == PTL_OK) {
/* set the status */
ptl_request->status.MPI_SOURCE = PTL_GET_SOURCE(ev->match_bits);
ptl_request->status.MPI_TAG = PTL_GET_TAG(ev->match_bits);
ptl_request->status.MPI_ERROR = MPI_SUCCESS;
ptl_request->status._ucount = MTL_PORTALS4_GET_LENGTH(ev->hdr_data);
ptl_request->found_match = 1;
} else {
ptl_request->found_match = 0;
}
opal_atomic_wmb();
ptl_request->req_complete = 1;
return OMPI_SUCCESS;
}
int
ompi_mtl_portals4_iprobe(struct mca_mtl_base_module_t* mtl,
@ -30,9 +54,61 @@ ompi_mtl_portals4_iprobe(struct mca_mtl_base_module_t* mtl,
int *flag,
struct ompi_status_public_t *status)
{
/* BWB: FIX ME: implement */
opal_output(ompi_mtl_base_output,
"%s:%d: iprobe failed: not implemented\n",
__FILE__, __LINE__);
struct ompi_mtl_portals4_probe_request_t request;
mca_mtl_base_endpoint_t *endpoint = NULL;
ptl_me_t me;
ptl_process_t remote_proc;
ptl_match_bits_t match_bits, ignore_bits;
int ret;
if (MPI_ANY_SOURCE == src) {
remote_proc.phys.nid = PTL_NID_ANY;
remote_proc.phys.pid = PTL_PID_ANY;
} else {
ompi_proc_t* ompi_proc = ompi_comm_peer_lookup( comm, src );
endpoint = (mca_mtl_base_endpoint_t*) ompi_proc->proc_pml;
remote_proc = endpoint->ptl_proc;
}
PTL_SET_RECV_BITS(match_bits, ignore_bits, comm->c_contextid,
src, tag);
me.start = NULL;
me.length = 0;
me.ct_handle = PTL_CT_NONE;
me.min_free = 0;
me.uid = PTL_UID_ANY;
me.options = PTL_ME_OP_PUT;
me.match_id = remote_proc;
me.match_bits = match_bits;
me.ignore_bits = ignore_bits;
request.super.event_callback = completion_fn;
request.req_complete = 0;
request.found_match = 0;
opal_atomic_wmb();
ret = PtlMESearch(ompi_mtl_portals4.ni_h,
ompi_mtl_portals4.send_idx,
&me,
PTL_SEARCH_ONLY,
&request);
if (PTL_OK != ret) {
opal_output(ompi_mtl_base_output,
"%s:%d: PtlMESearch failed: %d",
__FILE__, __LINE__, ret);
return ompi_mtl_portals4_get_error(ret);
}
while (0 == request.req_complete) {
opal_progress();
}
*flag = request.found_match;
if (1 == *flag) {
*status = request.status;
}
return OMPI_ERR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -35,27 +35,31 @@
/* called when a receive should be progressed */
int
ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
ompi_mtl_portals4_request_t* ptl_request)
ompi_mtl_portals4_base_request_t* ptl_base_request)
{
int ret;
ompi_mtl_portals4_recv_request_t *ptl_request =
(ompi_mtl_portals4_recv_request_t*) ptl_base_request;
switch (ev->type) {
case PTL_EVENT_PUT:
if (ev->ni_fail_type == PTL_NI_OK) {
size_t msg_length = MTL_PORTALS4_GET_LENGTH(ev->hdr_data);
/* set the status */
ptl_request->super.super.ompi_req->req_status.MPI_SOURCE =
PTL_GET_SOURCE(ev->match_bits);
ptl_request->super.super.ompi_req->req_status.MPI_TAG =
PTL_GET_TAG(ev->match_bits);
if (msg_length > ptl_request->delivery_len) {
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = MPI_ERR_TRUNCATE;
}
if (!PTL_IS_SHORT_MSG(ev->match_bits) && ompi_mtl_portals4.protocol == rndv) {
ptl_md_t md;
ev->rlength = ev->hdr_data & 0xFFFFFFFFULL;
ptl_request->super.ompi_req->req_status.MPI_SOURCE =
PTL_GET_SOURCE(ev->match_bits);
ptl_request->super.ompi_req->req_status.MPI_TAG =
PTL_GET_TAG(ev->match_bits);
if (ev->rlength > ptl_request->delivery_len) {
ptl_request->super.ompi_req->req_status.MPI_ERROR = MPI_ERR_TRUNCATE;
}
md.start = (char*) ptl_request->delivery_ptr + ompi_mtl_portals4.eager_limit;
md.length = ((ev->rlength > ptl_request->delivery_len) ?
ptl_request->delivery_len : ev->rlength) - ompi_mtl_portals4.eager_limit;
md.length = ((msg_length > ptl_request->delivery_len) ?
ptl_request->delivery_len : msg_length) - ompi_mtl_portals4.eager_limit;
md.options = 0;
md.eq_handle = ompi_mtl_portals4.eq_h;
md.ct_handle = PTL_CT_NONE;
@ -68,9 +72,9 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
opal_output(ompi_mtl_base_output,
"%s:%d: PtlMDBind failed: %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR =
ptl_request->super.super.ompi_req->req_status.MPI_ERROR =
ompi_mtl_portals4_get_error(ret);;
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.completion_callback(&ptl_request->super.super);
return OMPI_SUCCESS;
}
@ -93,18 +97,14 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
__FILE__, __LINE__, ret);
}
if (NULL != ptl_request->buffer_ptr) free(ptl_request->buffer_ptr);
ptl_request->super.ompi_req->req_status.MPI_ERROR =
ptl_request->super.super.ompi_req->req_status.MPI_ERROR =
ompi_mtl_portals4_get_error(ret);
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.completion_callback(&ptl_request->super.super);
return OMPI_SUCCESS;
}
break;
} else if (!PTL_IS_SHORT_MSG(ev->match_bits) && ompi_mtl_portals4.protocol == triggered) {
ptl_request->super.ompi_req->req_status.MPI_SOURCE =
PTL_GET_SOURCE(ev->match_bits);
ptl_request->super.ompi_req->req_status.MPI_TAG =
PTL_GET_TAG(ev->match_bits);
break;
} else {
/* make sure the data is in the right place */
@ -115,27 +115,18 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
opal_output(ompi_mtl_base_output,
"%s:%d: ompi_mtl_datatype_unpack failed: %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR = ret;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = ret;
}
/* set the status */
ptl_request->super.ompi_req->req_status.MPI_SOURCE =
PTL_GET_SOURCE(ev->match_bits);
ptl_request->super.ompi_req->req_status.MPI_TAG =
PTL_GET_TAG(ev->match_bits);
if (ev->rlength > ev->mlength) {
ptl_request->super.ompi_req->req_status.MPI_ERROR = MPI_ERR_TRUNCATE;
}
ptl_request->super.ompi_req->req_status._ucount =
ev->mlength;
ptl_request->super.super.ompi_req->req_status._ucount = ev->mlength;
}
} else {
opal_output(ompi_mtl_base_output,
"%s:%d: recv(PTL_EVENT_PUT) ni_fail_type: %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
}
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "recv completed"));
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.completion_callback(&ptl_request->super.super);
break;
case PTL_EVENT_REPLY:
@ -148,21 +139,19 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
opal_output(ompi_mtl_base_output,
"%s:%d: ompi_mtl_datatype_unpack failed: %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR = ret;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = ret;
}
/* set the status - most of this filled in right after issuing
the PtlGet */
ptl_request->super.ompi_req->req_status._ucount =
ev->mlength;
ptl_request->super.super.ompi_req->req_status._ucount = ev->mlength;
if (ompi_mtl_portals4.protocol == rndv || ompi_mtl_portals4.protocol == triggered) {
ptl_request->super.ompi_req->req_status._ucount +=
ptl_request->super.super.ompi_req->req_status._ucount +=
ompi_mtl_portals4.eager_limit;
}
} else {
opal_output(ompi_mtl_base_output,
"%s:%d: recv(PTL_EVENT_REPLY) ni_fail_type: %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
}
ret = PtlMDRelease(ptl_request->md_h);
if (PTL_OK != ret) {
@ -179,23 +168,24 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
}
}
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "recv completed"));
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.completion_callback(&ptl_request->super.super);
break;
case PTL_EVENT_PUT_OVERFLOW:
/* overflow case. Short messages have the buffer stashed
somewhere. Long messages left in buffer at the source */
if (PTL_IS_SHORT_MSG(ev->match_bits)) {
if (ev->ni_fail_type == PTL_NI_OK) {
ptl_request->super.ompi_req->req_status.MPI_SOURCE =
PTL_GET_SOURCE(ev->match_bits);
ptl_request->super.ompi_req->req_status.MPI_TAG =
PTL_GET_TAG(ev->match_bits);
if (ev->rlength > ptl_request->delivery_len) {
ptl_request->super.ompi_req->req_status.MPI_ERROR = MPI_ERR_TRUNCATE;
}
ptl_request->super.ompi_req->req_status._ucount =
ev->mlength;
if (ev->ni_fail_type == PTL_NI_OK) {
size_t msg_length = MTL_PORTALS4_GET_LENGTH(ev->hdr_data);
ptl_request->super.super.ompi_req->req_status.MPI_SOURCE =
PTL_GET_SOURCE(ev->match_bits);
ptl_request->super.super.ompi_req->req_status.MPI_TAG =
PTL_GET_TAG(ev->match_bits);
if (msg_length > ptl_request->delivery_len) {
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = MPI_ERR_TRUNCATE;
}
if (PTL_IS_SHORT_MSG(ev->match_bits)) {
ptl_request->super.super.ompi_req->req_status._ucount = ev->mlength;
if (ev->mlength > 0) {
struct iovec iov;
uint32_t iov_count = 1;
@ -212,8 +202,8 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
"%s:%d: opal_convertor_unpack failed: %d",
__FILE__, __LINE__, ret);
if (NULL != ptl_request->buffer_ptr) free(ptl_request->buffer_ptr);
ptl_request->super.ompi_req->req_status.MPI_ERROR = ret;
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = ret;
ptl_request->super.super.completion_callback(&ptl_request->super.super);
return OMPI_SUCCESS;
}
}
@ -235,46 +225,23 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
opal_output(ompi_mtl_base_output,
"%s:%d: PtlPut failed: %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR =
ptl_request->super.super.ompi_req->req_status.MPI_ERROR =
ompi_mtl_portals4_get_error(ret);;
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.completion_callback(&ptl_request->super.super);
return OMPI_SUCCESS;
}
}
} else {
opal_output(ompi_mtl_base_output,
"%s:%d: recv(PTL_EVENT_PUT_OVERFLOW) ni_fail_type: %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
}
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "recv completed"));
ptl_request->super.completion_callback(&ptl_request->super);
} else {
ptl_md_t md;
if (ev->ni_fail_type == PTL_NI_OK) {
/* set the status */
ptl_request->super.ompi_req->req_status.MPI_SOURCE =
PTL_GET_SOURCE(ev->match_bits);
ptl_request->super.ompi_req->req_status.MPI_TAG =
PTL_GET_TAG(ev->match_bits);
ptl_md_t md;
if (ompi_mtl_portals4.protocol == triggered) {
break;
}
if (ompi_mtl_portals4.protocol == rndv) {
ev->rlength = ev->hdr_data & 0xFFFFFFFFULL;
}
if (ev->rlength > ptl_request->delivery_len) {
ptl_request->super.ompi_req->req_status.MPI_ERROR = MPI_ERR_TRUNCATE;
}
md.start = (char*) ptl_request->delivery_ptr + ev->mlength;
md.length = ((ev->rlength > ptl_request->delivery_len) ?
ptl_request->delivery_len : ev->rlength) - ev->mlength;
md.length = ((msg_length > ptl_request->delivery_len) ?
ptl_request->delivery_len : msg_length) - ev->mlength;
md.options = 0;
md.eq_handle = ompi_mtl_portals4.eq_h;
md.ct_handle = PTL_CT_NONE;
@ -287,9 +254,9 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
opal_output(ompi_mtl_base_output,
"%s:%d: PtlMDBind failed: %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR =
ptl_request->super.super.ompi_req->req_status.MPI_ERROR =
ompi_mtl_portals4_get_error(ret);;
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.completion_callback(&ptl_request->super.super);
return OMPI_SUCCESS;
}
@ -312,18 +279,18 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
"%s:%d: PtlMDRelease failed: %d",
__FILE__, __LINE__, ret);
}
ptl_request->super.ompi_req->req_status.MPI_ERROR =
ompi_mtl_portals4_get_error(ret);;
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.ompi_req->req_status.MPI_ERROR =
ompi_mtl_portals4_get_error(ret);
ptl_request->super.super.completion_callback(&ptl_request->super.super);
return OMPI_SUCCESS;
}
} else {
opal_output(ompi_mtl_base_output,
"%s:%d: recv(PTL_EVENT_PUT_OVERFLOW) ni_fail_type: %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.completion_callback(&ptl_request->super);
}
} else {
opal_output(ompi_mtl_base_output,
"%s:%d: recv(PTL_EVENT_PUT_OVERFLOW) ni_fail_type: %d",
__FILE__, __LINE__, ret);
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.super.completion_callback(&ptl_request->super.super);
}
break;
@ -350,8 +317,8 @@ ompi_mtl_portals4_irecv(struct mca_mtl_base_module_t* mtl,
int ret = OMPI_SUCCESS;
ptl_process_t remote_proc;
mca_mtl_base_endpoint_t *endpoint = NULL;
ompi_mtl_portals4_request_t *ptl_request =
(ompi_mtl_portals4_request_t*) mtl_request;
ompi_mtl_portals4_recv_request_t *ptl_request =
(ompi_mtl_portals4_recv_request_t*) mtl_request;
void *start;
size_t length;
bool free_after;
@ -367,7 +334,10 @@ ompi_mtl_portals4_irecv(struct mca_mtl_base_module_t* mtl,
ompi_proc_t* ompi_proc = ompi_comm_peer_lookup( comm, src );
endpoint = (mca_mtl_base_endpoint_t*) ompi_proc->proc_pml;
remote_proc = endpoint->ptl_proc;
endpoint->recv_count++;
}
if (MPI_ANY_TAG == tag && ompi_mtl_portals4.protocol == triggered) {
printf("Brian broke any_tag with triggered rndv\n"); abort();
}
PTL_SET_RECV_BITS(match_bits, ignore_bits, comm->c_contextid,
@ -381,27 +351,23 @@ ompi_mtl_portals4_irecv(struct mca_mtl_base_module_t* mtl,
return ret;
}
ptl_request->event_callback = ompi_mtl_portals4_recv_progress;
ptl_request->super.event_callback = ompi_mtl_portals4_recv_progress;
ptl_request->buffer_ptr = (free_after) ? start : NULL;
ptl_request->convertor = convertor;
ptl_request->delivery_ptr = start;
ptl_request->delivery_len = length;
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_SUCCESS;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_SUCCESS;
if (MPI_ANY_SOURCE == src) {
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output,
"ANY_SOURCE Recv of length %d\n",
(int)length));
} else {
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output,
"Recv %d from %x,%x of length %d\n",
endpoint->recv_count,
endpoint->ptl_proc.phys.nid, endpoint->ptl_proc.phys.pid,
(int)length));
}
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output,
"Recv from %x,%x of length %d\n",
remote_proc.phys.nid, remote_proc.phys.pid,
(int)length));
if (ompi_mtl_portals4.protocol == triggered && length > ompi_mtl_portals4.eager_limit) {
ptl_md_t md;
ptl_match_bits_t match_bits;
PTL_SET_SEND_BITS(match_bits, comm->c_contextid, src, tag, PTL_LONG_MSG);
ret = PtlCTAlloc(ompi_mtl_portals4.ni_h,
&ptl_request->ct_h);
@ -433,7 +399,7 @@ ompi_mtl_portals4_irecv(struct mca_mtl_base_module_t* mtl,
length - ompi_mtl_portals4.eager_limit,
remote_proc,
ompi_mtl_portals4.read_idx,
endpoint->recv_count,
match_bits,
ompi_mtl_portals4.eager_limit,
ptl_request,
ptl_request->ct_h,

Просмотреть файл

@ -40,6 +40,6 @@ ompi_mtl_portals4_recv_short_block_repost(ptl_event_t *ev);
extern int
ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
ompi_mtl_portals4_request_t* ptl_request);
ompi_mtl_portals4_base_request_t* ptl_bae_request);
#endif /* OMPI_MTL_PORTALS_RECV_SHORT_H */

Просмотреть файл

@ -23,17 +23,52 @@
#include "opal/datatype/opal_convertor.h"
#include "ompi/mca/mtl/mtl.h"
struct ompi_mtl_portals4_request_t {
struct ompi_mtl_portals4_base_request_t {
struct mca_mtl_request_t super;
int (*event_callback)(ptl_event_t *ev, struct ompi_mtl_portals4_request_t*);
void *buffer_ptr; /* send and receive side */
ptl_handle_md_t md_h; /* send and receive side */
ptl_handle_me_t me_h; /* send and receive side */
int (*event_callback)(ptl_event_t *ev, struct ompi_mtl_portals4_base_request_t*);
};
typedef struct ompi_mtl_portals4_base_request_t ompi_mtl_portals4_base_request_t;
struct ompi_mtl_portals4_send_request_t {
ompi_mtl_portals4_base_request_t super;
void *buffer_ptr;
ptl_handle_md_t md_h;
ptl_handle_me_t me_h;
volatile int event_count;
};
typedef struct ompi_mtl_portals4_send_request_t ompi_mtl_portals4_send_request_t;
struct ompi_mtl_portals4_recv_request_t {
ompi_mtl_portals4_base_request_t super;
void *buffer_ptr;
ptl_handle_md_t md_h;
ptl_handle_me_t me_h;
ptl_handle_ct_t ct_h;
int event_count; /* send side */
struct opal_convertor_t *convertor; /* recv side */
void *delivery_ptr; /* recv side */
size_t delivery_len; /* recv side */
struct opal_convertor_t *convertor;
void *delivery_ptr;
size_t delivery_len;
};
typedef struct ompi_mtl_portals4_recv_request_t ompi_mtl_portals4_recv_request_t;
struct ompi_mtl_portals4_probe_request_t {
ompi_mtl_portals4_base_request_t super;
volatile int req_complete;
int found_match;
struct ompi_status_public_t status;
};
typedef struct ompi_mtl_portals4_probe_request_t ompi_mtl_portals4_probe_request_t;
struct ompi_mtl_portals4_request_t {
union {
ompi_mtl_portals4_send_request_t send;
ompi_mtl_portals4_recv_request_t recv;
ompi_mtl_portals4_probe_request_t probe;
} u;
};
typedef struct ompi_mtl_portals4_request_t ompi_mtl_portals4_request_t;

Просмотреть файл

@ -31,18 +31,20 @@
/* called when no ack is necessary */
static int
ompi_mtl_portals4_short_callback(ptl_event_t *ev, ompi_mtl_portals4_request_t *ptl_request)
ompi_mtl_portals4_short_callback(ptl_event_t *ev, ompi_mtl_portals4_base_request_t *ptl_base_request)
{
int ret;
ompi_mtl_portals4_send_request_t *ptl_request =
(ompi_mtl_portals4_send_request_t*) ptl_base_request;
assert(ev->type == PTL_EVENT_SEND);
assert(NULL != ptl_request->super.ompi_req);
assert(NULL != ptl_request->super.super.ompi_req);
if (ev->ni_fail_type != PTL_NI_OK) {
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: short send callback ni_fail_type: %d",
__FILE__, __LINE__, ev->ni_fail_type);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
}
if (NULL != ptl_request->buffer_ptr) {
free(ptl_request->buffer_ptr);
@ -52,10 +54,10 @@ ompi_mtl_portals4_short_callback(ptl_event_t *ev, ompi_mtl_portals4_request_t *p
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: short send callback PtlMDRelease returned %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
}
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "send completed"));
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.completion_callback(&ptl_request->super.super);
return OMPI_SUCCESS;
}
@ -63,18 +65,20 @@ ompi_mtl_portals4_short_callback(ptl_event_t *ev, ompi_mtl_portals4_request_t *p
/* called when send should wait for an ack or get */
static int
ompi_mtl_portals4_long_callback(ptl_event_t *ev, struct ompi_mtl_portals4_request_t* ptl_request)
ompi_mtl_portals4_long_callback(ptl_event_t *ev, struct ompi_mtl_portals4_base_request_t* ptl_base_request)
{
int ret;
ompi_mtl_portals4_send_request_t *ptl_request =
(ompi_mtl_portals4_send_request_t*) ptl_base_request;
assert(ev->type == PTL_EVENT_SEND || ev->type == PTL_EVENT_ACK || ev->type == PTL_EVENT_GET);
assert(NULL != ptl_request->super.ompi_req);
assert(NULL != ptl_request->super.super.ompi_req);
if (ev->ni_fail_type != PTL_NI_OK) {
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: long send callback ni_fail_type: %d",
__FILE__, __LINE__, ev->ni_fail_type);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
}
/* we only receive an ack if the message was received into an
@ -89,10 +93,10 @@ ompi_mtl_portals4_long_callback(ptl_event_t *ev, struct ompi_mtl_portals4_reques
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: long send callback PtlMDRelease returned %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
}
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "send completed"));
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.completion_callback(&ptl_request->super.super);
}
/* received an ack - unlink the me */
@ -111,18 +115,20 @@ ompi_mtl_portals4_long_callback(ptl_event_t *ev, struct ompi_mtl_portals4_reques
/* called when sync send should wait for an ack or put */
static int
ompi_mtl_portals4_sync_callback(ptl_event_t *ev, struct ompi_mtl_portals4_request_t* ptl_request)
ompi_mtl_portals4_sync_callback(ptl_event_t *ev, struct ompi_mtl_portals4_base_request_t* ptl_base_request)
{
int ret;
ompi_mtl_portals4_send_request_t *ptl_request =
(ompi_mtl_portals4_send_request_t*) ptl_base_request;
assert(ev->type == PTL_EVENT_SEND || ev->type == PTL_EVENT_ACK || ev->type == PTL_EVENT_PUT);
assert(NULL != ptl_request->super.ompi_req);
assert(NULL != ptl_request->super.super.ompi_req);
if (ev->ni_fail_type != PTL_NI_OK) {
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: sync send callback ni_fail_type: %d",
__FILE__, __LINE__, ev->ni_fail_type);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
}
/* we only receive an ack if the message was received into an
@ -137,10 +143,10 @@ ompi_mtl_portals4_sync_callback(ptl_event_t *ev, struct ompi_mtl_portals4_reques
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: sync send callback PtlMDRelease returned %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
}
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "send completed"));
ptl_request->super.completion_callback(&ptl_request->super);
ptl_request->super.super.completion_callback(&ptl_request->super.super);
}
/* received an ack - unlink the me */
@ -150,7 +156,7 @@ ompi_mtl_portals4_sync_callback(ptl_event_t *ev, struct ompi_mtl_portals4_reques
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: sync send callback PtlMEUnlink returned %d",
__FILE__, __LINE__, ret);
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_ERROR;
}
}
return OMPI_SUCCESS;
@ -160,17 +166,19 @@ ompi_mtl_portals4_sync_callback(ptl_event_t *ev, struct ompi_mtl_portals4_reques
static int
ompi_mtl_portals4_short_isend(mca_pml_base_send_mode_t mode, void *start, int length,
int contextid, int localrank, int tag, mca_mtl_base_endpoint_t *endpoint,
ompi_mtl_portals4_request_t *ptl_request )
ompi_mtl_portals4_send_request_t *ptl_request )
{
int ret;
ptl_match_bits_t mode_bits;
ptl_match_bits_t match_bits;
ptl_match_bits_t mode_bits, match_bits;
ptl_md_t md;
ptl_hdr_data_t hdr_data;
ptl_request->event_callback = ompi_mtl_portals4_short_callback;
ptl_request->super.event_callback = ompi_mtl_portals4_short_callback;
mode_bits = (MCA_PML_BASE_SEND_READY != mode) ? PTL_SHORT_MSG : PTL_READY_MSG;
PTL_SET_SEND_BITS(match_bits, contextid, localrank, tag, mode_bits);
MTL_PORTALS4_SET_HDR_DATA(hdr_data, ompi_mtl_portals4.opcount++, length);
md.start = start;
md.length = length;
@ -197,7 +205,7 @@ ompi_mtl_portals4_short_isend(mca_pml_base_send_mode_t mode, void *start, int le
match_bits,
0,
ptl_request,
0);
hdr_data);
if (PTL_OK != ret) {
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: PtlPut failed: %d",
@ -216,34 +224,22 @@ ompi_mtl_portals4_short_isend(mca_pml_base_send_mode_t mode, void *start, int le
static int
ompi_mtl_portals4_long_isend(void *start, int length, int contextid, int localrank, int tag,
ompi_mtl_portals4_long_isend(void *start, int length, int contextid,
int localrank, int destrank,
int tag,
mca_mtl_base_endpoint_t *endpoint,
ompi_mtl_portals4_request_t *ptl_request)
ompi_mtl_portals4_send_request_t *ptl_request)
{
int ret;
ptl_match_bits_t match_bits;
ptl_md_t md;
ptl_me_t me;
ptl_hdr_data_t hdr_data;
ptl_request->event_callback = ompi_mtl_portals4_long_callback;
ptl_request->super.event_callback = ompi_mtl_portals4_long_callback;
PTL_SET_SEND_BITS(match_bits, contextid, localrank, tag, PTL_LONG_MSG);
md.start = start;
md.length = length;
md.options = 0;
md.eq_handle = ompi_mtl_portals4.eq_h;
md.ct_handle = PTL_CT_NONE;
ret = PtlMDBind(ompi_mtl_portals4.ni_h,
&md,
&ptl_request->md_h);
if (PTL_OK != ret) {
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: PtlMDBind failed: %d",
__FILE__, __LINE__, ret);
return ompi_mtl_portals4_get_error(ret);
}
MTL_PORTALS4_SET_HDR_DATA(hdr_data, ompi_mtl_portals4.opcount++, length);
me.start = start;
me.length = length;
@ -252,12 +248,13 @@ ompi_mtl_portals4_long_isend(void *start, int length, int contextid, int localra
me.uid = PTL_UID_ANY;
me.options = PTL_ME_OP_GET | PTL_ME_USE_ONCE | PTL_ME_EVENT_UNLINK_DISABLE;
me.match_id = endpoint->ptl_proc;
if (ompi_mtl_portals4.protocol == rndv) {
me.match_bits = ((uint64_t) endpoint->send_count << 32) | length;
me.match_bits = (ptl_match_bits_t) hdr_data;
if (ompi_mtl_portals4.protocol == triggered) {
PTL_SET_RECV_BITS(me.match_bits, me.ignore_bits, contextid, destrank, tag);
} else {
me.match_bits = endpoint->send_count;
me.match_bits = hdr_data;
me.ignore_bits = 0;
}
me.ignore_bits = 0;
ret = PtlMEAppend(ompi_mtl_portals4.ni_h,
ompi_mtl_portals4.read_idx,
@ -278,6 +275,22 @@ ompi_mtl_portals4_long_isend(void *start, int length, int contextid, int localra
return ompi_mtl_portals4_get_error(ret);
}
md.start = start;
md.length = length;
md.options = 0;
md.eq_handle = ompi_mtl_portals4.eq_h;
md.ct_handle = PTL_CT_NONE;
ret = PtlMDBind(ompi_mtl_portals4.ni_h,
&md,
&ptl_request->md_h);
if (PTL_OK != ret) {
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: PtlMDBind failed: %d",
__FILE__, __LINE__, ret);
return ompi_mtl_portals4_get_error(ret);
}
if (ompi_mtl_portals4.protocol == rndv) {
ret = PtlPut(ptl_request->md_h,
0,
@ -288,7 +301,7 @@ ompi_mtl_portals4_long_isend(void *start, int length, int contextid, int localra
match_bits,
0,
ptl_request,
me.match_bits);
hdr_data);
} else if (ompi_mtl_portals4.protocol == triggered) {
ret = PtlPut(ptl_request->md_h,
0,
@ -299,7 +312,7 @@ ompi_mtl_portals4_long_isend(void *start, int length, int contextid, int localra
match_bits,
0,
ptl_request,
me.match_bits);
hdr_data);
} else {
ret = PtlPut(ptl_request->md_h,
0,
@ -310,7 +323,7 @@ ompi_mtl_portals4_long_isend(void *start, int length, int contextid, int localra
match_bits,
0,
ptl_request,
me.match_bits);
hdr_data);
}
if (PTL_OK != ret) {
opal_output_verbose(1, ompi_mtl_base_output,
@ -336,33 +349,21 @@ ompi_mtl_portals4_long_isend(void *start, int length, int contextid, int localra
static int
ompi_mtl_portals4_sync_isend(void *start, int length, int contextid, int localrank, int tag,
mca_mtl_base_endpoint_t *endpoint, ompi_mtl_portals4_request_t *ptl_request)
ompi_mtl_portals4_sync_isend(void *start, int length, int contextid,
int localrank, int destrank, int tag,
mca_mtl_base_endpoint_t *endpoint,
ompi_mtl_portals4_send_request_t *ptl_request)
{
int ret;
ptl_match_bits_t match_bits;
ptl_md_t md;
ptl_me_t me;
ptl_hdr_data_t hdr_data;
ptl_request->event_callback = ompi_mtl_portals4_sync_callback;
ptl_request->super.event_callback = ompi_mtl_portals4_sync_callback;
PTL_SET_SEND_BITS(match_bits, contextid, localrank, tag, PTL_SHORT_MSG);
md.start = start;
md.length = length;
md.options = 0;
md.eq_handle = ompi_mtl_portals4.eq_h;
md.ct_handle = PTL_CT_NONE;
ret = PtlMDBind(ompi_mtl_portals4.ni_h,
&md,
&ptl_request->md_h);
if (PTL_OK != ret) {
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: PtlMDBind failed: %d",
__FILE__, __LINE__, ret);
return ompi_mtl_portals4_get_error(ret);
}
MTL_PORTALS4_SET_HDR_DATA(hdr_data, ompi_mtl_portals4.opcount++, length);
me.start = NULL;
me.length = 0;
@ -371,7 +372,7 @@ ompi_mtl_portals4_sync_isend(void *start, int length, int contextid, int localra
me.uid = PTL_UID_ANY;
me.options = PTL_ME_OP_PUT | PTL_ME_USE_ONCE;
me.match_id = endpoint->ptl_proc;
me.match_bits = endpoint->send_count;
me.match_bits = hdr_data;
me.ignore_bits = 0;
ret = PtlMEAppend(ompi_mtl_portals4.ni_h,
@ -393,6 +394,22 @@ ompi_mtl_portals4_sync_isend(void *start, int length, int contextid, int localra
return ompi_mtl_portals4_get_error(ret);
}
md.start = start;
md.length = length;
md.options = 0;
md.eq_handle = ompi_mtl_portals4.eq_h;
md.ct_handle = PTL_CT_NONE;
ret = PtlMDBind(ompi_mtl_portals4.ni_h,
&md,
&ptl_request->md_h);
if (PTL_OK != ret) {
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: PtlMDBind failed: %d",
__FILE__, __LINE__, ret);
return ompi_mtl_portals4_get_error(ret);
}
ret = PtlPut(ptl_request->md_h,
0,
length,
@ -402,7 +419,7 @@ ompi_mtl_portals4_sync_isend(void *start, int length, int contextid, int localra
match_bits,
0,
ptl_request,
(ptl_hdr_data_t)(uintptr_t)ptl_request);
hdr_data);
if (PTL_OK != ret) {
opal_output_verbose(1, ompi_mtl_base_output,
"%s:%d: PtlPut failed: %d",
@ -440,7 +457,7 @@ ompi_mtl_portals4_isend(struct mca_mtl_base_module_t* mtl,
int ret = OMPI_SUCCESS;
ompi_proc_t *ompi_proc = ompi_comm_peer_lookup( comm, dest );
mca_mtl_base_endpoint_t *endpoint = (mca_mtl_base_endpoint_t*)ompi_proc->proc_pml;
ompi_mtl_portals4_request_t *ptl_request = (ompi_mtl_portals4_request_t*)mtl_request;
ompi_mtl_portals4_send_request_t *ptl_request = (ompi_mtl_portals4_send_request_t*)mtl_request;
void *start;
size_t length;
bool free_after;
@ -450,13 +467,10 @@ ompi_mtl_portals4_isend(struct mca_mtl_base_module_t* mtl,
ptl_request->buffer_ptr = (free_after) ? start : NULL;
ptl_request->event_count = 0;
ptl_request->super.ompi_req->req_status.MPI_ERROR = OMPI_SUCCESS;
endpoint->send_count++;
ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_SUCCESS;
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output,
"Send %d to %x,%x of length %d\n",
endpoint->send_count,
"Send to %x,%x of length %d\n",
endpoint->ptl_proc.phys.nid, endpoint->ptl_proc.phys.pid,
(int)length));
@ -484,6 +498,7 @@ ompi_mtl_portals4_isend(struct mca_mtl_base_module_t* mtl,
length,
comm->c_contextid,
comm->c_my_rank,
dest,
tag,
endpoint,
ptl_request);
@ -493,6 +508,7 @@ ompi_mtl_portals4_isend(struct mca_mtl_base_module_t* mtl,
length,
comm->c_contextid,
comm->c_my_rank,
dest,
tag,
endpoint,
ptl_request);