Skip to content

Commit

Permalink
Merge pull request #3490 from jain-surabhi-23/intra_node_colls
Browse files Browse the repository at this point in the history
ch4/posix: shared memory based intra-node collectives
  • Loading branch information
yfguo authored Apr 24, 2019
2 parents aa91671 + 703b78e commit 33f46d1
Show file tree
Hide file tree
Showing 38 changed files with 1,634 additions and 114 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,7 @@ fi
if test "$izem_atomic" = "yes" ; then
AC_DEFINE(ENABLE_IZEM_ATOMIC,1,[Define to enable using Izem CPU atomics])
fi
AM_CONDITIONAL([ENABLE_IZEM_ATOMIC], [test x$izem_atomic = xyes])

AC_ARG_VAR([ZMLIBNAME],[can be used to override the name of the Izem library (default: "zm")])
ZMLIBNAME=${ZMLIBNAME:-"zm"}
Expand Down
2 changes: 1 addition & 1 deletion maint/extracterrmsgs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ sub ProcessFile
!($args[$errClassLoc] =~ /^MPIDI_CH3I_SOCK_ERR_/) &&
!($args[$errClassLoc] =~ /^MPIX_ERR_/) &&
!($args[$errClassLoc] =~ /^errclass/) &&
!($args[$errClassLoc] =~ /^\*\(errflag_\)/) &&
!($args[$errClassLoc] =~ /^errflag/) &&
!($args[$errClassLoc] =~ /^\*errflag/)) {
$bad_syntax_in_file{$filename} = 1;
print STDERR "Invalid argument $args[$errClassLoc] for the MPI Error class in $routineName in $filename\n";
Expand Down
20 changes: 10 additions & 10 deletions src/mpi/coll/algorithms/common/algo_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ static int MPII_Algo_compare_int(const void *a, const void *b)
}

/* Avoid unused function warning in certain configurations */
static int MPII_Algo_calculate_pipeline_chunk_info(int maxbytes, int type_size, int count,
int *num_segments, int *segsize_floor,
int *segsize_ceil) ATTRIBUTE((unused));
static int MPII_Algo_calculate_pipeline_chunk_info(int maxbytes,
int type_size, int count,
int *num_segments,
int *segsize_floor, int *segsize_ceil)
static inline int MPIR_Algo_calculate_pipeline_chunk_info(int maxbytes, int type_size, int count,
int *num_segments, int *segsize_floor,
int *segsize_ceil) ATTRIBUTE((unused));
static inline int MPIR_Algo_calculate_pipeline_chunk_info(int maxbytes,
int type_size, int count,
int *num_segments,
int *segsize_floor, int *segsize_ceil)
{
int maxelems;
int mpi_errno = MPI_SUCCESS;

MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPII_ALGO_CALCULATE_PIPELINE_CHUNK_INFO);
MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPII_ALGO_CALCULATE_PIPELINE_CHUNK_INFO);
MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPIR_ALGO_CALCULATE_PIPELINE_CHUNK_INFO);
MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPIR_ALGO_CALCULATE_PIPELINE_CHUNK_INFO);

if (count == 0 || type_size == 0) {
*num_segments = *segsize_floor = *segsize_ceil = 0;
Expand All @@ -57,7 +57,7 @@ static int MPII_Algo_calculate_pipeline_chunk_info(int maxbytes,

MPL_DBG_MSG_FMT(MPIR_DBG_COLL, VERBOSE, (MPL_DBG_FDEST, "num_segments %d", *num_segments));

MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPII_ALGO_CALCULATE_PIPELINE_CHUNK_INFO);
MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPIR_ALGO_CALCULATE_PIPELINE_CHUNK_INFO);

fn_exit:
return mpi_errno;
Expand Down
12 changes: 6 additions & 6 deletions src/mpi/coll/algorithms/treealgo/treealgo.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ int MPII_Treealgo_comm_cleanup(MPIR_Comm * comm)
}


int MPII_Treealgo_tree_create(int rank, int nranks, int tree_type, int k, int root,
MPII_Treealgo_tree_t * ct)
int MPIR_Treealgo_tree_create(int rank, int nranks, int tree_type, int k, int root,
MPIR_Treealgo_tree_t * ct)
{
int mpi_errno = MPI_SUCCESS;

MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPII_TREEALGO_TREE_INIT);
MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPII_TREEALGO_TREE_INIT);
MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPIR_TREEALGO_TREE_INIT);
MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPIR_TREEALGO_TREE_INIT);

