X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/403af5e6247ce6452b721f418a5b41e4548efac4..8b9fbe2cd65513016e1a70b47cabfe0f688285fa:/src/smpi/include/smpi_coll.hpp diff --git a/src/smpi/include/smpi_coll.hpp b/src/smpi/include/smpi_coll.hpp index 99a7377644..e4c5df3ac5 100644 --- a/src/smpi/include/smpi_coll.hpp +++ b/src/smpi/include/smpi_coll.hpp @@ -1,5 +1,5 @@ /*High level handling of collective algorithms*/ -/* Copyright (c) 2009-2010, 2012-2017. The SimGrid Team. +/* Copyright (c) 2009-2019. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -11,10 +11,10 @@ #include "private.hpp" #include "xbt/base.h" -/** \brief MPI collective description */ +/** @brief MPI collective description */ #define COLL_DEFS(cat, ret, args, args2) \ - static void set_##cat(std::string name); \ + static void set_##cat(const std::string& name); \ static s_mpi_coll_description_t mpi_coll_##cat##_description[]; \ static int(*cat) args; @@ -83,58 +83,99 @@ namespace simgrid{ namespace smpi{ struct s_mpi_coll_description_t { - const char *name; - const char *description; + std::string name; + std::string description; void *coll; }; class Colls{ - public: - static XBT_PUBLIC(void) coll_help(const char *category, s_mpi_coll_description_t * table); - static XBT_PUBLIC(int) find_coll_description(s_mpi_coll_description_t* table, std::string name, const char* desc); - static void set_collectives(); - - // for each collective type, create the set_* prototype, the description array and the function pointer - COLL_APPLY(COLL_DEFS, COLL_GATHER_SIG, ""); - COLL_APPLY(COLL_DEFS, COLL_ALLGATHER_SIG, ""); - COLL_APPLY(COLL_DEFS, COLL_ALLGATHERV_SIG, ""); - COLL_APPLY(COLL_DEFS, COLL_REDUCE_SIG, ""); - COLL_APPLY(COLL_DEFS, COLL_ALLREDUCE_SIG, ""); - COLL_APPLY(COLL_DEFS, COLL_REDUCE_SCATTER_SIG, ""); - COLL_APPLY(COLL_DEFS, COLL_SCATTER_SIG, ""); - COLL_APPLY(COLL_DEFS, COLL_BARRIER_SIG, ""); - COLL_APPLY(COLL_DEFS, COLL_BCAST_SIG, ""); - COLL_APPLY(COLL_DEFS, COLL_ALLTOALL_SIG, ""); - COLL_APPLY(COLL_DEFS, COLL_ALLTOALLV_SIG, ""); - - // These fairly unused collectives only have one implementation in SMPI - static int gatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, int* displs, - MPI_Datatype recvtype, int root, MPI_Comm comm); - static int scatterv(void* sendbuf, int* sendcounts, int* displs, MPI_Datatype sendtype, void* recvbuf, - int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm); - static int scan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); - static int exscan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); - - static void (*smpi_coll_cleanup_callback)(); +public: + static XBT_PUBLIC void coll_help(const char* category, s_mpi_coll_description_t* table); + static XBT_PUBLIC int find_coll_description(s_mpi_coll_description_t* table, const std::string& name, + const char* desc); + static void set_collectives(); + + // for each collective type, create the set_* prototype, the description array and the function pointer + COLL_APPLY(COLL_DEFS, COLL_GATHER_SIG, ""); + COLL_APPLY(COLL_DEFS, COLL_ALLGATHER_SIG, ""); + COLL_APPLY(COLL_DEFS, COLL_ALLGATHERV_SIG, ""); + COLL_APPLY(COLL_DEFS, COLL_REDUCE_SIG, ""); + COLL_APPLY(COLL_DEFS, COLL_ALLREDUCE_SIG, ""); + COLL_APPLY(COLL_DEFS, COLL_REDUCE_SCATTER_SIG, ""); + COLL_APPLY(COLL_DEFS, COLL_SCATTER_SIG, ""); + COLL_APPLY(COLL_DEFS, COLL_BARRIER_SIG, ""); + COLL_APPLY(COLL_DEFS, COLL_BCAST_SIG, ""); + COLL_APPLY(COLL_DEFS, COLL_ALLTOALL_SIG, ""); + COLL_APPLY(COLL_DEFS, COLL_ALLTOALLV_SIG, ""); + + // These fairly unused collectives only have one implementation in SMPI + static int gatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, int* displs, + MPI_Datatype recvtype, int root, MPI_Comm comm); + static int scatterv(void* sendbuf, int* sendcounts, int* displs, MPI_Datatype sendtype, void* recvbuf, int recvcount, + MPI_Datatype recvtype, int root, MPI_Comm comm); + static int scan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); + static int exscan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); + static int alltoallw + (void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype* sendtypes, void* recvbuf, int* recvcounts, + int* recvdisps, MPI_Datatype* recvtypes, MPI_Comm comm); + + //async collectives + static int ibarrier(MPI_Comm comm, MPI_Request* request); + static int ibcast(void *buf, int count, MPI_Datatype datatype, + int root, MPI_Comm comm, MPI_Request* request); + static int igather (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, + MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request); + static int igatherv (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + int* recvcounts, int* displs, MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request); + static int iallgather (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + int recvcount, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request); + static int iallgatherv (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + int* recvcounts, int* displs, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request); + static int iscatter (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request); + static int iscatterv (void* sendbuf, int* sendcounts, int* displs, MPI_Datatype sendtype, + void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request); + static int ireduce + (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm, MPI_Request *request); + static int iallreduce + (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request); + static int iscan + (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request); + static int iexscan + (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request); + static int ireduce_scatter + (void* sendbuf, void* recvbuf, int* recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request); + static int ireduce_scatter_block + (void* sendbuf, void* recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request); + static int ialltoall (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + int recvcount, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request); + static int ialltoallv + (void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, + int* recvdisps, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request); + static int ialltoallw + (void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype* sendtypes, void* recvbuf, int* recvcounts, + int* recvdisps, MPI_Datatype* recvtypes, MPI_Comm comm, MPI_Request *request); + + + static void (*smpi_coll_cleanup_callback)(); }; class Coll { - public: - // for each collective type, create a function member - COLL_APPLY(COLL_SIG,COLL_GATHER_SIG,""); - COLL_APPLY(COLL_SIG,COLL_ALLGATHER_SIG,""); - COLL_APPLY(COLL_SIG,COLL_ALLGATHERV_SIG,""); - COLL_APPLY(COLL_SIG,COLL_REDUCE_SIG,""); - COLL_APPLY(COLL_SIG,COLL_ALLREDUCE_SIG,""); - COLL_APPLY(COLL_SIG,COLL_REDUCE_SCATTER_SIG,""); - COLL_APPLY(COLL_SIG,COLL_SCATTER_SIG,""); - COLL_APPLY(COLL_SIG,COLL_BARRIER_SIG,""); - COLL_APPLY(COLL_SIG,COLL_BCAST_SIG,""); - COLL_APPLY(COLL_SIG,COLL_ALLTOALL_SIG,""); - COLL_APPLY(COLL_SIG,COLL_ALLTOALLV_SIG,""); +public: + // for each collective type, create a function member + COLL_APPLY(COLL_SIG, COLL_GATHER_SIG, ""); + COLL_APPLY(COLL_SIG, COLL_ALLGATHER_SIG, ""); + COLL_APPLY(COLL_SIG, COLL_ALLGATHERV_SIG, ""); + COLL_APPLY(COLL_SIG, COLL_REDUCE_SIG, ""); + COLL_APPLY(COLL_SIG, COLL_ALLREDUCE_SIG, ""); + COLL_APPLY(COLL_SIG, COLL_REDUCE_SCATTER_SIG, ""); + COLL_APPLY(COLL_SIG, COLL_SCATTER_SIG, ""); + COLL_APPLY(COLL_SIG, COLL_BARRIER_SIG, ""); + COLL_APPLY(COLL_SIG, COLL_BCAST_SIG, ""); + COLL_APPLY(COLL_SIG, COLL_ALLTOALL_SIG, ""); + COLL_APPLY(COLL_SIG, COLL_ALLTOALLV_SIG, ""); }; - /************* * GATHER * *************/ @@ -398,6 +439,7 @@ COLL_APPLY(action, COLL_BARRIER_SIG, ompi_tree) COLL_sep \ COLL_APPLY(action, COLL_BARRIER_SIG, ompi_bruck) COLL_sep \ COLL_APPLY(action, COLL_BARRIER_SIG, ompi_recursivedoubling) COLL_sep \ COLL_APPLY(action, COLL_BARRIER_SIG, ompi_doublering) COLL_sep \ +COLL_APPLY(action, COLL_BARRIER_SIG, mpich_smp) COLL_sep \ COLL_APPLY(action, COLL_BARRIER_SIG, mpich) COLL_sep \ COLL_APPLY(action, COLL_BARRIER_SIG, mvapich2_pair) COLL_sep \ COLL_APPLY(action, COLL_BARRIER_SIG, mvapich2) COLL_sep \