From 532d392985a5418abb902cab371aa2267cd16465 Mon Sep 17 00:00:00 2001 From: Clement Foyer Date: Wed, 22 Nov 2017 10:20:53 +0100 Subject: [PATCH] Remove inter-dependencies between OSC modules. The osc monitoring component needed to include other OSC components header in order to be able tu access communicator through the component specific ompi_osc_*_module_t structures. This commit remove the dependency, and resolve the issue #4523. Extend the common monitoring API. * Now it's possible to translate from local rank to world rank from both the communicator and the group. * Remove useless hashtable as we directly use the w_group contained in window structure. Add automatic generation at config time. The templates are expanded at configure time. It creates a new header file that generates all the variables/functions needed. Adding this during the autogen automagicaly generates for each of the available modules the proper functions. Only keep a generated argv-style array. Following Jeff's advice, the configure.m4 file generate a simple array of module variables to be iterated over to find the proper module. Signed-off-by: Clement Foyer --- .../monitoring/coll_monitoring_allgather.c | 6 +- .../monitoring/coll_monitoring_allgatherv.c | 6 +- .../monitoring/coll_monitoring_allreduce.c | 6 +- .../monitoring/coll_monitoring_alltoall.c | 6 +- .../monitoring/coll_monitoring_alltoallv.c | 6 +- .../monitoring/coll_monitoring_alltoallw.c | 6 +- .../coll/monitoring/coll_monitoring_barrier.c | 6 +- .../coll/monitoring/coll_monitoring_bcast.c | 6 +- .../coll/monitoring/coll_monitoring_exscan.c | 6 +- .../coll/monitoring/coll_monitoring_gather.c | 6 +- .../coll/monitoring/coll_monitoring_gatherv.c | 6 +- .../coll_monitoring_neighbor_allgather.c | 10 +- .../coll_monitoring_neighbor_allgatherv.c | 10 +- .../coll_monitoring_neighbor_alltoall.c | 10 +- .../coll_monitoring_neighbor_alltoallv.c | 10 +- .../coll_monitoring_neighbor_alltoallw.c | 10 +- .../coll/monitoring/coll_monitoring_reduce.c | 6 +- .../coll_monitoring_reduce_scatter.c | 6 +- .../coll_monitoring_reduce_scatter_block.c | 6 +- .../coll/monitoring/coll_monitoring_scan.c | 6 +- .../coll/monitoring/coll_monitoring_scatter.c | 6 +- .../monitoring/coll_monitoring_scatterv.c | 6 +- .../mca/common/monitoring/common_monitoring.h | 10 +- .../monitoring/common_monitoring_coll.c | 7 +- ompi/mca/osc/monitoring/Makefile.am | 6 +- ompi/mca/osc/monitoring/configure.m4 | 110 +++++++++++++--- .../monitoring/osc_monitoring_accumulate.h | 14 +- ompi/mca/osc/monitoring/osc_monitoring_comm.h | 10 +- .../osc/monitoring/osc_monitoring_component.c | 56 ++++---- .../osc/monitoring/osc_monitoring_module.h | 122 ++++++++++-------- .../osc/monitoring/osc_monitoring_template.h | 52 ++------ .../mca/pml/monitoring/pml_monitoring_isend.c | 6 +- .../mca/pml/monitoring/pml_monitoring_start.c | 5 +- 33 files changed, 305 insertions(+), 245 deletions(-) diff --git a/ompi/mca/coll/monitoring/coll_monitoring_allgather.c b/ompi/mca/coll/monitoring/coll_monitoring_allgather.c index 5b9b5d26a2e..dc45d8f8974 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_allgather.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_allgather.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +34,7 @@ int mca_coll_monitoring_allgather(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -63,7 +63,7 @@ int mca_coll_monitoring_iallgather(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_allgatherv.c b/ompi/mca/coll/monitoring/coll_monitoring_allgatherv.c index 2bc7985009b..85510009df5 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_allgatherv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_allgatherv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +34,7 @@ int mca_coll_monitoring_allgatherv(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -63,7 +63,7 @@ int mca_coll_monitoring_iallgatherv(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_allreduce.c b/ompi/mca/coll/monitoring/coll_monitoring_allreduce.c index 95905070006..c0f3a74d086 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_allreduce.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_allreduce.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +34,7 @@ int mca_coll_monitoring_allreduce(const void *sbuf, void *rbuf, int count, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -62,7 +62,7 @@ int mca_coll_monitoring_iallreduce(const void *sbuf, void *rbuf, int count, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_alltoall.c b/ompi/mca/coll/monitoring/coll_monitoring_alltoall.c index 33dfbaed01f..60e8ebaeab4 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_alltoall.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_alltoall.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -32,7 +32,7 @@ int mca_coll_monitoring_alltoall(const void *sbuf, int scount, struct ompi_datat * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -61,7 +61,7 @@ int mca_coll_monitoring_ialltoall(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_alltoallv.c b/ompi/mca/coll/monitoring/coll_monitoring_alltoallv.c index acdd0d4b5f9..97941e7687e 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_alltoallv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_alltoallv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -33,7 +33,7 @@ int mca_coll_monitoring_alltoallv(const void *sbuf, const int *scounts, const in * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); data_size_aggreg += data_size; } @@ -65,7 +65,7 @@ int mca_coll_monitoring_ialltoallv(const void *sbuf, const int *scounts, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); data_size_aggreg += data_size; } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_alltoallw.c b/ompi/mca/coll/monitoring/coll_monitoring_alltoallw.c index d573e970506..8d8b0591b2e 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_alltoallw.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_alltoallw.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,7 +35,7 @@ int mca_coll_monitoring_alltoallw(const void *sbuf, const int *scounts, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); data_size_aggreg += data_size; } @@ -67,7 +67,7 @@ int mca_coll_monitoring_ialltoallw(const void *sbuf, const int *scounts, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); data_size_aggreg += data_size; } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_barrier.c b/ompi/mca/coll/monitoring/coll_monitoring_barrier.c index 7e8af198893..f1e42efed39 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_barrier.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_barrier.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,7 +25,7 @@ int mca_coll_monitoring_barrier(struct ompi_communicator_t *comm, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, 0); } } @@ -47,7 +47,7 @@ int mca_coll_monitoring_ibarrier(struct ompi_communicator_t *comm, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, 0); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_bcast.c b/ompi/mca/coll/monitoring/coll_monitoring_bcast.c index 0fc1488dae8..bb877458abd 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_bcast.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_bcast.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -35,7 +35,7 @@ int mca_coll_monitoring_bcast(void *buff, int count, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -64,7 +64,7 @@ int mca_coll_monitoring_ibcast(void *buff, int count, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_exscan.c b/ompi/mca/coll/monitoring/coll_monitoring_exscan.c index 8621506b66d..14a038d8985 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_exscan.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_exscan.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -33,7 +33,7 @@ int mca_coll_monitoring_exscan(const void *sbuf, void *rbuf, int count, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -60,7 +60,7 @@ int mca_coll_monitoring_iexscan(const void *sbuf, void *rbuf, int count, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_gather.c b/ompi/mca/coll/monitoring/coll_monitoring_gather.c index bd377773f52..331cf3725e9 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_gather.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_gather.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -32,7 +32,7 @@ int mca_coll_monitoring_gather(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -61,7 +61,7 @@ int mca_coll_monitoring_igather(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_gatherv.c b/ompi/mca/coll/monitoring/coll_monitoring_gatherv.c index cd5c876d5dc..bf28a56a87a 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_gatherv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_gatherv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +34,7 @@ int mca_coll_monitoring_gatherv(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); data_size_aggreg += data_size; } @@ -66,7 +66,7 @@ int mca_coll_monitoring_igatherv(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); data_size_aggreg += data_size; } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgather.c b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgather.c index e7da655ff2e..459b8d62209 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgather.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgather.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +43,7 @@ int mca_coll_monitoring_neighbor_allgather(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -54,7 +54,7 @@ int mca_coll_monitoring_neighbor_allgather(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -96,7 +96,7 @@ int mca_coll_monitoring_ineighbor_allgather(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -107,7 +107,7 @@ int mca_coll_monitoring_ineighbor_allgather(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgatherv.c b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgatherv.c index e7def27d584..1f74e141846 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgatherv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgatherv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -46,7 +46,7 @@ int mca_coll_monitoring_neighbor_allgatherv(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -57,7 +57,7 @@ int mca_coll_monitoring_neighbor_allgatherv(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -100,7 +100,7 @@ int mca_coll_monitoring_ineighbor_allgatherv(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -111,7 +111,7 @@ int mca_coll_monitoring_ineighbor_allgatherv(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoall.c b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoall.c index 72d189b4876..7e9e31e7968 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoall.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoall.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,7 +44,7 @@ int mca_coll_monitoring_neighbor_alltoall(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -55,7 +55,7 @@ int mca_coll_monitoring_neighbor_alltoall(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -98,7 +98,7 @@ int mca_coll_monitoring_ineighbor_alltoall(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -109,7 +109,7 @@ int mca_coll_monitoring_ineighbor_alltoall(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallv.c b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallv.c index 028f284785a..c355a1a54d8 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,7 +44,7 @@ int mca_coll_monitoring_neighbor_alltoallv(const void *sbuf, const int *scounts, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -57,7 +57,7 @@ int mca_coll_monitoring_neighbor_alltoallv(const void *sbuf, const int *scounts, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -103,7 +103,7 @@ int mca_coll_monitoring_ineighbor_alltoallv(const void *sbuf, const int *scounts * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -116,7 +116,7 @@ int mca_coll_monitoring_ineighbor_alltoallv(const void *sbuf, const int *scounts * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallw.c b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallw.c index e17edba783f..f707d36a287 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallw.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallw.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +45,7 @@ int mca_coll_monitoring_neighbor_alltoallw(const void *sbuf, const int *scounts, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -59,7 +59,7 @@ int mca_coll_monitoring_neighbor_alltoallw(const void *sbuf, const int *scounts, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -104,7 +104,7 @@ int mca_coll_monitoring_ineighbor_alltoallw(const void *sbuf, const int *scounts * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } @@ -118,7 +118,7 @@ int mca_coll_monitoring_ineighbor_alltoallw(const void *sbuf, const int *scounts * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm, &world_rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) { mca_common_monitoring_record_coll(world_rank, data_size); data_size_aggreg += data_size; } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_reduce.c b/ompi/mca/coll/monitoring/coll_monitoring_reduce.c index 35a73ee6ac8..afe417243b7 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_reduce.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_reduce.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +34,7 @@ int mca_coll_monitoring_reduce(const void *sbuf, void *rbuf, int count, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -64,7 +64,7 @@ int mca_coll_monitoring_ireduce(const void *sbuf, void *rbuf, int count, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter.c b/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter.c index e921258af16..86cce794a13 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +34,7 @@ int mca_coll_monitoring_reduce_scatter(const void *sbuf, void *rbuf, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } data_size_aggreg += data_size; @@ -64,7 +64,7 @@ int mca_coll_monitoring_ireduce_scatter(const void *sbuf, void *rbuf, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } data_size_aggreg += data_size; diff --git a/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter_block.c b/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter_block.c index a869fc2a594..5f76b413bb0 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter_block.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter_block.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +34,7 @@ int mca_coll_monitoring_reduce_scatter_block(const void *sbuf, void *rbuf, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -63,7 +63,7 @@ int mca_coll_monitoring_ireduce_scatter_block(const void *sbuf, void *rbuf, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_scan.c b/ompi/mca/coll/monitoring/coll_monitoring_scan.c index ff307a7acfb..1fd7deef70f 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_scan.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_scan.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -33,7 +33,7 @@ int mca_coll_monitoring_scan(const void *sbuf, void *rbuf, int count, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -60,7 +60,7 @@ int mca_coll_monitoring_iscan(const void *sbuf, void *rbuf, int count, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_scatter.c b/ompi/mca/coll/monitoring/coll_monitoring_scatter.c index 3aab77d7f87..82ca0da3dc3 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_scatter.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_scatter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,7 +35,7 @@ int mca_coll_monitoring_scatter(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } @@ -68,7 +68,7 @@ int mca_coll_monitoring_iscatter(const void *sbuf, int scount, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); } } diff --git a/ompi/mca/coll/monitoring/coll_monitoring_scatterv.c b/ompi/mca/coll/monitoring/coll_monitoring_scatterv.c index f187741cab2..af009cdbe4a 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_scatterv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_scatterv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -32,7 +32,7 @@ int mca_coll_monitoring_scatterv(const void *sbuf, const int *scounts, const int * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); data_size_aggreg += data_size; } @@ -62,7 +62,7 @@ int mca_coll_monitoring_iscatterv(const void *sbuf, const int *scounts, const in * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm, &rank) ) { + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) { mca_common_monitoring_record_coll(rank, data_size); data_size_aggreg += data_size; } diff --git a/ompi/mca/common/monitoring/common_monitoring.h b/ompi/mca/common/monitoring/common_monitoring.h index a199adef993..5dedf371bc7 100644 --- a/ompi/mca/common/monitoring/common_monitoring.h +++ b/ompi/mca/common/monitoring/common_monitoring.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -66,14 +66,14 @@ OMPI_DECLSPEC void mca_common_monitoring_record_osc(int world_rank, size_t data_ /* Records COLL communications. */ OMPI_DECLSPEC void mca_common_monitoring_record_coll(int world_rank, size_t data_size); -/* Translate the rank from the given communicator of a process to its rank in MPI_COMM_RANK. */ -static inline int mca_common_monitoring_get_world_rank(int dst, struct ompi_communicator_t*comm, - int*world_rank) +/* Translate the rank from the given rank of a process to its rank in MPI_COMM_RANK. */ +static inline int mca_common_monitoring_get_world_rank(int dest, ompi_group_t *group, + int *world_rank) { opal_process_name_t tmp; /* find the processor of the destination */ - ompi_proc_t *proc = ompi_group_get_proc_ptr(comm->c_remote_group, dst, true); + ompi_proc_t *proc = ompi_group_get_proc_ptr(group, dest, true); if( ompi_proc_is_sentinel(proc) ) { tmp = ompi_proc_sentinel_to_name((uintptr_t)proc); } else { diff --git a/ompi/mca/common/monitoring/common_monitoring_coll.c b/ompi/mca/common/monitoring/common_monitoring_coll.c index 9383eb415da..01b2f61bbde 100644 --- a/ompi/mca/common/monitoring/common_monitoring_coll.c +++ b/ompi/mca/common/monitoring/common_monitoring_coll.c @@ -2,7 +2,7 @@ * Copyright (c) 2013-2016 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2013-2017 Inria. All rights reserved. + * Copyright (c) 2013-2018 Inria. All rights reserved. * Copyright (c) 2015 Bull SAS. All rights reserved. * Copyright (c) 2016-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -57,7 +57,8 @@ static inline void mca_common_monitoring_coll_cache(mca_monitoring_coll_data_t*d int world_rank; 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, + mca_common_monitoring_get_world_rank(ompi_comm_rank(data->p_comm), + data->p_comm->c_remote_group, &data->world_rank); } /* Only list procs if the hashtable is already initialized, @@ -77,7 +78,7 @@ static inline void mca_common_monitoring_coll_cache(mca_monitoring_coll_data_t*d tmp_procs[0] = '\0'; /* Build procs list */ for(i = 0; i < size; ++i) { - if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, data->p_comm, &world_rank) ) + if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, data->p_comm->c_remote_group, &world_rank) ) pos += sprintf(&tmp_procs[pos], "%d,", world_rank); } tmp_procs[pos - 1] = '\0'; /* Remove final coma */ diff --git a/ompi/mca/osc/monitoring/Makefile.am b/ompi/mca/osc/monitoring/Makefile.am index 6c83b943652..a90ce38c6e3 100644 --- a/ompi/mca/osc/monitoring/Makefile.am +++ b/ompi/mca/osc/monitoring/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2016 Inria. All rights reserved. +# Copyright (c) 2016-2018 Inria. All rights reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. # $COPYRIGHT$ # @@ -32,8 +32,10 @@ mcacomponent_LTLIBRARIES = $(component_install) mca_osc_monitoring_la_SOURCES = $(monitoring_sources) mca_osc_monitoring_la_LDFLAGS = -module -avoid-version mca_osc_monitoring_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ - $(OMPI_TOP_BUILDDIR)/ompi/mca/common/monitoring/libmca_common_monitoring.la + $(OMPI_TOP_BUILDDIR)/ompi/mca/common/monitoring/libmca_common_monitoring.la noinst_LTLIBRARIES = $(component_noinst) libmca_osc_monitoring_la_SOURCES = $(monitoring_sources) libmca_osc_monitoring_la_LDFLAGS = -module -avoid-version + +DISTCLEANFILES = osc_monitoring_template_gen.h diff --git a/ompi/mca/osc/monitoring/configure.m4 b/ompi/mca/osc/monitoring/configure.m4 index 939efe155b5..a22f8cb1a62 100644 --- a/ompi/mca/osc/monitoring/configure.m4 +++ b/ompi/mca/osc/monitoring/configure.m4 @@ -1,22 +1,100 @@ -# -*- shell-script -*- -# -# Copyright (c) 2016 Inria. All rights reserved. -# $COPYRIGHT$ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2016-2018 Inria. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# mca_ompi_osc_monitoring_generate_templates # -# Additional copyrights may follow +# Overwrite $1. $1 is where the different templates are brought +# together and compose an array of components by listing component +# names in $2. # -# $HEADER$ +# $1 = filename +# $2 = osc component names # +AC_DEFUN( + [MCA_OMPI_OSC_MONITORING_GENERATE_TEMPLATES], + [m4_ifval( + [$1], + [AC_CONFIG_COMMANDS( + [$1], + [filename="$1" + components=`echo "$2" | sed -e 's/,/ /g' -e 's/monitoring//'` + cat <$filename +/* $filename + * + * This file was generated from ompi/mca/osc/monitoring/configure.m4 + * + * DO NOT EDIT THIS FILE. + * + */ +/* + * Copyright (c) 2017-2018 Inria. All rights reserved. + * \$COPYRIGHT$ + * + * Additional copyrights may follow + * + * \$HEADER$ + */ + +#ifndef MCA_OSC_MONITORING_GEN_TEMPLATE_H +#define MCA_OSC_MONITORING_GEN_TEMPLATE_H + +#include +#include +#include + +/************************************************************/ +/* Include template generating macros and inlined functions */ + +EOF + # Generate each case in order to register the proper template functions + for comp in $components + do + echo "OSC_MONITORING_MODULE_TEMPLATE_GENERATE(${comp})" >>$filename + done + cat <>$filename + +/************************************************************/ + +typedef struct { + const char * name; + ompi_osc_base_module_t * (*fct) (ompi_osc_base_module_t *); +} osc_monitoring_components_list_t; + +static const osc_monitoring_components_list_t osc_monitoring_components_list[[]] = { +EOF + for comp in $components + do + echo " { .name = \"${comp}\", .fct = OSC_MONITORING_SET_TEMPLATE_FCT_NAME(${comp}) }," >>$filename + done + cat <>$filename + { .name = NULL, .fct = NULL } +}; + +#endif /* MCA_OSC_MONITORING_GEN_TEMPLATE_H */ +EOF + unset filename components + ]) + ])dnl + ])dnl # MCA_ompi_osc_monitoring_CONFIG() # ------------------------------------------------ -AC_DEFUN([MCA_ompi_osc_monitoring_CONFIG],[ - AC_CONFIG_FILES([ompi/mca/osc/monitoring/Makefile]) - - AS_IF([test "$MCA_BUILD_ompi_common_monitoring_DSO_TRUE" = ''], - [$1], - [$2]) - OPAL_CHECK_PORTALS4([osc_monitoring], - [AC_DEFINE([OMPI_WITH_OSC_PORTALS4], [1], [Whether or not to generate template for osc_portals4])], - []) -])dnl +AC_DEFUN( + [MCA_ompi_osc_monitoring_CONFIG], + [AC_CONFIG_FILES([ompi/mca/osc/monitoring/Makefile]) + + AS_IF([test "$MCA_BUILD_ompi_common_monitoring_DSO_TRUE" = ''], + [$1], + [$2]) + + MCA_OMPI_OSC_MONITORING_GENERATE_TEMPLATES( + [ompi/mca/osc/monitoring/osc_monitoring_template_gen.h], + [mca_ompi_osc_m4_config_component_list, mca_ompi_osc_no_config_component_list])dnl + ])dnl diff --git a/ompi/mca/osc/monitoring/osc_monitoring_accumulate.h b/ompi/mca/osc/monitoring/osc_monitoring_accumulate.h index 543740146c7..259a496f73a 100644 --- a/ompi/mca/osc/monitoring/osc_monitoring_accumulate.h +++ b/ompi/mca/osc/monitoring/osc_monitoring_accumulate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,7 +29,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \ size_t type_size; \ ompi_datatype_type_size(dt, &type_size); \ mca_common_monitoring_record_osc(world_rank, type_size, SEND); \ @@ -56,7 +56,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -88,7 +88,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -116,7 +116,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -140,7 +140,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -162,7 +162,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \ size_t type_size; \ ompi_datatype_type_size(dt, &type_size); \ mca_common_monitoring_record_osc(world_rank, type_size, SEND); \ diff --git a/ompi/mca/osc/monitoring/osc_monitoring_comm.h b/ompi/mca/osc/monitoring/osc_monitoring_comm.h index 173a821427f..c98e0509558 100644 --- a/ompi/mca/osc/monitoring/osc_monitoring_comm.h +++ b/ompi/mca/osc/monitoring/osc_monitoring_comm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Inria. All rights reserved. + * Copyright (c) 2016-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,7 +30,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -55,7 +55,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -78,7 +78,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(source_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(source_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -103,7 +103,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(source_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(source_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ diff --git a/ompi/mca/osc/monitoring/osc_monitoring_component.c b/ompi/mca/osc/monitoring/osc_monitoring_component.c index 611360bf81e..39247e179ee 100644 --- a/ompi/mca/osc/monitoring/osc_monitoring_component.c +++ b/ompi/mca/osc/monitoring/osc_monitoring_component.c @@ -8,6 +8,7 @@ */ #include +#include #include "osc_monitoring.h" #include #include @@ -18,29 +19,12 @@ #include #include -/***************************************/ -/* Include template generating macros */ -#include "osc_monitoring_template.h" +/**************************************************/ +/* Include templated macros and inlined functions */ -#include -OSC_MONITORING_MODULE_TEMPLATE_GENERATE(rdma, ompi_osc_rdma_module_t, comm) -#undef GET_MODULE +#include "osc_monitoring_template_gen.h" -#include -OSC_MONITORING_MODULE_TEMPLATE_GENERATE(sm, ompi_osc_sm_module_t, comm) -#undef GET_MODULE - -#include -OSC_MONITORING_MODULE_TEMPLATE_GENERATE(pt2pt, ompi_osc_pt2pt_module_t, comm) -#undef GET_MODULE - -#ifdef OMPI_WITH_OSC_PORTALS4 -#include -OSC_MONITORING_MODULE_TEMPLATE_GENERATE(portals4, ompi_osc_portals4_module_t, comm) -#undef GET_MODULE -#endif /* OMPI_WITH_OSC_PORTALS4 */ - -/***************************************/ +/**************************************************/ static int mca_osc_monitoring_component_init(bool enable_progress_threads, bool enable_mpi_threads) @@ -69,6 +53,20 @@ static int mca_osc_monitoring_component_query(struct ompi_win_t *win, void **bas return mca_osc_monitoring_component.priority; } +static inline int +ompi_mca_osc_monitoring_set_template(ompi_osc_base_component_t *best_component, + ompi_osc_base_module_t *module) +{ + osc_monitoring_components_list_t comp = osc_monitoring_components_list[0]; + for (unsigned i = 0; NULL != comp.name; comp = osc_monitoring_components_list[++i]) { + if ( 0 == strcmp(comp.name, best_component->osc_version.mca_component_name) ) { + comp.fct(module); + return OMPI_SUCCESS; + } + } + return OMPI_ERR_NOT_SUPPORTED; +} + static int mca_osc_monitoring_component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model) @@ -108,20 +106,11 @@ static int mca_osc_monitoring_component_select(struct ompi_win_t *win, void **ba ret = best_component->osc_select(win, base, size, disp_unit, comm, info, flavor, model); if( OMPI_SUCCESS == ret ) { /* Intercept module functions with ours, based on selected component */ - if( 0 == strcmp("rdma", best_component->osc_version.mca_component_name) ) { - OSC_MONITORING_SET_TEMPLATE(rdma, win->w_osc_module); - } else if( 0 == strcmp("sm", best_component->osc_version.mca_component_name) ) { - OSC_MONITORING_SET_TEMPLATE(sm, win->w_osc_module); - } else if( 0 == strcmp("pt2pt", best_component->osc_version.mca_component_name) ) { - OSC_MONITORING_SET_TEMPLATE(pt2pt, win->w_osc_module); -#ifdef OMPI_WITH_OSC_PORTALS4 - } else if( 0 == strcmp("portals4", best_component->osc_version.mca_component_name) ) { - OSC_MONITORING_SET_TEMPLATE(portals4, win->w_osc_module); -#endif /* OMPI_WITH_OSC_PORTALS4 */ - } else { + ret = ompi_mca_osc_monitoring_set_template(best_component, win->w_osc_module); + if (OMPI_ERR_NOT_SUPPORTED == ret) { OPAL_MONITORING_PRINT_WARN("osc: monitoring disabled: no module for this component " "(%s)", best_component->osc_version.mca_component_name); - return ret; + return OMPI_SUCCESS; } } return ret; @@ -150,4 +139,3 @@ ompi_osc_monitoring_component_t mca_osc_monitoring_component = { }, .priority = INT_MAX }; - diff --git a/ompi/mca/osc/monitoring/osc_monitoring_module.h b/ompi/mca/osc/monitoring/osc_monitoring_module.h index fef351b3577..d24410964df 100644 --- a/ompi/mca/osc/monitoring/osc_monitoring_module.h +++ b/ompi/mca/osc/monitoring/osc_monitoring_module.h @@ -22,69 +22,87 @@ #define OMPI_OSC_MONITORING_MODULE_VARIABLE(template) \ ompi_osc_monitoring_module_## template ##_template -/* Define once and for all the module_template variable name */ -#define OMPI_OSC_MONITORING_MODULE_INIT(template) \ - ompi_osc_monitoring_module_## template ##_init_done - -/* Define once and for all the template variable name */ -#define OMPI_OSC_MONITORING_TEMPLATE_VARIABLE(template) \ - ompi_osc_monitoring_## template ##_template +/* Define once and for all the + * ompi_osc_monitoring_## template ##_set_template function name + */ +#define OSC_MONITORING_SET_TEMPLATE_FCT_NAME(template) \ + ompi_osc_monitoring_## template ##_set_template -/* Define the ompi_osc_monitoring_module_## template ##_template variable */ +/* Define the ompi_osc_monitoring_module_## template ##_template + * variable + */ #define OMPI_OSC_MONITORING_MODULE_GENERATE(template) \ - static ompi_osc_base_module_t OMPI_OSC_MONITORING_MODULE_VARIABLE(template) + /* Define the ompi_osc_monitoring_module_## template ##_template */ \ + static ompi_osc_base_module_t OMPI_OSC_MONITORING_MODULE_VARIABLE(template); -/* Define the ompi_osc_monitoring_module_## template ##_init_done variable */ -#define OMPI_OSC_MONITORING_MODULE_INIT_GENERATE(template) \ - static int32_t OMPI_OSC_MONITORING_MODULE_INIT(template) +#define OSC_MONITORING_GENERATE_TEMPLATE_MODULE(template) \ + \ + static int ompi_osc_monitoring_## template ##_free(ompi_win_t *win) \ + { \ + return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_free(win); \ + } -/* Define and set the ompi_osc_monitoring_## template ##_template - * variable. The functions recorded here are linked to the original - * functions of the original {template} module that were replaced. - */ #define MCA_OSC_MONITORING_MODULE_TEMPLATE_GENERATE(template) \ - static ompi_osc_base_module_t OMPI_OSC_MONITORING_TEMPLATE_VARIABLE(template) = { \ - .osc_win_attach = ompi_osc_monitoring_## template ##_attach, \ - .osc_win_detach = ompi_osc_monitoring_## template ##_detach, \ - .osc_free = ompi_osc_monitoring_## template ##_free, \ + /* Generate template specific module initialization function: \ + * ompi_osc_monitoring_## template ##_set_template(ompi_osc_base_module_t*module) \ + */ \ + static inline ompi_osc_base_module_t * \ + OSC_MONITORING_SET_TEMPLATE_FCT_NAME(template) (ompi_osc_base_module_t*module) \ + { \ + /* Define the ompi_osc_monitoring_module_## template ##_init_done variable */ \ + static int32_t init_done = 0; \ + /* Define and set the ompi_osc_monitoring_## template \ + * ##_template variable. The functions recorded here are \ + * linked to the original functions of the original \ + * {template} module that was replaced. \ + */ \ + static const ompi_osc_base_module_t module_specific_interception_layer = { \ + .osc_win_attach = ompi_osc_monitoring_## template ##_attach, \ + .osc_win_detach = ompi_osc_monitoring_## template ##_detach, \ + .osc_free = ompi_osc_monitoring_## template ##_free, \ \ - .osc_put = ompi_osc_monitoring_## template ##_put, \ - .osc_get = ompi_osc_monitoring_## template ##_get, \ - .osc_accumulate = ompi_osc_monitoring_## template ##_accumulate, \ - .osc_compare_and_swap = ompi_osc_monitoring_## template ##_compare_and_swap, \ - .osc_fetch_and_op = ompi_osc_monitoring_## template ##_fetch_and_op, \ - .osc_get_accumulate = ompi_osc_monitoring_## template ##_get_accumulate, \ + .osc_put = ompi_osc_monitoring_## template ##_put, \ + .osc_get = ompi_osc_monitoring_## template ##_get, \ + .osc_accumulate = ompi_osc_monitoring_## template ##_accumulate, \ + .osc_compare_and_swap = ompi_osc_monitoring_## template ##_compare_and_swap, \ + .osc_fetch_and_op = ompi_osc_monitoring_## template ##_fetch_and_op, \ + .osc_get_accumulate = ompi_osc_monitoring_## template ##_get_accumulate, \ \ - .osc_rput = ompi_osc_monitoring_## template ##_rput, \ - .osc_rget = ompi_osc_monitoring_## template ##_rget, \ - .osc_raccumulate = ompi_osc_monitoring_## template ##_raccumulate, \ - .osc_rget_accumulate = ompi_osc_monitoring_## template ##_rget_accumulate, \ + .osc_rput = ompi_osc_monitoring_## template ##_rput, \ + .osc_rget = ompi_osc_monitoring_## template ##_rget, \ + .osc_raccumulate = ompi_osc_monitoring_## template ##_raccumulate, \ + .osc_rget_accumulate = ompi_osc_monitoring_## template ##_rget_accumulate, \ \ - .osc_fence = ompi_osc_monitoring_## template ##_fence, \ + .osc_fence = ompi_osc_monitoring_## template ##_fence, \ \ - .osc_start = ompi_osc_monitoring_## template ##_start, \ - .osc_complete = ompi_osc_monitoring_## template ##_complete, \ - .osc_post = ompi_osc_monitoring_## template ##_post, \ - .osc_wait = ompi_osc_monitoring_## template ##_wait, \ - .osc_test = ompi_osc_monitoring_## template ##_test, \ + .osc_start = ompi_osc_monitoring_## template ##_start, \ + .osc_complete = ompi_osc_monitoring_## template ##_complete, \ + .osc_post = ompi_osc_monitoring_## template ##_post, \ + .osc_wait = ompi_osc_monitoring_## template ##_wait, \ + .osc_test = ompi_osc_monitoring_## template ##_test, \ \ - .osc_lock = ompi_osc_monitoring_## template ##_lock, \ - .osc_unlock = ompi_osc_monitoring_## template ##_unlock, \ - .osc_lock_all = ompi_osc_monitoring_## template ##_lock_all, \ - .osc_unlock_all = ompi_osc_monitoring_## template ##_unlock_all, \ + .osc_lock = ompi_osc_monitoring_## template ##_lock, \ + .osc_unlock = ompi_osc_monitoring_## template ##_unlock, \ + .osc_lock_all = ompi_osc_monitoring_## template ##_lock_all, \ + .osc_unlock_all = ompi_osc_monitoring_## template ##_unlock_all, \ \ - .osc_sync = ompi_osc_monitoring_## template ##_sync, \ - .osc_flush = ompi_osc_monitoring_## template ##_flush, \ - .osc_flush_all = ompi_osc_monitoring_## template ##_flush_all, \ - .osc_flush_local = ompi_osc_monitoring_## template ##_flush_local, \ - .osc_flush_local_all = ompi_osc_monitoring_## template ##_flush_local_all, \ - } - -#define OSC_MONITORING_GENERATE_TEMPLATE_MODULE(template) \ - \ - static int ompi_osc_monitoring_## template ##_free(ompi_win_t *win) \ - { \ - return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_free(win); \ + .osc_sync = ompi_osc_monitoring_## template ##_sync, \ + .osc_flush = ompi_osc_monitoring_## template ##_flush, \ + .osc_flush_all = ompi_osc_monitoring_## template ##_flush_all, \ + .osc_flush_local = ompi_osc_monitoring_## template ##_flush_local, \ + .osc_flush_local_all = ompi_osc_monitoring_## template ##_flush_local_all, \ + }; \ + if ( 1 == opal_atomic_add_32(&init_done, 1) ) { \ + /* Saves the original module functions in \ + * ompi_osc_monitoring_module_## template ##_template \ + */ \ + memcpy(&OMPI_OSC_MONITORING_MODULE_VARIABLE(template), \ + module, sizeof(ompi_osc_base_module_t)); \ + } \ + /* Replace the original functions with our generated ones */ \ + memcpy(module, &module_specific_interception_layer, \ + sizeof(ompi_osc_base_module_t)); \ + return module; \ } #endif /* MCA_OSC_MONITORING_MODULE_H */ diff --git a/ompi/mca/osc/monitoring/osc_monitoring_template.h b/ompi/mca/osc/monitoring/osc_monitoring_template.h index 7d56421b3d8..f78a678b8d6 100644 --- a/ompi/mca/osc/monitoring/osc_monitoring_template.h +++ b/ompi/mca/osc/monitoring/osc_monitoring_template.h @@ -23,31 +23,21 @@ #include "osc_monitoring_module.h" #include "osc_monitoring_passive_target.h" -/* module_type correspond to the ompi_osc_## template ##_module_t type - * comm correspond to the comm field name in ompi_osc_## template ##_module_t - * - * The magic used here is that for a given module type (given with the +/* The magic used here is that for a given module type (given with the * {template} parameter), we generate a set of every functions defined * in ompi_osc_base_module_t, the ompi_osc_monitoring_module_## * template ##_template variable recording the original set of - * functions, and the ompi_osc_monitoring_## template ##_template - * variable that record the generated set of functions. When a - * function is called from the original module, we route the call to - * our generated function that does the monitoring, and then we call - * the original function that had been saved in the + * functions, and the generated set of functions is recorded as a + * static variable inside the initialization function. When a function + * is called from the original module, we route the call to our + * generated function that does the monitoring, and then we call the + * original function that had been saved in the * ompi_osc_monitoring_module_## template ##_template variable. */ -#define OSC_MONITORING_MODULE_TEMPLATE_GENERATE(template, module_type, comm) \ +#define OSC_MONITORING_MODULE_TEMPLATE_GENERATE(template) \ /* Generate the proper symbol for the \ ompi_osc_monitoring_module_## template ##_template variable */ \ - OMPI_OSC_MONITORING_MODULE_GENERATE(template); \ - OMPI_OSC_MONITORING_MODULE_INIT_GENERATE(template); \ - /* Generate module specific module->comm accessor */ \ - static inline struct ompi_communicator_t* \ - ompi_osc_monitoring_## template ##_get_comm(ompi_win_t*win) \ - { \ - return ((module_type*)win->w_osc_module)->comm; \ - } \ + OMPI_OSC_MONITORING_MODULE_GENERATE(template) \ /* Generate each module specific functions */ \ OSC_MONITORING_GENERATE_TEMPLATE_ACCUMULATE(template) \ OSC_MONITORING_GENERATE_TEMPLATE_ACTIVE_TARGET(template) \ @@ -55,27 +45,9 @@ OSC_MONITORING_GENERATE_TEMPLATE_DYNAMIC(template) \ OSC_MONITORING_GENERATE_TEMPLATE_MODULE(template) \ OSC_MONITORING_GENERATE_TEMPLATE_PASSIVE_TARGET(template) \ - /* Set the mca_osc_monitoring_## template ##_template variable */ \ - MCA_OSC_MONITORING_MODULE_TEMPLATE_GENERATE(template); \ - /* Generate template specific module initialization function */ \ - static inline void* \ - ompi_osc_monitoring_## template ##_set_template (ompi_osc_base_module_t*module) \ - { \ - if( 1 == opal_atomic_add_32(&(OMPI_OSC_MONITORING_MODULE_INIT(template)), 1) ) { \ - /* Saves the original module functions in \ - * ompi_osc_monitoring_module_## template ##_template \ - */ \ - memcpy(&OMPI_OSC_MONITORING_MODULE_VARIABLE(template), \ - module, sizeof(ompi_osc_base_module_t)); \ - } \ - /* Replace the original functions with our generated ones */ \ - memcpy(module, &OMPI_OSC_MONITORING_TEMPLATE_VARIABLE(template), \ - sizeof(ompi_osc_base_module_t)); \ - return module; \ - } - -#define OSC_MONITORING_SET_TEMPLATE(template, module) \ - ompi_osc_monitoring_## template ##_set_template(module) + /* Generate template specific module initialization function: \ + * ompi_osc_monitoring_## template ##_set_template(ompi_osc_base_module_t*module) \ + */ \ + MCA_OSC_MONITORING_MODULE_TEMPLATE_GENERATE(template) #endif /* MCA_OSC_MONITORING_TEMPLATE_H */ - diff --git a/ompi/mca/pml/monitoring/pml_monitoring_isend.c b/ompi/mca/pml/monitoring/pml_monitoring_isend.c index 727a5dc30fd..6b167db1fb2 100644 --- a/ompi/mca/pml/monitoring/pml_monitoring_isend.c +++ b/ompi/mca/pml/monitoring/pml_monitoring_isend.c @@ -2,7 +2,7 @@ * Copyright (c) 2013-2015 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2013-2017 Inria. All rights reserved. + * Copyright (c) 2013-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -40,7 +40,7 @@ int mca_pml_monitoring_isend(const void *buf, * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank */ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(dst, comm, &world_rank)) { + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(dst, comm->c_remote_group, &world_rank)) { size_t type_size, data_size; ompi_datatype_type_size(datatype, &type_size); data_size = count*type_size; @@ -61,7 +61,7 @@ int mca_pml_monitoring_send(const void *buf, { int world_rank; /* Are we sending to a peer from my own MPI_COMM_WORLD? */ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(dst, comm, &world_rank)) { + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(dst, comm->c_remote_group, &world_rank)) { size_t type_size, data_size; ompi_datatype_type_size(datatype, &type_size); data_size = count*type_size; diff --git a/ompi/mca/pml/monitoring/pml_monitoring_start.c b/ompi/mca/pml/monitoring/pml_monitoring_start.c index 17d91165d60..903aec805e3 100644 --- a/ompi/mca/pml/monitoring/pml_monitoring_start.c +++ b/ompi/mca/pml/monitoring/pml_monitoring_start.c @@ -2,7 +2,7 @@ * Copyright (c) 2013-2015 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2013-2017 Inria. All rights reserved. + * Copyright (c) 2013-2018 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,7 +38,8 @@ int mca_pml_monitoring_start(size_t count, * If this fails the destination is not part of my MPI_COM_WORLD */ if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(pml_request->req_peer, - pml_request->req_comm, &world_rank)) { + pml_request->req_comm->c_remote_group, + &world_rank)) { size_t type_size, data_size; ompi_datatype_type_size(pml_request->req_datatype, &type_size); data_size = pml_request->req_count * type_size;