Skip to content

Commit

Permalink
mpi/coll: add TSP-based scatter/ring-based-allgather algo for Ibcast
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenggb72 committed Feb 9, 2022
1 parent 038496d commit a0f1e29
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/mpi/coll/coll_algorithms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ ibcast-intra:
cvar_params: TREE_TYPE, TREE_KVAL, TREE_PIPELINE_CHUNK_SIZE
tsp_scatterv_recexch_allgatherv
func_name: scatterv_allgatherv
extra_params: scatterv_k, allgatherv_k
cvar_params: SCATTERV_KVAL, ALLGATHERV_RECEXCH_KVAL
extra_params: allgatherv_algo=MPIR_CVAR_IALLGATHERV_INTRA_ALGORITHM_tsp_recexch_doubling, scatterv_k, allgatherv_k
cvar_params: -, SCATTERV_KVAL, ALLGATHERV_RECEXCH_KVAL
tsp_scatterv_ring_allgatherv
extra_params: scatterv_k
cvar_params: SCATTERV_KVAL
tsp_ring
func_name: tree
extra_params: tree_type=MPIR_TREE_TYPE_KARY, k=1, chunk_size
Expand Down
1 change: 1 addition & 0 deletions src/mpi/coll/cvars.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ cvars:
sched_scatter_ring_allgather - Force Scatter Ring Allgather algorithm
tsp_tree - Force Generic Transport Tree algorithm
tsp_scatterv_recexch_allgatherv - Force Generic Transport Scatterv followed by Recursive Exchange Allgatherv algorithm
tsp_scatterv_ring_allgatherv - Force Generic Transport Scatterv followed by Ring Allgatherv algorithm
tsp_ring - Force Generic Transport Ring algorithm

- name : MPIR_CVAR_IBCAST_SCATTERV_KVAL
Expand Down
1 change: 1 addition & 0 deletions src/mpi/coll/ibcast/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mpi_core_sources += \
src/mpi/coll/ibcast/ibcast_intra_sched_smp.c \
src/mpi/coll/ibcast/ibcast_inter_sched_flat.c \
src/mpi/coll/ibcast/ibcast_tsp_scatterv_allgatherv.c \
src/mpi/coll/ibcast/ibcast_tsp_scatterv_ring_allgatherv.c \
src/mpi/coll/ibcast/ibcast_tsp_tree.c \
src/mpi/coll/ibcast/ibcast_utils.c

Expand Down
21 changes: 14 additions & 7 deletions src/mpi/coll/ibcast/ibcast_tsp_scatterv_allgatherv.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
/* Routine to schedule a scatter followed by recursive exchange based broadcast */
int MPIR_TSP_Ibcast_sched_intra_scatterv_allgatherv(void *buffer, MPI_Aint count,
MPI_Datatype datatype, int root,
MPIR_Comm * comm, int scatterv_k,
int allgatherv_k, MPIR_TSP_sched_t sched)
MPIR_Comm * comm, int allgatherv_algo,
int scatterv_k, int allgatherv_k,
MPIR_TSP_sched_t sched)
{
int mpi_errno = MPI_SUCCESS;
int mpi_errno_ret ATTRIBUTE((unused)) = MPI_SUCCESS;
Expand Down Expand Up @@ -168,13 +169,19 @@ int MPIR_TSP_Ibcast_sched_intra_scatterv_allgatherv(void *buffer, MPI_Aint count
mpi_errno = MPIR_TSP_sched_fence(sched); /* wait for scatter to complete */
MPIR_ERR_COLL_CHECKANDCONT(mpi_errno, errflag);

/* Schedule Allgatherv */
mpi_errno =
MPIR_TSP_Iallgatherv_sched_intra_recexch(MPI_IN_PLACE, cnts[rank], MPI_BYTE, tmp_buf, cnts,
displs, MPI_BYTE, comm, 0, allgatherv_k, sched);
if (allgatherv_algo == MPIR_CVAR_IALLGATHERV_INTRA_ALGORITHM_tsp_ring)
/* Schedule Allgatherv ring */
mpi_errno =
MPIR_TSP_Iallgatherv_sched_intra_ring(MPI_IN_PLACE, cnts[rank], MPI_BYTE, tmp_buf,
cnts, displs, MPI_BYTE, comm, sched);
else
/* Schedule Allgatherv recexch */
mpi_errno =
MPIR_TSP_Iallgatherv_sched_intra_recexch(MPI_IN_PLACE, cnts[rank], MPI_BYTE, tmp_buf,
cnts, displs, MPI_BYTE, comm, 0, allgatherv_k,
sched);
MPIR_ERR_CHECK(mpi_errno);


if (!is_contig) {
if (rank != root) {
mpi_errno = MPIR_TSP_sched_sink(sched, &sink_id); /* wait for allgather to complete */
Expand Down
31 changes: 31 additions & 0 deletions src/mpi/coll/ibcast/ibcast_tsp_scatterv_ring_allgatherv.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (C) by Argonne National Laboratory
* See COPYRIGHT in top-level directory
*/

#include "mpiimpl.h"
#include "algo_common.h"

/* Routine to schedule a scatter followed by ring based broadcast */
int MPIR_TSP_Ibcast_sched_intra_scatterv_ring_allgatherv(void *buffer, MPI_Aint count,
MPI_Datatype datatype, int root,
MPIR_Comm * comm, int scatterv_k,
MPIR_TSP_sched_t sched)
{
int mpi_errno = MPI_SUCCESS;

MPIR_FUNC_ENTER;

mpi_errno = MPIR_TSP_Ibcast_sched_intra_scatterv_allgatherv(buffer, count, datatype, root,
comm,
MPIR_CVAR_IALLGATHERV_INTRA_ALGORITHM_tsp_ring,
scatterv_k, 0, sched);
MPIR_ERR_CHECK(mpi_errno);

fn_exit:
MPIR_FUNC_EXIT;
return mpi_errno;
fn_fail:
goto fn_exit;

}
4 changes: 4 additions & 0 deletions src/mpi/coll/include/csel_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ typedef enum {
MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibarrier_inter_sched_bcast,
MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_tsp_tree,
MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_tsp_scatterv_recexch_allgatherv,
MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_tsp_scatterv_ring_allgatherv,
MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_tsp_ring,
MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_sched_binomial,
MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_sched_scatter_recursive_doubling_allgather,
Expand Down Expand Up @@ -287,6 +288,9 @@ typedef struct {
int scatterv_k;
int allgatherv_k;
} intra_tsp_scatterv_recexch_allgatherv;
struct {
int scatterv_k;
} intra_tsp_scatterv_ring_allgatherv;
} ibcast;
struct {
struct {
Expand Down
2 changes: 2 additions & 0 deletions test/mpi/maint/coll_cvars.txt
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ algorithms:
tsp_scatterv_recexch_allgatherv
.MPIR_CVAR_IBCAST_SCATTERV_KVAL=3
.MPIR_CVAR_IBCAST_ALLGATHER_RECEXCH=3
tsp_scatterv_ring_allgatherv
.MPIR_CVAR_IBCAST_SCATTERV_KVAL=3
tsp_ring
.MPIR_CVAR_IBCAST_RING_CHUNK_SIZE=4096
exscan:
Expand Down

0 comments on commit a0f1e29

Please sign in to comment.