Skip to content

Commit 724801b

Browse files
committed
mtl-portals4: Introduce a "short_limit" for the short message size. "eager_limit" will only be used for
the limit of the eager part of the messages sent with the rndv protocol
1 parent 9e58b48 commit 724801b

File tree

6 files changed

+42
-19
lines changed

6 files changed

+42
-19
lines changed

ompi/mca/mtl/portals4/mtl_portals4.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ struct mca_mtl_portals4_module_t {
5353
/* Use flow control: 1 (true) : 0 (false) */
5454
int32_t use_flowctl;
5555

56+
/** Short limit; Size limit for short messages */
57+
uint64_t short_limit;
5658
/** Eager limit; messages greater than this use a rendezvous protocol */
5759
uint64_t eager_limit;
5860
/** Size of short message blocks */

ompi/mca/mtl/portals4/mtl_portals4_component.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@ ompi_mtl_portals4_component_register(void)
100100
OPAL_INFO_LVL_9,
101101
MCA_BASE_VAR_SCOPE_READONLY,
102102
&param_priority);
103+
ompi_mtl_portals4.short_limit = 2 * 1024;
104+
(void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
105+
"short_limit",
106+
"Size limit for short messages",
107+
MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG,
108+
NULL,
109+
0,
110+
0,
111+
OPAL_INFO_LVL_5,
112+
MCA_BASE_VAR_SCOPE_READONLY,
113+
&ompi_mtl_portals4.short_limit);
114+
103115

104116
ompi_mtl_portals4.eager_limit = 2 * 1024;
105117
(void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
@@ -196,6 +208,9 @@ ompi_mtl_portals4_component_open(void)
196208
"no"
197209
#endif
198210
);
211+
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
212+
"Short limit: %d", (int)
213+
ompi_mtl_portals4.short_limit);
199214
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
200215
"Eager limit: %d", (int)
201216
ompi_mtl_portals4.eager_limit);

ompi/mca/mtl/portals4/mtl_portals4_recv.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,16 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
114114
#endif
115115

116116
ptl_request->super.super.ompi_req->req_status._ucount = ev->mlength;
117-
if (!MTL_PORTALS4_IS_SHORT_MSG(ev->match_bits) && ompi_mtl_portals4.protocol == rndv) {
118-
/* If it's not a short message and we're doing rndv, we
117+
if (!MTL_PORTALS4_IS_SHORT_MSG(ev->match_bits) && ompi_mtl_portals4.protocol == rndv && msg_length != ev->mlength) {
118+
/* If it's not a short message and we're doing rndv and the message is not complete, we
119119
only have the first part of the message. Issue the get
120120
to pull the second part of the message. */
121-
ret = read_msg((char*) ptl_request->delivery_ptr + ompi_mtl_portals4.eager_limit,
121+
ret = read_msg((char*) ptl_request->delivery_ptr + ev->mlength,
122122
((msg_length > ptl_request->delivery_len) ?
123-
ptl_request->delivery_len : msg_length) - ompi_mtl_portals4.eager_limit,
123+
ptl_request->delivery_len : msg_length) - ev->mlength,
124124
ev->initiator,
125125
ev->hdr_data,
126-
ompi_mtl_portals4.eager_limit,
126+
ev->mlength,
127127
ptl_request);
128128
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
129129
if (NULL != ptl_request->buffer_ptr) free(ptl_request->buffer_ptr);
@@ -164,7 +164,7 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
164164
}
165165

166166
/* set the received length in the status, now that we know
167-
excatly how much data was sent. */
167+
exactly how much data was sent. */
168168
ptl_request->super.super.ompi_req->req_status._ucount += ev->mlength;
169169

170170
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
@@ -280,12 +280,12 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev,
280280
/* For long messages in the overflow list, ev->mlength = 0 */
281281
ptl_request->super.super.ompi_req->req_status._ucount = 0;
282282

