From: degomme Date: Tue, 14 Mar 2017 22:01:23 +0000 (+0100) Subject: Simplify, cleanup, remove useless bits, and some files. X-Git-Tag: v3_15~116 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/88f516f55bc49095f754361920a9f2f6e418c484 Simplify, cleanup, remove useless bits, and some files. --- diff --git a/src/include/smpi/smpi_interface.h b/src/include/smpi/smpi_interface.h deleted file mode 100644 index 74df6907f7..0000000000 --- a/src/include/smpi/smpi_interface.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#ifndef SMPI_INTERFACE_H -#define SMPI_INTERFACE_H -#include "smpi/smpi.h" - -SG_BEGIN_DECL() - -/** \brief MPI collective description */ - -struct mpi_coll_description { - const char *name; - const char *description; - void *coll; -}; -typedef struct mpi_coll_description s_mpi_coll_description_t; -typedef struct mpi_coll_description* mpi_coll_description_t; - -/** \ingroup MPI gather - * \brief The list of all available allgather collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_gather_description[]; - -/** \ingroup MPI allgather - * \brief The list of all available allgather collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_allgather_description[]; - -/** \ingroup MPI allgather - * \brief The list of all available allgather collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_allgatherv_description[]; - -/** \ingroup MPI allreduce - * \brief The list of all available allgather collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_allreduce_description[]; - -/** \ingroup MPI alltoall - * \brief The list of all available alltoall collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_alltoall_description[]; - -/** \ingroup MPI alltoallv - * \brief The list of all available alltoallv collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_alltoallv_description[]; - -/** \ingroup MPI bcast - * \brief The list of all available bcast collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_bcast_description[]; - -/** \ingroup MPI reduce - * \brief The list of all available reduce collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_reduce_description[]; - -/** \ingroup MPI reduce_scatter - * \brief The list of all available allgather collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_reduce_scatter_description[]; - -/** \ingroup MPI scatter - * \brief The list of all available allgather collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_scatter_description[]; - -/** \ingroup MPI barrier - * \brief The list of all available allgather collectives - */ -XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_barrier_description[]; -XBT_PUBLIC_DATA(int (*mpi_coll_barrier_fun)(MPI_Comm comm)); - -XBT_PUBLIC(void) coll_help(const char *category, s_mpi_coll_description_t * table); -XBT_PUBLIC(int) find_coll_description(s_mpi_coll_description_t * table, const char *name, const char *desc); - -XBT_PUBLIC_DATA(void) (*smpi_coll_cleanup_callback)(); -XBT_PUBLIC(void) smpi_coll_cleanup_mvapich2(void); - -SG_END_DECL() - -#endif diff --git a/src/simgrid/sg_config.cpp b/src/simgrid/sg_config.cpp index a2d536bf3a..9f2d3d3ed0 100644 --- a/src/simgrid/sg_config.cpp +++ b/src/simgrid/sg_config.cpp @@ -20,9 +20,6 @@ #include "simgrid/simix.h" #include "simgrid/sg_config.h" #include "simgrid_config.h" /* what was compiled in? */ -#if HAVE_SMPI -#include "smpi/smpi_interface.h" -#endif #include "mc/mc.h" #include "simgrid/instr.h" #include "src/mc/mc_replay.h" @@ -202,64 +199,6 @@ static void _sg_cfg_cb__network_model(const char *name) /* New Module missing */ find_model_description(surf_network_model_description, val); } - -#if HAVE_SMPI -/* callback of the mpi collectives: simply check that this is a valid name. It will be picked up in smpi_global.cpp */ -static void _check_coll(const char *category, - s_mpi_coll_description_t * table, - const char *name) -{ - xbt_assert(_sg_cfg_init_status < 2, "Cannot change the collective algorithm after the initialization"); - - char *val = xbt_cfg_get_string(name); - if (val && !strcmp(val, "help")) { - coll_help(category, table); - sg_cfg_exit_early(); - } - - find_coll_description(table, val, category); -} -static void _check_coll_gather(const char *name){ - _check_coll("gather", mpi_coll_gather_description, name); -} -static void _check_coll_allgather(const char *name){ - _check_coll("allgather", mpi_coll_allgather_description, name); -} -static void _check_coll_allgatherv(const char *name){ - _check_coll("allgatherv", mpi_coll_allgatherv_description, name); -} -static void _check_coll_allreduce(const char *name) -{ - _check_coll("allreduce", mpi_coll_allreduce_description, name); -} -static void _check_coll_alltoall(const char *name) -{ - _check_coll("alltoall", mpi_coll_alltoall_description, name); -} -static void _check_coll_alltoallv(const char *name) -{ - _check_coll("alltoallv", mpi_coll_alltoallv_description, name); -} -static void _check_coll_bcast(const char *name) -{ - _check_coll("bcast", mpi_coll_bcast_description, name); -} -static void _check_coll_reduce(const char *name) -{ - _check_coll("reduce", mpi_coll_reduce_description, name); -} -static void _check_coll_reduce_scatter(const char *name){ - _check_coll("reduce_scatter", mpi_coll_reduce_scatter_description, name); -} -static void _check_coll_scatter(const char *name){ - _check_coll("scatter", mpi_coll_scatter_description, name); -} -static void _check_coll_barrier(const char *name){ - _check_coll("barrier", mpi_coll_barrier_description, name); -} - -#endif - /* callback to decide if we want to use the model-checking */ #include "src/xbt_modinter.h" @@ -576,18 +515,18 @@ void sg_config_init(int *argc, char **argv) xbt_cfg_register_string("smpi/coll-selector", "default", nullptr, "Which collective selector to use"); xbt_cfg_register_alias("smpi/coll-selector","smpi/coll_selector"); - xbt_cfg_register_string("smpi/gather", nullptr, &_check_coll_gather, "Which collective to use for gather"); - xbt_cfg_register_string("smpi/allgather", nullptr, &_check_coll_allgather, "Which collective to use for allgather"); - xbt_cfg_register_string("smpi/barrier", nullptr, &_check_coll_barrier, "Which collective to use for barrier"); - xbt_cfg_register_string("smpi/reduce-scatter",nullptr, &_check_coll_reduce_scatter, "Which collective to use for reduce_scatter"); + xbt_cfg_register_string("smpi/gather", nullptr, nullptr, "Which collective to use for gather"); + xbt_cfg_register_string("smpi/allgather", nullptr, nullptr, "Which collective to use for allgather"); + xbt_cfg_register_string("smpi/barrier", nullptr, nullptr, "Which collective to use for barrier"); + xbt_cfg_register_string("smpi/reduce-scatter",nullptr, nullptr, "Which collective to use for reduce_scatter"); xbt_cfg_register_alias("smpi/reduce-scatter","smpi/reduce_scatter"); - xbt_cfg_register_string("smpi/scatter", nullptr, &_check_coll_scatter, "Which collective to use for scatter"); - xbt_cfg_register_string("smpi/allgatherv", nullptr, &_check_coll_allgatherv, "Which collective to use for allgatherv"); - xbt_cfg_register_string("smpi/allreduce", nullptr, &_check_coll_allreduce, "Which collective to use for allreduce"); - xbt_cfg_register_string("smpi/alltoall", nullptr, &_check_coll_alltoall, "Which collective to use for alltoall"); - xbt_cfg_register_string("smpi/alltoallv", nullptr, &_check_coll_alltoallv,"Which collective to use for alltoallv"); - xbt_cfg_register_string("smpi/bcast", nullptr, &_check_coll_bcast, "Which collective to use for bcast"); - xbt_cfg_register_string("smpi/reduce", nullptr, &_check_coll_reduce, "Which collective to use for reduce"); + xbt_cfg_register_string("smpi/scatter", nullptr, nullptr, "Which collective to use for scatter"); + xbt_cfg_register_string("smpi/allgatherv", nullptr, nullptr, "Which collective to use for allgatherv"); + xbt_cfg_register_string("smpi/allreduce", nullptr, nullptr, "Which collective to use for allreduce"); + xbt_cfg_register_string("smpi/alltoall", nullptr, nullptr, "Which collective to use for alltoall"); + xbt_cfg_register_string("smpi/alltoallv", nullptr, nullptr,"Which collective to use for alltoallv"); + xbt_cfg_register_string("smpi/bcast", nullptr, nullptr, "Which collective to use for bcast"); + xbt_cfg_register_string("smpi/reduce", nullptr, nullptr, "Which collective to use for reduce"); #endif // HAVE_SMPI /* Storage */ diff --git a/src/smpi/colls/colls.h b/src/smpi/colls/colls.h deleted file mode 100644 index 35fbe1959b..0000000000 --- a/src/smpi/colls/colls.h +++ /dev/null @@ -1,358 +0,0 @@ -/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#ifndef SMPI_COLLS_H -#define SMPI_COLLS_H - -#include -#include "smpi/mpi.h" -#include "src/smpi/private.h" -#include "xbt/ex.h" -#include "xbt.h" - -SG_BEGIN_DECL() - - -namespace simgrid{ -namespace smpi{ - -#define COLL_DESCRIPTION(cat, ret, args, name) \ - {# name,\ - # cat " " # name " collective",\ - (void*) Coll_ ## cat ## _ ## name::cat } - -#define COLL_PROTO(cat, ret, args, name) \ -class Coll_ ## cat ## _ ## name : public Coll_ ## cat { \ -public: \ -static ret cat (COLL_UNPAREN args); \ -}; - -#define COLL_UNPAREN(...) __VA_ARGS__ - -#define COLL_APPLY(action, sig, name) action(sig, name) -#define COLL_COMMA , -#define COLL_NOsep -#define COLL_NOTHING(...) - -/************* - * GATHER * - *************/ - -#define COLL_GATHER_SIG gather, int, \ - (void *send_buff, int send_count, MPI_Datatype send_type, \ - void *recv_buff, int recv_count, MPI_Datatype recv_type, \ - int root, MPI_Comm comm) - -#define COLL_GATHERS(action, COLL_sep) \ -COLL_APPLY(action, COLL_GATHER_SIG, default) COLL_sep \ -COLL_APPLY(action, COLL_GATHER_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_GATHER_SIG, ompi_basic_linear) COLL_sep \ -COLL_APPLY(action, COLL_GATHER_SIG, ompi_binomial) COLL_sep \ -COLL_APPLY(action, COLL_GATHER_SIG, ompi_linear_sync) COLL_sep \ -COLL_APPLY(action, COLL_GATHER_SIG, mpich) COLL_sep \ -COLL_APPLY(action, COLL_GATHER_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_GATHER_SIG, mvapich2_two_level) COLL_sep \ -COLL_APPLY(action, COLL_GATHER_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_GATHER_SIG, automatic) - -COLL_GATHERS(COLL_PROTO, COLL_NOsep) - -/************* - * ALLGATHER * - *************/ -#define COLL_ALLGATHER_SIG allgather, int, \ - (void *send_buff, int send_count, MPI_Datatype send_type, \ - void *recv_buff, int recv_count, MPI_Datatype recv_type, \ - MPI_Comm comm) - -#define COLL_ALLGATHERS(action, COLL_sep) \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, default) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, 2dmesh) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, 3dmesh) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, bruck) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, GB) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, loosely_lr) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR_NB) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, pair) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, rdb) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, rhv) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, ring) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, SMP_NTS) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, smp_simple) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, spreading_simple) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, ompi_neighborexchange) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, mvapich2_smp) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, mpich) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, automatic) - -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, default) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, GB) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, pair) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, ring) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi_neighborexchange) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi_bruck) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, mpich) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, mpich_rdb) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, mpich_ring) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHERV_SIG, automatic) - -COLL_ALLGATHERVS(COLL_PROTO, COLL_NOsep) - -/************* - * ALLREDUCE * - *************/ -#define COLL_ALLREDUCE_SIG allreduce, int, \ - (void *sbuf, void *rbuf, int rcount, \ - MPI_Datatype dtype, MPI_Op op, MPI_Comm comm) - -#define COLL_ALLREDUCES(action, COLL_sep) \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, default) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, lr) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab1) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab2) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_rdb) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, rdb) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_binomial) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_binomial_pipeline) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rdb) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag_lr) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag_rab) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, redbcast) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, ompi_ring_segmented) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, mpich) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, mvapich2_rs) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, mvapich2_two_level) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab) COLL_sep \ -COLL_APPLY(action, COLL_ALLREDUCE_SIG, automatic) - -COLL_ALLREDUCES(COLL_PROTO, COLL_NOsep) - -/************ - * ALLTOALL * - ************/ -#define COLL_ALLTOALL_SIG alltoall, int, \ - (void *send_buff, int send_count, MPI_Datatype send_type, \ - void *recv_buff, int recv_count, MPI_Datatype recv_type, \ - MPI_Comm comm) - -#define COLL_ALLTOALLS(action, COLL_sep) \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, default) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, 2dmesh) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, 3dmesh) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, basic_linear) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, bruck) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, pair) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_rma) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_light_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_mpi_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_one_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, rdb) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, ring) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_light_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_mpi_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_one_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, mvapich2_scatter_dest) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, mpich) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALL_SIG, automatic) - -COLL_ALLTOALLS(COLL_PROTO, COLL_NOsep) - -/************* - * ALLTOALLV * - *************/ -#define COLL_ALLTOALLV_SIG alltoallv, int, \ - (void *send_buff, int *send_counts, int *send_disps, MPI_Datatype send_type, \ - void *recv_buff, int *recv_counts, int *recv_disps, MPI_Datatype recv_type, \ - MPI_Comm comm) - -#define COLL_ALLTOALLVS(action, COLL_sep) \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, default) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, bruck) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_light_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_mpi_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_one_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_light_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_mpi_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_one_barrier) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, mpich) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, ompi_basic_linear) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_ALLTOALLV_SIG, automatic) - -COLL_ALLTOALLVS(COLL_PROTO, COLL_NOsep) - -/********* - * BCAST * - *********/ -#define COLL_BCAST_SIG bcast, int, \ - (void *buf, int count, MPI_Datatype datatype, \ - int root, MPI_Comm comm) - -#define COLL_BCASTS(action, COLL_sep) \ -COLL_APPLY(action, COLL_BCAST_SIG, default) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, arrival_pattern_aware) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, arrival_pattern_aware_wait) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, arrival_scatter) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, binomial_tree) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, flattree) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, flattree_pipeline) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, NTSB) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, NTSL) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, NTSL_Isend) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, scatter_LR_allgather) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, scatter_rdb_allgather) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, SMP_binary) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, SMP_binomial) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, SMP_linear) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, ompi_split_bintree) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, ompi_pipeline) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, mpich) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, mvapich2_inter_node) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, mvapich2_intra_node) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, mvapich2_knomial_intra_node) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_BCAST_SIG, automatic) - -COLL_BCASTS(COLL_PROTO, COLL_NOsep) - - -/********** - * REDUCE * - **********/ -#define COLL_REDUCE_SIG reduce, int, \ - (void *buf, void *rbuf, int count, MPI_Datatype datatype, \ - MPI_Op op, int root, MPI_Comm comm) - -#define COLL_REDUCES(action, COLL_sep) \ -COLL_APPLY(action, COLL_REDUCE_SIG, default) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, arrival_pattern_aware) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, binomial) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, flat_tree) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, NTSL) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, scatter_gather) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, ompi_chain) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, ompi_pipeline) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, ompi_basic_linear) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, ompi_in_order_binary) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, ompi_binary) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, ompi_binomial) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, mpich) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, mvapich2_knomial) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, mvapich2_two_level) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, rab) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SIG, automatic) - -COLL_REDUCES(COLL_PROTO, COLL_NOsep) - -/************* - * REDUCE_SCATTER * - *************/ -#define COLL_REDUCE_SCATTER_SIG reduce_scatter, int, \ - (void *sbuf, void *rbuf, int *rcounts,\ - MPI_Datatype dtype,MPI_Op op,MPI_Comm comm) - -#define COLL_REDUCE_SCATTERS(action, COLL_sep) \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, default) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi_basic_recursivehalving) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi_ring) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich_pair) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich_rdb) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich_noncomm) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, automatic) - - - -COLL_REDUCE_SCATTERS(COLL_PROTO, COLL_NOsep) - - -/************* - * SCATTER * - *************/ -#define COLL_SCATTER_SIG scatter, int, \ - (void *sendbuf, int sendcount, MPI_Datatype sendtype,\ - void *recvbuf, int recvcount, MPI_Datatype recvtype,\ - int root, MPI_Comm comm) - -#define COLL_SCATTERS(action, COLL_sep) \ -COLL_APPLY(action, COLL_SCATTER_SIG, default) COLL_sep \ -COLL_APPLY(action, COLL_SCATTER_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_SCATTER_SIG, ompi_basic_linear) COLL_sep \ -COLL_APPLY(action, COLL_SCATTER_SIG, ompi_binomial) COLL_sep \ -COLL_APPLY(action, COLL_SCATTER_SIG, mpich) COLL_sep \ -COLL_APPLY(action, COLL_SCATTER_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_SCATTER_SIG, mvapich2_two_level_binomial) COLL_sep \ -COLL_APPLY(action, COLL_SCATTER_SIG, mvapich2_two_level_direct) COLL_sep \ -COLL_APPLY(action, COLL_SCATTER_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_SCATTER_SIG, automatic) - -COLL_SCATTERS(COLL_PROTO, COLL_NOsep) - -/************* - * SCATTER * - *************/ -#define COLL_BARRIER_SIG barrier, int, \ - (MPI_Comm comm) - -#define COLL_BARRIERS(action, COLL_sep) \ -COLL_APPLY(action, COLL_BARRIER_SIG, default) COLL_sep \ -COLL_APPLY(action, COLL_BARRIER_SIG, ompi) COLL_sep \ -COLL_APPLY(action, COLL_BARRIER_SIG, ompi_basic_linear) COLL_sep \ -COLL_APPLY(action, COLL_BARRIER_SIG, ompi_two_procs) COLL_sep \ -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) COLL_sep \ -COLL_APPLY(action, COLL_BARRIER_SIG, mvapich2_pair) COLL_sep \ -COLL_APPLY(action, COLL_BARRIER_SIG, mvapich2) COLL_sep \ -COLL_APPLY(action, COLL_BARRIER_SIG, impi) COLL_sep \ -COLL_APPLY(action, COLL_BARRIER_SIG, automatic) - -COLL_BARRIERS(COLL_PROTO, COLL_NOsep) - -} -} - -SG_END_DECL() - -#endif diff --git a/src/smpi/colls/colls_private.h b/src/smpi/colls/colls_private.h index 0d4c999465..7ae80dc00b 100644 --- a/src/smpi/colls/colls_private.h +++ b/src/smpi/colls/colls_private.h @@ -6,7 +6,12 @@ #ifndef SMPI_COLLS_PRIVATE_H #define SMPI_COLLS_PRIVATE_H -#include "colls.h" +#include +#include "smpi/mpi.h" +#include "src/smpi/private.h" +#include "xbt/ex.h" +#include "xbt.h" +#include "../smpi_coll.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_colls); diff --git a/src/smpi/colls/smpi_automatic_selector.cpp b/src/smpi/colls/smpi_automatic_selector.cpp index af06809efe..2e97cfea33 100644 --- a/src/smpi/colls/smpi_automatic_selector.cpp +++ b/src/smpi/colls/smpi_automatic_selector.cpp @@ -19,7 +19,7 @@ }\ char cont_name[25];\ snprintf(cont_name,25, "rank-%d", smpi_process_index());\ - val_t value = PJ_value_get_or_new(mpi_coll_##cat##_description[i].name,"1.0 1.0 1.0", type);\ + val_t value = PJ_value_get_or_new(Colls::mpi_coll_##cat##_description[i].name,"1.0 1.0 1.0", type);\ new_pajeNewEvent (SIMIX_get_clock(), PJ_container_get(cont_name), type, value);\ } @@ -30,15 +30,15 @@ int min_coll=-1, global_coll=-1;\ int i;\ double buf_in, buf_out, max_min=DBL_MAX;\ - for (i = 0; mpi_coll_##cat##_description[i].name; i++){\ - if(!strcmp(mpi_coll_##cat##_description[i].name, "automatic"))continue;\ - if(!strcmp(mpi_coll_##cat##_description[i].name, "default"))continue;\ + for (i = 0; Colls::mpi_coll_##cat##_description[i].name; i++){\ + if(!strcmp(Colls::mpi_coll_##cat##_description[i].name, "automatic"))continue;\ + if(!strcmp(Colls::mpi_coll_##cat##_description[i].name, "default"))continue;\ Coll_barrier_default::barrier(comm);\ TRACE_AUTO_COLL(cat)\ time1 = SIMIX_get_clock();\ try {\ ((int (*) args)\ - mpi_coll_##cat##_description[i].coll) args2 ;\ + Colls::mpi_coll_##cat##_description[i].coll) args2 ;\ }\ catch (std::exception& ex) {\ continue;\ @@ -58,9 +58,9 @@ }\ }\ if(comm->rank()==0){\ - XBT_WARN("For rank 0, the quickest was %s : %f , but global was %s : %f at max",mpi_coll_##cat##_description[min_coll].name, time_min,mpi_coll_##cat##_description[global_coll].name, max_min);\ + XBT_WARN("For rank 0, the quickest was %s : %f , but global was %s : %f at max",Colls::mpi_coll_##cat##_description[min_coll].name, time_min,Colls::mpi_coll_##cat##_description[global_coll].name, max_min);\ }else\ - XBT_WARN("The quickest %s was %s on rank %d and took %f",#cat,mpi_coll_##cat##_description[min_coll].name, comm->rank(), time_min);\ + XBT_WARN("The quickest %s was %s on rank %d and took %f",#cat,Colls::mpi_coll_##cat##_description[min_coll].name, comm->rank(), time_min);\ return (min_coll!=-1)?MPI_SUCCESS:MPI_ERR_INTERN;\ } diff --git a/src/smpi/colls/smpi_mvapich2_selector_stampede.h b/src/smpi/colls/smpi_mvapich2_selector_stampede.h index c6a28b8029..a2296bfb7f 100644 --- a/src/smpi/colls/smpi_mvapich2_selector_stampede.h +++ b/src/smpi/colls/smpi_mvapich2_selector_stampede.h @@ -12,6 +12,8 @@ using namespace simgrid::smpi; +XBT_PUBLIC(void) smpi_coll_cleanup_mvapich2(void); + typedef struct { int min; int max; @@ -49,8 +51,8 @@ static void init_mv2_alltoall_tables_stampede(){ int agg_table_sum = 0; mv2_alltoall_tuning_table **table_ptrs = NULL; mv2_alltoall_num_ppn_conf = 3; - if(smpi_coll_cleanup_callback==NULL) - smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; + if(Colls::smpi_coll_cleanup_callback==NULL) + Colls::smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; mv2_alltoall_thresholds_table = static_cast(xbt_malloc(sizeof(mv2_alltoall_tuning_table *) * mv2_alltoall_num_ppn_conf)); table_ptrs = static_cast(xbt_malloc(sizeof(mv2_alltoall_tuning_table *) @@ -341,8 +343,8 @@ static void init_mv2_allgather_tables_stampede(){ int i; int agg_table_sum = 0; - if(smpi_coll_cleanup_callback==NULL) - smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; + if(Colls::smpi_coll_cleanup_callback==NULL) + Colls::smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; mv2_allgather_tuning_table **table_ptrs = NULL; mv2_allgather_num_ppn_conf = 3; mv2_allgather_thresholds_table @@ -599,8 +601,8 @@ MV2_Gather_function_ptr MV2_Gather_intra_node_function = NULL; static void init_mv2_gather_tables_stampede(){ - if(smpi_coll_cleanup_callback==NULL) - smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; + if(Colls::smpi_coll_cleanup_callback==NULL) + Colls::smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; mv2_size_gather_tuning_table=7; mv2_gather_thresholds_table = static_cast(xbt_malloc(mv2_size_gather_tuning_table* sizeof (mv2_gather_tuning_table))); @@ -686,8 +688,8 @@ mv2_allgatherv_tuning_table *mv2_allgatherv_thresholds_table = NULL; static void init_mv2_allgatherv_tables_stampede(){ - if(smpi_coll_cleanup_callback==NULL) - smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; + if(Colls::smpi_coll_cleanup_callback==NULL) + Colls::smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; mv2_size_allgatherv_tuning_table = 6; mv2_allgatherv_thresholds_table = static_cast(xbt_malloc(mv2_size_allgatherv_tuning_table * sizeof (mv2_allgatherv_tuning_table))); @@ -834,8 +836,8 @@ static int MPIR_Allreduce_reduce_shmem_MV2( void *sendbuf, static void init_mv2_allreduce_tables_stampede(){ - if(smpi_coll_cleanup_callback==NULL) - smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; + if(Colls::smpi_coll_cleanup_callback==NULL) + Colls::smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; mv2_size_allreduce_tuning_table = 8; mv2_allreduce_thresholds_table = static_cast(xbt_malloc(mv2_size_allreduce_tuning_table * sizeof (mv2_allreduce_tuning_table))); @@ -1034,8 +1036,8 @@ int mv2_intra_node_knomial_factor = 4; static void init_mv2_bcast_tables_stampede(){ //Stampede, - if(smpi_coll_cleanup_callback==NULL) - smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; + if(Colls::smpi_coll_cleanup_callback==NULL) + Colls::smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; mv2_size_bcast_tuning_table=8; mv2_bcast_thresholds_table = static_cast(xbt_malloc(mv2_size_bcast_tuning_table * sizeof (mv2_bcast_tuning_table))); @@ -1302,8 +1304,8 @@ int (*MV2_Reduce_intra_function)( void *sendbuf, static void init_mv2_reduce_tables_stampede(){ - if(smpi_coll_cleanup_callback==NULL) - smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; + if(Colls::smpi_coll_cleanup_callback==NULL) + Colls::smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; /*Stampede*/ mv2_size_reduce_tuning_table = 8; mv2_reduce_thresholds_table = static_cast(xbt_malloc(mv2_size_reduce_tuning_table * @@ -1546,8 +1548,8 @@ static int MPIR_Reduce_Scatter_Basic_MV2(void *sendbuf, static void init_mv2_reduce_scatter_tables_stampede(){ - if(smpi_coll_cleanup_callback==NULL) - smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; + if(Colls::smpi_coll_cleanup_callback==NULL) + Colls::smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; mv2_size_red_scat_tuning_table = 6; mv2_red_scat_thresholds_table = static_cast(xbt_malloc(mv2_size_red_scat_tuning_table * sizeof (mv2_red_scat_tuning_table))); @@ -1672,8 +1674,8 @@ int MPIR_Scatter_mcst_wrap_MV2(void *sendbuf, static void init_mv2_scatter_tables_stampede(){ - if(smpi_coll_cleanup_callback==NULL) - smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; + if(Colls::smpi_coll_cleanup_callback==NULL) + Colls::smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2; int agg_table_sum = 0; int i; diff --git a/src/smpi/private.h b/src/smpi/private.h index a324d2de05..a4ca5d8000 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -8,7 +8,6 @@ #include "simgrid/simix.h" #include "smpi/smpi.h" -#include "src/include/smpi/smpi_interface.h" #include "src/instr/instr_private.h" #include "src/internal_config.h" #include "xbt.h" diff --git a/src/smpi/smpi_base.cpp b/src/smpi/smpi_base.cpp index 86f22315cc..aefc260c54 100644 --- a/src/smpi/smpi_base.cpp +++ b/src/smpi/smpi_base.cpp @@ -15,7 +15,6 @@ #include "surf/surf.h" #include "simgrid/sg_config.h" #include "smpi/smpi_utils.hpp" -#include "colls/colls.h" #include #include "src/kernel/activity/SynchroComm.hpp" diff --git a/src/smpi/smpi_coll.cpp b/src/smpi/smpi_coll.cpp index 37a3612e43..eefd8197ed 100644 --- a/src/smpi/smpi_coll.cpp +++ b/src/smpi/smpi_coll.cpp @@ -11,64 +11,51 @@ #include #include "private.h" -#include "colls/colls.h" #include "simgrid/sg_config.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI (coll)"); -s_mpi_coll_description_t mpi_coll_gather_description[] = { - COLL_GATHERS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */ -}; - -s_mpi_coll_description_t mpi_coll_allgather_description[] = { - COLL_ALLGATHERS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} -}; - -s_mpi_coll_description_t mpi_coll_allgatherv_description[] = { COLL_ALLGATHERVS(COLL_DESCRIPTION, COLL_COMMA), - {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */ -}; - -s_mpi_coll_description_t mpi_coll_allreduce_description[] ={ COLL_ALLREDUCES(COLL_DESCRIPTION, COLL_COMMA), - {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */ -}; - -s_mpi_coll_description_t mpi_coll_reduce_scatter_description[] = {COLL_REDUCE_SCATTERS(COLL_DESCRIPTION, COLL_COMMA), - {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */ -}; - -s_mpi_coll_description_t mpi_coll_scatter_description[] ={COLL_SCATTERS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr}}; - -s_mpi_coll_description_t mpi_coll_barrier_description[] ={COLL_BARRIERS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr}}; - -s_mpi_coll_description_t mpi_coll_alltoall_description[] = {COLL_ALLTOALLS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr}}; - -s_mpi_coll_description_t mpi_coll_alltoallv_description[] = {COLL_ALLTOALLVS(COLL_DESCRIPTION, COLL_COMMA), - {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */ -}; - -s_mpi_coll_description_t mpi_coll_bcast_description[] = {COLL_BCASTS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr}}; - -s_mpi_coll_description_t mpi_coll_reduce_description[] = {COLL_REDUCES(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +namespace simgrid{ +namespace smpi{ +void (*Colls::smpi_coll_cleanup_callback)(); + +/* these arrays must be nullptr terminated */ +s_mpi_coll_description_t Colls::mpi_coll_gather_description[] = { + COLL_GATHERS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +s_mpi_coll_description_t Colls::mpi_coll_allgather_description[] = { + COLL_ALLGATHERS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +s_mpi_coll_description_t Colls::mpi_coll_allgatherv_description[] = { + COLL_ALLGATHERVS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +s_mpi_coll_description_t Colls::mpi_coll_allreduce_description[] ={ + COLL_ALLREDUCES(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +s_mpi_coll_description_t Colls::mpi_coll_reduce_scatter_description[] = { + COLL_REDUCE_SCATTERS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +s_mpi_coll_description_t Colls::mpi_coll_scatter_description[] ={ + COLL_SCATTERS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +s_mpi_coll_description_t Colls::mpi_coll_barrier_description[] ={ + COLL_BARRIERS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +s_mpi_coll_description_t Colls::mpi_coll_alltoall_description[] = { + COLL_ALLTOALLS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +s_mpi_coll_description_t Colls::mpi_coll_alltoallv_description[] = { + COLL_ALLTOALLVS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +s_mpi_coll_description_t Colls::mpi_coll_bcast_description[] = { + COLL_BCASTS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; +s_mpi_coll_description_t Colls::mpi_coll_reduce_description[] = { + COLL_REDUCES(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} }; /** Displays the long description of all registered models, and quit */ -void coll_help(const char *category, s_mpi_coll_description_t * table) +void Colls::coll_help(const char *category, s_mpi_coll_description_t * table) { printf("Long description of the %s models accepted by this simulator:\n", category); for (int i = 0; table[i].name; i++) printf(" %s: %s\n", table[i].name, table[i].description); } -int find_coll_description(s_mpi_coll_description_t * table, const char *name, const char *desc) +int Colls::find_coll_description(s_mpi_coll_description_t * table, const char *name, const char *desc) { char *name_list = nullptr; - int selector_on=0; - if (name==nullptr || name[0] == '\0') { - //no argument provided, use active selector's algorithm - name=static_cast(xbt_cfg_get_string("smpi/coll-selector")); - selector_on=1; - } for (int i = 0; table[i].name; i++) if (!strcmp(name, table[i].name)) { if (strcmp(table[i].name,"default")) @@ -76,13 +63,6 @@ int find_coll_description(s_mpi_coll_description_t * table, const char *name, co return i; } - if(selector_on){ - // collective seems not handled by the active selector, try with default one - for (int i = 0; table[i].name; i++) - if (!strcmp("default", table[i].name)) { - return i; - } - } if (!table[0].name) xbt_die("No collective is valid for '%s'! This is a bug.",name); name_list = xbt_strdup(table[0].name); @@ -95,25 +75,10 @@ int find_coll_description(s_mpi_coll_description_t * table, const char *name, co return -1; } -void (*smpi_coll_cleanup_callback)(); - -namespace simgrid{ -namespace smpi{ - -int (*Colls::gather)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, int root, MPI_Comm); -int (*Colls::allgather)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm); -int (*Colls::allgatherv)(void *, int, MPI_Datatype, void*, int*, int*, MPI_Datatype, MPI_Comm); -int (*Colls::allreduce)(void *sbuf, void *rbuf, int rcount, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm); -int (*Colls::alltoall)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm); -int (*Colls::alltoallv)(void *, int*, int*, MPI_Datatype, void*, int*, int*, MPI_Datatype, MPI_Comm); -int (*Colls::bcast)(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm com); -int (*Colls::reduce)(void *buf, void *rbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm); -int (*Colls::reduce_scatter)(void *sbuf, void *rbuf, int *rcounts,MPI_Datatype dtype,MPI_Op op,MPI_Comm comm); -int (*Colls::scatter)(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbuf, int recvcount, MPI_Datatype recvtype,int root, MPI_Comm comm); -int (*Colls::barrier)(MPI_Comm comm); #define COLL_SETTER(cat, ret, args, args2)\ +int (*Colls::cat ) args;\ void Colls::set_##cat (const char * name){\ int id = find_coll_description(mpi_coll_## cat ##_description,\ name,#cat);\ @@ -207,6 +172,8 @@ void Colls::set_collectives(){ } +//Implementations of the single algorith collectives + int Colls::gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm) { diff --git a/src/smpi/smpi_coll.hpp b/src/smpi/smpi_coll.hpp index 7728984e27..1326935d34 100644 --- a/src/smpi/smpi_coll.hpp +++ b/src/smpi/smpi_coll.hpp @@ -12,13 +12,24 @@ #include "private.h" +/** \brief MPI collective description */ + +struct mpi_coll_description { + const char *name; + const char *description; + void *coll; +}; +typedef struct mpi_coll_description s_mpi_coll_description_t; +typedef struct mpi_coll_description* mpi_coll_description_t; + + namespace simgrid{ namespace smpi{ + class Colls{ private: public: - static void set_collectives(); static void set_gather(const char* name); static void set_allgather(const char* name); static void set_allgatherv(const char* name); @@ -31,7 +42,22 @@ class Colls{ static void set_barrier(const char* name); static void set_bcast(const char* name); - static void coll_help(const char *category, s_mpi_coll_description_t * table); + static s_mpi_coll_description_t mpi_coll_gather_description[]; + static s_mpi_coll_description_t mpi_coll_allgather_description[]; + static s_mpi_coll_description_t mpi_coll_allgatherv_description[]; + static s_mpi_coll_description_t mpi_coll_allreduce_description[]; + static s_mpi_coll_description_t mpi_coll_alltoall_description[]; + static s_mpi_coll_description_t mpi_coll_alltoallv_description[]; + static s_mpi_coll_description_t mpi_coll_bcast_description[]; + static s_mpi_coll_description_t mpi_coll_reduce_description[]; + static s_mpi_coll_description_t mpi_coll_reduce_scatter_description[]; + static s_mpi_coll_description_t mpi_coll_scatter_description[]; + static s_mpi_coll_description_t mpi_coll_barrier_description[]; + + + 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 char *name, const char *desc); + static void set_collectives(); static int (*gather)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, int root, MPI_Comm); static int (*allgather)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm); @@ -51,6 +77,8 @@ class Colls{ 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)(); }; class Coll_algo{ @@ -127,6 +155,340 @@ class Coll_barrier : public Coll_algo { }; + +#define COLL_DESCRIPTION(cat, ret, args, name) \ + {# name,\ + # cat " " # name " collective",\ + (void*) Coll_ ## cat ## _ ## name::cat } + +#define COLL_PROTO(cat, ret, args, name) \ +class Coll_ ## cat ## _ ## name : public Coll_ ## cat { \ +public: \ +static ret cat (COLL_UNPAREN args); \ +}; + +#define COLL_UNPAREN(...) __VA_ARGS__ + +#define COLL_APPLY(action, sig, name) action(sig, name) +#define COLL_COMMA , +#define COLL_NOsep +#define COLL_NOTHING(...) + +/************* + * GATHER * + *************/ + +#define COLL_GATHER_SIG gather, int, \ + (void *send_buff, int send_count, MPI_Datatype send_type, \ + void *recv_buff, int recv_count, MPI_Datatype recv_type, \ + int root, MPI_Comm comm) + +#define COLL_GATHERS(action, COLL_sep) \ +COLL_APPLY(action, COLL_GATHER_SIG, default) COLL_sep \ +COLL_APPLY(action, COLL_GATHER_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_GATHER_SIG, ompi_basic_linear) COLL_sep \ +COLL_APPLY(action, COLL_GATHER_SIG, ompi_binomial) COLL_sep \ +COLL_APPLY(action, COLL_GATHER_SIG, ompi_linear_sync) COLL_sep \ +COLL_APPLY(action, COLL_GATHER_SIG, mpich) COLL_sep \ +COLL_APPLY(action, COLL_GATHER_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_GATHER_SIG, mvapich2_two_level) COLL_sep \ +COLL_APPLY(action, COLL_GATHER_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_GATHER_SIG, automatic) + +COLL_GATHERS(COLL_PROTO, COLL_NOsep) + +/************* + * ALLGATHER * + *************/ +#define COLL_ALLGATHER_SIG allgather, int, \ + (void *send_buff, int send_count, MPI_Datatype send_type, \ + void *recv_buff, int recv_count, MPI_Datatype recv_type, \ + MPI_Comm comm) + +#define COLL_ALLGATHERS(action, COLL_sep) \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, default) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, 2dmesh) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, 3dmesh) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, bruck) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, GB) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, loosely_lr) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR_NB) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, pair) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, rdb) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, rhv) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, ring) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, SMP_NTS) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, smp_simple) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, spreading_simple) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, ompi_neighborexchange) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, mvapich2_smp) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, mpich) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHER_SIG, automatic) + +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, default) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, GB) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, pair) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, ring) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi_neighborexchange) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi_bruck) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, mpich) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, mpich_rdb) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, mpich_ring) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_ALLGATHERV_SIG, automatic) + +COLL_ALLGATHERVS(COLL_PROTO, COLL_NOsep) + +/************* + * ALLREDUCE * + *************/ +#define COLL_ALLREDUCE_SIG allreduce, int, \ + (void *sbuf, void *rbuf, int rcount, \ + MPI_Datatype dtype, MPI_Op op, MPI_Comm comm) + +#define COLL_ALLREDUCES(action, COLL_sep) \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, default) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, lr) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab1) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab2) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_rdb) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, rdb) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_binomial) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_binomial_pipeline) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rdb) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag_lr) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag_rab) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, redbcast) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, ompi_ring_segmented) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, mpich) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, mvapich2_rs) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, mvapich2_two_level) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab) COLL_sep \ +COLL_APPLY(action, COLL_ALLREDUCE_SIG, automatic) + +COLL_ALLREDUCES(COLL_PROTO, COLL_NOsep) + +/************ + * ALLTOALL * + ************/ +#define COLL_ALLTOALL_SIG alltoall, int, \ + (void *send_buff, int send_count, MPI_Datatype send_type, \ + void *recv_buff, int recv_count, MPI_Datatype recv_type, \ + MPI_Comm comm) + +#define COLL_ALLTOALLS(action, COLL_sep) \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, default) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, 2dmesh) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, 3dmesh) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, basic_linear) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, bruck) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, pair) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_rma) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_light_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_mpi_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_one_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, rdb) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, ring) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_light_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_mpi_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_one_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, mvapich2_scatter_dest) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, mpich) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALL_SIG, automatic) + +COLL_ALLTOALLS(COLL_PROTO, COLL_NOsep) + +/************* + * ALLTOALLV * + *************/ +#define COLL_ALLTOALLV_SIG alltoallv, int, \ + (void *send_buff, int *send_counts, int *send_disps, MPI_Datatype send_type, \ + void *recv_buff, int *recv_counts, int *recv_disps, MPI_Datatype recv_type, \ + MPI_Comm comm) + +#define COLL_ALLTOALLVS(action, COLL_sep) \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, default) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, bruck) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_light_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_mpi_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_one_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_light_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_mpi_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_one_barrier) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, mpich) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, ompi_basic_linear) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_ALLTOALLV_SIG, automatic) + +COLL_ALLTOALLVS(COLL_PROTO, COLL_NOsep) + +/********* + * BCAST * + *********/ +#define COLL_BCAST_SIG bcast, int, \ + (void *buf, int count, MPI_Datatype datatype, \ + int root, MPI_Comm comm) + +#define COLL_BCASTS(action, COLL_sep) \ +COLL_APPLY(action, COLL_BCAST_SIG, default) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, arrival_pattern_aware) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, arrival_pattern_aware_wait) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, arrival_scatter) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, binomial_tree) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, flattree) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, flattree_pipeline) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, NTSB) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, NTSL) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, NTSL_Isend) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, scatter_LR_allgather) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, scatter_rdb_allgather) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, SMP_binary) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, SMP_binomial) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, SMP_linear) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, ompi_split_bintree) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, ompi_pipeline) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, mpich) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, mvapich2_inter_node) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, mvapich2_intra_node) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, mvapich2_knomial_intra_node) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_BCAST_SIG, automatic) + +COLL_BCASTS(COLL_PROTO, COLL_NOsep) + + +/********** + * REDUCE * + **********/ +#define COLL_REDUCE_SIG reduce, int, \ + (void *buf, void *rbuf, int count, MPI_Datatype datatype, \ + MPI_Op op, int root, MPI_Comm comm) + +#define COLL_REDUCES(action, COLL_sep) \ +COLL_APPLY(action, COLL_REDUCE_SIG, default) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, arrival_pattern_aware) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, binomial) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, flat_tree) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, NTSL) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, scatter_gather) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, ompi_chain) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, ompi_pipeline) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, ompi_basic_linear) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, ompi_in_order_binary) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, ompi_binary) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, ompi_binomial) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, mpich) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, mvapich2_knomial) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, mvapich2_two_level) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, rab) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SIG, automatic) + +COLL_REDUCES(COLL_PROTO, COLL_NOsep) + +/************* + * REDUCE_SCATTER * + *************/ +#define COLL_REDUCE_SCATTER_SIG reduce_scatter, int, \ + (void *sbuf, void *rbuf, int *rcounts,\ + MPI_Datatype dtype,MPI_Op op,MPI_Comm comm) + +#define COLL_REDUCE_SCATTERS(action, COLL_sep) \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, default) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi_basic_recursivehalving) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi_ring) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich_pair) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich_rdb) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich_noncomm) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, automatic) + + + +COLL_REDUCE_SCATTERS(COLL_PROTO, COLL_NOsep) + + +/************* + * SCATTER * + *************/ +#define COLL_SCATTER_SIG scatter, int, \ + (void *sendbuf, int sendcount, MPI_Datatype sendtype,\ + void *recvbuf, int recvcount, MPI_Datatype recvtype,\ + int root, MPI_Comm comm) + +#define COLL_SCATTERS(action, COLL_sep) \ +COLL_APPLY(action, COLL_SCATTER_SIG, default) COLL_sep \ +COLL_APPLY(action, COLL_SCATTER_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_SCATTER_SIG, ompi_basic_linear) COLL_sep \ +COLL_APPLY(action, COLL_SCATTER_SIG, ompi_binomial) COLL_sep \ +COLL_APPLY(action, COLL_SCATTER_SIG, mpich) COLL_sep \ +COLL_APPLY(action, COLL_SCATTER_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_SCATTER_SIG, mvapich2_two_level_binomial) COLL_sep \ +COLL_APPLY(action, COLL_SCATTER_SIG, mvapich2_two_level_direct) COLL_sep \ +COLL_APPLY(action, COLL_SCATTER_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_SCATTER_SIG, automatic) + +COLL_SCATTERS(COLL_PROTO, COLL_NOsep) + +/************* + * SCATTER * + *************/ +#define COLL_BARRIER_SIG barrier, int, \ + (MPI_Comm comm) + +#define COLL_BARRIERS(action, COLL_sep) \ +COLL_APPLY(action, COLL_BARRIER_SIG, default) COLL_sep \ +COLL_APPLY(action, COLL_BARRIER_SIG, ompi) COLL_sep \ +COLL_APPLY(action, COLL_BARRIER_SIG, ompi_basic_linear) COLL_sep \ +COLL_APPLY(action, COLL_BARRIER_SIG, ompi_two_procs) COLL_sep \ +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) COLL_sep \ +COLL_APPLY(action, COLL_BARRIER_SIG, mvapich2_pair) COLL_sep \ +COLL_APPLY(action, COLL_BARRIER_SIG, mvapich2) COLL_sep \ +COLL_APPLY(action, COLL_BARRIER_SIG, impi) COLL_sep \ +COLL_APPLY(action, COLL_BARRIER_SIG, automatic) + +COLL_BARRIERS(COLL_PROTO, COLL_NOsep) + + } } diff --git a/src/smpi/smpi_comm.cpp b/src/smpi/smpi_comm.cpp index 179708675f..bbf41ec502 100644 --- a/src/smpi/smpi_comm.cpp +++ b/src/smpi/smpi_comm.cpp @@ -15,7 +15,6 @@ #include "private.h" #include "src/simix/smx_private.h" -#include "colls/colls.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi, "Logging specific to SMPI (comm)"); diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index bda2de80d2..27f0e87766 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -636,8 +636,8 @@ void smpi_global_destroy() if (MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED){ MPI_COMM_WORLD->cleanup_smp(); MPI_COMM_WORLD->cleanup_attributes(); - if(smpi_coll_cleanup_callback!=nullptr) - smpi_coll_cleanup_callback(); + if(Colls::smpi_coll_cleanup_callback!=nullptr) + Colls::smpi_coll_cleanup_callback(); delete MPI_COMM_WORLD; } @@ -717,7 +717,7 @@ static void smpi_init_logs(){ static void smpi_init_options(){ Colls::set_collectives(); - smpi_coll_cleanup_callback=nullptr; + Colls::smpi_coll_cleanup_callback=nullptr; smpi_cpu_threshold = xbt_cfg_get_double("smpi/cpu-threshold"); smpi_host_speed = xbt_cfg_get_double("smpi/host-speed"); smpi_privatize_global_variables = xbt_cfg_get_boolean("smpi/privatize-global-variables"); diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 9c63deb29c..ece7b316a7 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -9,7 +9,6 @@ set(EXTRA_DIST src/mc/PageStore.hpp src/mc/mc_record.h src/include/simgrid/sg_config.h - src/include/smpi/smpi_interface.h src/include/smpi/smpi_utils.hpp src/include/surf/datatypes.h src/include/surf/maxmin.h @@ -38,7 +37,6 @@ set(EXTRA_DIST src/kernel/activity/SynchroSleep.hpp src/kernel/activity/SynchroRaw.hpp src/smpi/colls/coll_tuned_topo.h - src/smpi/colls/colls.h src/smpi/colls/colls_private.h src/smpi/colls/smpi_mvapich2_selector_stampede.h src/smpi/private.h @@ -212,6 +210,7 @@ set(SMPI_SRC src/smpi/smpi_memory.cpp src/smpi/smpi_static_variables.cpp src/smpi/smpi_coll.cpp + src/smpi/smpi_coll.hpp src/smpi/smpi_comm.cpp src/smpi/smpi_comm.hpp src/smpi/smpi_deployment.cpp