smp_simple spreading_simple)
ADD_TEST(smpi-allgather-coll-${ALLGATHER_COLL} ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg smpi/allgather:${ALLGATHER_COLL} --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/allgather_coll.tesh)
ENDFOREACH()
+ FOREACH (ALLGATHERV_COLL default pair ring)
+ ADD_TEST(smpi-allgatherv-coll-${ALLGATHERV_COLL} ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg smpi/allgatherv:${ALLGATHERV_COLL} --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/allgatherv_coll.tesh)
+ ENDFOREACH()
FOREACH (ALLREDUCE_COLL default lr NTS rab1 rab2 rab_rsag rdb smp_binomial smp_rdb smp_rsag
smp_rsag_lr smp_rsag_rab redbcast)
ADD_TEST(smpi-allreduce-coll-${ALLREDUCE_COLL} ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg smpi/allreduce:${ALLREDUCE_COLL} --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/allreduce_coll.tesh)
src/smpi/colls/allgather-SMP-NTS.c
src/smpi/colls/allgather-smp-simple.c
src/smpi/colls/allgather-spreading-simple.c
+ src/smpi/colls/allgatherv-pair.c
+ src/smpi/colls/allgatherv-ring.c
src/smpi/colls/allreduce-lr.c
src/smpi/colls/allreduce-NTS.c
src/smpi/colls/allreduce-rab1.c
(void *, int, MPI_Datatype, void *, int, MPI_Datatype,
MPI_Comm));
+/** \ingroup MPI allgather
+ * \brief The list of all available allgather collectives
+ */
+XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_allgatherv_description[];
+XBT_PUBLIC_DATA(int (*mpi_coll_allgatherv_fun)
+ (void *, int, MPI_Datatype, void *, int*, int*, MPI_Datatype,
+ MPI_Comm));
+
/** \ingroup MPI allreduce
* \brief The list of all available allgather collectives
static void _sg_cfg_cb__coll_allgather(const char *name, int pos){
_sg_cfg_cb__coll("allgather", mpi_coll_allgather_description, name, pos);
}
+static void _sg_cfg_cb__coll_allgatherv(const char *name, int pos){
+ _sg_cfg_cb__coll("allgatherv", mpi_coll_allgatherv_description, name, pos);
+}
static void _sg_cfg_cb__coll_allreduce(const char *name, int pos)
{
- _sg_cfg_cb__coll("allreduce", mpi_coll_allreduce_description, name, pos);
+ _sg_cfg_cb__coll("allreduce", mpi_coll_allreduce_description, name, pos);
}
static void _sg_cfg_cb__coll_alltoall(const char *name, int pos)
{
xbt_cfgelm_string, &default_value, 1, 1, &_sg_cfg_cb__coll_allgather,
NULL);
+ default_value = xbt_strdup("default");
+ xbt_cfg_register(&_sg_cfg_set, "smpi/allgatherv",
+ "Which collective to use for allgatherv",
+ xbt_cfgelm_string, &default_value, 1, 1, &_sg_cfg_cb__coll_allgatherv,
+ NULL);
+
default_value = xbt_strdup("default");
xbt_cfg_register(&_sg_cfg_set, "smpi/allreduce",
"Which collective to use for allreduce",
--- /dev/null
+#include "colls_private.h"
+
+/*****************************************************************************
+
+Copyright (c) 2006, Ahmad Faraj & Xin Yuan,
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of the Florida State University nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ *************************************************************************
+ * Any results obtained from executing this software require the *
+ * acknowledgment and citation of the software and its owners. *
+ * The full citation is given below: *
+ * *
+ * A. Faraj and X. Yuan. "Automatic Generation and Tuning of MPI *
+ * Collective Communication Routines." The 19th ACM International *
+ * Conference on Supercomputing (ICS), Cambridge, Massachusetts, *
+ * June 20-22, 2005. *
+ *************************************************************************
+
+*****************************************************************************/
+
+/*****************************************************************************
+ * Function: allgather_pair
+ * return: int
+ * inputs:
+ * send_buff: send input buffer
+ * send_count: number of elements to send
+ * send_type: data type of elements being sent
+ * recv_buff: receive output buffer
+ * recv_count: number of elements to received
+ * recv_type: data type of elements being received
+ * comm: communication
+ * Descrp: Function works when P is power of two. In each phase of P - 1
+ * phases, nodes in pair communicate their data.
+ * Auther: Ahmad Faraj
+ ****************************************************************************/
+int
+smpi_coll_tuned_allgatherv_pair(void *send_buff, int send_count,
+ MPI_Datatype send_type, void *recv_buff,
+ int *recv_counts, int *recv_disps, MPI_Datatype recv_type,
+ MPI_Comm comm)
+{
+
+ MPI_Aint extent;
+ int i, src, dst, rank, num_procs;
+ int tag = 1;
+ MPI_Status status;
+
+ char *send_ptr = (char *) send_buff;
+ char *recv_ptr = (char *) recv_buff;
+
+ rank = smpi_comm_rank(comm);
+ num_procs = smpi_comm_size(comm);
+ extent = smpi_datatype_get_extent(send_type);
+
+ // local send/recv
+ smpi_mpi_sendrecv(send_ptr, send_count, send_type, rank, tag,
+ recv_ptr + recv_disps[rank] * extent,
+ recv_counts[rank], recv_type, rank, tag, comm, &status);
+ for (i = 1; i < num_procs; i++) {
+ src = dst = rank ^ i;
+ smpi_mpi_sendrecv(send_ptr, send_count, send_type, dst, tag,
+ recv_ptr + recv_disps[src] * extent, recv_counts[src], recv_type,
+ src, tag, comm, &status);
+ }
+
+ return MPI_SUCCESS;
+}
--- /dev/null
+#include "colls_private.h"
+
+/*****************************************************************************
+
+Copyright (c) 2006, Ahmad Faraj & Xin Yuan,
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of the Florida State University nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ *************************************************************************
+ * Any results obtained from executing this software require the *
+ * acknowledgment and citation of the software and its owners. *
+ * The full citation is given below: *
+ * *
+ * A. Faraj and X. Yuan. "Automatic Generation and Tuning of MPI *
+ * Collective Communication Routines." The 19th ACM International *
+ * Conference on Supercomputing (ICS), Cambridge, Massachusetts, *
+ * June 20-22, 2005. *
+ *************************************************************************
+
+*****************************************************************************/
+
+/*****************************************************************************
+ * Function: allgather_ring
+ * return: int
+ * inputs:
+ * send_buff: send input buffer
+ * send_count: number of elements to send
+ * send_type: data type of elements being sent
+ * recv_buff: receive output buffer
+ * recv_count: number of elements to received
+ * recv_type: data type of elements being received
+ * comm: communication
+ * Descrp: Function works in P - 1 steps. In step i, node j - i -> j -> j+ i.
+ * Auther: Ahmad Faraj
+ ****************************************************************************/
+int
+smpi_coll_tuned_allgatherv_ring(void *send_buff, int send_count,
+ MPI_Datatype send_type, void *recv_buff,
+ int *recv_counts, int *recv_disps, MPI_Datatype recv_type,
+ MPI_Comm comm)
+{
+
+ MPI_Aint extent;
+ int i, src, dst, rank, num_procs;
+ int tag = 1;
+ MPI_Status status;
+
+ char *sendptr = (char *) send_buff;
+ char *recvptr = (char *) recv_buff;
+
+ rank = smpi_comm_rank(comm);
+ num_procs = smpi_comm_size(comm);
+ extent = smpi_datatype_get_extent(send_type);
+
+ // local send/recv
+ smpi_mpi_sendrecv(sendptr, send_count, send_type, rank, tag,
+ recvptr + recv_disps[rank] * extent,
+ recv_counts[rank], recv_type, rank, tag, comm, &status);
+
+ for (i = 1; i < num_procs; i++) {
+ src = (rank - i + num_procs) % num_procs;
+ dst = (rank + i) % num_procs;
+
+ smpi_mpi_sendrecv(sendptr, send_count, send_type, dst, tag,
+ recvptr + recv_disps[src] * extent, recv_counts[src], recv_type,
+ src, tag, comm, &status);
+ }
+
+ return MPI_SUCCESS;
+}
COLL_ALLGATHERS(COLL_PROTO, COLL_NOsep)
+/**************
+ * ALLGATHERV *
+ **************/
+#define COLL_ALLGATHERV_SIG allgatherv, int, \
+ (void *send_buff, int send_count, MPI_Datatype send_type, \
+ void *recv_buff, int *recv_count, int *recv_disps, \
+ MPI_Datatype recv_type, MPI_Comm comm)
+
+#define COLL_ALLGATHERVS(action, COLL_sep) \
+COLL_APPLY(action, COLL_ALLGATHERV_SIG, pair) COLL_sep \
+COLL_APPLY(action, COLL_ALLGATHERV_SIG, ring)
+
+COLL_ALLGATHERVS(COLL_PROTO, COLL_NOsep)
/*************
* ALLREDUCE *
{NULL, NULL, NULL} /* this array must be NULL terminated */
};
+s_mpi_coll_description_t mpi_coll_allgatherv_description[] = {
+ {"default",
+ "allgatherv default collective",
+ smpi_mpi_allgatherv},
+COLL_ALLGATHERVS(COLL_DESCRIPTION, COLL_COMMA),
+ {NULL, NULL, NULL} /* this array must be NULL terminated */
+};
+
s_mpi_coll_description_t mpi_coll_allreduce_description[] = {
{"default",
"allreduce default collective",
"Logging specific to SMPI (coll)");
int (*mpi_coll_allgather_fun)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm);
+int (*mpi_coll_allgatherv_fun)(void *, int, MPI_Datatype, void*, int*, int*, MPI_Datatype, MPI_Comm);
int (*mpi_coll_allreduce_fun)(void *sbuf, void *rbuf, int rcount, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm);
int (*mpi_coll_alltoall_fun)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm);
int (*mpi_coll_alltoallv_fun)(void *, int*, int*, MPI_Datatype, void*, int*, int*, MPI_Datatype, MPI_Comm);
void*, int, MPI_Datatype, MPI_Comm))
mpi_coll_allgather_description[allgather_id].coll;
+ int allgatherv_id = find_coll_description(mpi_coll_allgatherv_description,
+ sg_cfg_get_string("smpi/allgatherv"));
+ mpi_coll_allgatherv_fun = (int (*)(void *, int, MPI_Datatype,
+ void*, int*, int*, MPI_Datatype, MPI_Comm))
+ mpi_coll_allgatherv_description[allgatherv_id].coll;
+
int allreduce_id = find_coll_description(mpi_coll_allreduce_description,
sg_cfg_get_string("smpi/allreduce"));
mpi_coll_allreduce_fun = (int (*)(void *sbuf, void *rbuf, int rcount, \
} else if (recvcounts == NULL || displs == NULL) {
retval = MPI_ERR_ARG;
} else {
- smpi_mpi_allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
+ mpi_coll_allgatherv_fun(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
displs, recvtype, comm);
retval = MPI_SUCCESS;
}
include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi")
add_executable(allgather_coll allgather_coll.c)
+ add_executable(allgatherv_coll allgatherv_coll.c)
add_executable(alltoall2 alltoall2.c)
add_executable(alltoall_basic alltoall_basic.c)
- add_executable(alltoall_coll alltoall_coll.c)
+ add_executable(alltoall_coll alltoall_coll.c)
add_executable(alltoallv_coll alltoallv_coll.c)
add_executable(allreduce allreduce.c)
add_executable(allreduce_coll allreduce_coll.c)
add_executable(indexed_test indexed_test.c)
add_executable(struct_test struct_test.c)
- target_link_libraries(allgather_coll simgrid)
+ target_link_libraries(allgather_coll simgrid)
+ target_link_libraries(allgatherv_coll simgrid)
target_link_libraries(alltoall2 simgrid)
target_link_libraries(alltoall_basic simgrid)
- target_link_libraries(alltoall_coll simgrid)
+ target_link_libraries(alltoall_coll simgrid)
target_link_libraries(alltoallv_coll simgrid)
target_link_libraries(allreduce simgrid)
target_link_libraries(allreduce_coll simgrid)
set(tesh_files
${tesh_files}
${CMAKE_CURRENT_SOURCE_DIR}/allgather_coll.tesh
+ ${CMAKE_CURRENT_SOURCE_DIR}/allgatherv_coll.tesh
${CMAKE_CURRENT_SOURCE_DIR}/allreduce_coll.tesh
- ${CMAKE_CURRENT_SOURCE_DIR}/alltoall_coll.tesh
+ ${CMAKE_CURRENT_SOURCE_DIR}/alltoall_coll.tesh
+ ${CMAKE_CURRENT_SOURCE_DIR}/alltoallv_coll.tesh
${CMAKE_CURRENT_SOURCE_DIR}/bcast.tesh
${CMAKE_CURRENT_SOURCE_DIR}/bcast_coll.tesh
${CMAKE_CURRENT_SOURCE_DIR}/compute.tesh
set(examples_src
${examples_src}
${CMAKE_CURRENT_SOURCE_DIR}/allgather_coll.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/allgatherv_coll.c
${CMAKE_CURRENT_SOURCE_DIR}/allreduce_coll.c
${CMAKE_CURRENT_SOURCE_DIR}/alltoall_coll.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/alltoallv_coll.c
${CMAKE_CURRENT_SOURCE_DIR}/bcast_coll.c
${CMAKE_CURRENT_SOURCE_DIR}/reduce_coll.c
${CMAKE_CURRENT_SOURCE_DIR}/alltoallv_coll.c