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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_coll_monitoring_neighbor_allgather
  2. mca_coll_monitoring_ineighbor_allgather

   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_allgather(const void *sbuf, int scount,
  18                                            struct ompi_datatype_t *sdtype, void *rbuf,
  19                                            int rcount, struct ompi_datatype_t *rdtype,
  20                                            struct ompi_communicator_t *comm,
  21                                            mca_coll_base_module_t *module)
  22 {
  23     mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
  24     size_t type_size, data_size, data_size_aggreg = 0;
  25     const mca_topo_base_comm_cart_t *cart = comm->c_topo->mtc.cart;
  26     int dim, srank, drank, world_rank;
  27 
  28     ompi_datatype_type_size(sdtype, &type_size);
  29     data_size = scount * type_size;
  30 
  31     for( dim = 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             /**
  43              * If this fails the destination is not part of my MPI_COM_WORLD
  44              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  45              */
  46             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) {
  47                 mca_common_monitoring_record_coll(world_rank, data_size);
  48                 data_size_aggreg += data_size;
  49             }
  50         }
  51 
  52         if (MPI_PROC_NULL != drank) {
  53             /**
  54              * If this fails the destination is not part of my MPI_COM_WORLD
  55              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  56              */
  57             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) {
  58                 mca_common_monitoring_record_coll(world_rank, data_size);
  59                 data_size_aggreg += data_size;
  60             }
  61         }
  62     }
  63 
  64     mca_common_monitoring_coll_a2a(data_size_aggreg, monitoring_module->data);
  65 
  66     return monitoring_module->real.coll_neighbor_allgather(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, monitoring_module->real.coll_neighbor_allgather_module);
  67 }
  68 
  69 int mca_coll_monitoring_ineighbor_allgather(const void *sbuf, int scount,
  70                                             struct ompi_datatype_t *sdtype, void *rbuf,
  71                                             int rcount, struct ompi_datatype_t *rdtype,
  72                                             struct ompi_communicator_t *comm,
  73                                             ompi_request_t ** request,
  74                                             mca_coll_base_module_t *module)
  75 {
  76     mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
  77     size_t type_size, data_size, data_size_aggreg = 0;
  78     const mca_topo_base_comm_cart_t *cart = comm->c_topo->mtc.cart;
  79     int dim, srank, drank, world_rank;
  80 
  81     ompi_datatype_type_size(sdtype, &type_size);
  82     data_size = scount * type_size;
  83 
  84     for( dim = 0; dim < cart->ndims; ++dim ) {
  85         srank = MPI_PROC_NULL, drank = MPI_PROC_NULL;
  86 
  87         if (cart->dims[dim] > 1) {
  88             mca_topo_base_cart_shift (comm, dim, 1, &srank, &drank);
  89         } else if (1 == cart->dims[dim] && cart->periods[dim]) {
  90             /* Don't record exchanges with self */
  91             continue;
  92         }
  93 
  94         if (MPI_PROC_NULL != srank) {
  95             /**
  96              * If this fails the destination is not part of my MPI_COM_WORLD
  97              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  98              */
  99             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) {
 100                 mca_common_monitoring_record_coll(world_rank, data_size);
 101                 data_size_aggreg += data_size;
 102             }
 103         }
 104 
 105         if (MPI_PROC_NULL != drank) {
 106             /**
 107              * If this fails the destination is not part of my MPI_COM_WORLD
 108              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
 109              */
 110             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) {
 111                 mca_common_monitoring_record_coll(world_rank, data_size);
 112                 data_size_aggreg += data_size;
 113             }
 114         }
 115     }
 116 
 117     mca_common_monitoring_coll_a2a(data_size_aggreg, monitoring_module->data);
 118 
 119     return monitoring_module->real.coll_ineighbor_allgather(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, request, monitoring_module->real.coll_ineighbor_allgather_module);
 120 }

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