root/ompi/mca/osc/monitoring/osc_monitoring_accumulate.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_ACCUMULATE_H
  11 #define MCA_OSC_MONITORING_ACCUMULATE_H
  12 
  13 #include <ompi/datatype/ompi_datatype.h>
  14 #include <ompi/op/op.h>
  15 #include <ompi/win/win.h>
  16 
  17 #define OSC_MONITORING_GENERATE_TEMPLATE_ACCUMULATE(template)           \
  18                                                                         \
  19     static int ompi_osc_monitoring_## template ##_compare_and_swap (const void *origin_addr, \
  20                                                                     const void *compare_addr, \
  21                                                                     void *result_addr, \
  22                                                                     ompi_datatype_t *dt, \
  23                                                                     int target_rank, \
  24                                                                     ptrdiff_t target_disp, \
  25                                                                     ompi_win_t *win) \
  26     {                                                                   \
  27         int world_rank;                                                 \
  28         /**                                                             \
  29          * If this fails the destination is not part of my MPI_COM_WORLD \
  30          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \
  31          */                                                             \
  32         if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \
  33             size_t type_size;                                           \
  34             ompi_datatype_type_size(dt, &type_size);                    \
  35             mca_common_monitoring_record_osc(world_rank, type_size, SEND); \
  36             mca_common_monitoring_record_osc(world_rank, type_size, RECV); \
  37             OPAL_MONITORING_PRINT_INFO("MPI_Compare_and_swap to %d intercepted", world_rank); \
  38         }                                                               \
  39         return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_compare_and_swap(origin_addr, compare_addr, result_addr, dt, target_rank, target_disp, win); \
  40     }                                                                   \
  41                                                                         \
  42     static int ompi_osc_monitoring_## template ##_get_accumulate (const void *origin_addr, \
  43                                                                   int origin_count, \
  44                                                                   ompi_datatype_t*origin_datatype, \
  45                                                                   void *result_addr, \
  46                                                                   int result_count, \
  47                                                                   ompi_datatype_t*result_datatype, \
  48                                                                   int target_rank, \
  49                                                                   MPI_Aint target_disp, \
  50                                                                   int target_count, \
  51                                                                   ompi_datatype_t*target_datatype, \
  52                                                                   ompi_op_t *op, ompi_win_t*win) \
  53     {                                                                   \
  54         int world_rank;                                                 \
  55         /**                                                             \
  56          * If this fails the destination is not part of my MPI_COM_WORLD \
  57          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \
  58          */                                                             \
  59         if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \
  60             size_t type_size, data_size;                                \
  61             ompi_datatype_type_size(origin_datatype, &type_size);       \
  62             data_size = origin_count*type_size;                         \
  63             mca_common_monitoring_record_osc(world_rank, data_size, SEND); \
  64             ompi_datatype_type_size(result_datatype, &type_size);       \
  65             data_size = result_count*type_size;                         \
  66             mca_common_monitoring_record_osc(world_rank, data_size, RECV); \
  67             OPAL_MONITORING_PRINT_INFO("MPI_Get_accumulate to %d intercepted", world_rank); \
  68         }                                                               \
  69         return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_get_accumulate(origin_addr, origin_count, origin_datatype, result_addr, result_count, result_datatype, target_rank, target_disp, target_count, target_datatype, op, win); \
  70     }                                                                   \
  71                                                                         \
  72     static int ompi_osc_monitoring_## template ##_rget_accumulate (const void *origin_addr, \
  73                                                                    int origin_count, \
  74                                                                    ompi_datatype_t *origin_datatype, \
  75                                                                    void *result_addr, \
  76                                                                    int result_count, \
  77                                                                    ompi_datatype_t *result_datatype, \
  78                                                                    int target_rank, \
  79                                                                    MPI_Aint target_disp, \
  80                                                                    int target_count, \
  81                                                                    ompi_datatype_t*target_datatype, \
  82                                                                    ompi_op_t *op, \
  83                                                                    ompi_win_t *win, \
  84                                                                    ompi_request_t **request) \
  85     {                                                                   \
  86         int world_rank;                                                 \
  87         /**                                                             \
  88          * If this fails the destination is not part of my MPI_COM_WORLD \
  89          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \
  90          */                                                             \
  91         if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \
  92             size_t type_size, data_size;                                \
  93             ompi_datatype_type_size(origin_datatype, &type_size);       \
  94             data_size = origin_count*type_size;                         \
  95             mca_common_monitoring_record_osc(world_rank, data_size, SEND); \
  96             ompi_datatype_type_size(result_datatype, &type_size);       \
  97             data_size = result_count*type_size;                         \
  98             mca_common_monitoring_record_osc(world_rank, data_size, RECV); \
  99             OPAL_MONITORING_PRINT_INFO("MPI_Rget_accumulate to %d intercepted", world_rank); \
 100         }                                                               \
 101         return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_rget_accumulate(origin_addr, origin_count, origin_datatype, result_addr, result_count, result_datatype, target_rank, target_disp, target_count, target_datatype, op, win, request); \
 102     }                                                                   \
 103                                                                         \
 104     static int ompi_osc_monitoring_## template ##_raccumulate (const void *origin_addr, \
 105                                                                int origin_count, \
 106                                                                ompi_datatype_t *origin_datatype, \
 107                                                                int target_rank, \
 108                                                                ptrdiff_t target_disp, \
 109                                                                int target_count, \
 110                                                                ompi_datatype_t *target_datatype, \
 111                                                                ompi_op_t *op, ompi_win_t *win, \
 112                                                                ompi_request_t **request) \
 113     {                                                                   \
 114         int world_rank;                                                 \
 115         /**                                                             \
 116          * If this fails the destination is not part of my MPI_COM_WORLD \
 117          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \
 118          */                                                             \
 119         if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \
 120             size_t type_size, data_size;                                \
 121             ompi_datatype_type_size(origin_datatype, &type_size);       \
 122             data_size = origin_count*type_size;                         \
 123             mca_common_monitoring_record_osc(world_rank, data_size, SEND); \
 124             OPAL_MONITORING_PRINT_INFO("MPI_Raccumulate to %d intercepted", world_rank); \
 125         }                                                               \
 126         return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_raccumulate(origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, op, win, request); \
 127     }                                                                   \
 128                                                                         \
 129     static int ompi_osc_monitoring_## template ##_accumulate (const void *origin_addr, \
 130                                                               int origin_count, \
 131                                                               ompi_datatype_t *origin_datatype, \
 132                                                               int target_rank, \
 133                                                               ptrdiff_t target_disp, \
 134                                                               int target_count, \
 135                                                               ompi_datatype_t *target_datatype, \
 136                                                               ompi_op_t *op, ompi_win_t *win) \
 137     {                                                                   \
 138         int world_rank;                                                 \
 139         /**                                                             \
 140          * If this fails the destination is not part of my MPI_COM_WORLD \
 141          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \
 142          */                                                             \
 143         if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \
 144             size_t type_size, data_size;                                \
 145             ompi_datatype_type_size(origin_datatype, &type_size);       \
 146             data_size = origin_count*type_size;                         \
 147             mca_common_monitoring_record_osc(world_rank, data_size, SEND); \
 148             OPAL_MONITORING_PRINT_INFO("MPI_Accumulate to %d intercepted", world_rank); \
 149         }                                                               \
 150         return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_accumulate(origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, op, win); \
 151     }                                                                   \
 152                                                                         \
 153     static int ompi_osc_monitoring_## template ##_fetch_and_op (const void *origin_addr, \
 154                                                                 void *result_addr, \
 155                                                                 ompi_datatype_t *dt, \
 156                                                                 int target_rank, \
 157                                                                 ptrdiff_t target_disp, \
 158                                                                 ompi_op_t *op, ompi_win_t *win) \
 159     {                                                                   \
 160         int world_rank;                                                 \
 161         /**                                                             \
 162          * If this fails the destination is not part of my MPI_COM_WORLD \
 163          * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \
 164          */                                                             \
 165         if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, win->w_group, &world_rank)) { \
 166             size_t type_size;                                           \
 167             ompi_datatype_type_size(dt, &type_size);                    \
 168             mca_common_monitoring_record_osc(world_rank, type_size, SEND); \
 169             mca_common_monitoring_record_osc(world_rank, type_size, RECV); \
 170             OPAL_MONITORING_PRINT_INFO("MPI_Fetch_and_op to %d intercepted", world_rank); \
 171         }                                                               \
 172         return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_fetch_and_op(origin_addr, result_addr, dt, target_rank, target_disp, op, win); \
 173     }
 174 
 175 #endif /* MCA_OSC_MONITORING_ACCUMULATE_H */

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