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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_coll_monitoring_neighbor_allgatherv
  2. mca_coll_monitoring_ineighbor_allgatherv

   1 /*
   2  * Copyright (c) 2016-2018 Inria. All rights reserved.
   3  * Copyright (c) 2017      Research Organization for Information Science
   4  *                         and Technology (RIST). All rights reserved.
   5  * $COPYRIGHT$
   6  *
   7  * Additional copyrights may follow
   8  *
   9  * $HEADER$
  10  */
  11 
  12 #include <ompi_config.h>
  13 #include <ompi/request/request.h>
  14 #include <ompi/datatype/ompi_datatype.h>
  15 #include <ompi/communicator/communicator.h>
  16 #include <ompi/mca/topo/base/base.h>
  17 #include "coll_monitoring.h"
  18 
  19 int mca_coll_monitoring_neighbor_allgatherv(const void *sbuf, int scount,
  20                                             struct ompi_datatype_t *sdtype,
  21                                             void * rbuf, const int *rcounts, const int *disps,
  22                                             struct ompi_datatype_t *rdtype,
  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_2_2_0_t *cart = comm->c_topo->mtc.cart;
  29     int dim, srank, drank, world_rank;
  30 
  31     ompi_datatype_type_size(sdtype, &type_size);
  32     data_size = scount * type_size;
  33 
  34     for( dim = 0; dim < cart->ndims; ++dim ) {
  35         srank = MPI_PROC_NULL, drank = MPI_PROC_NULL;
  36 
  37         if (cart->dims[dim] > 1) {
  38             mca_topo_base_cart_shift (comm, dim, 1, &srank, &drank);
  39         } else if (1 == cart->dims[dim] && cart->periods[dim]) {
  40             /* Don't record exchanges with self */
  41             continue;
  42         }
  43 
  44         if (MPI_PROC_NULL != srank) {
  45             /**
  46              * If this fails the destination is not part of my MPI_COM_WORLD
  47              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  48              */
  49             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) {
  50                 mca_common_monitoring_record_coll(world_rank, data_size);
  51                 data_size_aggreg += data_size;
  52             }
  53         }
  54 
  55         if (MPI_PROC_NULL != drank) {
  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         }
  65     }
  66 
  67     mca_common_monitoring_coll_a2a(data_size_aggreg, monitoring_module->data);
  68 
  69     return monitoring_module->real.coll_neighbor_allgatherv(sbuf, scount, sdtype, rbuf, rcounts, disps, rdtype, comm, monitoring_module->real.coll_neighbor_allgatherv_module);
  70 }
  71 
  72 int mca_coll_monitoring_ineighbor_allgatherv(const void *sbuf, int scount,
  73                                              struct ompi_datatype_t *sdtype,
  74                                              void * rbuf, const int *rcounts, const int *disps,
  75                                              struct ompi_datatype_t *rdtype,
  76                                              struct ompi_communicator_t *comm,
  77                                              ompi_request_t ** request,
  78                                              mca_coll_base_module_t *module)
  79 {
  80     mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
  81     size_t type_size, data_size, data_size_aggreg = 0;
  82     const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart;
  83     int dim, srank, drank, world_rank;
  84 
  85     ompi_datatype_type_size(sdtype, &type_size);
  86     data_size = scount * type_size;
  87 
  88     for( dim = 0; dim < cart->ndims; ++dim ) {
  89         srank = MPI_PROC_NULL, drank = MPI_PROC_NULL;
  90 
  91         if (cart->dims[dim] > 1) {
  92             mca_topo_base_cart_shift (comm, dim, 1, &srank, &drank);
  93         } else if (1 == cart->dims[dim] && cart->periods[dim]) {
  94             /* Don't record exchanges with self */
  95             continue;
  96         }
  97 
  98         if (MPI_PROC_NULL != srank) {
  99             /**
 100              * If this fails the destination is not part of my MPI_COM_WORLD
 101              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
 102              */
 103             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(srank, comm->c_remote_group, &world_rank) ) {
 104                 mca_common_monitoring_record_coll(world_rank, data_size);
 105                 data_size_aggreg += data_size;
 106             }
 107         }
 108 
 109         if (MPI_PROC_NULL != drank) {
 110             /**
 111              * If this fails the destination is not part of my MPI_COM_WORLD
 112              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
 113              */
 114             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(drank, comm->c_remote_group, &world_rank) ) {
 115                 mca_common_monitoring_record_coll(world_rank, data_size);
 116                 data_size_aggreg += data_size;
 117             }
 118         }
 119     }
 120 
 121     mca_common_monitoring_coll_a2a(data_size_aggreg, monitoring_module->data);
 122 
 123     return monitoring_module->real.coll_ineighbor_allgatherv(sbuf, scount, sdtype, rbuf, rcounts, disps, rdtype, comm, request, monitoring_module->real.coll_ineighbor_allgatherv_module);
 124 }

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