283-
ret = read_msg((char*) ptl_request->delivery_ptr + ev->mlength,
284-
((msg_length > ptl_request->delivery_len) ?
285-
ptl_request->delivery_len : msg_length) - ev->mlength,
283+
ret = read_msg((char*) ptl_request->delivery_ptr,
284+
(msg_length > ptl_request->delivery_len) ?
285+
ptl_request->delivery_len : msg_length,
286286
ev->initiator,
287287
ev->hdr_data,
288-
ev->mlength,
288+
0,
289289
ptl_request);
290290
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
291291
if (NULL != ptl_request->buffer_ptr) free(ptl_request->buffer_ptr);
@@ -383,7 +383,7 @@ ompi_mtl_portals4_irecv(struct mca_mtl_base_module_t* mtl,
383383
PTL_ME_OP_PUT |
384384
PTL_ME_USE_ONCE |
385385
PTL_ME_EVENT_UNLINK_DISABLE;
386-
if (length <= ompi_mtl_portals4.eager_limit) {
386+
if (length <= ompi_mtl_portals4.short_limit) {
387387
me.options |= PTL_ME_EVENT_LINK_DISABLE;
388388
}
389389
me.match_id = remote_proc;
@@ -407,7 +407,7 @@ ompi_mtl_portals4_irecv(struct mca_mtl_base_module_t* mtl,
407407
/* if a long message, spin until we either have a comm event or a
408408
link event, guaranteeing progress for long unexpected
409409
messages. */
410-
if (length > ompi_mtl_portals4.eager_limit) {
410+
if (length > ompi_mtl_portals4.short_limit) {
411411
while (true != ptl_request->req_started) {
412412
ompi_mtl_portals4_progress();
413413
}

ompi/mca/mtl/portals4/mtl_portals4_recv_short.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ ompi_mtl_portals4_activate_block(ompi_mtl_portals4_recv_short_block_t *block)
191191
me.start = block->start;
192192
me.length = ompi_mtl_portals4.recv_short_size;
193193
me.ct_handle = PTL_CT_NONE;
194-
me.min_free = ompi_mtl_portals4.eager_limit;
194+
me.min_free = ompi_mtl_portals4.short_limit;
195195
me.uid = ompi_mtl_portals4.uid;
196196
me.options =
197197
PTL_ME_OP_PUT |

ompi/mca/mtl/portals4/mtl_portals4_request.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct ompi_mtl_portals4_isend_request_t {
5252
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
5353
struct ompi_mtl_portals4_pending_request_t *pending;
5454
#endif
55+
ptl_size_t length;
5556
uint32_t event_count;
5657
};
5758
typedef struct ompi_mtl_portals4_isend_request_t ompi_mtl_portals4_isend_request_t;

ompi/mca/mtl/portals4/mtl_portals4_send.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ ompi_mtl_portals4_callback(ptl_event_t *ev,
9191

9292
if ((PTL_EVENT_ACK == ev->type) &&
9393
(PTL_PRIORITY_LIST == ev->ptl_list) &&
94-
(eager == ompi_mtl_portals4.protocol) &&
94+
(ev->mlength == ptl_request->length) &&
9595
(!PtlHandleIsEqual(ptl_request->me_h, PTL_INVALID_HANDLE))) {
96-
/* long expected messages with the eager protocol won't see a
96+
/* long expected messages with the eager protocol
97+
(and also with the rndv protocol if the length
98+
is less or egal to eager_limit) won't see a
9799
get event to complete the message. Give them an extra
98100
count to cause the message to complete with just the SEND
99101
and ACK events and remove the ME. (we wait for the counter
@@ -307,8 +309,10 @@ ompi_mtl_portals4_long_isend(void *start, size_t length, int contextid, int tag,
307309
"Send %lu long send with hdr_data 0x%lx (0x%lx)",
308310
ptl_request->opcount, hdr_data, match_bits));
309311

310-
put_length = (rndv == ompi_mtl_portals4.protocol) ?
311-
(ptl_size_t) ompi_mtl_portals4.eager_limit : (ptl_size_t) length;
312+
if ((rndv == ompi_mtl_portals4.protocol) && ((ptl_size_t) length > (ptl_size_t) ompi_mtl_portals4.eager_limit))
313+
put_length = (ptl_size_t) ompi_mtl_portals4.eager_limit;
314+
else put_length = (ptl_size_t) length;
315+
312316

313317
ret = PtlPut(ompi_mtl_portals4.send_md_h,
314318
(ptl_size_t) start,
@@ -355,7 +359,7 @@ ompi_mtl_portals4_pending_list_progress()
355359
}
356360

357361
pending = (ompi_mtl_portals4_pending_request_t*) item;
358-
if (pending->length <= ompi_mtl_portals4.eager_limit) {
362+
if (pending->length <= ompi_mtl_portals4.short_limit) {
359363
ret = ompi_mtl_portals4_short_isend(pending->mode,
360364
pending->start,
361365
pending->length,
@@ -414,6 +418,7 @@ ompi_mtl_portals4_send_start(struct mca_mtl_base_module_t* mtl,
414418

415419
ptl_request->opcount = OPAL_THREAD_ADD64((int64_t*)&ompi_mtl_portals4.opcount, 1);
416420
ptl_request->buffer_ptr = (free_after) ? start : NULL;
421+
ptl_request->length = length;
417422
ptl_request->event_count = 0;
418423

419424
OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output,
@@ -461,7 +466,7 @@ ompi_mtl_portals4_send_start(struct mca_mtl_base_module_t* mtl,
461466
return OMPI_SUCCESS;
462467
}
463468
#endif
464-
if (length <= ompi_mtl_portals4.eager_limit) {
469+
if (length <= ompi_mtl_portals4.short_limit) {
465470
ret = ompi_mtl_portals4_short_isend(mode,
466471
start,
467472
length,

0 commit comments

Comments
 (0)