Skip to content

Commit ab35097

Browse files
committed
coll/ch4: activate CH4 POSIX release_gather algorithms
Enable CVARs and JSONs to select ch4-posix layer release_gather algorithms. Select MPIDI_POSIX_mpi_bcast_release_gather if it passes MPIDI_CH4_release_gather condition check, which only passes if comm is an posix intranode comm.
1 parent 20eb0bd commit ab35097

File tree

5 files changed

+38
-8
lines changed

5 files changed

+38
-8
lines changed

src/mpi/coll/coll_algorithms.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ conditions:
7070
avg_msg_size(thresh): MPIR_Csel_avg_msg_size
7171
total_msg_size(thresh): MPIR_Csel_total_msg_size
7272

73+
# conditional conditions - only call the condition function under macro_guard
74+
MPIDI_CH4_release_gather: MPIDI_POSIX_check_release_gather #if defined(MPIDI_CH4_SHM_POSIX)
75+
7376
# ----
7477
general:
7578
MPIR_Coll_auto
@@ -110,6 +113,11 @@ bcast-intra:
110113
pipelined_tree
111114
extra_params: tree_type, k, is_non_blocking, chunk_size, recv_pre_posted
112115
cvar_params: TREE_TYPE, TREE_KVAL, IS_NON_BLOCKING, TREE_PIPELINE_CHUNK_SIZE, RECV_PRE_POST
116+
release_gather
117+
func_name: MPIDI_POSIX_mpi_bcast_release_gather
118+
inline: 1
119+
macro_guard: defined(MPIDI_CH4_SHM_POSIX)
120+
restrictions: MPIDI_CH4_release_gather
113121
ibcast-intra:
114122
sched_binomial
115123
sched_smp

src/mpi/coll/coll_selection.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"collective=bcast-intra":
33
{
4+
"MPIDI_CH4_release_gather":
5+
{
6+
"algorithm=MPIDI_POSIX_mpi_bcast_release_gather":{}
7+
},
48
"comm_size(8)":
59
{
610
"algorithm=MPIR_Bcast_intra_binomial":{}

src/mpi/coll/cvars.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ cvars:
202202
scatter_ring_allgather - Force Scatter Ring
203203
pipelined_tree - Force tree-based pipelined algorithm
204204
tree - Force tree-based algorithm
205+
release_gather - Force CH4 POSIX release_gather algorithm
205206

206207
- name : MPIR_CVAR_BCAST_TREE_KVAL
207208
category : COLLECTIVE

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

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,27 @@
2929
#include "algo_common.h"
3030
#include "release_gather.h"
3131

32+
MPL_STATIC_INLINE_PREFIX bool MPIDI_POSIX_check_release_gather(MPIR_Csel_coll_sig_s * coll_sig)
33+
{
34+
/* Check whether comm is an intranode comm */
35+
MPIR_Comm *comm_ptr = coll_sig->comm_ptr;
36+
MPIR_Assert(comm_ptr->attr & MPIR_COMM_ATTR__HIERARCHY);
37+
if (comm_ptr->num_external > 1) {
38+
return false;
39+
}
40+
41+
/* Check repeats if the algorithm CVAR is not set */
42+
if (!(coll_sig->flags & MPIR_COLL_SIG_FLAG__CVAR)) {
43+
MPIDI_POSIX_COMM(comm_ptr, release_gather).num_collective_calls++;
44+
if (MPIDI_POSIX_COMM(comm_ptr, release_gather).num_collective_calls <
45+
MPIR_CVAR_POSIX_NUM_COLLS_THRESHOLD) {
46+
return false;
47+
}
48+
}
49+
50+
return true;
51+
}
52+
3253
/* Intra-node bcast is implemented as a release step followed by gather step in release_gather
3354
* framework. The actual data movement happens in release step. Gather step makes sure that
3455
* the shared bcast buffer can be reused for next bcast call. Release gather framework has
@@ -59,14 +80,6 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_bcast_release_gather(void *buffer,
5980
goto fn_exit;
6081
}
6182

62-
MPIDI_POSIX_COMM(comm_ptr, release_gather).num_collective_calls++;
63-
if (MPIDI_POSIX_COMM(comm_ptr, release_gather).num_collective_calls <
64-
MPIR_CVAR_POSIX_NUM_COLLS_THRESHOLD) {
65-
/* Fallback to pt2pt algorithms if the total number of release_gather collective calls is
66-
* less than the specified threshold */
67-
goto fallback;
68-
}
69-
7083
/* Lazy initialization of release_gather specific struct */
7184
mpi_errno =
7285
MPIDI_POSIX_mpi_release_gather_comm_init(comm_ptr, MPIDI_POSIX_RELEASE_GATHER_OPCODE_BCAST);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#include <mpi.h>
1010
#include "release_gather_types.h"
1111

12+
/* define a macro to sigify that we have CH4 POSIX. An example usage is
13+
* to macro-guard posix collective algorithms */
14+
#define MPIDI_CH4_SHM_POSIX 1
15+
1216
#define MPIDI_POSIX_MAX_AM_HDR_SIZE 800 /* constrained by MPIDI_POSIX_AM_HDR_POOL_CELL_SIZE */
1317
#define MPIDI_POSIX_AM_MSG_HEADER_SIZE (sizeof(MPIDI_POSIX_am_header_t))
1418
#define MPIDI_POSIX_MAX_IOV_NUM (3) /* am_hdr, [padding], payload */

0 commit comments

Comments
 (0)