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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_coll_monitoring_scatter
  2. mca_coll_monitoring_iscatter

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

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