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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_coll_monitoring_gather
  2. mca_coll_monitoring_igather

   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 "coll_monitoring.h"
  15 
  16 int mca_coll_monitoring_gather(const void *sbuf, int scount,
  17                                struct ompi_datatype_t *sdtype,
  18                                void *rbuf, int rcount, struct ompi_datatype_t *rdtype,
  19                                int root, struct ompi_communicator_t *comm,
  20                                mca_coll_base_module_t *module)
  21 {
  22     mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
  23     if( root == ompi_comm_rank(comm) ) {
  24         int i, rank;
  25         size_t type_size, data_size;
  26         const int comm_size = ompi_comm_size(comm);
  27         ompi_datatype_type_size(rdtype, &type_size);
  28         data_size = rcount * type_size;
  29         for( i = 0; i < comm_size; ++i ) {
  30             if( root == i ) continue; /* No communication for self */
  31             /**
  32              * If this fails the destination is not part of my MPI_COM_WORLD
  33              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  34              */
  35             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) {
  36                 mca_common_monitoring_record_coll(rank, data_size);
  37             }
  38         }
  39         mca_common_monitoring_coll_a2o(data_size * (comm_size - 1), monitoring_module->data);
  40     }
  41     return monitoring_module->real.coll_gather(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm, monitoring_module->real.coll_gather_module);
  42 }
  43 
  44 int mca_coll_monitoring_igather(const void *sbuf, int scount,
  45                                 struct ompi_datatype_t *sdtype,
  46                                 void *rbuf, int rcount, struct ompi_datatype_t *rdtype,
  47                                 int root, struct ompi_communicator_t *comm,
  48                                 ompi_request_t ** request,
  49                                 mca_coll_base_module_t *module)
  50 {
  51     mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
  52     if( root == ompi_comm_rank(comm) ) {
  53         int i, rank;
  54         size_t type_size, data_size;
  55         const int comm_size = ompi_comm_size(comm);
  56         ompi_datatype_type_size(rdtype, &type_size);
  57         data_size = rcount * type_size;
  58         for( i = 0; i < comm_size; ++i ) {
  59             if( root == i ) continue; /* No communication for self */
  60             /**
  61              * If this fails the destination is not part of my MPI_COM_WORLD
  62              * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  63              */
  64             if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) {
  65                 mca_common_monitoring_record_coll(rank, data_size);
  66             }
  67         }
  68         mca_common_monitoring_coll_a2o(data_size * (comm_size - 1), monitoring_module->data);
  69     }
  70     return monitoring_module->real.coll_igather(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm, request, monitoring_module->real.coll_igather_module);
  71 }

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