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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_coll_monitoring_reduce
  2. mca_coll_monitoring_ireduce

   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(const void *sbuf, void *rbuf, int count,
  18                                struct ompi_datatype_t *dtype,
  19                                struct ompi_op_t *op,
  20                                int root,
  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     if( root == ompi_comm_rank(comm) ) {
  26         int i, rank;
  27         size_t type_size, data_size;
  28         const int comm_size = ompi_comm_size(comm);
  29         ompi_datatype_type_size(dtype, &type_size);
  30         data_size = count * type_size;
  31         for( i = 0; i < comm_size; ++i ) {
  32             if( root == i ) continue; /* No communication for self */
  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         }
  41         mca_common_monitoring_coll_a2o(data_size * (comm_size - 1), monitoring_module->data);
  42     }
  43     return monitoring_module->real.coll_reduce(sbuf, rbuf, count, dtype, op, root, comm, monitoring_module->real.coll_reduce_module);
  44 }
  45 
  46 int mca_coll_monitoring_ireduce(const void *sbuf, void *rbuf, int count,
  47                                 struct ompi_datatype_t *dtype,
  48                                 struct ompi_op_t *op,
  49                                 int root,
  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     if( root == ompi_comm_rank(comm) ) {
  56         int i, rank;
  57         size_t type_size, data_size;
  58         const int comm_size = ompi_comm_size(comm);
  59         ompi_datatype_type_size(dtype, &type_size);
  60         data_size = count * type_size;
  61         for( i = 0; i < comm_size; ++i ) {
  62             if( root == i ) continue; /* No communication for self */
  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         }
  71         mca_common_monitoring_coll_a2o(data_size * (comm_size - 1), monitoring_module->data);
  72     }
  73     return monitoring_module->real.coll_ireduce(sbuf, rbuf, count, dtype, op, root, comm, request, monitoring_module->real.coll_ireduce_module);
  74 }

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