root/ompi/mca/osc/monitoring/osc_monitoring_comm.h

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

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2016-2018 Inria.  All rights reserved.
   3  * $COPYRIGHT$
   4  *
   5  * Additional copyrights may follow
   6  *
   7  * $HEADER$
   8  */
   9 
  10 #ifndef MCA_OSC_MONITORING_COMM_H
  11 #define MCA_OSC_MONITORING_COMM_H
  12 
  13 #include <ompi/request/request.h>
  14 #include <ompi/datatype/ompi_datatype.h>
  15 #include <ompi/win/win.h>
  16 
  17 #define OSC_MONITORING_GENERATE_TEMPLATE_COMM(template)                 \
  18                                                                         \
  19     static int ompi_osc_monitoring_## template ##_put (const void *origin_addr, \
  20                                                        int origin_count, \
  21                                                        ompi_datatype_t *origin_datatype, \
  22                                                        int target_rank, \
  23                                                        ptrdiff_t target_disp, \
  24                                                        int target_count, \
  25                                                        ompi_datatype_t *target_datatype, \
  26                                                        ompi_win_t *win) \
  27     {                                                                   \
  28         int world_rank;                                                 \
  29         /**                                                             \
  30          * If this fails the destination is not part of my MPI_COM_WORLD \
  31          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \
  32          */                                                             \
  33         if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \
  34             size_t type_size, data_size;                                \
  35             ompi_datatype_type_size(origin_datatype, &type_size);       \
  36             data_size = origin_count*type_size;                         \
  37             mca_common_monitoring_record_osc(world_rank, data_size, SEND); \
  38             OPAL_MONITORING_PRINT_INFO("MPI_Put to %d intercepted", world_rank); \
  39         }                                                               \
  40         return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_put(origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, win); \
  41     }                                                                   \
  42                                                                         \
  43     static int ompi_osc_monitoring_## template ##_rput (const void *origin_addr, \
  44                                                         int origin_count, \
  45                                                         ompi_datatype_t *origin_datatype, \
  46                                                         int target_rank, \
  47                                                         ptrdiff_t target_disp, \
  48                                                         int target_count, \
  49                                                         ompi_datatype_t *target_datatype, \
  50                                                         ompi_win_t *win, \
  51                                                         ompi_request_t **request) \
  52     {                                                                   \
  53         int world_rank;                                                 \
  54         /**                                                             \
  55          * If this fails the destination is not part of my MPI_COM_WORLD \
  56          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \
  57          */                                                             \
  58         if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \
  59             size_t type_size, data_size;                                \
  60             ompi_datatype_type_size(origin_datatype, &type_size);       \
  61             data_size = origin_count*type_size;                         \
  62             mca_common_monitoring_record_osc(world_rank, data_size, SEND); \
  63             OPAL_MONITORING_PRINT_INFO("MPI_Rput to %d intercepted", world_rank); \
  64         }                                                               \
  65         return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_rput(origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, win, request); \
  66     }                                                                   \
  67                                                                         \
  68     static int ompi_osc_monitoring_## template ##_get (void *origin_addr, int origin_count, \
  69                                                        ompi_datatype_t *origin_datatype, \
  70                                                        int source_rank, \
  71                                                        ptrdiff_t source_disp, \
  72                                                        int source_count, \
  73                                                        ompi_datatype_t *source_datatype, \
  74                                                        ompi_win_t *win) \
  75     {                                                                   \
  76         int world_rank;                                                 \
  77         /**                                                             \
  78          * If this fails the destination is not part of my MPI_COM_WORLD \
  79          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \
  80          */                                                             \
  81         if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(source_rank, win->w_group, &world_rank)) { \
  82             size_t type_size, data_size;                                \
  83             ompi_datatype_type_size(origin_datatype, &type_size);       \
  84             data_size = origin_count*type_size;                         \
  85             mca_common_monitoring_record_osc(world_rank, 0, SEND);      \
  86             mca_common_monitoring_record_osc(world_rank, data_size, RECV); \
  87             OPAL_MONITORING_PRINT_INFO("MPI_Get to %d intercepted", world_rank); \
  88         }                                                               \
  89         return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_get(origin_addr, origin_count, origin_datatype, source_rank, source_disp, source_count, source_datatype, win); \
  90     }                                                                   \
  91                                                                         \
  92     static int ompi_osc_monitoring_## template ##_rget (void *origin_addr, int origin_count, \
  93                                                         ompi_datatype_t *origin_datatype, \
  94                                                         int source_rank, \
  95                                                         ptrdiff_t source_disp, \
  96                                                         int source_count, \
  97                                                         ompi_datatype_t *source_datatype, \
  98                                                         ompi_win_t *win, \
  99                                                         ompi_request_t **request) \
 100     {                                                                   \
 101         int world_rank;                                                 \
 102         /**                                                             \
 103          * If this fails the destination is not part of my MPI_COM_WORLD \
 104          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \
 105          */                                                             \
 106         if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(source_rank, win->w_group, &world_rank)) { \
 107             size_t type_size, data_size;                                \
 108             ompi_datatype_type_size(origin_datatype, &type_size);       \
 109             data_size = origin_count*type_size;                         \
 110             mca_common_monitoring_record_osc(world_rank, 0, SEND);      \
 111             mca_common_monitoring_record_osc(world_rank, data_size, RECV); \
 112             OPAL_MONITORING_PRINT_INFO("MPI_Rget to %d intercepted", world_rank); \
 113         }                                                               \
 114         return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_rget(origin_addr, origin_count, origin_datatype, source_rank, source_disp, source_count, source_datatype, win, request); \
 115     }
 116 
 117 #endif /* MCA_OSC_MONITORING_COMM_H */
 118 

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