Skip to content

Commit 4626de4

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 e3932d9 commit 4626de4

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-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 : 8
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 : 8
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: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,31 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_progress_send(int vci, int *made_progre
140140
MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_progress(int vci, int *made_progress)
141141
{
142142
int mpi_errno = MPI_SUCCESS;
143+
int made_send_progress = 0;
144+
int made_recv_progress = 0;
143145
MPIR_FUNC_ENTER;
144146

145147
MPIR_Assert(vci < MPIDI_POSIX_global.num_vcis);
146148

147-
mpi_errno = MPIDI_POSIX_progress_recv(vci, made_progress);
148-
MPIR_ERR_CHECK(mpi_errno);
149+
for (int i = 0; i < MPIR_CVAR_CH4_SHM_POSIX_PROGRESS_RECV_LOOPS; i++) {
150+
made_recv_progress = 0;
151+
mpi_errno = MPIDI_POSIX_progress_recv(vci, &made_recv_progress);
152+
MPIR_ERR_CHECK(mpi_errno);
153+
if (!made_recv_progress)
154+
break;
149155

150-
mpi_errno = MPIDI_POSIX_progress_send(vci, made_progress);
151-
MPIR_ERR_CHECK(mpi_errno);
156+
*made_progress |= made_recv_progress;
157+
}
158+
159+
for (int i = 0; i < MPIR_CVAR_CH4_SHM_POSIX_PROGRESS_SEND_LOOPS; i++) {
160+
made_send_progress = 0;
161+
mpi_errno = MPIDI_POSIX_progress_send(vci, &made_send_progress);
162+
MPIR_ERR_CHECK(mpi_errno);
163+
if (!made_send_progress)
164+
break;
165+
166+
*made_progress |= made_send_progress;
167+
}
152168

153169
fn_exit:
154170
MPIR_FUNC_EXIT;

0 commit comments

Comments
 (0)