Skip to content

Commit 37c5480

Browse files
author
Yanfei Guo
committed
ch4/posix: using polling loop for recv and send queue
Trying do multiple polling for the recv and send queue to improve the message latency. This helps the for multiple incoming messages or deferred sends use cases. Two CVARs are add to control the maximum number of loops in one progress call If any of the queue is empty, POSIX will skip the rest iterations.
1 parent 64084b5 commit 37c5480

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

src/mpid/ch4/shm/posix/posix_init.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,28 @@
4747
description : >-
4848
Controls topology-aware communication in POSIX.
4949
50+
- name : MPIR_CVAR_CH4_SHM_POSIX_PROGRESS_RECV_LOOPS
51+
category : CH4
52+
type : int
53+
default : 1
54+
class : none
55+
verbosity : MPI_T_VERBOSITY_USER_BASIC
56+
scope : MPI_T_SCOPE_ALL_EQ
57+
description : >-
58+
Controls the maximum number of polling on recv queue
59+
per progress.
60+
61+
- name : MPIR_CVAR_CH4_SHM_POSIX_PROGRESS_SEND_LOOPS
62+
category : CH4
63+
type : int
64+
default : 1
65+
class : none
66+
verbosity : MPI_T_VERBOSITY_USER_BASIC
67+
scope : MPI_T_SCOPE_ALL_EQ
68+
description : >-
69+
Controls the maximum number of polling on send queue (for
70+
deferred sends) per progress.
71+
5072
=== END_MPI_T_CVAR_INFO_BLOCK ===
5173
*/
5274

src/mpid/ch4/shm/posix/posix_progress.h

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,25 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_progress(int vci, int *made_progress)
144144

145145
MPIR_Assert(vci < MPIDI_POSIX_global.num_vcis);
146146

147-
mpi_errno = MPIDI_POSIX_progress_recv(vci, made_progress);
148-
MPIR_ERR_CHECK(mpi_errno);
147+
for (int i = 0; i < MPIR_CVAR_CH4_SHM_POSIX_PROGRESS_RECV_LOOPS; i++) {
148+
int made_recv_progress = 0;
149+
mpi_errno = MPIDI_POSIX_progress_recv(vci, &made_recv_progress);
150+
MPIR_ERR_CHECK(mpi_errno);
151+
if (!made_recv_progress)
152+
break;
153+
154+
*made_progress |= made_recv_progress;
155+
}
156+
157+
for (int i = 0; i < MPIR_CVAR_CH4_SHM_POSIX_PROGRESS_SEND_LOOPS; i++) {
158+
int made_send_progress = 0;
159+
mpi_errno = MPIDI_POSIX_progress_send(vci, &made_send_progress);
160+
MPIR_ERR_CHECK(mpi_errno);
161+
if (!made_send_progress)
162+
break;
149163

150-
mpi_errno = MPIDI_POSIX_progress_send(vci, made_progress);
151-
MPIR_ERR_CHECK(mpi_errno);
164+
*made_progress |= made_send_progress;
165+
}
152166

153167
fn_exit:
154168
MPIR_FUNC_EXIT;

0 commit comments

Comments
 (0)