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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_coll_monitoring_neighbor_alltoallv
  2. mca_coll_monitoring_ineighbor_alltoallv

   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_alltoallv(const void *sbuf, const int *scounts,
  18                                            const int *sdisps, struct ompi_datatype_t *sdtype,
  19                                            void *rbuf, const int *rcounts, const int *rdisps,
  20                                            struct ompi_datatype_t *rdtype,
  21                                            struct ompi_communicator_t *comm,
  22                                            mca_coll_base_module_t *module)
  23 {
  24     mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
  25     size_t type_size, data_size, data_size_aggreg = 0;
  26     const mca_topo_base_comm_cart_t *cart = comm->c_topo->mtc.cart;
  27     int dim, i, srank, drank, world_rank;
  28 
  29     ompi_datatype_type_size(sdtype, &type_size);
  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             data_size = scounts[i] * type_size;
  43             /**
  44              * If this fails the destination is not part of my MPI_COM_WORLD
  45              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  46              */
  47             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) {
  48                 mca_common_monitoring_record_coll(world_rank, data_size);
  49                 data_size_aggreg += data_size;
  50             }
  51             ++i;
  52         }
  53 
  54         if (MPI_PROC_NULL != drank) {
  55             data_size = scounts[i] * type_size;
  56             /**
  57              * If this fails the destination is not part of my MPI_COM_WORLD
  58              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  59              */
  60             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) {
  61                 mca_common_monitoring_record_coll(world_rank, data_size);
  62                 data_size_aggreg += data_size;
  63             }
  64             ++i;
  65         }
  66     }
  67 
  68     mca_common_monitoring_coll_a2a(data_size_aggreg, monitoring_module->data);
  69 
  70     return monitoring_module->real.coll_neighbor_alltoallv(sbuf, scounts, sdisps, sdtype, rbuf, rcounts, rdisps, rdtype, comm, monitoring_module->real.coll_neighbor_alltoallv_module);
  71 }
  72 
  73 int mca_coll_monitoring_ineighbor_alltoallv(const void *sbuf, const int *scounts,
  74                                             const int *sdisps,
  75                                             struct ompi_datatype_t *sdtype,
  76                                             void *rbuf, const int *rcounts,
  77                                             const int *rdisps,
  78                                             struct ompi_datatype_t *rdtype,
  79                                             struct ompi_communicator_t *comm,
  80                                             ompi_request_t ** request,
  81                                             mca_coll_base_module_t *module)
  82 {
  83     mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
  84     size_t type_size, data_size, data_size_aggreg = 0;
  85     const mca_topo_base_comm_cart_t *cart = comm->c_topo->mtc.cart;
  86     int dim, i, srank, drank, world_rank;
  87 
  88     ompi_datatype_type_size(sdtype, &type_size);
  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             data_size = scounts[i] * type_size;
 102             /**
 103              * If this fails the destination is not part of my MPI_COM_WORLD
 104              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
 105              */
 106             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) {
 107                 mca_common_monitoring_record_coll(world_rank, data_size);
 108                 data_size_aggreg += data_size;
 109             }
 110             ++i;
 111         }
 112 
 113         if (MPI_PROC_NULL != drank) {
 114             data_size = scounts[i] * type_size;
 115             /**
 116              * If this fails the destination is not part of my MPI_COM_WORLD
 117              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
 118              */
 119             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) {
 120                 mca_common_monitoring_record_coll(world_rank, data_size);
 121                 data_size_aggreg += data_size;
 122             }
 123             ++i;
 124         }
 125     }
 126 
 127     mca_common_monitoring_coll_a2a(data_size_aggreg, monitoring_module->data);
 128 
 129     return monitoring_module->real.coll_ineighbor_alltoallv(sbuf, scounts, sdisps, sdtype, rbuf, rcounts, rdisps, rdtype, comm, request, monitoring_module->real.coll_ineighbor_alltoallv_module);
 130 }

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