root/ompi/mca/hook/demo/hook_demo_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_hook_demo_component_open
  2. ompi_hook_demo_component_close
  3. ompi_hook_demo_component_register

   1 /*
   2  * Copyright (c) 2017      IBM Corporation.  All rights reserved.
   3  * $COPYRIGHT$
   4  *
   5  * Additional copyrights may follow
   6  *
   7  * $HEADER$
   8  */
   9 
  10 #include "ompi_config.h"
  11 
  12 #include "hook_demo.h"
  13 
  14 static int ompi_hook_demo_component_open(void);
  15 static int ompi_hook_demo_component_close(void);
  16 static int ompi_hook_demo_component_register(void);
  17 
  18 /*
  19  * Public string showing the component version number
  20  */
  21 const char *mca_hook_demo_component_version_string =
  22     "Open MPI 'demo' hook MCA component version " OMPI_VERSION;
  23 
  24 /*
  25  * Instantiate the public struct with all of our public information
  26  * and pointers to our public functions in it
  27  */
  28 const ompi_hook_base_component_1_0_0_t mca_hook_demo_component = {
  29 
  30     /* First, the mca_component_t struct containing meta information
  31      * about the component itself */
  32     .hookm_version = {
  33         OMPI_HOOK_BASE_VERSION_1_0_0,
  34 
  35         /* Component name and version */
  36         .mca_component_name = "demo",
  37         MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
  38                               OMPI_RELEASE_VERSION),
  39 
  40         /* Component open and close functions */
  41         .mca_open_component = ompi_hook_demo_component_open,
  42         .mca_close_component = ompi_hook_demo_component_close,
  43         .mca_register_component_params = ompi_hook_demo_component_register,
  44 
  45         // Force this component to always be considered - component must be static
  46         .mca_component_flags = MCA_BASE_COMPONENT_FLAG_REQUIRED,
  47     },
  48     .hookm_data = {
  49         /* The component is checkpoint ready */
  50         MCA_BASE_METADATA_PARAM_CHECKPOINT
  51     },
  52 
  53     /* Component functions */
  54     .hookm_mpi_initialized_top = ompi_hook_demo_mpi_initialized_top,
  55     .hookm_mpi_initialized_bottom = ompi_hook_demo_mpi_initialized_bottom,
  56 
  57     .hookm_mpi_finalized_top = ompi_hook_demo_mpi_finalized_top,
  58     .hookm_mpi_finalized_bottom = ompi_hook_demo_mpi_finalized_bottom,
  59 
  60     .hookm_mpi_init_top = ompi_hook_demo_mpi_init_top,
  61     .hookm_mpi_init_top_post_opal = ompi_hook_demo_mpi_init_top_post_opal,
  62     .hookm_mpi_init_bottom = ompi_hook_demo_mpi_init_bottom,
  63     .hookm_mpi_init_error = ompi_hook_demo_mpi_init_error,
  64 
  65     .hookm_mpi_finalize_top = ompi_hook_demo_mpi_finalize_top,
  66     .hookm_mpi_finalize_bottom = ompi_hook_demo_mpi_finalize_bottom,
  67 };
  68 
  69 /*
  70  * Example 'extra' component with an additional callback that is dynamically
  71  * registered at runtime in addition to the callbacks that are a part of the
  72  * component structure.
  73  */
  74 ompi_hook_base_component_1_0_0_t hook_demo_extra_component = {
  75     /* Component functions */
  76     .hookm_mpi_init_bottom = ompi_hook_demo_extra_mpi_init_bottom,
  77 };
  78 
  79 static int ompi_hook_demo_component_open(void)
  80 {
  81     opal_output(0, "hook/demo: component_open()");
  82 
  83     // Register the 'extra' callback(s) to be called the next time those
  84     // functions are encountered.
  85     ompi_hook_base_register_callbacks( &hook_demo_extra_component );
  86 
  87     return OMPI_SUCCESS;
  88 }
  89 
  90 static int ompi_hook_demo_component_close(void)
  91 {
  92     opal_output(0, "hook/demo: component_close()");
  93 
  94     // Deregister the 'extra' callback(s) so that they are no longer called.
  95     // Must pass in the same 'component' structure that was passed to the
  96     // ompi_hook_base_register_callbacks() earlier.
  97     ompi_hook_base_deregister_callbacks( &hook_demo_extra_component );
  98 
  99     return OMPI_SUCCESS;
 100 }
 101 
 102 static int ompi_hook_demo_component_register(void)
 103 {
 104     opal_output(0, "hook/demo: component_register()");
 105     return OMPI_SUCCESS;
 106 }
 107 

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