switch (tree_type) {
case MPIR_TREE_TYPE_KARY:
Expand All @@ -68,7 +68,7 @@ int MPII_Treealgo_tree_create(int rank, int nranks, int tree_type, int k, int ro
break;
}

MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPII_TREEALGO_TREE_INIT);
MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPIR_TREEALGO_TREE_INIT);

fn_exit:
return mpi_errno;
Expand All @@ -78,7 +78,7 @@ int MPII_Treealgo_tree_create(int rank, int nranks, int tree_type, int k, int ro
}


void MPII_Treealgo_tree_free(MPII_Treealgo_tree_t * tree)
void MPIR_Treealgo_tree_free(MPIR_Treealgo_tree_t * tree)
{
utarray_free(tree->children);
}
6 changes: 3 additions & 3 deletions src/mpi/coll/algorithms/treealgo/treealgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
int MPII_Treealgo_init(void);
int MPII_Treealgo_comm_init(MPIR_Comm * comm);
int MPII_Treealgo_comm_cleanup(MPIR_Comm * comm);
int MPII_Treealgo_tree_create(int rank, int nranks, int tree_type, int k, int root,
MPII_Treealgo_tree_t * ct);
void MPII_Treealgo_tree_free(MPII_Treealgo_tree_t * tree);
int MPIR_Treealgo_tree_create(int rank, int nranks, int tree_type, int k, int root,
MPIR_Treealgo_tree_t * ct);
void MPIR_Treealgo_tree_free(MPIR_Treealgo_tree_t * tree);

#endif /* TREEALGO_H_INCLUDED */
2 changes: 1 addition & 1 deletion src/mpi/coll/algorithms/treealgo/treealgo_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ typedef struct {
int parent;
int num_children;
UT_array *children;
} MPII_Treealgo_tree_t;
} MPIR_Treealgo_tree_t;

#endif /* TREEALGO_TYPES_H_INCLUDED */
8 changes: 4 additions & 4 deletions src/mpi/coll/algorithms/treealgo/treeutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "treeutil.h"
#include "mpiimpl.h"

static int tree_add_child(MPII_Treealgo_tree_t * t, int rank)
static int tree_add_child(MPIR_Treealgo_tree_t * t, int rank)
{
int mpi_errno = MPI_SUCCESS;

Expand All @@ -26,7 +26,7 @@ static int tree_add_child(MPII_Treealgo_tree_t * t, int rank)
}


