root/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallw.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. mca_coll_monitoring_neighbor_alltoallw
  2. mca_coll_monitoring_ineighbor_alltoallw

   1 /*
   2  * Copyright (c) 2016-2018 Inria. All rights reserved.
   3  * $COPYRIGHT$
   4  *
   5  * Additional copyrights may follow
   6  *
   7  * $HEADER$
   8  */
   9 
  10 #include <ompi_config.h>
  11 #include <ompi/request/request.h>
  12 #include <ompi/datatype/ompi_datatype.h>
  13 #include <ompi/communicator/communicator.h>
  14 #include <ompi/mca/topo/base/base.h>
  15 #include "coll_monitoring.h"
  16 
  17 int mca_coll_monitoring_neighbor_alltoallw(const void *sbuf, const int *scounts,
  18                                            const MPI_Aint *sdisps,
  19                                            struct ompi_datatype_t * const *sdtypes,
  20                                            void *rbuf, const int *rcounts,
  21                                            const MPI_Aint *rdisps,
  22                                            struct ompi_datatype_t * const *rdtypes,
  23                                            struct ompi_communicator_t *comm,
  24                                            mca_coll_base_module_t *module)
  25 {
  26     mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
  27     size_t type_size, data_size, data_size_aggreg = 0;
  28     const mca_topo_base_comm_cart_t *cart = comm->c_topo->mtc.cart;
  29     int dim, i, srank, drank, world_rank;
  30 
  31     for( dim = 0, i = 0; dim < cart->ndims; ++dim ) {
  32         srank = MPI_PROC_NULL, drank = MPI_PROC_NULL;
  33 
  34         if (cart->dims[dim] > 1) {
  35             mca_topo_base_cart_shift (comm, dim, 1, &srank, &drank);
  36         } else if (1 == cart->dims[dim] && cart->periods[dim]) {
  37             /* Don't record exchanges with self */
  38             continue;
  39         }
  40 
  41         if (MPI_PROC_NULL != srank) {
  42             ompi_datatype_type_size(sdtypes[i], &type_size);
  43             data_size = scounts[i] * type_size;
  44             /**
  45              * If this fails the destination is not part of my MPI_COM_WORLD
  46              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  47              */
  48             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) {
  49                 mca_common_monitoring_record_coll(world_rank, data_size);
  50                 data_size_aggreg += data_size;
  51             }
  52             ++i;
  53         }
  54 
  55         if (MPI_PROC_NULL != drank) {
  56             ompi_datatype_type_size(sdtypes[i], &type_size);
  57             data_size = scounts[i] * type_size;
  58             /**
  59              * If this fails the destination is not part of my MPI_COM_WORLD
  60              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  61              */
  62             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) {
  63                 mca_common_monitoring_record_coll(world_rank, data_size);
  64                 data_size_aggreg += data_size;
  65             }
  66             ++i;
  67         }
  68     }
  69 
  70     mca_common_monitoring_coll_a2a(data_size_aggreg, monitoring_module->data);
  71 
  72     return monitoring_module->real.coll_neighbor_alltoallw(sbuf, scounts, sdisps, sdtypes, rbuf, rcounts, rdisps, rdtypes, comm, monitoring_module->real.coll_neighbor_alltoallw_module);
  73 }
  74 
  75 int mca_coll_monitoring_ineighbor_alltoallw(const void *sbuf, const int *scounts,
  76                                             const MPI_Aint *sdisps,
  77                                             struct ompi_datatype_t * const *sdtypes,
  78                                             void *rbuf, const int *rcounts,
  79                                             const MPI_Aint *rdisps,
  80                                             struct ompi_datatype_t * const *rdtypes,
  81                                             struct ompi_communicator_t *comm,
  82                                             ompi_request_t ** request,
  83                                             mca_coll_base_module_t *module)
  84 {
  85     mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
  86     size_t type_size, data_size, data_size_aggreg = 0;
  87     const mca_topo_base_comm_cart_t *cart = comm->c_topo->mtc.cart;
  88     int dim, i, srank, drank, world_rank;
  89 
  90     for( dim = 0, i = 0; dim < cart->ndims; ++dim ) {
  91         srank = MPI_PROC_NULL, drank = MPI_PROC_NULL;
  92 
  93         if (cart->dims[dim] > 1) {
  94             mca_topo_base_cart_shift (comm, dim, 1, &srank, &drank);
  95         } else if (1 == cart->dims[dim] && cart->periods[dim]) {
  96             /* Don't record exchanges with self */
  97             continue;
  98         }
  99 
 100         if (MPI_PROC_NULL != srank) {
 101             ompi_datatype_type_size(sdtypes[i], &type_size);
 102             data_size = scounts[i] * type_size;
 103             /**
 104              * If this fails the destination is not part of my MPI_COM_WORLD
 105              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
 106              */
 107             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) {
 108                 mca_common_monitoring_record_coll(world_rank, data_size);
 109                 data_size_aggreg += data_size;
 110             }
 111             ++i;
 112         }
 113 
 114         if (MPI_PROC_NULL != drank) {
 115             ompi_datatype_type_size(sdtypes[i], &type_size);
 116             data_size = scounts[i] * type_size;
 117             /**
 118              * If this fails the destination is not part of my MPI_COM_WORLD
 119              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
 120              */
 121             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) {
 122                 mca_common_monitoring_record_coll(world_rank, data_size);
 123                 data_size_aggreg += data_size;
 124             }
 125             ++i;
 126         }
 127     }
 128 
 129     mca_common_monitoring_coll_a2a(data_size_aggreg, monitoring_module->data);
 130 
 131     return monitoring_module->real.coll_ineighbor_alltoallw(sbuf, scounts, sdisps, sdtypes, rbuf, rcounts, rdisps, rdtypes, comm, request, monitoring_module->real.coll_ineighbor_alltoallw_module);
 132 }

/* [<][>][^][v][top][bottom][index][help] */