From 418cf958d9de4488861f26ec7568202be7df853d Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Thu, 4 Sep 2025 11:33:13 -0500 Subject: [PATCH 1/6] mpit: fix an unused function warning Warning under -Wall. --- src/mpi_t/mpit_initthread.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mpi_t/mpit_initthread.c b/src/mpi_t/mpit_initthread.c index 39393b21f88..5d34377b8b4 100644 --- a/src/mpi_t/mpit_initthread.c +++ b/src/mpi_t/mpit_initthread.c @@ -9,6 +9,7 @@ * Read global config files that have MPICH_ environment variables for us to * use */ +#ifdef USE_CONFIGFILE static int read_config_files(const char *fname) { int lineno = 0; @@ -49,6 +50,7 @@ static int read_config_files(const char *fname) fclose(f); return TRUE; } +#endif static inline void MPIR_T_enum_env_init(void) { From 5a4c91156eef1cfe03fe1118327a569e03da6a8f Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Mon, 25 Aug 2025 11:40:35 -0500 Subject: [PATCH 2/6] misc: spelling check --- src/mpi/coll/allgather/allgather_intra_recexch.c | 2 +- src/mpi/coll/iallgather/iallgather_tsp_recexch.c | 2 +- src/mpi/coll/iallgatherv/iallgatherv_tsp_recexch.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mpi/coll/allgather/allgather_intra_recexch.c b/src/mpi/coll/allgather/allgather_intra_recexch.c index d2ee4702ba4..51fcb60040b 100644 --- a/src/mpi/coll/allgather/allgather_intra_recexch.c +++ b/src/mpi/coll/allgather/allgather_intra_recexch.c @@ -106,7 +106,7 @@ int MPIR_Allgather_intra_recexch(const void *sendbuf, MPI_Aint sendcount, MPIR_ERR_CHECK(mpi_errno); } - if (step1_sendto != -1) { /* non-participating rank sends the data to a partcipating rank */ + if (step1_sendto != -1) { /* non-participating rank sends the data to a participating rank */ void *buf_to_send; send_offset = rank * recv_extent * recvcount; if (is_inplace) diff --git a/src/mpi/coll/iallgather/iallgather_tsp_recexch.c b/src/mpi/coll/iallgather/iallgather_tsp_recexch.c index 5b849db5fd7..44d44d34736 100644 --- a/src/mpi/coll/iallgather/iallgather_tsp_recexch.c +++ b/src/mpi/coll/iallgather/iallgather_tsp_recexch.c @@ -70,7 +70,7 @@ static int MPIR_TSP_Iallgather_sched_intra_recexch_step1(int step1_sendto, int * int vtx_id; MPIR_FUNC_ENTER; - if (step1_sendto != -1) { /* non-participating rank sends the data to a partcipating rank */ + if (step1_sendto != -1) { /* non-participating rank sends the data to a participating rank */ void *buf_to_send; MPI_Aint send_offset = rank * recv_extent * recvcount; if (is_inplace) diff --git a/src/mpi/coll/iallgatherv/iallgatherv_tsp_recexch.c b/src/mpi/coll/iallgatherv/iallgatherv_tsp_recexch.c index f228b787192..c3cb3c680d3 100644 --- a/src/mpi/coll/iallgatherv/iallgatherv_tsp_recexch.c +++ b/src/mpi/coll/iallgatherv/iallgatherv_tsp_recexch.c @@ -78,7 +78,7 @@ static int MPIR_TSP_Iallgatherv_sched_intra_recexch_step1(int step1_sendto, int int i, vtx_id; MPIR_FUNC_ENTER; - if (step1_sendto != -1) { /* non-participating rank sends the data to a partcipating rank */ + if (step1_sendto != -1) { /* non-participating rank sends the data to a participating rank */ void *buf_to_send; MPI_Aint send_offset = displs[rank] * recv_extent; if (is_inplace) From 6607d2d3ed881da10c8bad6bcbcc3b8a4da80a73 Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Sun, 24 Aug 2025 21:05:49 -0500 Subject: [PATCH 3/6] maint: move json_gen.sh to top of maint folder Do not hide the script. Move it to maint/ as the reset of the autogen scripts. --- autogen.sh | 2 +- maint/{tuning/coll => }/json_gen.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename maint/{tuning/coll => }/json_gen.sh (100%) diff --git a/autogen.sh b/autogen.sh index 113d52b2556..4578f4ff1e6 100755 --- a/autogen.sh +++ b/autogen.sh @@ -535,7 +535,7 @@ fn_gen_binding_c() { fn_json_gen() { echo_n "generating json char arrays... " - ./maint/tuning/coll/json_gen.sh + ./maint/json_gen.sh echo "done" } diff --git a/maint/tuning/coll/json_gen.sh b/maint/json_gen.sh similarity index 100% rename from maint/tuning/coll/json_gen.sh rename to maint/json_gen.sh From 87a6892fbcd13baa0177a3b3be52b75229c6993e Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Fri, 22 Aug 2025 20:13:15 -0500 Subject: [PATCH 4/6] ch4/shm: inclusion order for shm_am.h ipc_p2p.h references MPIDI_POSIX_am_eager_limit, which is defined in shm_am.h. Currently it is probably pulled in by `shm_coll.h`, which we will remove in near future. --- src/mpid/ch4/shm/src/shm_impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mpid/ch4/shm/src/shm_impl.h b/src/mpid/ch4/shm/src/shm_impl.h index dcb424154a7..7d58441419b 100644 --- a/src/mpid/ch4/shm/src/shm_impl.h +++ b/src/mpid/ch4/shm/src/shm_impl.h @@ -12,6 +12,8 @@ #ifndef SHM_IMPL_H_INCLUDED #define SHM_IMPL_H_INCLUDED +#include "shm_am.h" + #ifdef MPIDI_ENABLE_AM_ONLY #include "shm_am_fallback.h" #else @@ -22,7 +24,6 @@ #include "shm_hooks.h" #endif -#include "shm_am.h" #include "shm_progress.h" #include "shm_hooks_internal.h" From 77c71816af2954c2d3915dfcb888156e49e7d447 Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Fri, 22 Aug 2025 20:19:44 -0500 Subject: [PATCH 5/6] all: use fallback routines for internal collectives The fallback collectives (e.g. MPIR_Bcast_fallback) are manual "auto" functions that may not be the best algorithms for the system, but are sufficient for internal usages during init and object constricutions. Not all collective types have fallbacks defined since internally we use limited types. We'll define new fallback routines when we need them in the future. This prepares for the revamp of CSEL. --- src/binding/c/comm_api.txt | 4 +- src/include/mpir_coll.h | 3 + src/mpi/coll/algorithms/treealgo/treeutil.c | 6 +- src/mpi/coll/allgather/allgather_intra_smp.c | 17 +++--- ...lgatherv_inter_remote_gather_local_bcast.c | 2 +- src/mpi/comm/comm_impl.c | 24 ++++---- src/mpi/comm/comm_split.c | 20 +++---- src/mpi/comm/comm_split_type_nbhd.c | 13 +++-- src/mpi/comm/commutil.c | 3 +- src/mpi/comm/contextid.c | 14 ++--- src/mpi/stream/stream_impl.c | 17 +++--- src/mpi/threadcomm/threadcomm_impl.c | 4 +- src/mpi/topo/dist_graph_create.c | 4 +- .../ch3/channels/nemesis/src/ch3_win_fns.c | 56 +++++++++---------- src/mpid/ch3/src/ch3u_comm_spawn_multiple.c | 8 ++- src/mpid/ch3/src/ch3u_port.c | 26 ++++----- src/mpid/ch3/src/ch3u_rma_sync.c | 15 ++--- src/mpid/ch3/src/ch3u_win_fns.c | 4 +- src/mpid/ch3/src/mpid_vc.c | 16 +++--- src/mpid/ch3/src/mpidi_rma.c | 2 +- src/mpid/ch4/netmod/ofi/ofi_comm.c | 6 +- src/mpid/ch4/netmod/ofi/ofi_win.c | 31 +++++----- src/mpid/ch4/netmod/ucx/ucx_vci.c | 6 +- src/mpid/ch4/netmod/ucx/ucx_win.c | 18 +++--- src/mpid/ch4/shm/ipc/src/ipc_fd.c | 17 +++--- src/mpid/ch4/shm/ipc/src/ipc_win.c | 9 +-- .../ch4/shm/posix/eager/iqueue/iqueue_init.c | 2 +- src/mpid/ch4/shm/posix/posix_coll_gpu_ipc.h | 7 ++- src/mpid/ch4/shm/posix/posix_vci.c | 8 +-- .../posix/release_gather/nb_release_gather.c | 13 +++-- .../shm/posix/release_gather/release_gather.c | 13 +++-- src/mpid/ch4/shm/src/topotree.c | 10 ++-- src/mpid/ch4/src/ch4_comm.c | 8 +-- src/mpid/ch4/src/ch4_spawn.c | 11 ++-- src/mpid/ch4/src/mpidig_win.c | 30 +++++----- src/mpid/ch4/src/mpidig_win.h | 2 +- src/mpid/common/shm/mpidu_init_shm_alloc.c | 10 ++-- src/mpid/common/shm/mpidu_shm_alloc.c | 51 +++++++++-------- src/util/ccl/nccl.c | 3 +- src/util/ccl/rccl.c | 4 +- src/util/mpir_nodemap.c | 10 ++-- 41 files changed, 270 insertions(+), 257 deletions(-) diff --git a/src/binding/c/comm_api.txt b/src/binding/c/comm_api.txt index 2ab5de90820..9c1aa06cd4c 100644 --- a/src/binding/c/comm_api.txt +++ b/src/binding/c/comm_api.txt @@ -300,8 +300,8 @@ MPI_Intercomm_merge: * The Intel test suite checks for this; it is also an easy * error to make */ acthigh = high ? 1 : 0; /* Clamp high into 1 or 0 */ - mpi_errno = MPIR_Allreduce(MPI_IN_PLACE, &acthigh, 1, MPIR_INT_INTERNAL, - MPI_SUM, intercomm_ptr->local_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allreduce_fallback(MPI_IN_PLACE, &acthigh, 1, MPIR_INT_INTERNAL, + MPI_SUM, intercomm_ptr->local_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* acthigh must either == 0 or the size of the local comm */ if (acthigh != 0 && acthigh != intercomm_ptr->local_size) { diff --git a/src/include/mpir_coll.h b/src/include/mpir_coll.h index d150998e47a..080f83d775d 100644 --- a/src/include/mpir_coll.h +++ b/src/include/mpir_coll.h @@ -19,6 +19,9 @@ #define MPIR_Allreduce_fallback MPIR_Allreduce_intra_recursive_doubling #define MPIR_Bcast_fallback MPIR_Bcast_intra_binomial #define MPIR_Gather_fallback MPIR_Gather_intra_binomial +#define MPIR_Reduce_scatter_block_fallback MPIR_Reduce_scatter_block_intra_recursive_doubling +/* used in MPIR_Comm_split_impl */ +#define MPIR_Allgather_inter_fallback MPIR_Allgather_inter_local_gather_remote_bcast /* Internal point-to-point communication for collectives */ diff --git a/src/mpi/coll/algorithms/treealgo/treeutil.c b/src/mpi/coll/algorithms/treealgo/treeutil.c index 53ae9c925dd..ee164415275 100644 --- a/src/mpi/coll/algorithms/treealgo/treeutil.c +++ b/src/mpi/coll/algorithms/treealgo/treeutil.c @@ -758,9 +758,9 @@ int MPII_Treeutil_tree_topology_aware_k_init(MPIR_Comm * comm, int k, int root, } else { /* rank level - build a tree on the ranks */ /* Do an allgather to know the current num_children on each rank */ - mpi_errno = MPIR_Allgather_impl(&(ct->num_children), 1, MPIR_INT_INTERNAL, - num_childrens, 1, MPIR_INT_INTERNAL, comm, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(&(ct->num_children), 1, MPIR_INT_INTERNAL, + num_childrens, 1, MPIR_INT_INTERNAL, comm, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); int switch_leader = tree_ut_int_elt(&level->ranks, level->root_idx); diff --git a/src/mpi/coll/allgather/allgather_intra_smp.c b/src/mpi/coll/allgather/allgather_intra_smp.c index 6edb566b9e5..7af8c1c0186 100644 --- a/src/mpi/coll/allgather/allgather_intra_smp.c +++ b/src/mpi/coll/allgather/allgather_intra_smp.c @@ -29,8 +29,9 @@ int MPIR_Allgather_intra_smp_no_order(const void *sendbuf, MPI_Aint sendcount, int external_rank = comm_ptr->external_rank; if (local_size == comm_size || external_size == comm_size) { - mpi_errno = MPIR_Allgather_impl(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, - comm_ptr, coll_attr); + mpi_errno = + MPIR_Allgather_fallback(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, + comm_ptr, coll_attr); goto fn_exit; } @@ -80,20 +81,20 @@ int MPIR_Allgather_intra_smp_no_order(const void *sendbuf, MPI_Aint sendcount, MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); local_recvbuf = (char *) recvbuf + displs[external_rank] * recvtype_extent; } - mpi_errno = MPIR_Gather_impl(sendbuf, sendcount, sendtype, - local_recvbuf, recvcount, recvtype, 0, node_comm, coll_attr); + mpi_errno = MPIR_Gather_fallback(sendbuf, sendcount, sendtype, + local_recvbuf, recvcount, recvtype, 0, node_comm, coll_attr); MPIR_ERR_CHECK(mpi_errno); /* -- allgatherv over node roots -- */ if (local_rank == 0) { - mpi_errno = MPIR_Allgatherv_impl(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, - recvbuf, counts, displs, recvtype, - node_roots_comm, coll_attr); + mpi_errno = MPIR_Allgatherv_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, + recvbuf, counts, displs, recvtype, + node_roots_comm, coll_attr); MPIR_ERR_CHECK(mpi_errno); } /* -- bcast over node -- */ - mpi_errno = MPIR_Bcast_impl(recvbuf, total_count, recvtype, 0, node_comm, coll_attr); + mpi_errno = MPIR_Bcast_fallback(recvbuf, total_count, recvtype, 0, node_comm, coll_attr); MPIR_ERR_CHECK(mpi_errno); fn_exit: diff --git a/src/mpi/coll/allgatherv/allgatherv_inter_remote_gather_local_bcast.c b/src/mpi/coll/allgatherv/allgatherv_inter_remote_gather_local_bcast.c index 16229a4df11..1a36720b38a 100644 --- a/src/mpi/coll/allgatherv/allgatherv_inter_remote_gather_local_bcast.c +++ b/src/mpi/coll/allgatherv/allgatherv_inter_remote_gather_local_bcast.c @@ -71,7 +71,7 @@ int MPIR_Allgatherv_inter_remote_gather_local_bcast(const void *sendbuf, MPI_Ain mpi_errno = MPIR_Type_commit_impl(&newtype); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = MPIR_Bcast_allcomm_auto(recvbuf, 1, newtype, 0, newcomm_ptr, coll_attr); + mpi_errno = MPIR_Bcast_fallback(recvbuf, 1, newtype, 0, newcomm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); MPIR_Type_free_impl(&newtype); diff --git a/src/mpi/comm/comm_impl.c b/src/mpi/comm/comm_impl.c index 6547317cf75..afa32cfb4f5 100644 --- a/src/mpi/comm/comm_impl.c +++ b/src/mpi/comm/comm_impl.c @@ -310,24 +310,24 @@ int MPIR_Comm_create_inter(MPIR_Comm * comm_ptr, MPIR_Group * group_ptr, MPIR_Co MPIR_ERR_CHECK(mpi_errno); /* Broadcast to the other members of the local group */ - mpi_errno = MPIR_Bcast(rinfo, 2, MPIR_INT_INTERNAL, 0, comm_ptr->local_comm, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(rinfo, 2, MPIR_INT_INTERNAL, 0, comm_ptr->local_comm, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = MPIR_Bcast(remote_mapping, remote_size, MPIR_INT_INTERNAL, 0, - comm_ptr->local_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(remote_mapping, remote_size, MPIR_INT_INTERNAL, 0, + comm_ptr->local_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } else { /* The other processes */ /* Broadcast to the other members of the local group */ - mpi_errno = MPIR_Bcast(rinfo, 2, MPIR_INT_INTERNAL, 0, comm_ptr->local_comm, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(rinfo, 2, MPIR_INT_INTERNAL, 0, comm_ptr->local_comm, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); context_id = rinfo[0]; remote_size = rinfo[1]; MPIR_CHKLMEM_MALLOC(remote_mapping, remote_size * sizeof(int)); - mpi_errno = MPIR_Bcast(remote_mapping, remote_size, MPIR_INT_INTERNAL, 0, - comm_ptr->local_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(remote_mapping, remote_size, MPIR_INT_INTERNAL, 0, + comm_ptr->local_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } @@ -690,8 +690,8 @@ int MPIR_Intercomm_create_from_groups_impl(MPIR_Group * local_group_ptr, int loc /* synchronize mpi_errno */ int tmp_err = mpi_errno; - mpi_errno = MPIR_Bcast_impl(&tmp_err, 1, MPIR_INT_INTERNAL, local_leader, local_comm, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(&tmp_err, 1, MPIR_INT_INTERNAL, local_leader, local_comm, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); mpi_errno = tmp_err; MPIR_ERR_CHECK(mpi_errno); @@ -1050,8 +1050,8 @@ int MPIR_Intercomm_merge_impl(MPIR_Comm * comm_ptr, int high, MPIR_Comm ** new_i * value of local_high, which may have changed if both groups * of processes had the same value for high */ - mpi_errno = MPIR_Bcast(&local_high, 1, MPIR_INT_INTERNAL, 0, comm_ptr->local_comm, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(&local_high, 1, MPIR_INT_INTERNAL, 0, comm_ptr->local_comm, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* diff --git a/src/mpi/comm/comm_split.c b/src/mpi/comm/comm_split.c index 7f941e43ff5..79db9a7452d 100644 --- a/src/mpi/comm/comm_split.c +++ b/src/mpi/comm/comm_split.c @@ -111,8 +111,9 @@ int MPIR_Comm_split_impl(MPIR_Comm * comm_ptr, int color, int key, MPIR_Comm ** local_comm_ptr = comm_ptr; } /* Gather information on the local group of processes */ - mpi_errno = MPIR_Allgather(MPI_IN_PLACE, 2, MPIR_INT_INTERNAL, table, 2, MPIR_INT_INTERNAL, - local_comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 2, MPIR_INT_INTERNAL, + table, 2, MPIR_INT_INTERNAL, + local_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* Step 2: How many processes have our same color? */ @@ -156,8 +157,9 @@ int MPIR_Comm_split_impl(MPIR_Comm * comm_ptr, int color, int key, MPIR_Comm ** * same color */ mypair.color = color; mypair.key = key; - mpi_errno = MPIR_Allgather(&mypair, 2, MPIR_INT_INTERNAL, remotetable, 2, MPIR_INT_INTERNAL, - comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_inter_fallback(&mypair, 2, MPIR_INT_INTERNAL, + remotetable, 2, MPIR_INT_INTERNAL, + comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* Each process can now match its color with the entries in the table */ @@ -214,9 +216,8 @@ int MPIR_Comm_split_impl(MPIR_Comm * comm_ptr, int color, int key, MPIR_Comm ** &remote_context_id, 1, MPIR_CONTEXT_ID_T_DATATYPE, 0, 0, comm_ptr, MPI_STATUS_IGNORE, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = - MPIR_Bcast(&remote_context_id, 1, MPIR_CONTEXT_ID_T_DATATYPE, 0, local_comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(&remote_context_id, 1, MPIR_CONTEXT_ID_T_DATATYPE, 0, + local_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (!in_newcomm) { @@ -224,9 +225,8 @@ int MPIR_Comm_split_impl(MPIR_Comm * comm_ptr, int color, int key, MPIR_Comm ** } } else { /* Broadcast to the other members of the local group */ - mpi_errno = - MPIR_Bcast(&remote_context_id, 1, MPIR_CONTEXT_ID_T_DATATYPE, 0, local_comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(&remote_context_id, 1, MPIR_CONTEXT_ID_T_DATATYPE, 0, + local_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } } diff --git a/src/mpi/comm/comm_split_type_nbhd.c b/src/mpi/comm/comm_split_type_nbhd.c index 4a9375245d4..2c91e671917 100644 --- a/src/mpi/comm/comm_split_type_nbhd.c +++ b/src/mpi/comm/comm_split_type_nbhd.c @@ -275,8 +275,9 @@ static int network_split_by_minsize(MPIR_Comm * comm_ptr, int key, int subcomm_m } MPIR_Assert(num_processes_at_node != NULL); /* Send the count to processes */ - mpi_errno = MPIR_Allreduce(MPI_IN_PLACE, num_processes_at_node, num_nodes, - MPIR_INT_INTERNAL, MPI_SUM, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allreduce_fallback(MPI_IN_PLACE, num_processes_at_node, num_nodes, + MPIR_INT_INTERNAL, MPI_SUM, comm_ptr, + MPIR_COLL_ATTR_SYNC); if (topo_type == MPIR_NETTOPO_TYPE__FAT_TREE || topo_type == MPIR_NETTOPO_TYPE__CLOS_NETWORK) { @@ -375,8 +376,8 @@ static int network_split_by_minsize(MPIR_Comm * comm_ptr, int key, int subcomm_m tree_depth = MPIR_hwtopo_get_depth(obj_containing_cpuset); /* get min tree depth to all processes */ - MPIR_Allreduce(&tree_depth, &min_tree_depth, 1, MPIR_INT_INTERNAL, MPI_MIN, node_comm, - MPIR_COLL_ATTR_SYNC); + MPIR_Allreduce_fallback(&tree_depth, &min_tree_depth, 1, MPIR_INT_INTERNAL, MPI_MIN, + node_comm, MPIR_COLL_ATTR_SYNC); if (min_tree_depth) { int num_hwloc_objs_at_depth; @@ -389,8 +390,8 @@ static int network_split_by_minsize(MPIR_Comm * comm_ptr, int key, int subcomm_m parent_idx[subcomm_rank] = obj_containing_cpuset; /* get parent_idx to all processes */ - MPIR_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, parent_idx, 1, MPIR_INT_INTERNAL, - node_comm, MPIR_COLL_ATTR_SYNC); + MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, parent_idx, 1, + MPIR_INT_INTERNAL, node_comm, MPIR_COLL_ATTR_SYNC); /* reorder parent indices */ for (i = 0; i < num_procs - 1; i++) { diff --git a/src/mpi/comm/commutil.c b/src/mpi/comm/commutil.c index 33b579188c1..d76e540cdd3 100644 --- a/src/mpi/comm/commutil.c +++ b/src/mpi/comm/commutil.c @@ -780,8 +780,7 @@ static int init_comm_seq(MPIR_Comm * comm) /* Every rank need share the same seq from root. NOTE: it is possible for * different communicators to have the same seq. It is only used as an * opportunistic optimization */ - mpi_errno = MPIR_Bcast_allcomm_auto(&tmp, 1, MPIR_INT_INTERNAL, 0, comm, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(&tmp, 1, MPIR_INT_INTERNAL, 0, comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); comm->seq = tmp; diff --git a/src/mpi/comm/contextid.c b/src/mpi/comm/contextid.c index 66dd26e7678..eda23239ffa 100644 --- a/src/mpi/comm/contextid.c +++ b/src/mpi/comm/contextid.c @@ -455,9 +455,9 @@ int MPIR_Get_contextid_sparse_group(MPIR_Comm * comm_ptr, MPIR_Group * group_ptr MPIR_INT_INTERNAL, MPI_BAND, comm_ptr, group_ptr, coll_tag, MPIR_COLL_ATTR_SYNC); } else { - mpi_errno = MPIR_Allreduce_impl(MPI_IN_PLACE, st.local_mask, MPIR_MAX_CONTEXT_MASK + 1, - MPIR_INT_INTERNAL, MPI_BAND, comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = + MPIR_Allreduce_fallback(MPI_IN_PLACE, st.local_mask, MPIR_MAX_CONTEXT_MASK + 1, + MPIR_INT_INTERNAL, MPI_BAND, comm_ptr, MPIR_COLL_ATTR_SYNC); } MPIR_ERR_CHECK(mpi_errno); @@ -555,8 +555,8 @@ int MPIR_Get_contextid_sparse_group(MPIR_Comm * comm_ptr, MPIR_Group * group_ptr MPI_MIN, comm_ptr, group_ptr, coll_tag, MPIR_COLL_ATTR_SYNC); } else { - mpi_errno = MPIR_Allreduce_impl(MPI_IN_PLACE, &minfree, 1, MPIR_INT_INTERNAL, - MPI_MIN, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allreduce_fallback(MPI_IN_PLACE, &minfree, 1, MPIR_INT_INTERNAL, + MPI_MIN, comm_ptr, MPIR_COLL_ATTR_SYNC); } if (minfree > 0) { @@ -1053,8 +1053,8 @@ int MPIR_Get_intercomm_contextid(MPIR_Comm * comm_ptr, int *context_id, int *rec /* Make sure that all of the local processes now have this * id */ - mpi_errno = MPIR_Bcast_impl(&remote_context_id, 1, MPIR_CONTEXT_ID_T_DATATYPE, - 0, comm_ptr->local_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(&remote_context_id, 1, MPIR_CONTEXT_ID_T_DATATYPE, + 0, comm_ptr->local_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* The recvcontext_id must be the one that was allocated out of the local * group, not the remote group. Otherwise we could end up posting two diff --git a/src/mpi/stream/stream_impl.c b/src/mpi/stream/stream_impl.c index f15ddf8bddb..f1910bed451 100644 --- a/src/mpi/stream/stream_impl.c +++ b/src/mpi/stream/stream_impl.c @@ -268,8 +268,9 @@ int MPIR_Stream_comm_create_impl(MPIR_Comm * comm_ptr, MPIR_Stream * stream_ptr, vci_table = MPL_malloc(comm_ptr->local_size * sizeof(int), MPL_MEM_OTHER); MPIR_ERR_CHKANDJUMP(!vci_table, mpi_errno, MPI_ERR_OTHER, "**nomem"); - mpi_errno = MPIR_Allgather_impl(&vci, 1, MPIR_INT_INTERNAL, - vci_table, 1, MPIR_INT_INTERNAL, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(&vci, 1, MPIR_INT_INTERNAL, + vci_table, 1, MPIR_INT_INTERNAL, comm_ptr, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); (*newcomm_ptr)->stream_comm_type = MPIR_STREAM_COMM_SINGLE; @@ -312,9 +313,9 @@ int MPIR_Stream_comm_create_multiplex_impl(MPIR_Comm * comm_ptr, MPIR_ERR_CHKANDJUMP(!displs, mpi_errno, MPI_ERR_OTHER, "**nomem"); MPI_Aint num_tmp = num_streams; - mpi_errno = MPIR_Allgather_impl(&num_tmp, 1, MPIR_AINT_INTERNAL, - num_table, 1, MPIR_AINT_INTERNAL, comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(&num_tmp, 1, MPIR_AINT_INTERNAL, + num_table, 1, MPIR_AINT_INTERNAL, comm_ptr, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); MPI_Aint num_total = 0; @@ -346,9 +347,9 @@ int MPIR_Stream_comm_create_multiplex_impl(MPIR_Comm * comm_ptr, local_vcis[i] = stream_ptr ? stream_ptr->vci : 0; } - mpi_errno = MPIR_Allgatherv_impl(local_vcis, num_streams, MPI_INT, - vci_table, num_table, displs, MPI_INT, comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgatherv_fallback(local_vcis, num_streams, MPI_INT, + vci_table, num_table, displs, MPI_INT, comm_ptr, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); (*newcomm_ptr)->stream_comm_type = MPIR_STREAM_COMM_MULTIPLEX; diff --git a/src/mpi/threadcomm/threadcomm_impl.c b/src/mpi/threadcomm/threadcomm_impl.c index 025c4bb89b2..215d8c932c9 100644 --- a/src/mpi/threadcomm/threadcomm_impl.c +++ b/src/mpi/threadcomm/threadcomm_impl.c @@ -34,8 +34,8 @@ int MPIR_Threadcomm_init_impl(MPIR_Comm * comm, int num_threads, MPIR_Comm ** co threads_table = MPL_malloc(comm_size * sizeof(int), MPL_MEM_OTHER); MPIR_ERR_CHKANDJUMP(!threads_table, mpi_errno, MPI_ERR_OTHER, "**nomem"); - mpi_errno = MPIR_Allgather_impl(&num_threads, 1, MPIR_INT_INTERNAL, threads_table, 1, - MPIR_INT_INTERNAL, comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(&num_threads, 1, MPIR_INT_INTERNAL, threads_table, 1, + MPIR_INT_INTERNAL, comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); int *rank_offset_table;; diff --git a/src/mpi/topo/dist_graph_create.c b/src/mpi/topo/dist_graph_create.c index b98a61cd9fa..0cc24a9b3e0 100644 --- a/src/mpi/topo/dist_graph_create.c +++ b/src/mpi/topo/dist_graph_create.c @@ -127,8 +127,8 @@ int MPIR_Dist_graph_create_impl(MPIR_Comm * comm_ptr, /* compute the number of peers I will recv from */ int in_out_peers[2] = { -1, 1 }; - mpi_errno = MPIR_Reduce_scatter_block(rs, in_out_peers, 2, MPIR_INT_INTERNAL, MPI_SUM, - comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Reduce_scatter_block_fallback(rs, in_out_peers, 2, MPIR_INT_INTERNAL, MPI_SUM, + comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); MPIR_Assert(in_out_peers[0] <= comm_size && in_out_peers[0] >= 0); diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c b/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c index 2754f2405a0..5b9f90c15ee 100644 --- a/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c +++ b/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c @@ -199,9 +199,9 @@ static int MPIDI_CH3I_SHM_Wins_match(MPIR_Win ** win_ptr, MPIR_Win ** matched_wi * this call. */ base_shm_offs[node_rank] = (MPI_Aint) ((*win_ptr)->base) - (MPI_Aint) (shm_win->shm_base_addr); - mpi_errno = MPIR_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, - base_shm_offs, 1, MPIR_AINT_INTERNAL, - node_comm_ptr, 0); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, + base_shm_offs, 1, MPIR_AINT_INTERNAL, + node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); base_diff = 0; @@ -342,13 +342,12 @@ static int MPIDI_CH3I_Win_gather_info(void *base, MPI_Aint size, int disp_unit, &serialized_hnd_ptr); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = - MPIR_Bcast(serialized_hnd_ptr, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, 0, node_comm_ptr, - 0); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd_ptr, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, + 0, node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* wait for other processes to attach to win */ - mpi_errno = MPIR_Barrier(node_comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* unlink shared memory region so it gets deleted when all processes exit */ @@ -359,9 +358,8 @@ static int MPIDI_CH3I_Win_gather_info(void *base, MPI_Aint size, int disp_unit, char serialized_hnd[MPL_SHM_GHND_SZ] = { 0 }; /* get serialized handle from rank 0 and deserialize it */ - mpi_errno = - MPIR_Bcast(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, 0, node_comm_ptr, - 0); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, + 0, node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); mpl_err = MPL_shm_hnd_deserialize((*win_ptr)->info_shm_segment_handle, serialized_hnd, @@ -374,7 +372,7 @@ static int MPIDI_CH3I_Win_gather_info(void *base, MPI_Aint size, int disp_unit, &(*win_ptr)->info_shm_base_addr, 0); MPIR_ERR_CHKANDJUMP(mpl_err, mpi_errno, MPI_ERR_OTHER, "**attach_shar_mem"); - mpi_errno = MPIR_Barrier(node_comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); } @@ -387,8 +385,8 @@ static int MPIDI_CH3I_Win_gather_info(void *base, MPI_Aint size, int disp_unit, tmp_buf[4 * comm_rank + 2] = (MPI_Aint) disp_unit; tmp_buf[4 * comm_rank + 3] = (MPI_Aint) (*win_ptr)->handle; - mpi_errno = MPIR_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, tmp_buf, 4, MPIR_AINT_INTERNAL, - (*win_ptr)->comm_ptr, 0); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, + tmp_buf, 4, MPIR_AINT_INTERNAL, (*win_ptr)->comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); if (node_rank == 0) { @@ -403,7 +401,7 @@ static int MPIDI_CH3I_Win_gather_info(void *base, MPI_Aint size, int disp_unit, } /* Make sure that all local processes see the results written by node_rank == 0 */ - mpi_errno = MPIR_Barrier(node_comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); fn_exit: @@ -472,9 +470,9 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPIR_Info * node_sizes[node_rank] = (MPI_Aint) size; - mpi_errno = MPIR_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, - node_sizes, sizeof(MPI_Aint), MPIR_BYTE_INTERNAL, - node_comm_ptr, 0); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, + node_sizes, sizeof(MPI_Aint), MPIR_BYTE_INTERNAL, + node_comm_ptr, 0); MPIR_T_PVAR_TIMER_END(RMA, rma_wincreate_allgather); MPIR_ERR_CHECK(mpi_errno); @@ -512,12 +510,12 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPIR_Info * &serialized_hnd_ptr); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = MPIR_Bcast(serialized_hnd_ptr, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, 0, - node_comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd_ptr, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, + 0, node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* wait for other processes to attach to win */ - mpi_errno = MPIR_Barrier(node_comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* unlink shared memory region so it gets deleted when all processes exit */ @@ -528,8 +526,8 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPIR_Info * char serialized_hnd[MPL_SHM_GHND_SZ] = { 0 }; /* get serialized handle from rank 0 and deserialize it */ - mpi_errno = MPIR_Bcast(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, 0, - node_comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, 0, + node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); mpi_errno = @@ -543,7 +541,7 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPIR_Info * &(*win_ptr)->shm_base_addr, 0); MPIR_ERR_CHKANDJUMP(mpl_err, mpi_errno, MPI_ERR_OTHER, "**attach_shar_mem"); - mpi_errno = MPIR_Barrier(node_comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); } @@ -569,12 +567,12 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPIR_Info * &serialized_hnd_ptr); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = MPIR_Bcast(serialized_hnd_ptr, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, 0, - node_comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd_ptr, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, + 0, node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* wait for other processes to attach to win */ - mpi_errno = MPIR_Barrier(node_comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* unlink shared memory region so it gets deleted when all processes exit */ @@ -585,8 +583,8 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPIR_Info * char serialized_hnd[MPL_SHM_GHND_SZ] = { 0 }; /* get serialized handle from rank 0 and deserialize it */ - mpi_errno = MPIR_Bcast(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, 0, - node_comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, 0, + node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); mpi_errno = @@ -600,7 +598,7 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPIR_Info * (void **) &(*win_ptr)->shm_mutex, 0); MPIR_ERR_CHKANDJUMP(mpl_err, mpi_errno, MPI_ERR_OTHER, "**attach_shar_mem"); - mpi_errno = MPIR_Barrier(node_comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); } diff --git a/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c b/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c index 9780d03f0a5..d6956dbd5d2 100644 --- a/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c +++ b/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c @@ -75,13 +75,15 @@ int MPIDI_Comm_spawn_multiple(int count, char **commands, } if (errcodes != MPI_ERRCODES_IGNORE) { - mpi_errno = MPIR_Bcast(&should_accept, 1, MPIR_INT_INTERNAL, root, comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(&should_accept, 1, MPIR_INT_INTERNAL, root, comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = MPIR_Bcast(&total_num_processes, 1, MPIR_INT_INTERNAL, root, comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(&total_num_processes, 1, MPIR_INT_INTERNAL, root, + comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = MPIR_Bcast(errcodes, total_num_processes, MPIR_INT_INTERNAL, root, comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(errcodes, total_num_processes, MPIR_INT_INTERNAL, root, + comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); } diff --git a/src/mpid/ch3/src/ch3u_port.c b/src/mpid/ch3/src/ch3u_port.c index 0bca16298b5..5950b4710a9 100644 --- a/src/mpid/ch3/src/ch3u_port.c +++ b/src/mpid/ch3/src/ch3u_port.c @@ -656,7 +656,7 @@ int MPIDI_Comm_connect(const char *port_name, MPIR_Info *info, int root, /* broadcast the received info to local processes */ MPL_DBG_MSG(MPIDI_CH3_DBG_CONNECT,VERBOSE,"broadcasting the received 3 ints"); - mpi_errno = MPIR_Bcast_allcomm_auto(recv_ints, 3, MPIR_INT_INTERNAL, root, comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(recv_ints, 3, MPIR_INT_INTERNAL, root, comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* check if root was unable to connect to the port */ @@ -705,7 +705,7 @@ int MPIDI_Comm_connect(const char *port_name, MPIR_Info *info, int root, /* Broadcast out the remote rank translation array */ MPL_DBG_MSG(MPIDI_CH3_DBG_CONNECT,VERBOSE,"Broadcasting remote translation"); - mpi_errno = MPIR_Bcast_allcomm_auto(remote_translation, remote_comm_size * 2, MPIR_INT_INTERNAL, + mpi_errno = MPIR_Bcast_fallback(remote_translation, remote_comm_size * 2, MPIR_INT_INTERNAL, root, comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); @@ -744,7 +744,7 @@ int MPIDI_Comm_connect(const char *port_name, MPIR_Info *info, int root, } /*printf("connect:barrier\n");fflush(stdout);*/ - mpi_errno = MPIR_Barrier_allcomm_auto(comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* Free new_vc. It was explicitly allocated in MPIDI_CH3_Connect_to_root.*/ @@ -790,7 +790,7 @@ int MPIDI_Comm_connect(const char *port_name, MPIR_Info *info, int root, /* notify other processes to return an error */ MPL_DBG_MSG(MPIDI_CH3_DBG_CONNECT,VERBOSE,"broadcasting 3 ints: error case"); - mpi_errno2 = MPIR_Bcast_allcomm_auto(recv_ints, 3, MPIR_INT_INTERNAL, root, comm_ptr, 0); + mpi_errno2 = MPIR_Bcast_fallback(recv_ints, 3, MPIR_INT_INTERNAL, root, comm_ptr, 0); if (mpi_errno2) MPIR_ERR_ADD(mpi_errno, mpi_errno2); goto fn_fail; } @@ -937,7 +937,7 @@ static int ReceivePGAndDistribute( MPIR_Comm *tmp_comm, MPIR_Comm *comm_ptr, /* Broadcast the size and data to the local communicator */ /*printf("accept:broadcasting 1 int\n");fflush(stdout);*/ - mpi_errno = MPIR_Bcast_allcomm_auto(&j, 1, MPIR_INT_INTERNAL, root, comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(&j, 1, MPIR_INT_INTERNAL, root, comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); if (rank != root) { @@ -948,7 +948,7 @@ static int ReceivePGAndDistribute( MPIR_Comm *tmp_comm, MPIR_Comm *comm_ptr, } } /*printf("accept:broadcasting string of length %d\n", j);fflush(stdout);*/ - mpi_errno = MPIR_Bcast_allcomm_auto(pg_str, j, MPIR_CHAR_INTERNAL, root, comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(pg_str, j, MPIR_CHAR_INTERNAL, root, comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* Then reconstruct the received process group. This step also initializes the created process group */ @@ -990,7 +990,7 @@ int MPID_PG_BCast( MPIR_Comm *peercomm_p, MPIR_Comm *comm_p, int root ) } /* Now, broadcast the number of local pgs */ - mpi_errno = MPIR_Bcast( &n_local_pgs, 1, MPIR_INT_INTERNAL, root, comm_p, 0); + mpi_errno = MPIR_Bcast_fallback(&n_local_pgs, 1, MPIR_INT_INTERNAL, root, comm_p, 0); MPIR_ERR_CHECK(mpi_errno); pg_list = pg_head; @@ -1010,7 +1010,7 @@ int MPID_PG_BCast( MPIR_Comm *peercomm_p, MPIR_Comm *comm_p, int root ) len = pg_list->lenStr; pg_list = pg_list->next; } - mpi_errno = MPIR_Bcast( &len, 1, MPIR_INT_INTERNAL, root, comm_p, 0); + mpi_errno = MPIR_Bcast_fallback(&len, 1, MPIR_INT_INTERNAL, root, comm_p, 0); MPIR_ERR_CHECK(mpi_errno); if (rank != root) { pg_str = (char *)MPL_malloc(len, MPL_MEM_DYNAMIC); @@ -1019,7 +1019,7 @@ int MPID_PG_BCast( MPIR_Comm *peercomm_p, MPIR_Comm *comm_p, int root ) goto fn_exit; } } - mpi_errno = MPIR_Bcast( pg_str, len, MPIR_CHAR_INTERNAL, root, comm_p, 0); + mpi_errno = MPIR_Bcast_fallback(pg_str, len, MPIR_CHAR_INTERNAL, root, comm_p, 0); if (mpi_errno) { if (rank != root) MPL_free( pg_str ); @@ -1179,7 +1179,7 @@ int MPIDI_Comm_accept(const char *port_name, MPIR_Info *info, int root, /* broadcast the received info to local processes */ /*printf("accept:broadcasting 2 ints - %d and %d\n", recv_ints[0], recv_ints[1]);fflush(stdout);*/ - mpi_errno = MPIR_Bcast_allcomm_auto(recv_ints, 3, MPIR_INT_INTERNAL, root, comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(recv_ints, 3, MPIR_INT_INTERNAL, root, comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); @@ -1229,7 +1229,7 @@ int MPIDI_Comm_accept(const char *port_name, MPIR_Info *info, int root, /* Broadcast out the remote rank translation array */ MPL_DBG_MSG(MPIDI_CH3_DBG_CONNECT,VERBOSE,"Broadcast remote_translation"); - mpi_errno = MPIR_Bcast_allcomm_auto(remote_translation, remote_comm_size * 2, MPIR_INT_INTERNAL, + mpi_errno = MPIR_Bcast_fallback(remote_translation, remote_comm_size * 2, MPIR_INT_INTERNAL, root, comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); #ifdef MPICH_DBG_OUTPUT @@ -1266,7 +1266,7 @@ int MPIDI_Comm_accept(const char *port_name, MPIR_Info *info, int root, } MPL_DBG_MSG(MPIDI_CH3_DBG_CONNECT,VERBOSE,"Barrier"); - mpi_errno = MPIR_Barrier_allcomm_auto(comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* Free new_vc once the connection is completed. It was explicitly @@ -1345,7 +1345,7 @@ static int SetupNewIntercomm( MPIR_Comm *comm_ptr, int remote_comm_size, MPIR_ERR_CHECK(mpi_errno); MPL_DBG_MSG(MPIDI_CH3_DBG_CONNECT,VERBOSE,"Barrier"); - mpi_errno = MPIR_Barrier_allcomm_auto(comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); fn_exit: diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c index c30be063051..43695f45d43 100644 --- a/src/mpid/ch3/src/ch3u_rma_sync.c +++ b/src/mpid/ch3/src/ch3u_rma_sync.c @@ -489,11 +489,11 @@ int MPID_Win_fence(int assert, MPIR_Win * win_ptr) if (win_ptr->shm_allocated == TRUE) { MPIR_Comm *node_comm_ptr = win_ptr->comm_ptr->node_comm; - mpi_errno = MPIR_Barrier(node_comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); } - mpi_errno = MPIR_Ibarrier(win_ptr->comm_ptr, &fence_sync_req_ptr); + mpi_errno = MPIR_Ibarrier_impl(win_ptr->comm_ptr, &fence_sync_req_ptr); MPIR_ERR_CHECK(mpi_errno); if (fence_sync_req_ptr == NULL) { @@ -537,8 +537,9 @@ int MPID_Win_fence(int assert, MPIR_Win * win_ptr) win_ptr->at_completion_counter += comm_size; - mpi_errno = MPIR_Reduce_scatter_block(MPI_IN_PLACE, rma_target_marks, 1, MPIR_INT_INTERNAL, - MPI_SUM, win_ptr->comm_ptr, 0); + mpi_errno = MPIR_Reduce_scatter_block_fallback(MPI_IN_PLACE, rma_target_marks, + 1, MPIR_INT_INTERNAL, + MPI_SUM, win_ptr->comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); win_ptr->at_completion_counter -= comm_size; @@ -578,7 +579,7 @@ int MPID_Win_fence(int assert, MPIR_Win * win_ptr) MPIR_ERR_CHECK(mpi_errno); if (scalable_fence_enabled) { - mpi_errno = MPIR_Barrier(win_ptr->comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(win_ptr->comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* Set window access state properly. */ @@ -603,7 +604,7 @@ int MPID_Win_fence(int assert, MPIR_Win * win_ptr) MPIR_Request* fence_sync_req_ptr; /* Prepare for the next possible epoch */ - mpi_errno = MPIR_Ibarrier(win_ptr->comm_ptr, &fence_sync_req_ptr); + mpi_errno = MPIR_Ibarrier_impl(win_ptr->comm_ptr, &fence_sync_req_ptr); MPIR_ERR_CHECK(mpi_errno); if (fence_sync_req_ptr == NULL) { @@ -628,7 +629,7 @@ int MPID_Win_fence(int assert, MPIR_Win * win_ptr) if (win_ptr->shm_allocated == TRUE) { MPIR_Comm *node_comm_ptr = win_ptr->comm_ptr->node_comm; - mpi_errno = MPIR_Barrier(node_comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback(node_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); } } diff --git a/src/mpid/ch3/src/ch3u_win_fns.c b/src/mpid/ch3/src/ch3u_win_fns.c index 5458777e3df..32927ac79e9 100644 --- a/src/mpid/ch3/src/ch3u_win_fns.c +++ b/src/mpid/ch3/src/ch3u_win_fns.c @@ -59,8 +59,8 @@ int MPIDI_CH3U_Win_gather_info(void *base, MPI_Aint size, int disp_unit, tmp_buf[4 * rank + 2] = (MPI_Aint) disp_unit; tmp_buf[4 * rank + 3] = (MPI_Aint) (*win_ptr)->handle; - mpi_errno = MPIR_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, - tmp_buf, 4, MPIR_AINT_INTERNAL, (*win_ptr)->comm_ptr, 0); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, + tmp_buf, 4, MPIR_AINT_INTERNAL, (*win_ptr)->comm_ptr, 0); MPIR_T_PVAR_TIMER_END(RMA, rma_wincreate_allgather); MPIR_ERR_CHECK(mpi_errno); diff --git a/src/mpid/ch3/src/mpid_vc.c b/src/mpid/ch3/src/mpid_vc.c index 1e62b5b3a94..4f14f971aea 100644 --- a/src/mpid/ch3/src/mpid_vc.c +++ b/src/mpid/ch3/src/mpid_vc.c @@ -511,10 +511,11 @@ int MPID_Intercomm_exchange(MPIR_Comm *local_comm_ptr, int local_leader, comm_info[0] = *remote_size; comm_info[1] = *remote_context_id; MPL_DBG_MSG(MPIDI_CH3_DBG_OTHER,VERBOSE,"About to bcast on local_comm"); - mpi_errno = MPIR_Bcast( comm_info, 2, MPIR_INT_INTERNAL, local_leader, local_comm_ptr, 0 ); + mpi_errno = MPIR_Bcast_fallback(comm_info, 2, MPIR_INT_INTERNAL, local_leader, + local_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = MPIR_Bcast( remote_gpids, (*remote_size)*sizeof(MPIDI_Gpid), MPIR_BYTE_INTERNAL, local_leader, - local_comm_ptr, 0 ); + mpi_errno = MPIR_Bcast_fallback(remote_gpids, (*remote_size)*sizeof(MPIDI_Gpid), + MPIR_BYTE_INTERNAL, local_leader, local_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); MPL_DBG_MSG_D(MPIDI_CH3_DBG_OTHER,VERBOSE,"end of bcast on local_comm of size %d", local_comm_ptr->local_size ); @@ -523,13 +524,14 @@ int MPID_Intercomm_exchange(MPIR_Comm *local_comm_ptr, int local_leader, { /* we're the other processes */ MPL_DBG_MSG(MPIDI_CH3_DBG_OTHER,VERBOSE,"About to receive bcast on local_comm"); - mpi_errno = MPIR_Bcast( comm_info, 2, MPIR_INT_INTERNAL, local_leader, local_comm_ptr, 0 ); + mpi_errno = MPIR_Bcast_fallback(comm_info, 2, MPIR_INT_INTERNAL, local_leader, + local_comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); *remote_size = comm_info[0]; MPIR_CHKLMEM_MALLOC(remote_gpids, (*remote_size)*sizeof(MPIDI_Gpid)); *remote_lpids = MPL_malloc((*remote_size)*sizeof(MPIR_Lpid), MPL_MEM_ADDRESS); - mpi_errno = MPIR_Bcast( remote_gpids, (*remote_size)*sizeof(MPIDI_Gpid), MPIR_BYTE_INTERNAL, local_leader, - local_comm_ptr, 0 ); + mpi_errno = MPIR_Bcast_fallback(remote_gpids, (*remote_size)*sizeof(MPIDI_Gpid), + MPIR_BYTE_INTERNAL, local_leader, local_comm_ptr, 0 ); MPIR_ERR_CHECK(mpi_errno); /* Extract the context and group sign information */ @@ -637,7 +639,7 @@ int MPIDI_PG_ForwardPGInfo( MPIR_Comm *peer_ptr, MPIR_Comm *comm_ptr, } /* See if everyone is happy */ - mpi_errno = MPIR_Allreduce( MPI_IN_PLACE, &allfound, 1, MPIR_INT_INTERNAL, MPI_LAND, comm_ptr, 0 ); + mpi_errno = MPIR_Allreduce_fallback( MPI_IN_PLACE, &allfound, 1, MPIR_INT_INTERNAL, MPI_LAND, comm_ptr, 0 ); MPIR_ERR_CHECK(mpi_errno); if (allfound) return MPI_SUCCESS; diff --git a/src/mpid/ch3/src/mpidi_rma.c b/src/mpid/ch3/src/mpidi_rma.c index a8373c232e7..b53fdf00341 100644 --- a/src/mpid/ch3/src/mpidi_rma.c +++ b/src/mpid/ch3/src/mpidi_rma.c @@ -164,7 +164,7 @@ int MPID_Win_free(MPIR_Win ** win_ptr) MPIR_ERR_CHECK(mpi_errno); } - mpi_errno = MPIR_Barrier((*win_ptr)->comm_ptr, 0); + mpi_errno = MPIR_Barrier_fallback((*win_ptr)->comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); /* Free window resources in lower layer. */ diff --git a/src/mpid/ch4/netmod/ofi/ofi_comm.c b/src/mpid/ch4/netmod/ofi/ofi_comm.c index 619ee3f3c2a..b72772ee291 100644 --- a/src/mpid/ch4/netmod/ofi/ofi_comm.c +++ b/src/mpid/ch4/netmod/ofi/ofi_comm.c @@ -105,9 +105,9 @@ static int update_nic_preferences(MPIR_Comm * comm) /* Collect the NIC IDs set for the other ranks. We always expect to receive a single * NIC id from each rank, i.e., one MPI_INT. */ - mpi_errno = MPIR_Allgather_allcomm_auto(MPI_IN_PLACE, 0, MPIR_INT_INTERNAL, - pref_nic_copy, 1, MPIR_INT_INTERNAL, comm, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPIR_INT_INTERNAL, + pref_nic_copy, 1, MPIR_INT_INTERNAL, comm, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (MPIDI_OFI_COMM(comm).pref_nic == NULL) { diff --git a/src/mpid/ch4/netmod/ofi/ofi_win.c b/src/mpid/ch4/netmod/ofi/ofi_win.c index 9ac46837561..0b4a3b41bfd 100644 --- a/src/mpid/ch4/netmod/ofi/ofi_win.c +++ b/src/mpid/ch4/netmod/ofi/ofi_win.c @@ -132,8 +132,9 @@ static int win_allgather(MPIR_Win * win, void *base, int disp_unit) * Attempting to create an optimized memory region key. Gets the next MR key that's * available to the processes involved in the RMA window. Use the current maximum + 1 * to ensure that the key is available for all processes. */ - mpi_errno = MPIR_Allreduce(&MPIDI_OFI_global.global_max_optimized_mr_key, &local_key, 1, - MPI_UNSIGNED, MPI_MAX, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = + MPIR_Allreduce_fallback(&MPIDI_OFI_global.global_max_optimized_mr_key, &local_key, + 1, MPI_UNSIGNED, MPI_MAX, comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (local_key + 1 < MPIDI_OFI_NUM_OPTIMIZED_MEMORY_REGIONS) { @@ -216,7 +217,8 @@ static int win_allgather(MPIR_Win * win, void *base, int disp_unit) } /* Check if any process fails to register. If so, release local MR and force AM path. */ - MPIR_Allreduce(&rc, &allrc, 1, MPIR_INT_INTERNAL, MPI_MIN, comm_ptr, MPIR_COLL_ATTR_SYNC); + MPIR_Allreduce_fallback(&rc, &allrc, 1, MPIR_INT_INTERNAL, MPI_MIN, comm_ptr, + MPIR_COLL_ATTR_SYNC); if (allrc < 0) { if (rc >= 0 && MPIDI_OFI_WIN(win).mr) MPIDI_OFI_CALL(fi_close(&MPIDI_OFI_WIN(win).mr->fid), fi_close); @@ -238,10 +240,9 @@ static int win_allgather(MPIR_Win * win, void *base, int disp_unit) winfo[comm_ptr->rank].base = (uintptr_t) base; } - mpi_errno = MPIR_Allgather(MPI_IN_PLACE, 0, - MPI_DATATYPE_NULL, - winfo, sizeof(*winfo), MPIR_BYTE_INTERNAL, comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, + winfo, sizeof(*winfo), MPIR_BYTE_INTERNAL, comm_ptr, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (!MPIDI_OFI_ENABLE_MR_PROV_KEY && !MPIDI_OFI_ENABLE_MR_VIRT_ADDRESS) { @@ -963,7 +964,8 @@ int MPIDI_OFI_mpi_win_attach_hook(MPIR_Win * win, void *base, MPI_Aint size) } /* Check if any process fails to register. If so, release local MR and force AM path. */ - MPIR_Allreduce(&rc, &allrc, 1, MPIR_INT_INTERNAL, MPI_MIN, comm_ptr, MPIR_COLL_ATTR_SYNC); + MPIR_Allreduce_fallback(&rc, &allrc, 1, MPIR_INT_INTERNAL, MPI_MIN, comm_ptr, + MPIR_COLL_ATTR_SYNC); if (allrc < 0) { if (rc >= 0) MPIDI_OFI_CALL(fi_close(&mr->fid), fi_close); @@ -983,10 +985,9 @@ int MPIDI_OFI_mpi_win_attach_hook(MPIR_Win * win, void *base, MPI_Aint size) target_mrs[comm_ptr->rank].mr_key = fi_mr_key(mr); target_mrs[comm_ptr->rank].base = (const void *) base; target_mrs[comm_ptr->rank].size = (uintptr_t) size; - mpi_errno = MPIR_Allgather(MPI_IN_PLACE, 0, - MPI_DATATYPE_NULL, - target_mrs, sizeof(dwin_target_mr_t), MPIR_BYTE_INTERNAL, comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, target_mrs, + sizeof(dwin_target_mr_t), MPIR_BYTE_INTERNAL, comm_ptr, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* Insert each remote MR which will be searched when issuing an RMA operation @@ -1039,9 +1040,9 @@ int MPIDI_OFI_mpi_win_detach_hook(MPIR_Win * win, const void *base) /* Exchange remote MR across all processes because "coll_attach" info ensures * that all processes collectively call detach. */ target_bases[comm_ptr->rank] = base; - mpi_errno = MPIR_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, - target_bases, sizeof(const void *), MPIR_BYTE_INTERNAL, comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, target_bases, + sizeof(const void *), MPIR_BYTE_INTERNAL, comm_ptr, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* Search and delete each remote MR */ diff --git a/src/mpid/ch4/netmod/ucx/ucx_vci.c b/src/mpid/ch4/netmod/ucx/ucx_vci.c index c58a5ace8c0..4c27c5d9fc4 100644 --- a/src/mpid/ch4/netmod/ucx/ucx_vci.c +++ b/src/mpid/ch4/netmod/ucx/ucx_vci.c @@ -75,9 +75,9 @@ static int all_vcis_address_exchange(MPIR_Comm * comm) MPIDI_UCX_global.ctx[i].addrname_len); } /* Allgather */ - mpi_errno = MPIR_Allgather_allcomm_auto(MPI_IN_PLACE, 0, MPIR_BYTE_INTERNAL, - all_names, my_len, MPIR_BYTE_INTERNAL, - comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPIR_BYTE_INTERNAL, + all_names, my_len, MPIR_BYTE_INTERNAL, + comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* insert the addresses */ diff --git a/src/mpid/ch4/netmod/ucx/ucx_win.c b/src/mpid/ch4/netmod/ucx/ucx_win.c index 018a9716976..1c2068ecb91 100644 --- a/src/mpid/ch4/netmod/ucx/ucx_win.c +++ b/src/mpid/ch4/netmod/ucx/ucx_win.c @@ -82,9 +82,9 @@ static int win_allgather(MPIR_Win * win, size_t length, uint32_t disp_unit, void rkey_sizes = (MPI_Aint *) MPL_malloc(sizeof(MPI_Aint) * comm_ptr->local_size, MPL_MEM_OTHER); rkey_sizes[comm_ptr->rank] = (MPI_Aint) rkey_size; - mpi_errno = - MPIR_Allgather(MPI_IN_PLACE, 1, MPIR_AINT_INTERNAL, - rkey_sizes, 1, MPIR_AINT_INTERNAL, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 1, MPIR_AINT_INTERNAL, + rkey_sizes, 1, MPIR_AINT_INTERNAL, comm_ptr, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); @@ -99,9 +99,9 @@ static int win_allgather(MPIR_Win * win, size_t length, uint32_t disp_unit, void rkey_recv_buff = MPL_malloc(cntr, MPL_MEM_OTHER); /* allgather */ - mpi_errno = MPIR_Allgatherv(rkey_buffer, rkey_size, MPIR_BYTE_INTERNAL, - rkey_recv_buff, rkey_sizes, recv_disps, MPIR_BYTE_INTERNAL, - comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgatherv_fallback(rkey_buffer, rkey_size, MPIR_BYTE_INTERNAL, + rkey_recv_buff, rkey_sizes, recv_disps, MPIR_BYTE_INTERNAL, + comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); @@ -140,9 +140,9 @@ static int win_allgather(MPIR_Win * win, size_t length, uint32_t disp_unit, void share_data[comm_ptr->rank].disp = disp_unit; share_data[comm_ptr->rank].addr = (MPI_Aint) * base_ptr; - mpi_errno = - MPIR_Allgather(MPI_IN_PLACE, sizeof(struct ucx_share), MPIR_BYTE_INTERNAL, share_data, - sizeof(struct ucx_share), MPIR_BYTE_INTERNAL, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, sizeof(struct ucx_share), MPIR_BYTE_INTERNAL, + share_data, sizeof(struct ucx_share), MPIR_BYTE_INTERNAL, + comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); for (i = 0; i < comm_ptr->local_size; i++) { diff --git a/src/mpid/ch4/shm/ipc/src/ipc_fd.c b/src/mpid/ch4/shm/ipc/src/ipc_fd.c index a8713abf130..6101fce2128 100644 --- a/src/mpid/ch4/shm/ipc/src/ipc_fd.c +++ b/src/mpid/ch4/shm/ipc/src/ipc_fd.c @@ -46,8 +46,9 @@ int MPIDI_FD_comm_bootstrap(MPIR_Comm * comm) } int already_initialized; - mpi_errno = MPIR_Allreduce_impl(&ipc_fd_initialized, &already_initialized, 1, MPIR_INT_INTERNAL, - MPI_MAX, node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = + MPIR_Allreduce_fallback(&ipc_fd_initialized, &already_initialized, 1, MPIR_INT_INTERNAL, + MPI_MAX, node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (already_initialized) { @@ -141,7 +142,7 @@ static int MPIDI_IPC_mpi_socks_init(MPIR_Comm * node_comm, pid_t * all_pids, int MPIR_STRERROR_BUF_SIZE), errno); } - mpi_errno = MPIR_Barrier_impl(node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* create clients for higher ranks */ @@ -224,9 +225,9 @@ static int MPIDI_IPC_mpi_fd_init(MPIR_Comm * node_comm) MPIR_CHKLMEM_MALLOC(all_pids, local_size * sizeof(pid_t)); all_pids[local_rank] = getpid(); - mpi_errno = MPIR_Allgather_impl(MPI_IN_PLACE, sizeof(pid_t), MPIR_BYTE_INTERNAL, - all_pids, sizeof(pid_t), MPIR_BYTE_INTERNAL, - node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, sizeof(pid_t), MPIR_BYTE_INTERNAL, + all_pids, sizeof(pid_t), MPIR_BYTE_INTERNAL, + node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* Initialize fd_socks */ @@ -252,10 +253,10 @@ static int MPIDI_IPC_mpi_fd_init(MPIR_Comm * node_comm) if (node_comm->rank == 0) { mpi_errno = MPIDI_IPC_mpi_fd_cleanup(local_size, local_rank, all_pids, fd_socks); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = MPIR_Barrier_impl(node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } else { - mpi_errno = MPIR_Barrier_impl(node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); mpi_errno = MPIDI_IPC_mpi_fd_cleanup(local_size, local_rank, all_pids, fd_socks); MPIR_ERR_CHECK(mpi_errno); diff --git a/src/mpid/ch4/shm/ipc/src/ipc_win.c b/src/mpid/ch4/shm/ipc/src/ipc_win.c index caf950e2d21..416de2b46fc 100644 --- a/src/mpid/ch4/shm/ipc/src/ipc_win.c +++ b/src/mpid/ch4/shm/ipc/src/ipc_win.c @@ -106,12 +106,9 @@ int MPIDI_IPC_mpi_win_create_hook(MPIR_Win * win) #undef IPC_HANDLE } - mpi_errno = MPIR_Allgather(MPI_IN_PLACE, - 0, - MPI_DATATYPE_NULL, - ipc_shared_table, - sizeof(win_shared_info_t), MPIR_BYTE_INTERNAL, shm_comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, ipc_shared_table, + sizeof(win_shared_info_t), MPIR_BYTE_INTERNAL, shm_comm_ptr, + MPIR_COLL_ATTR_SYNC); MPIR_T_PVAR_TIMER_END(RMA, rma_wincreate_allgather); MPIR_ERR_CHECK(mpi_errno); diff --git a/src/mpid/ch4/shm/posix/eager/iqueue/iqueue_init.c b/src/mpid/ch4/shm/posix/eager/iqueue/iqueue_init.c index 5283e9aac7d..7d29e252871 100644 --- a/src/mpid/ch4/shm/posix/eager/iqueue/iqueue_init.c +++ b/src/mpid/ch4/shm/posix/eager/iqueue/iqueue_init.c @@ -161,7 +161,7 @@ int MPIDI_POSIX_iqueue_set_vcis(void *slab, MPIR_Comm * comm, int max_vcis) MPIR_Comm *node_comm = MPIR_Comm_get_node_comm(comm); MPIR_Assert(node_comm); - mpi_errno = MPIR_Barrier_impl(node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); fn_exit: diff --git a/src/mpid/ch4/shm/posix/posix_coll_gpu_ipc.h b/src/mpid/ch4/shm/posix/posix_coll_gpu_ipc.h index 296588d346e..4343057ae30 100644 --- a/src/mpid/ch4/shm/posix/posix_coll_gpu_ipc.h +++ b/src/mpid/ch4/shm/posix/posix_coll_gpu_ipc.h @@ -99,10 +99,11 @@ static int allgather_ipc_handles(const void *buf, MPI_Aint count, MPI_Datatype d } /* allgather is needed to exchange all the IPC handles */ + /* FIXME: call MPIR_Coll_auto */ mpi_errno = - MPIR_Allgather_impl(&my_ipc_handle, sizeof(MPIDI_IPCI_ipc_handle_t), MPIR_BYTE_INTERNAL, - ipc_handles, sizeof(MPIDI_IPCI_ipc_handle_t), MPIR_BYTE_INTERNAL, comm, - MPIR_COLL_ATTR_SYNC); + MPIR_Allgather_fallback(&my_ipc_handle, sizeof(MPIDI_IPCI_ipc_handle_t), MPIR_BYTE_INTERNAL, + ipc_handles, sizeof(MPIDI_IPCI_ipc_handle_t), MPIR_BYTE_INTERNAL, + comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* check the ipc_handles to make sure all the buffers are on GPU */ diff --git a/src/mpid/ch4/shm/posix/posix_vci.c b/src/mpid/ch4/shm/posix/posix_vci.c index 37ee06cfeee..d329342ec4f 100644 --- a/src/mpid/ch4/shm/posix/posix_vci.c +++ b/src/mpid/ch4/shm/posix/posix_vci.c @@ -17,8 +17,8 @@ int MPIDI_POSIX_comm_set_vcis(MPIR_Comm * comm, int num_vcis) MPIR_Assert(node_comm); int max_vcis; - mpi_errno = MPIR_Allreduce_impl(&num_vcis, &max_vcis, 1, MPIR_INT_INTERNAL, MPI_MAX, - node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allreduce_fallback(&num_vcis, &max_vcis, 1, MPIR_INT_INTERNAL, MPI_MAX, + node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (max_vcis > 1) { @@ -38,7 +38,7 @@ int MPIDI_POSIX_comm_set_vcis(MPIR_Comm * comm, int num_vcis) slab = MPL_initshm_open(MPIDI_POSIX_global.shm_vci_name, slab_size, NULL); MPIR_ERR_CHKANDJUMP(!slab, mpi_errno, MPI_ERR_OTHER, "**nomem"); - mpi_errno = MPIR_Barrier_impl(node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); #else mpi_errno = MPIDU_Init_shm_comm_alloc(comm, slab_size, (void *) &slab); @@ -49,7 +49,7 @@ int MPIDI_POSIX_comm_set_vcis(MPIR_Comm * comm, int num_vcis) mpi_errno = MPIDI_POSIX_eager_set_vcis(MPIDI_POSIX_global.shm_vci_slab, comm, max_vcis); MPIR_ERR_CHECK(mpi_errno); - mpi_errno = MPIR_Barrier_impl(node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } diff --git a/src/mpid/ch4/shm/posix/release_gather/nb_release_gather.c b/src/mpid/ch4/shm/posix/release_gather/nb_release_gather.c index b26f9e4ce2a..62c4e4d8d81 100644 --- a/src/mpid/ch4/shm/posix/release_gather/nb_release_gather.c +++ b/src/mpid/ch4/shm/posix/release_gather/nb_release_gather.c @@ -121,18 +121,19 @@ int MPIDI_POSIX_nb_release_gather_comm_init(MPIR_Comm * comm_ptr, to other algorithms.\n"); } fallback = 1; - MPIR_Bcast_impl(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); + MPIR_Bcast_fallback(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_NO_MEM, "**nomem"); } else { /* More shm can be created, update the shared counter */ MPL_atomic_fetch_add_uint64(MPIDI_POSIX_shm_limit_counter, memory_to_be_allocated); fallback = 0; mpi_errno = - MPIR_Bcast_impl(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); + MPIR_Bcast_fallback(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); } } else { - mpi_errno = MPIR_Bcast_impl(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); + mpi_errno = + MPIR_Bcast_fallback(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); if (fallback) { MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_NO_MEM, "**nomem"); @@ -168,8 +169,8 @@ int MPIDI_POSIX_nb_release_gather_comm_init(MPIR_Comm * comm_ptr, topotree_fail[0] = -1; topotree_fail[1] = -1; } - mpi_errno = MPIR_Allreduce_impl(MPI_IN_PLACE, topotree_fail, 2, MPIR_INT_INTERNAL, - MPI_MAX, comm_ptr, coll_attr); + mpi_errno = MPIR_Allreduce_fallback(MPI_IN_PLACE, topotree_fail, 2, MPIR_INT_INTERNAL, + MPI_MAX, comm_ptr, coll_attr); } else { topotree_fail[0] = -1; topotree_fail[1] = -1; @@ -267,7 +268,7 @@ int MPIDI_POSIX_nb_release_gather_comm_init(MPIR_Comm * comm_ptr, if (initialize_ibcast_buf || initialize_ireduce_buf) { /* Make sure all the flags are set before ranks start reading each other's flags from shm */ - mpi_errno = MPIR_Barrier_impl(comm_ptr, coll_attr); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); } diff --git a/src/mpid/ch4/shm/posix/release_gather/release_gather.c b/src/mpid/ch4/shm/posix/release_gather/release_gather.c index ce79beac81b..15c12b80237 100644 --- a/src/mpid/ch4/shm/posix/release_gather/release_gather.c +++ b/src/mpid/ch4/shm/posix/release_gather/release_gather.c @@ -303,18 +303,19 @@ int MPIDI_POSIX_mpi_release_gather_comm_init(MPIR_Comm * comm_ptr, } fallback = 1; - MPIR_Bcast_impl(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); + MPIR_Bcast_fallback(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_NO_MEM, "**nomem"); } else { /* More shm can be created, update the shared counter */ MPL_atomic_fetch_add_uint64(MPIDI_POSIX_shm_limit_counter, memory_to_be_allocated); fallback = 0; mpi_errno = - MPIR_Bcast_impl(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); + MPIR_Bcast_fallback(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); } } else { - mpi_errno = MPIR_Bcast_impl(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); + mpi_errno = + MPIR_Bcast_fallback(&fallback, 1, MPIR_INT_INTERNAL, 0, comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); if (fallback) { MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_NO_MEM, "**nomem"); @@ -359,8 +360,8 @@ int MPIDI_POSIX_mpi_release_gather_comm_init(MPIR_Comm * comm_ptr, topotree_fail[0] = -1; topotree_fail[1] = -1; } - mpi_errno = MPIR_Allreduce_impl(MPI_IN_PLACE, topotree_fail, 2, MPIR_INT_INTERNAL, - MPI_MAX, comm_ptr, coll_attr); + mpi_errno = MPIR_Allreduce_fallback(MPI_IN_PLACE, topotree_fail, 2, MPIR_INT_INTERNAL, + MPI_MAX, comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); } else { topotree_fail[0] = -1; @@ -424,7 +425,7 @@ int MPIDI_POSIX_mpi_release_gather_comm_init(MPIR_Comm * comm_ptr, release_gather_info_ptr->release_state); /* Make sure all the flags are set before ranks start reading each other's flags from shm */ - mpi_errno = MPIR_Barrier_impl(comm_ptr, coll_attr); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); } diff --git a/src/mpid/ch4/shm/src/topotree.c b/src/mpid/ch4/shm/src/topotree.c index 2569617c042..debdc65f6fb 100644 --- a/src/mpid/ch4/shm/src/topotree.c +++ b/src/mpid/ch4/shm/src/topotree.c @@ -499,7 +499,7 @@ int MPIDI_SHM_topology_tree_init(MPIR_Comm * comm_ptr, int root, int bcast_k, in shared_region_ptr[rank][depth++] = MPIR_hwtopo_get_lid(gid); gid = MPIR_hwtopo_get_ancestor(gid, topo_depth - depth - 1); } - mpi_errno = MPIR_Barrier_impl(comm_ptr, coll_attr); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); /* STEP 3. Root has all the bind_map information, now build tree */ @@ -557,7 +557,7 @@ int MPIDI_SHM_topology_tree_init(MPIR_Comm * comm_ptr, int root, int bcast_k, in 0 /*left_skewed */ , bcast_tree_type); MPIR_ERR_CHECK(mpi_errno); } - mpi_errno = MPIR_Barrier_impl(comm_ptr, coll_attr); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); /* Every rank copies their tree out from shared memory */ @@ -566,7 +566,7 @@ int MPIDI_SHM_topology_tree_init(MPIR_Comm * comm_ptr, int root, int bcast_k, in MPIDI_SHM_print_topotree_file("BCAST", comm_ptr->context_id, rank, bcast_tree); /* Wait until shared memory is available */ - mpi_errno = MPIR_Barrier_impl(comm_ptr, coll_attr); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); /* Generate the reduce tree */ /* For Reduce, package leaders are added after the package local ranks, and the per_package @@ -580,7 +580,7 @@ int MPIDI_SHM_topology_tree_init(MPIR_Comm * comm_ptr, int root, int bcast_k, in MPIR_ERR_CHECK(mpi_errno); } - mpi_errno = MPIR_Barrier_impl(comm_ptr, coll_attr); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); /* each rank copy the reduce tree out */ @@ -589,7 +589,7 @@ int MPIDI_SHM_topology_tree_init(MPIR_Comm * comm_ptr, int root, int bcast_k, in if (MPIDI_SHM_TOPOTREE_DEBUG) MPIDI_SHM_print_topotree_file("REDUCE", comm_ptr->context_id, rank, reduce_tree); /* Wait for all ranks to copy out the tree */ - mpi_errno = MPIR_Barrier_impl(comm_ptr, coll_attr); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, coll_attr); MPIR_ERR_CHECK(mpi_errno); /* Cleanup */ if (rank == root) { diff --git a/src/mpid/ch4/src/ch4_comm.c b/src/mpid/ch4/src/ch4_comm.c index 061e758236e..3e41349e934 100644 --- a/src/mpid/ch4/src/ch4_comm.c +++ b/src/mpid/ch4/src/ch4_comm.c @@ -365,8 +365,8 @@ int MPID_Intercomm_exchange(MPIR_Comm * local_comm, int local_leader, bcast_data.mpi_errno = mpi_errno; bcast_data.remote_data_size = remote_data_size; } - mpi_errno = MPIR_Bcast_impl(&bcast_data, 2, MPIR_INT_INTERNAL, - local_leader, local_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(&bcast_data, 2, MPIR_INT_INTERNAL, + local_leader, local_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* error checking of previous leader exchange */ @@ -384,8 +384,8 @@ int MPID_Intercomm_exchange(MPIR_Comm * local_comm, int local_leader, MPIR_ERR_CHKANDJUMP(!remote_data, mpi_errno, MPI_ERR_OTHER, "**nomem"); } - mpi_errno = MPIR_Bcast_impl(remote_data, remote_data_size, MPIR_BYTE_INTERNAL, - local_leader, local_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(remote_data, remote_data_size, MPIR_BYTE_INTERNAL, + local_leader, local_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* Stage 3: Each process extract data (if necessary: add worlds, convert lpids) */ diff --git a/src/mpid/ch4/src/ch4_spawn.c b/src/mpid/ch4/src/ch4_spawn.c index 489815720b8..9e3ed895b24 100644 --- a/src/mpid/ch4/src/ch4_spawn.c +++ b/src/mpid/ch4/src/ch4_spawn.c @@ -69,7 +69,8 @@ int MPID_Comm_spawn_multiple(int count, char *commands[], char **argvs[], const bcast_ints[0] = total_num_processes; bcast_ints[1] = mpi_errno; } - mpi_errno = MPIR_Bcast(bcast_ints, 2, MPIR_INT_INTERNAL, root, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(bcast_ints, 2, MPIR_INT_INTERNAL, root, comm_ptr, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (comm_ptr->rank != root) { total_num_processes = bcast_ints[0]; @@ -88,8 +89,8 @@ int MPID_Comm_spawn_multiple(int count, char *commands[], char **argvs[], const int should_accept = 1; if (errcodes != MPI_ERRCODES_IGNORE) { - mpi_errno = MPIR_Bcast(pmi_errcodes, total_num_processes, MPIR_INT_INTERNAL, - root, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(pmi_errcodes, total_num_processes, MPIR_INT_INTERNAL, + root, comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); for (int i = 0; i < total_num_processes; i++) { @@ -378,10 +379,10 @@ static int dynamic_intercomm_create(const char *port_name, MPIR_Info * info, int fn_fail: /* In case root fails, we bcast mpi_errno so other ranks will abort too */ - MPIR_Bcast_impl(&mpi_errno, 1, MPIR_INT_INTERNAL, root, comm_ptr, MPIR_COLL_ATTR_SYNC); + MPIR_Bcast_fallback(&mpi_errno, 1, MPIR_INT_INTERNAL, root, comm_ptr, MPIR_COLL_ATTR_SYNC); } else { int root_errno; - MPIR_Bcast_impl(&root_errno, 1, MPIR_INT_INTERNAL, root, comm_ptr, MPIR_COLL_ATTR_SYNC); + MPIR_Bcast_fallback(&root_errno, 1, MPIR_INT_INTERNAL, root, comm_ptr, MPIR_COLL_ATTR_SYNC); if (root_errno) { MPIR_ERR_SET(mpi_errno, MPI_ERR_PORT, "**comm_connect_fail"); } diff --git a/src/mpid/ch4/src/mpidig_win.c b/src/mpid/ch4/src/mpidig_win.c index 923602e46c1..7339425a4ca 100644 --- a/src/mpid/ch4/src/mpidig_win.c +++ b/src/mpid/ch4/src/mpidig_win.c @@ -394,8 +394,8 @@ static int win_init(MPI_Aint length, int disp_unit, MPIR_Win ** win_ptr, MPIR_In if (!comm_ptr->node_comm) no_local = true; - mpi_errno = MPIR_Allreduce(&no_local, &all_no_local, 1, MPIR_C_BOOL_INTERNAL, - MPI_LAND, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allreduce_fallback(&no_local, &all_no_local, 1, MPIR_C_BOOL_INTERNAL, + MPI_LAND, comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (all_no_local) MPIDI_WIN(win, winattr) |= MPIDI_WINATTR_ACCU_NO_SHM; @@ -521,12 +521,9 @@ static int win_shm_alloc_impl(MPI_Aint size, int disp_unit, MPIR_Comm * comm_ptr shared_table[shm_comm_ptr->rank].disp_unit = disp_unit; shared_table[shm_comm_ptr->rank].shm_base_addr = NULL; - mpi_errno = MPIR_Allgather(MPI_IN_PLACE, - 0, - MPI_DATATYPE_NULL, - shared_table, - sizeof(MPIDIG_win_shared_info_t), MPIR_BYTE_INTERNAL, - shm_comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, shared_table, + sizeof(MPIDIG_win_shared_info_t), MPIR_BYTE_INTERNAL, + shm_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_T_PVAR_TIMER_END(RMA, rma_wincreate_allgather); if (mpi_errno != MPI_SUCCESS) goto fn_fail; @@ -561,8 +558,9 @@ static int win_shm_alloc_impl(MPI_Aint size, int disp_unit, MPIR_Comm * comm_ptr * thus all process can be assigned to a page aligned start address. * - user sets alloc_shared_noncontig=true, thus we can internally make * the size aligned on each process. */ - mpi_errno = MPIR_Allreduce(&symheap_flag, &global_symheap_flag, 1, MPIR_C_BOOL_INTERNAL, - MPI_LAND, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = + MPIR_Allreduce_fallback(&symheap_flag, &global_symheap_flag, 1, MPIR_C_BOOL_INTERNAL, + MPI_LAND, comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } else global_symheap_flag = false; @@ -692,7 +690,7 @@ int MPIDIG_mpi_win_set_info(MPIR_Win * win, MPIR_Info * info) /* Do not update winattr except for info set at window creation. * Because it will change RMA's behavior which requires collective synchronization. */ - mpi_errno = MPIR_Barrier(win->comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(win->comm_ptr, MPIR_COLL_ATTR_SYNC); fn_exit: MPIR_FUNC_EXIT; return mpi_errno; @@ -857,7 +855,7 @@ int MPIDIG_mpi_win_free(MPIR_Win ** win_ptr) MPIDIG_ACCESS_EPOCH_CHECK_NONE(win, mpi_errno, return mpi_errno); MPIDIG_EXPOSURE_EPOCH_CHECK_NONE(win, mpi_errno, return mpi_errno); - mpi_errno = MPIR_Barrier(win->comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(win->comm_ptr, MPIR_COLL_ATTR_SYNC); if (mpi_errno != MPI_SUCCESS) goto fn_fail; @@ -894,7 +892,7 @@ int MPIDIG_mpi_win_create(void *base, MPI_Aint length, int disp_unit, MPIR_Info MPIR_ERR_CHECK(mpi_errno); #endif - mpi_errno = MPIR_Barrier(win->comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(win->comm_ptr, MPIR_COLL_ATTR_SYNC); if (mpi_errno != MPI_SUCCESS) goto fn_fail; @@ -962,7 +960,7 @@ int MPIDIG_mpi_win_allocate_shared(MPI_Aint size, int disp_unit, MPIR_Info * inf MPIR_ERR_CHECK(mpi_errno); #endif - mpi_errno = MPIR_Barrier(comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(comm_ptr, MPIR_COLL_ATTR_SYNC); fn_exit: MPIR_FUNC_EXIT; @@ -1026,7 +1024,7 @@ int MPIDIG_mpi_win_allocate(MPI_Aint size, int disp_unit, MPIR_Info * info, MPIR MPIR_ERR_CHECK(mpi_errno); #endif - mpi_errno = MPIR_Barrier(comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(comm, MPIR_COLL_ATTR_SYNC); if (mpi_errno != MPI_SUCCESS) goto fn_fail; @@ -1065,7 +1063,7 @@ int MPIDIG_mpi_win_create_dynamic(MPIR_Info * info, MPIR_Comm * comm, MPIR_Win * MPIR_ERR_CHECK(mpi_errno); #endif - mpi_errno = MPIR_Barrier(comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(comm, MPIR_COLL_ATTR_SYNC); fn_exit: MPIR_FUNC_EXIT; diff --git a/src/mpid/ch4/src/mpidig_win.h b/src/mpid/ch4/src/mpidig_win.h index a172bceceec..b4a6e91dafa 100644 --- a/src/mpid/ch4/src/mpidig_win.h +++ b/src/mpid/ch4/src/mpidig_win.h @@ -522,7 +522,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDIG_mpi_win_fence(int massert, MPIR_Win * win) * the VCI lock internally. */ MPID_THREAD_CS_EXIT(VCI, MPIDI_VCI_LOCK(vci)); need_unlock = 0; - mpi_errno = MPIR_Barrier(win->comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(win->comm_ptr, MPIR_COLL_ATTR_SYNC); fn_exit: if (need_unlock) { diff --git a/src/mpid/common/shm/mpidu_init_shm_alloc.c b/src/mpid/common/shm/mpidu_init_shm_alloc.c index 55291a90b5d..37371505093 100644 --- a/src/mpid/common/shm/mpidu_init_shm_alloc.c +++ b/src/mpid/common/shm/mpidu_init_shm_alloc.c @@ -199,13 +199,13 @@ int MPIDU_Init_shm_comm_alloc(MPIR_Comm * comm, size_t len, void **ptr) } MPIR_Assert(serialized_hnd_size <= MPIDU_INIT_SHM_BLOCK_SIZE); if (node_comm) { - mpi_errno = MPIR_Bcast_impl(serialized_hnd, MPIDU_INIT_SHM_BLOCK_SIZE, - MPIR_BYTE_INTERNAL, 0, node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd, MPIDU_INIT_SHM_BLOCK_SIZE, + MPIR_BYTE_INTERNAL, 0, node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } } else { - mpi_errno = MPIR_Bcast_impl(serialized_hnd_buffer, MPIDU_INIT_SHM_BLOCK_SIZE, - MPIR_BYTE_INTERNAL, 0, node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd_buffer, MPIDU_INIT_SHM_BLOCK_SIZE, + MPIR_BYTE_INTERNAL, 0, node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); serialized_hnd = serialized_hnd_buffer; serialized_hnd_size = strlen(serialized_hnd) + 1; /* add 1 for null char */ @@ -222,7 +222,7 @@ int MPIDU_Init_shm_comm_alloc(MPIR_Comm * comm, size_t len, void **ptr) } if (node_comm) { - mpi_errno = MPIR_Barrier_impl(node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Barrier_fallback(node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } if (need_remove) { diff --git a/src/mpid/common/shm/mpidu_shm_alloc.c b/src/mpid/common/shm/mpidu_shm_alloc.c index d3e0faf5f90..e6abe90e5e2 100644 --- a/src/mpid/common/shm/mpidu_shm_alloc.c +++ b/src/mpid/common/shm/mpidu_shm_alloc.c @@ -235,8 +235,8 @@ static int allreduce_maxloc(size_t mysz, int myloc, MPIR_Comm * comm, size_t * m maxloc.loc = myloc; mpi_errno = - MPIR_Allreduce(&maxloc, &maxloc_result, 1, maxloc_type, maxloc_op->handle, comm, - MPIR_COLL_ATTR_SYNC); + MPIR_Allreduce_fallback(&maxloc, &maxloc_result, 1, maxloc_type, maxloc_op->handle, comm, + MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); *maxsz_loc = maxloc_result.loc; @@ -291,23 +291,23 @@ static int map_symm_shm(MPIR_Comm * shm_comm_ptr, MPIDU_shm_seg_t * shm_seg, int root_sync: /* broadcast the mapping result on rank 0 */ - mpi_errno = MPIR_Bcast(map_result_ptr, 1, MPIR_INT_INTERNAL, 0, shm_comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(map_result_ptr, 1, MPIR_INT_INTERNAL, 0, + shm_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (*map_result_ptr != SYMSHM_SUCCESS) goto map_fail; - mpi_errno = MPIR_Bcast(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_BYTE_INTERNAL, 0, - shm_comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_BYTE_INTERNAL, + 0, shm_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } else { char serialized_hnd[MPL_SHM_GHND_SZ] = { 0 }; /* receive the mapping result of rank 0 */ - mpi_errno = MPIR_Bcast(map_result_ptr, 1, MPIR_INT_INTERNAL, 0, shm_comm_ptr, - MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(map_result_ptr, 1, MPIR_INT_INTERNAL, 0, + shm_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (*map_result_ptr != SYMSHM_SUCCESS) @@ -316,8 +316,8 @@ static int map_symm_shm(MPIR_Comm * shm_comm_ptr, MPIDU_shm_seg_t * shm_seg, int /* if rank 0 mapped successfully, others on the node attach shared memory region */ /* get serialized handle from rank 0 and deserialize it */ - mpi_errno = MPIR_Bcast(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_BYTE_INTERNAL, 0, - shm_comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_BYTE_INTERNAL, + 0, shm_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); mpl_err = @@ -341,8 +341,9 @@ static int map_symm_shm(MPIR_Comm * shm_comm_ptr, MPIDU_shm_seg_t * shm_seg, int /* check results of all processes. If any failure happens (max result > 0), * return SYMSHM_OTHER_FAIL if anyone reports it (max result == 2). * Otherwise return SYMSHM_MAP_FAIL (max result == 1). */ - mpi_errno = MPIR_Allreduce(map_result_ptr, &all_map_result, 1, MPIR_INT_INTERNAL, - MPI_MAX, shm_comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = + MPIR_Allreduce_fallback(map_result_ptr, &all_map_result, 1, MPIR_INT_INTERNAL, + MPI_MAX, shm_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (all_map_result != SYMSHM_SUCCESS) @@ -434,8 +435,8 @@ static int shm_alloc_symm_all(MPIR_Comm * comm_ptr, size_t offset, MPIDU_shm_seg map_pointer = generate_random_addr(shm_seg->segment_len); /* broadcast fixed address to the other processes in comm */ - mpi_errno = MPIR_Bcast(&map_pointer, sizeof(char *), MPIR_CHAR_INTERNAL, - maxsz_loc, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(&map_pointer, sizeof(char *), MPIR_CHAR_INTERNAL, + maxsz_loc, comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* optimization: make sure every process memory in the shared segment is mapped @@ -452,8 +453,8 @@ static int shm_alloc_symm_all(MPIR_Comm * comm_ptr, size_t offset, MPIDU_shm_seg MPIR_ERR_CHECK(mpi_errno); /* check if any mapping failure occurs */ - mpi_errno = MPIR_Allreduce(&map_result, &all_map_result, 1, MPIR_INT_INTERNAL, - MPI_MAX, comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allreduce_fallback(&map_result, &all_map_result, 1, MPIR_INT_INTERNAL, + MPI_MAX, comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* cleanup local shm segment if mapping failed on other process */ @@ -503,16 +504,17 @@ static int shm_alloc(MPIR_Comm * shm_comm_ptr, MPIDU_shm_seg_t * shm_seg) if (shm_fail_flag) serialized_hnd = &mpl_err_hnd[0]; - mpi_errno = MPIR_Bcast_impl(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_BYTE_INTERNAL, 0, - shm_comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_BYTE_INTERNAL, 0, + shm_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (shm_fail_flag) goto map_fail; /* ensure all other processes have mapped successfully */ - mpi_errno = MPIR_Allreduce_impl(&shm_fail_flag, &any_shm_fail_flag, 1, MPIR_C_BOOL_INTERNAL, - MPI_LOR, shm_comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = + MPIR_Allreduce_fallback(&shm_fail_flag, &any_shm_fail_flag, 1, MPIR_C_BOOL_INTERNAL, + MPI_LOR, shm_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* unlink shared memory region so it gets deleted when all processes exit */ @@ -526,8 +528,8 @@ static int shm_alloc(MPIR_Comm * shm_comm_ptr, MPIDU_shm_seg_t * shm_seg) char serialized_hnd[MPL_SHM_GHND_SZ] = { 0 }; /* get serialized handle from rank 0 and deserialize it */ - mpi_errno = MPIR_Bcast_impl(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, 0, - shm_comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(serialized_hnd, MPL_SHM_GHND_SZ, MPIR_CHAR_INTERNAL, 0, + shm_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* empty handler means root fails */ @@ -549,8 +551,9 @@ static int shm_alloc(MPIR_Comm * shm_comm_ptr, MPIDU_shm_seg_t * shm_seg) mapped_flag = true; result_sync: - mpi_errno = MPIR_Allreduce_impl(&shm_fail_flag, &any_shm_fail_flag, 1, MPIR_C_BOOL_INTERNAL, - MPI_LOR, shm_comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = + MPIR_Allreduce_fallback(&shm_fail_flag, &any_shm_fail_flag, 1, MPIR_C_BOOL_INTERNAL, + MPI_LOR, shm_comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); if (any_shm_fail_flag) diff --git a/src/util/ccl/nccl.c b/src/util/ccl/nccl.c index 0ca15e800d2..1acbdbb1560 100644 --- a/src/util/ccl/nccl.c +++ b/src/util/ccl/nccl.c @@ -29,7 +29,8 @@ static int MPIR_NCCLcomm_init(MPIR_Comm * comm_ptr, int rank) ncclGetUniqueId(&(ncclcomm->id)); } - mpi_errno = MPIR_Bcast(&(ncclcomm->id), sizeof(ncclcomm->id), MPIR_UINT8, 0, comm_ptr, 0); + mpi_errno = MPIR_Bcast_fallback(&(ncclcomm->id), sizeof(ncclcomm->id), MPIR_UINT8, 0, + comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); ret = cudaStreamCreate(&(ncclcomm->stream)); diff --git a/src/util/ccl/rccl.c b/src/util/ccl/rccl.c index 5ecc0d654da..2c28cf646a3 100644 --- a/src/util/ccl/rccl.c +++ b/src/util/ccl/rccl.c @@ -33,8 +33,8 @@ static int MPIR_RCCLcomm_init(MPIR_Comm * comm_ptr, int rank) ncclGetUniqueId(&(rcclcomm->id)); } - mpi_errno = - MPIR_Bcast(&(rcclcomm->id), sizeof(rcclcomm->id), MPIR_UINT8, 0, comm_ptr, MPI_SUCCESS); + mpi_errno = MPIR_Bcast_fallback(&(rcclcomm->id), sizeof(rcclcomm->id), MPIR_UINT8, 0, + comm_ptr, 0); MPIR_ERR_CHECK(mpi_errno); ret = hipStreamCreate(&(rcclcomm->stream)); diff --git a/src/util/mpir_nodemap.c b/src/util/mpir_nodemap.c index ea10f44af0c..1a6ea95e612 100644 --- a/src/util/mpir_nodemap.c +++ b/src/util/mpir_nodemap.c @@ -454,16 +454,16 @@ int MPIR_nodeid_init(void) MPIR_Strerror(errno, strerrbuf, MPIR_STRERROR_BUF_SIZE), errno); my_hostname[MAX_HOSTNAME_LEN - 1] = '\0'; - mpi_errno = MPIR_Allgather_impl(MPI_IN_PLACE, MAX_HOSTNAME_LEN, MPIR_CHAR_INTERNAL, - allhostnames, MAX_HOSTNAME_LEN, MPIR_CHAR_INTERNAL, - node_roots_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(MPI_IN_PLACE, MAX_HOSTNAME_LEN, MPIR_CHAR_INTERNAL, + allhostnames, MAX_HOSTNAME_LEN, MPIR_CHAR_INTERNAL, + node_roots_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } MPIR_Comm *node_comm = MPIR_Process.comm_world->node_comm; if (node_comm) { - mpi_errno = MPIR_Bcast_impl(allhostnames, MAX_HOSTNAME_LEN * MPIR_Process.num_nodes, - MPIR_CHAR_INTERNAL, 0, node_comm, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Bcast_fallback(allhostnames, MAX_HOSTNAME_LEN * MPIR_Process.num_nodes, + MPIR_CHAR_INTERNAL, 0, node_comm, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); } From 9158350aeebec98d99a557bf6d1c43e74fb4d8e5 Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Sun, 16 Nov 2025 13:55:04 -0600 Subject: [PATCH 6/6] coll: define fallback algorithms They are manual "auto" algorithms that selects from a small set of algorithms that are suitable for internal usages, e.g. during init, finalize, and communicator constructions. --- src/include/mpir_coll.h | 29 ++++++++----- src/mpi/coll/src/Makefile.mk | 1 + src/mpi/coll/src/coll_fallback.c | 71 ++++++++++++++++++++++++++++++++ src/mpi/comm/comm_split.c | 6 +-- 4 files changed, 94 insertions(+), 13 deletions(-) create mode 100644 src/mpi/coll/src/coll_fallback.c diff --git a/src/include/mpir_coll.h b/src/include/mpir_coll.h index 080f83d775d..ee3de8052d2 100644 --- a/src/include/mpir_coll.h +++ b/src/include/mpir_coll.h @@ -11,17 +11,26 @@ /* During init, not all algorithms are safe to use. For example, the csel * may not have been initialized. We define a set of fallback routines that - * are safe to use during init. They are all intra algorithms. + * are safe to use during init. */ -#define MPIR_Barrier_fallback MPIR_Barrier_intra_dissemination -#define MPIR_Allgather_fallback MPIR_Allgather_intra_brucks -#define MPIR_Allgatherv_fallback MPIR_Allgatherv_intra_brucks -#define MPIR_Allreduce_fallback MPIR_Allreduce_intra_recursive_doubling -#define MPIR_Bcast_fallback MPIR_Bcast_intra_binomial -#define MPIR_Gather_fallback MPIR_Gather_intra_binomial -#define MPIR_Reduce_scatter_block_fallback MPIR_Reduce_scatter_block_intra_recursive_doubling -/* used in MPIR_Comm_split_impl */ -#define MPIR_Allgather_inter_fallback MPIR_Allgather_inter_local_gather_remote_bcast +int MPIR_Barrier_fallback(MPIR_Comm * comm_ptr, int coll_attr); +int MPIR_Allgather_fallback(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtype, + void *recvbuf, MPI_Aint recvcount, MPI_Datatype recvtype, + MPIR_Comm * comm_ptr, int coll_attr); +int MPIR_Allgatherv_fallback(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtype, + void *recvbuf, const MPI_Aint * recvcounts, const MPI_Aint * displs, + MPI_Datatype recvtype, MPIR_Comm * comm_ptr, int coll_attr); +int MPIR_Allreduce_fallback(const void *sendbuf, void *recvbuf, + MPI_Aint count, MPI_Datatype datatype, + MPI_Op op, MPIR_Comm * comm_ptr, int coll_attr); +int MPIR_Bcast_fallback(void *buffer, MPI_Aint count, MPI_Datatype datatype, int root, + MPIR_Comm * comm_ptr, int coll_attr); +int MPIR_Gather_fallback(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtype, + void *recvbuf, MPI_Aint recvcount, MPI_Datatype recvtype, int root, + MPIR_Comm * comm_ptr, int coll_attr); +int MPIR_Reduce_scatter_block_fallback(const void *sendbuf, void *recvbuf, MPI_Aint recvcount, + MPI_Datatype datatype, MPI_Op op, + MPIR_Comm * comm_ptr, int coll_attr); /* Internal point-to-point communication for collectives */ diff --git a/src/mpi/coll/src/Makefile.mk b/src/mpi/coll/src/Makefile.mk index 1dd1b78b204..0b138fa9105 100644 --- a/src/mpi/coll/src/Makefile.mk +++ b/src/mpi/coll/src/Makefile.mk @@ -9,6 +9,7 @@ mpi_core_sources += \ src/mpi/coll/src/coll_impl.c \ + src/mpi/coll/src/coll_fallback.c \ src/mpi/coll/src/csel.c \ src/mpi/coll/src/csel_container.c \ src/mpi/coll/src/csel_json_autogen.c diff --git a/src/mpi/coll/src/coll_fallback.c b/src/mpi/coll/src/coll_fallback.c new file mode 100644 index 00000000000..97fd68a64e4 --- /dev/null +++ b/src/mpi/coll/src/coll_fallback.c @@ -0,0 +1,71 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpiimpl.h" +#include "coll_impl.h" + +int MPIR_Barrier_fallback(MPIR_Comm * comm_ptr, int coll_attr) +{ + MPIR_Assert(comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM); + return MPIR_Barrier_intra_dissemination(comm_ptr, coll_attr); +} + +int MPIR_Allgather_fallback(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtype, + void *recvbuf, MPI_Aint recvcount, MPI_Datatype recvtype, + MPIR_Comm * comm_ptr, int coll_attr) +{ + if (comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM) { + return MPIR_Allgather_intra_brucks(sendbuf, sendcount, sendtype, + recvbuf, recvcount, recvtype, comm_ptr, coll_attr); + } else { + return MPIR_Allgather_inter_local_gather_remote_bcast(sendbuf, sendcount, sendtype, + recvbuf, recvcount, recvtype, + comm_ptr, coll_attr); + } +} + +int MPIR_Allgatherv_fallback(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtype, + void *recvbuf, const MPI_Aint * recvcounts, const MPI_Aint * displs, + MPI_Datatype recvtype, MPIR_Comm * comm_ptr, int coll_attr) +{ + MPIR_Assert(comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM); + return MPIR_Allgatherv_intra_brucks(sendbuf, sendcount, sendtype, + recvbuf, recvcounts, displs, recvtype, comm_ptr, coll_attr); +} + +int MPIR_Allreduce_fallback(const void *sendbuf, void *recvbuf, + MPI_Aint count, MPI_Datatype datatype, + MPI_Op op, MPIR_Comm * comm_ptr, int coll_attr) +{ + MPIR_Assert(comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM); + return MPIR_Allreduce_intra_recursive_doubling(sendbuf, recvbuf, count, datatype, op, + comm_ptr, coll_attr); +} + +int MPIR_Bcast_fallback(void *buffer, MPI_Aint count, MPI_Datatype datatype, int root, + MPIR_Comm * comm_ptr, int coll_attr) +{ + MPIR_Assert(comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM); + return MPIR_Bcast_intra_binomial(buffer, count, datatype, root, comm_ptr, coll_attr); +} + +int MPIR_Gather_fallback(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtype, + void *recvbuf, MPI_Aint recvcount, MPI_Datatype recvtype, int root, + MPIR_Comm * comm_ptr, int coll_attr) +{ + MPIR_Assert(comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM); + return MPIR_Gather_intra_binomial(sendbuf, sendcount, sendtype, + recvbuf, recvcount, recvtype, root, comm_ptr, coll_attr); +} + +int MPIR_Reduce_scatter_block_fallback(const void *sendbuf, void *recvbuf, MPI_Aint recvcount, + MPI_Datatype datatype, MPI_Op op, + MPIR_Comm * comm_ptr, int coll_attr) +{ + MPIR_Assert(comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM); + MPIR_Assert(MPIR_Op_is_commutative(op)); + return MPIR_Reduce_scatter_block_intra_recursive_halving(sendbuf, recvbuf, recvcount, datatype, + op, comm_ptr, coll_attr); +} diff --git a/src/mpi/comm/comm_split.c b/src/mpi/comm/comm_split.c index 79db9a7452d..5c2d00781e9 100644 --- a/src/mpi/comm/comm_split.c +++ b/src/mpi/comm/comm_split.c @@ -157,9 +157,9 @@ int MPIR_Comm_split_impl(MPIR_Comm * comm_ptr, int color, int key, MPIR_Comm ** * same color */ mypair.color = color; mypair.key = key; - mpi_errno = MPIR_Allgather_inter_fallback(&mypair, 2, MPIR_INT_INTERNAL, - remotetable, 2, MPIR_INT_INTERNAL, - comm_ptr, MPIR_COLL_ATTR_SYNC); + mpi_errno = MPIR_Allgather_fallback(&mypair, 2, MPIR_INT_INTERNAL, + remotetable, 2, MPIR_INT_INTERNAL, + comm_ptr, MPIR_COLL_ATTR_SYNC); MPIR_ERR_CHECK(mpi_errno); /* Each process can now match its color with the entries in the table */