From 5471e7257ff1a171b33234d6c08227f34a1ba029 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 22 Feb 2015 15:29:24 +0100 Subject: [PATCH] SMPI: info message when the collective algorithm is changed --- src/include/smpi/smpi_interface.h | 2 +- src/simgrid/sg_config.c | 2 +- src/smpi/smpi_coll.c | 12 +++++++----- src/smpi/smpi_global.c | 22 +++++++++++----------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/include/smpi/smpi_interface.h b/src/include/smpi/smpi_interface.h index 41f9d40827..40712bc2cc 100644 --- a/src/include/smpi/smpi_interface.h +++ b/src/include/smpi/smpi_interface.h @@ -116,7 +116,7 @@ XBT_PUBLIC_DATA(int (*mpi_coll_barrier_fun) 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, - char *name); + char *name, const char *desc); extern double smpi_wtime_sleep; diff --git a/src/simgrid/sg_config.c b/src/simgrid/sg_config.c index 3fc88bcb1b..544de00018 100644 --- a/src/simgrid/sg_config.c +++ b/src/simgrid/sg_config.c @@ -303,7 +303,7 @@ static void _sg_cfg_cb__coll(const char *category, } /* New Module missing */ - find_coll_description(table, val); + find_coll_description(table, val, category); } static void _sg_cfg_cb__coll_gather(const char *name, int pos){ _sg_cfg_cb__coll("gather", mpi_coll_gather_description, name, pos); diff --git a/src/smpi/smpi_coll.c b/src/smpi/smpi_coll.c index 3bca49dbb4..4a3bb418d7 100644 --- a/src/smpi/smpi_coll.c +++ b/src/smpi/smpi_coll.c @@ -14,6 +14,9 @@ #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[] = { {"default", "gather default collective", @@ -121,7 +124,7 @@ void coll_help(const char *category, s_mpi_coll_description_t * table) } int find_coll_description(s_mpi_coll_description_t * table, - char *name) + char *name, const char *desc) { int i; char *name_list = NULL; @@ -132,6 +135,8 @@ int find_coll_description(s_mpi_coll_description_t * table, } for (i = 0; table[i].name; i++) if (!strcmp(name, table[i].name)) { + if (strcmp(table[i].name,"default")) + XBT_INFO("Switch to algorithm %s for collective %s",table[i].name,desc); return i; } @@ -144,7 +149,7 @@ int find_coll_description(s_mpi_coll_description_t * table, } } if (!table[0].name) - xbt_die("No collective is valid! This is a bug."); + xbt_die("No collective is valid for '%s'! This is a bug.",name); name_list = xbt_strdup(table[0].name); for (i = 1; table[i].name; i++) { name_list = @@ -157,9 +162,6 @@ int find_coll_description(s_mpi_coll_description_t * table, return -1; } -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, - "Logging specific to SMPI (coll)"); - int (*mpi_coll_gather_fun)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, int root, MPI_Comm); 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); diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index 9a647eed81..585847b760 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -550,51 +550,51 @@ static void smpi_init_logs(){ static void smpi_init_options(){ int gather_id = find_coll_description(mpi_coll_gather_description, - sg_cfg_get_string("smpi/gather")); + sg_cfg_get_string("smpi/gather"),"gather"); mpi_coll_gather_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm)) mpi_coll_gather_description[gather_id].coll; int allgather_id = find_coll_description(mpi_coll_allgather_description, - sg_cfg_get_string("smpi/allgather")); + sg_cfg_get_string("smpi/allgather"),"allgather"); mpi_coll_allgather_fun = (int (*)(void *, int, MPI_Datatype, 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")); + sg_cfg_get_string("smpi/allgatherv"),"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")); + sg_cfg_get_string("smpi/allreduce"),"allreduce"); mpi_coll_allreduce_fun = (int (*)(void *sbuf, void *rbuf, int rcount, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)) mpi_coll_allreduce_description[allreduce_id].coll; int alltoall_id = find_coll_description(mpi_coll_alltoall_description, - sg_cfg_get_string("smpi/alltoall")); + sg_cfg_get_string("smpi/alltoall"),"alltoall"); mpi_coll_alltoall_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm)) mpi_coll_alltoall_description[alltoall_id].coll; int alltoallv_id = find_coll_description(mpi_coll_alltoallv_description, - sg_cfg_get_string("smpi/alltoallv")); + sg_cfg_get_string("smpi/alltoallv"),"alltoallv"); mpi_coll_alltoallv_fun = (int (*)(void *, int *, int *, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm)) mpi_coll_alltoallv_description[alltoallv_id].coll; int bcast_id = find_coll_description(mpi_coll_bcast_description, - sg_cfg_get_string("smpi/bcast")); + sg_cfg_get_string("smpi/bcast"),"bcast"); mpi_coll_bcast_fun = (int (*)(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm com)) mpi_coll_bcast_description[bcast_id].coll; int reduce_id = find_coll_description(mpi_coll_reduce_description, - sg_cfg_get_string("smpi/reduce")); + sg_cfg_get_string("smpi/reduce"),"reduce"); mpi_coll_reduce_fun = (int (*)(void *buf, void *rbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)) @@ -602,14 +602,14 @@ static void smpi_init_options(){ int reduce_scatter_id = find_coll_description(mpi_coll_reduce_scatter_description, - sg_cfg_get_string("smpi/reduce_scatter")); + sg_cfg_get_string("smpi/reduce_scatter"),"reduce_scatter"); mpi_coll_reduce_scatter_fun = (int (*)(void *sbuf, void *rbuf, int *rcounts, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)) mpi_coll_reduce_scatter_description[reduce_scatter_id].coll; int scatter_id = find_coll_description(mpi_coll_scatter_description, - sg_cfg_get_string("smpi/scatter")); + sg_cfg_get_string("smpi/scatter"),"scatter"); mpi_coll_scatter_fun = (int (*)(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, @@ -617,7 +617,7 @@ static void smpi_init_options(){ mpi_coll_scatter_description[scatter_id].coll; int barrier_id = find_coll_description(mpi_coll_barrier_description, - sg_cfg_get_string("smpi/barrier")); + sg_cfg_get_string("smpi/barrier"),"barrier"); mpi_coll_barrier_fun = (int (*)(MPI_Comm comm)) mpi_coll_barrier_description[barrier_id].coll; -- 2.20.1