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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_coll_monitoring_reduce_scatter
  2. mca_coll_monitoring_ireduce_scatter

   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/op/op.h>
  12 #include <ompi/request/request.h>
  13 #include <ompi/datatype/ompi_datatype.h>
  14 #include <ompi/communicator/communicator.h>
  15 #include "coll_monitoring.h"
  16 
  17 int mca_coll_monitoring_reduce_scatter(const void *sbuf, void *rbuf,
  18                                        const int *rcounts,
  19                                        struct ompi_datatype_t *dtype,
  20                                        struct ompi_op_t *op,
  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 int comm_size = ompi_comm_size(comm);
  27     const int my_rank = ompi_comm_rank(comm);
  28     int i, rank;
  29     ompi_datatype_type_size(dtype, &type_size);
  30     for( i = 0; i < comm_size; ++i ) {
  31         if( my_rank == i ) continue; /* No communication for self */
  32         data_size = rcounts[i] * type_size;
  33         /**
  34          * If this fails the destination is not part of my MPI_COM_WORLD
  35          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  36          */
  37         if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) {
  38             mca_common_monitoring_record_coll(rank, data_size);
  39         }
  40         data_size_aggreg += data_size;
  41     }
  42     mca_common_monitoring_coll_a2a(data_size_aggreg, monitoring_module->data);
  43     return monitoring_module->real.coll_reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm, monitoring_module->real.coll_reduce_scatter_module);
  44 }
  45 
  46 int mca_coll_monitoring_ireduce_scatter(const void *sbuf, void *rbuf,
  47                                         const int *rcounts,
  48                                         struct ompi_datatype_t *dtype,
  49                                         struct ompi_op_t *op,
  50                                         struct ompi_communicator_t *comm,
  51                                         ompi_request_t ** request,
  52                                         mca_coll_base_module_t *module)
  53 {
  54     mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
  55     size_t type_size, data_size, data_size_aggreg = 0;
  56     const int comm_size = ompi_comm_size(comm);
  57     const int my_rank = ompi_comm_rank(comm);
  58     int i, rank;
  59     ompi_datatype_type_size(dtype, &type_size);
  60     for( i = 0; i < comm_size; ++i ) {
  61         if( my_rank == i ) continue; /* No communication for self */
  62         data_size = rcounts[i] * type_size;
  63         /**
  64          * If this fails the destination is not part of my MPI_COM_WORLD
  65          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  66          */
  67         if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) {
  68             mca_common_monitoring_record_coll(rank, data_size);
  69         }
  70         data_size_aggreg += data_size;
  71     }
  72     mca_common_monitoring_coll_a2a(data_size_aggreg, monitoring_module->data);
  73     return monitoring_module->real.coll_ireduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm, request, monitoring_module->real.coll_ireduce_scatter_module);
  74 }

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