1 /* 2 * Copyright (c) 2016-2017 Inria. All rights reserved. 3 * Copyright (c) 2017 Amazon.com, Inc. or its affiliates. All Rights 4 * reserved. 5 * $COPYRIGHT$ 6 * 7 * Additional copyrights may follow 8 * 9 * $HEADER$ 10 */ 11 12 #ifndef MCA_OSC_MONITORING_TEMPLATE_H 13 #define MCA_OSC_MONITORING_TEMPLATE_H 14 15 #include <ompi_config.h> 16 #include <ompi/communicator/communicator.h> 17 #include <ompi/win/win.h> 18 #include <opal/sys/atomic.h> 19 #include "osc_monitoring_accumulate.h" 20 #include "osc_monitoring_active_target.h" 21 #include "osc_monitoring_comm.h" 22 #include "osc_monitoring_dynamic.h" 23 #include "osc_monitoring_module.h" 24 #include "osc_monitoring_passive_target.h" 25 26 /* The magic used here is that for a given module type (given with the 27 * {template} parameter), we generate a set of every functions defined 28 * in ompi_osc_base_module_t, the ompi_osc_monitoring_module_## 29 * template ##_template variable recording the original set of 30 * functions, and the generated set of functions is recorded as a 31 * static variable inside the initialization function. When a function 32 * is called from the original module, we route the call to our 33 * generated function that does the monitoring, and then we call the 34 * original function that had been saved in the 35 * ompi_osc_monitoring_module_## template ##_template variable. 36 */ 37 #define OSC_MONITORING_MODULE_TEMPLATE_GENERATE(template) \ 38 /* Generate the proper symbol for the \ 39 ompi_osc_monitoring_module_## template ##_template variable */ \ 40 OMPI_OSC_MONITORING_MODULE_GENERATE(template) \ 41 /* Generate each module specific functions */ \ 42 OSC_MONITORING_GENERATE_TEMPLATE_ACCUMULATE(template) \ 43 OSC_MONITORING_GENERATE_TEMPLATE_ACTIVE_TARGET(template) \ 44 OSC_MONITORING_GENERATE_TEMPLATE_COMM(template) \ 45 OSC_MONITORING_GENERATE_TEMPLATE_DYNAMIC(template) \ 46 OSC_MONITORING_GENERATE_TEMPLATE_MODULE(template) \ 47 OSC_MONITORING_GENERATE_TEMPLATE_PASSIVE_TARGET(template) \ 48 /* Generate template specific module initialization function: \ 49 * ompi_osc_monitoring_## template ##_set_template(ompi_osc_base_module_t*module) \ 50 */ \ 51 MCA_OSC_MONITORING_MODULE_TEMPLATE_GENERATE(template) 52 53 #endif /* MCA_OSC_MONITORING_TEMPLATE_H */