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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_coll_monitoring_allreduce
  2. mca_coll_monitoring_iallreduce

   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_allreduce(const void *sbuf, void *rbuf, int count,
  18                                           struct ompi_datatype_t *dtype,
  19                                           struct ompi_op_t *op,
  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;
  25     const int comm_size = ompi_comm_size(comm);
  26     const int my_rank = ompi_comm_rank(comm);
  27     int i, rank;
  28     ompi_datatype_type_size(dtype, &type_size);
  29     data_size = count * type_size;
  30     mca_common_monitoring_coll_a2a(data_size * (comm_size - 1), monitoring_module->data);
  31     for( i = 0; i < comm_size; ++i ) {
  32         if( my_rank == 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     return monitoring_module->real.coll_allreduce(sbuf, rbuf, count, dtype, op, comm, monitoring_module->real.coll_allreduce_module);
  42 }
  43 
  44 int mca_coll_monitoring_iallreduce(const void *sbuf, void *rbuf, int count,
  45                                           struct ompi_datatype_t *dtype,
  46                                           struct ompi_op_t *op,
  47                                           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     size_t type_size, data_size;
  53     const int comm_size = ompi_comm_size(comm);
  54     const int my_rank = ompi_comm_rank(comm);
  55     int i, rank;
  56     ompi_datatype_type_size(dtype, &type_size);
  57     data_size = count * type_size;
  58     mca_common_monitoring_coll_a2a(data_size * (comm_size - 1), monitoring_module->data);
  59     for( i = 0; i < comm_size; ++i ) {
  60         if( my_rank == i ) continue; /* No communication for self */
  61         /**
  62          * If this fails the destination is not part of my MPI_COM_WORLD
  63          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank
  64          */
  65         if( OPAL_SUCCESS == mca_common_monitoring_get_world_rank(i, comm->c_remote_group, &rank) ) {
  66             mca_common_monitoring_record_coll(rank, data_size);
  67         }
  68     }
  69     return monitoring_module->real.coll_iallreduce(sbuf, rbuf, count, dtype, op, comm, request, monitoring_module->real.coll_iallreduce_module);
  70 }

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