int MPII_Treeutil_tree_kary_init(int rank, int nranks, int k, int root, MPII_Treealgo_tree_t * ct)
int MPII_Treeutil_tree_kary_init(int rank, int nranks, int k, int root, MPIR_Treealgo_tree_t * ct)
{
int lrank, child;
int mpi_errno = MPI_SUCCESS;
Expand Down Expand Up @@ -76,7 +76,7 @@ int MPII_Treeutil_tree_kary_init(int rank, int nranks, int k, int root, MPII_Tre
* 3
*/
int MPII_Treeutil_tree_knomial_1_init(int rank, int nranks, int k, int root,
MPII_Treealgo_tree_t * ct)
MPIR_Treealgo_tree_t * ct)
{
int lrank, i, j, maxtime, tmp, time, parent, current_rank, running_rank, crank;
int mpi_errno = MPI_SUCCESS;
Expand Down Expand Up @@ -171,7 +171,7 @@ int MPII_Treeutil_tree_knomial_1_init(int rank, int nranks, int k, int root,
* 7
*/
int MPII_Treeutil_tree_knomial_2_init(int rank, int nranks, int k, int root,
MPII_Treealgo_tree_t * ct)
MPIR_Treealgo_tree_t * ct)
{
int mpi_errno = MPI_SUCCESS;
int lrank, i, j, depth;
Expand Down
6 changes: 3 additions & 3 deletions src/mpi/coll/algorithms/treealgo/treeutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
#define TREEUTIL_H_INCLUDED

/* Generate kary tree information for rank 'rank' */
int MPII_Treeutil_tree_kary_init(int rank, int nranks, int k, int root, MPII_Treealgo_tree_t * ct);
int MPII_Treeutil_tree_kary_init(int rank, int nranks, int k, int root, MPIR_Treealgo_tree_t * ct);

/* Generate knomial_1 tree information for rank 'rank' */
int MPII_Treeutil_tree_knomial_1_init(int rank, int nranks, int k, int root,
MPII_Treealgo_tree_t * ct);
MPIR_Treealgo_tree_t * ct);

/* Generate knomial_2 tree information for rank 'rank' */
int MPII_Treeutil_tree_knomial_2_init(int rank, int nranks, int k, int root,
MPII_Treealgo_tree_t * ct);
MPIR_Treealgo_tree_t * ct);

#endif /* TREEUTIL_H_INCLUDED */
8 changes: 4 additions & 4 deletions src/mpi/coll/iallreduce/iallreduce_tsp_tree_algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int MPIR_TSP_Iallreduce_sched_intra_tree(const void *sendbuf, void *recvbuf, int
int size;
int rank;
int num_children = 0;
MPII_Treealgo_tree_t my_tree;
MPIR_Treealgo_tree_t my_tree;
void **child_buffer; /* Buffer array in which data from children is received */
void *reduce_buffer; /* Buffer in which allreduced data is present */
int *vtcs = NULL, *recv_id = NULL, *reduce_id = NULL; /* Arrays to store graph vertex ids */
Expand Down Expand Up @@ -61,7 +61,7 @@ int MPIR_TSP_Iallreduce_sched_intra_tree(const void *sendbuf, void *recvbuf, int


/* calculate chunking information for pipelining */
MPII_Algo_calculate_pipeline_chunk_info(maxbytes, type_size, count, &num_chunks,
MPIR_Algo_calculate_pipeline_chunk_info(maxbytes, type_size, count, &num_chunks,
&chunk_size_floor, &chunk_size_ceil);
/* print chunking information */
MPL_DBG_MSG_FMT(MPIR_DBG_COLL, VERBOSE, (MPL_DBG_FDEST,
Expand All @@ -76,7 +76,7 @@ int MPIR_TSP_Iallreduce_sched_intra_tree(const void *sendbuf, void *recvbuf, int

/* initialize the tree */
my_tree.children = NULL;
mpi_errno = MPII_Treealgo_tree_create(rank, size, tree_type, k, root, &my_tree);
mpi_errno = MPIR_Treealgo_tree_create(rank, size, tree_type, k, root, &my_tree);
if (mpi_errno)
MPIR_ERR_POP(mpi_errno);
num_children = my_tree.num_children;
Expand Down Expand Up @@ -216,7 +216,7 @@ int MPIR_TSP_Iallreduce_sched_intra_tree(const void *sendbuf, void *recvbuf, int
offset += msgsize;
}

MPII_Treealgo_tree_free(&my_tree);
MPIR_Treealgo_tree_free(&my_tree);

fn_exit:
MPL_free(vtcs);
Expand Down
8 changes: 4 additions & 4 deletions src/mpi/coll/ibcast/ibcast_tsp_tree_algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int MPIR_TSP_Ibcast_sched_intra_tree(void *buffer, int count, MPI_Datatype datat
int rank;
int recv_id;
int num_children;
MPII_Treealgo_tree_t my_tree;
MPIR_Treealgo_tree_t my_tree;
int tag;

MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPIR_TSP_IBCAST_SCHED_INTRA_TREE);
Expand All @@ -51,15 +51,15 @@ int MPIR_TSP_Ibcast_sched_intra_tree(void *buffer, int count, MPI_Datatype datat
extent = MPL_MAX(extent, true_extent);

/* calculate chunking information for pipelining */
MPII_Algo_calculate_pipeline_chunk_info(maxbytes, type_size, count, &num_chunks,
MPIR_Algo_calculate_pipeline_chunk_info(maxbytes, type_size, count, &num_chunks,
&chunk_size_floor, &chunk_size_ceil);
/* print chunking information */
MPL_DBG_MSG_FMT(MPIR_DBG_COLL, VERBOSE, (MPL_DBG_FDEST,
"Broadcast pipeline info: maxbytes=%d count=%d num_chunks=%d chunk_size_floor=%d chunk_size_ceil=%d",
maxbytes, count, num_chunks,
chunk_size_floor, chunk_size_ceil));

mpi_errno = MPII_Treealgo_tree_create(rank, size, tree_type, k, root, &my_tree);
mpi_errno = MPIR_Treealgo_tree_create(rank, size, tree_type, k, root, &my_tree);
if (mpi_errno)
MPIR_ERR_POP(mpi_errno);
num_children = my_tree.num_children;
Expand Down Expand Up @@ -93,7 +93,7 @@ int MPIR_TSP_Ibcast_sched_intra_tree(void *buffer, int count, MPI_Datatype datat
offset += msgsize;
}

MPII_Treealgo_tree_free(&my_tree);
MPIR_Treealgo_tree_free(&my_tree);

fn_exit:
MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPIR_TSP_IBCAST_SCHED_INTRA_TREE);
Expand Down
10 changes: 5 additions & 5 deletions src/mpi/coll/igather/igather_tsp_tree_algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int MPIR_TSP_Igather_sched_intra_tree(const void *sendbuf, int sendcount,
void *tmp_buf = NULL;
const void *data_buf = NULL;
int tree_type;
MPII_Treealgo_tree_t my_tree, parents_tree;
MPIR_Treealgo_tree_t my_tree, parents_tree;
int next_child, num_children, *child_subtree_size = NULL, *child_data_offset = NULL;
int offset, recv_size, num_dependencies;

Expand All @@ -48,7 +48,7 @@ int MPIR_TSP_Igather_sched_intra_tree(const void *sendbuf, int sendcount,
is_inplace = (sendbuf == MPI_IN_PLACE); /* For gather, MPI_IN_PLACE is significant only at root */

tree_type = MPIR_TREE_TYPE_KNOMIAL_1; /* currently only tree_type=MPIR_TREE_TYPE_KNOMIAL_1 is supported for gather */
mpi_errno = MPII_Treealgo_tree_create(rank, size, tree_type, k, root, &my_tree);
mpi_errno = MPIR_Treealgo_tree_create(rank, size, tree_type, k, root, &my_tree);
if (mpi_errno)
MPIR_ERR_POP(mpi_errno);
num_children = my_tree.num_children;
Expand Down Expand Up @@ -83,7 +83,7 @@ int MPIR_TSP_Igather_sched_intra_tree(const void *sendbuf, int sendcount,

/* get tree information of the parent */
if (my_tree.parent != -1) {
MPII_Treealgo_tree_create(my_tree.parent, size, tree_type, k, root, &parents_tree);
MPIR_Treealgo_tree_create(my_tree.parent, size, tree_type, k, root, &parents_tree);
} else { /* initialize an empty children array */
utarray_new(parents_tree.children, &ut_int_icd, MPL_MEM_COLL);
parents_tree.num_children = 0;
Expand Down Expand Up @@ -116,7 +116,7 @@ int MPIR_TSP_Igather_sched_intra_tree(const void *sendbuf, int sendcount,
recv_size += child_subtree_size[i];
}

MPII_Treealgo_tree_free(&parents_tree);
MPIR_Treealgo_tree_free(&parents_tree);

recv_size *= (lrank == 0) ? recvcount : sendcount;
offset = (lrank == 0) ? recvcount : sendcount;
Expand Down Expand Up @@ -184,7 +184,7 @@ int MPIR_TSP_Igather_sched_intra_tree(const void *sendbuf, int sendcount,

}

MPII_Treealgo_tree_free(&my_tree);
MPIR_Treealgo_tree_free(&my_tree);

fn_exit:
MPL_free(child_subtree_size);
Expand Down
8 changes: 4 additions & 4 deletions src/mpi/coll/ireduce/ireduce_tsp_tree_algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int MPIR_TSP_Ireduce_sched_intra_tree(const void *sendbuf, void *recvbuf, int co
* rank 0 sends the reduced data to the root of the ecollective op. */
int is_tree_root, is_tree_leaf, is_tree_intermediate; /* Variables to store location of this rank in the tree */
int is_root;
MPII_Treealgo_tree_t my_tree;
MPIR_Treealgo_tree_t my_tree;
void **child_buffer = NULL; /* Buffer array in which data from children is received */
void *reduce_buffer; /* Buffer in which reduced data is present */
int *vtcs = NULL, *recv_id = NULL, *reduce_id = NULL; /* Arrays to store graph vertex ids */
Expand All @@ -66,7 +66,7 @@ int MPIR_TSP_Ireduce_sched_intra_tree(const void *sendbuf, void *recvbuf, int co
is_commutative = MPIR_Op_is_commutative(op);

/* calculate chunking information for pipelining */
MPII_Algo_calculate_pipeline_chunk_info(maxbytes, type_size, count, &num_chunks,
MPIR_Algo_calculate_pipeline_chunk_info(maxbytes, type_size, count, &num_chunks,
&chunk_size_floor, &chunk_size_ceil);
/* print chunking information */
MPL_DBG_MSG_FMT(MPIR_DBG_COLL, VERBOSE, (MPL_DBG_FDEST,
Expand All @@ -85,7 +85,7 @@ int MPIR_TSP_Ireduce_sched_intra_tree(const void *sendbuf, void *recvbuf, int co

/* initialize the tree */
my_tree.children = NULL;
mpi_errno = MPII_Treealgo_tree_create(rank, size, tree_type, k, tree_root, &my_tree);
mpi_errno = MPIR_Treealgo_tree_create(rank, size, tree_type, k, tree_root, &my_tree);
if (mpi_errno)
MPIR_ERR_POP(mpi_errno);
num_children = my_tree.num_children;
Expand Down Expand Up @@ -240,7 +240,7 @@ int MPIR_TSP_Ireduce_sched_intra_tree(const void *sendbuf, void *recvbuf, int co
offset += msgsize;
}

MPII_Treealgo_tree_free(&my_tree);
MPIR_Treealgo_tree_free(&my_tree);

fn_exit:
MPL_free(vtcs);
Expand Down
10 changes: 5 additions & 5 deletions src/mpi/coll/iscatter/iscatter_tsp_tree_algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int MPIR_TSP_Iscatter_sched_intra_tree(const void *sendbuf, int sendcount,
void *tmp_buf = NULL;
int recv_id;
int tree_type;
MPII_Treealgo_tree_t my_tree, parents_tree;
MPIR_Treealgo_tree_t my_tree, parents_tree;
int next_child;
int num_children, *child_subtree_size = NULL, *child_data_offset = NULL;
int offset, recv_size;
Expand All @@ -50,7 +50,7 @@ int MPIR_TSP_Iscatter_sched_intra_tree(const void *sendbuf, int sendcount,
is_inplace = (recvbuf == MPI_IN_PLACE); /* For scatter, MPI_IN_PLACE is significant only at root */

tree_type = MPIR_TREE_TYPE_KNOMIAL_1; /* currently only tree_type=MPIR_TREE_TYPE_KNOMIAL_1 is supported for scatter */
mpi_errno = MPII_Treealgo_tree_create(rank, size, tree_type, k, root, &my_tree);
mpi_errno = MPIR_Treealgo_tree_create(rank, size, tree_type, k, root, &my_tree);
if (mpi_errno)
MPIR_ERR_POP(mpi_errno);
num_children = my_tree.num_children;
Expand Down Expand Up @@ -85,7 +85,7 @@ int MPIR_TSP_Iscatter_sched_intra_tree(const void *sendbuf, int sendcount,

/* get tree information of the parent */
if (my_tree.parent != -1) {
MPII_Treealgo_tree_create(my_tree.parent, size, tree_type, k, root, &parents_tree);
MPIR_Treealgo_tree_create(my_tree.parent, size, tree_type, k, root, &parents_tree);
} else { /* initialize an empty children array */
utarray_new(parents_tree.children, &ut_int_icd, MPL_MEM_COLL);
parents_tree.num_children = 0;
Expand Down Expand Up @@ -118,7 +118,7 @@ int MPIR_TSP_Iscatter_sched_intra_tree(const void *sendbuf, int sendcount,
recv_size += child_subtree_size[i];
}

MPII_Treealgo_tree_free(&parents_tree);
MPIR_Treealgo_tree_free(&parents_tree);

recv_size *= (lrank == 0) ? sendcount : recvcount;
offset = (lrank == 0) ? sendcount : recvcount;
Expand Down Expand Up @@ -177,7 +177,7 @@ int MPIR_TSP_Iscatter_sched_intra_tree(const void *sendbuf, int sendcount,
recvcount, recvtype, sched, 0, NULL);
}

MPII_Treealgo_tree_free(&my_tree);
MPIR_Treealgo_tree_free(&my_tree);

fn_exit:
MPL_free(child_subtree_size);
Expand Down
3 changes: 3 additions & 0 deletions src/mpi/errhan/errnames.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ MPI_TYPECLASS_INTEGER, or MPI_TYPECLASS_COMPLEX
**treetype: Invalid tree type used for initializing Tree algorithms
**treetype %d: Invalid tree type (%d) used for initializing Tree algorithms

**noizem: release_gather based intra-node collectives cannot be used without izem submodule. \
Reconfigure mpich with --enable-izem=atomic --with-zm-prefix=yes

# -- FIXME: Some (but not all) of the messages below this line have been used
#---- The messages below this line haven't been used yet.
#
Expand Down
Loading

0 comments on commit 33f46d1

Please sign in to comment.