From 9a8fc1b9f1021f353c40a62956bae1d8875884d6 Mon Sep 17 00:00:00 2001 From: Clement Foyer Date: Wed, 12 Jul 2017 16:13:11 +0200 Subject: [PATCH 1/2] Simplify the communicator's name caching management Remove useless over-initialization Signed-off-by: Clement Foyer --- .../monitoring/common_monitoring_coll.c | 36 ++++++------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/ompi/mca/common/monitoring/common_monitoring_coll.c b/ompi/mca/common/monitoring/common_monitoring_coll.c index 37d3a243c9..c68ae442f1 100644 --- a/ompi/mca/common/monitoring/common_monitoring_coll.c +++ b/ompi/mca/common/monitoring/common_monitoring_coll.c @@ -41,33 +41,20 @@ struct mca_monitoring_coll_data_t { /* Collectives operation monitoring */ static opal_hash_table_t *comm_data = NULL; -/* Check whether the communicator's name have been changed. Update the - * data->comm_name field if so. - */ -static inline void mca_common_monitoring_coll_check_name(mca_monitoring_coll_data_t*data) -{ - if( data->comm_name && data->p_comm && (data->p_comm->c_flags & OMPI_COMM_NAMEISSET) - && 0 < strlen(data->p_comm->c_name) - && 0 != strncmp(data->p_comm->c_name, data->comm_name, OPAL_MAX_OBJECT_NAME - 1) ) - { - free(data->comm_name); - data->comm_name = strdup(data->p_comm->c_name); - } -} - static inline void mca_common_monitoring_coll_cache(mca_monitoring_coll_data_t*data) { - if( NULL == data->comm_name && 0 < strlen(data->p_comm->c_name) ) { + if( data->is_released ) { + /* As long as the data struct is not released, we still have the communicator to + immediately fetch the communicator's name */ data->comm_name = strdup(data->p_comm->c_name); - } else { - mca_common_monitoring_coll_check_name(data); } if( -1 == data->world_rank ) { /* Get current process world_rank */ mca_common_monitoring_get_world_rank(ompi_comm_rank(data->p_comm), data->p_comm, &data->world_rank); } - /* Only list procs if the hashtable is already initialized, ie if the previous call worked */ + /* Only list procs if the hashtable is already initialized, + i.e. if the previous call worked */ if( (-1 != data->world_rank) && (NULL == data->procs || 0 == strlen(data->procs)) ) { int i, pos = 0, size, world_size = -1, max_length, world_rank; char*tmp_procs; @@ -100,9 +87,7 @@ mca_monitoring_coll_data_t*mca_common_monitoring_coll_new( ompi_communicator_t*c return NULL; } - data->procs = NULL; - data->comm_name = NULL; - data->p_comm = comm; + data->p_comm = comm; /* Allocate hashtable */ if( NULL == comm_data ) { @@ -137,8 +122,8 @@ void mca_common_monitoring_coll_release(mca_monitoring_coll_data_t*data) #endif /* OPAL_ENABLE_DEBUG */ /* not flushed yet */ - mca_common_monitoring_coll_cache(data); data->is_released = 1; + mca_common_monitoring_coll_cache(data); } static void mca_common_monitoring_coll_cond_release(mca_monitoring_coll_data_t*data) @@ -169,16 +154,15 @@ void mca_common_monitoring_coll_finalize( void ) void mca_common_monitoring_coll_flush(FILE *pf, mca_monitoring_coll_data_t*data) { - /* Check for any change in the communicator's name */ - mca_common_monitoring_coll_check_name(data); - /* Flush data */ fprintf(pf, "D\t%s\tprocs: %s\n" "O2A\t%" PRId32 "\t%zu bytes\t%zu msgs sent\n" "A2O\t%" PRId32 "\t%zu bytes\t%zu msgs sent\n" "A2A\t%" PRId32 "\t%zu bytes\t%zu msgs sent\n", - data->comm_name ? data->comm_name : "(no-name)", data->procs, + data->p_comm ? data->p_comm->c_name + : data->comm_name ? data->comm_name : "(no-name)", + data->procs, data->world_rank, data->o2a_size, data->o2a_count, data->world_rank, data->a2o_size, data->a2o_count, data->world_rank, data->a2a_size, data->a2a_count); From d5c192c8255871dab7f7987834636e247d104663 Mon Sep 17 00:00:00 2001 From: Clement Foyer Date: Mon, 11 Sep 2017 14:32:00 +0200 Subject: [PATCH 2/2] Fix typos. Fix improper output on test. Reorder benchmarks. Signed-off-by: Clement Foyer --- test/monitoring/test_overhead.c | 14 +++++++------- test/monitoring/test_overhead.sh | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/monitoring/test_overhead.c b/test/monitoring/test_overhead.c index 43717294bf..5356761334 100644 --- a/test/monitoring/test_overhead.c +++ b/test/monitoring/test_overhead.c @@ -10,7 +10,7 @@ */ /* - Measurement for thze pml_monitoring component overhead + Measurement for the pml_monitoring component overhead Designed by Clement Foyer Contact the authors for questions. @@ -85,7 +85,7 @@ static inline void op_send(double*res, void*sbuf, int size, int tagno, void*rbuf MPI_Irecv(rbuf, size, MPI_BYTE, from, tagno, MPI_COMM_WORLD, &request); /* Token ring to synchronize */ - /* We send to the sender to make him know we are ready to + /* We message the sender to make him know we are ready to receive (even for non-eager mode sending) */ if( 0 == rank_world ) { MPI_Send(NULL, 0, MPI_BYTE, from, 100, MPI_COMM_WORLD); @@ -235,17 +235,17 @@ int main(int argc, char* argv[]) sprintf(name, "MPI_Alltoall"); break; case 3: + op = op_send_pingpong; + sprintf(name, "MPI_Send_pp"); + break; + case 4: op = op_put; sprintf(name, "MPI_Put"); break; - case 4: + case 5: op = op_get; sprintf(name, "MPI_Get"); break; - case 5: - op = op_send_pingpong; - sprintf(name, "MPI_Send_pp"); - break; } if( 0 == rank_world ) diff --git a/test/monitoring/test_overhead.sh b/test/monitoring/test_overhead.sh index 3f263f1d6f..d17f99ba09 100755 --- a/test/monitoring/test_overhead.sh +++ b/test/monitoring/test_overhead.sh @@ -147,6 +147,8 @@ order by nbprocs, datasize; EOF done cat >> $dbscript <