This source file includes following definitions.
- mca_pml_cm_component_register
- mca_pml_cm_component_open
- mca_pml_cm_component_close
- mca_pml_cm_component_init
- mca_pml_cm_component_fini
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 #include "ompi_config.h"
  23 
  24 #include "pml_cm.h"
  25 #include "opal/mca/event/event.h"
  26 #include "ompi/mca/mtl/mtl.h"
  27 #include "ompi/mca/mtl/base/base.h"
  28 #include "ompi/mca/pml/base/pml_base_bsend.h"
  29 
  30 #include "pml_cm_sendreq.h"
  31 #include "pml_cm_recvreq.h"
  32 #include "pml_cm_component.h"
  33 
  34 static int mca_pml_cm_component_register(void);
  35 static int mca_pml_cm_component_open(void);
  36 static int mca_pml_cm_component_close(void);
  37 static mca_pml_base_module_t* mca_pml_cm_component_init( int* priority,
  38                             bool enable_progress_threads, bool enable_mpi_threads);
  39 static int mca_pml_cm_component_fini(void);
  40 
  41 mca_pml_base_component_2_0_0_t mca_pml_cm_component = {
  42     
  43 
  44 
  45     .pmlm_version = {
  46         MCA_PML_BASE_VERSION_2_0_0,
  47 
  48         .mca_component_name = "cm",
  49         MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
  50                               OMPI_RELEASE_VERSION),
  51         .mca_open_component = mca_pml_cm_component_open,
  52         .mca_close_component = mca_pml_cm_component_close,
  53         .mca_register_component_params = mca_pml_cm_component_register,
  54     },
  55     .pmlm_data = {
  56         
  57         MCA_BASE_METADATA_PARAM_NONE
  58     },
  59 
  60     .pmlm_init = mca_pml_cm_component_init,
  61     .pmlm_finalize = mca_pml_cm_component_fini,
  62 };
  63 
  64 
  65 
  66 
  67 
  68 void (*send_completion_callbacks[MCA_PML_BASE_SEND_SIZE])
  69     (struct mca_mtl_request_t *mtl_request) =
  70   { mca_pml_cm_send_request_completion,
  71     mca_pml_cm_send_request_completion,
  72     mca_pml_cm_send_request_completion,
  73     mca_pml_cm_send_request_completion,
  74     mca_pml_cm_send_request_completion } ;
  75 
  76 static int
  77 mca_pml_cm_component_register(void)
  78 {
  79 
  80     ompi_pml_cm.free_list_num = 4;
  81     (void) mca_base_component_var_register(&mca_pml_cm_component.pmlm_version, "free_list_num",
  82                                            "Initial size of request free lists",
  83                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  84                                            OPAL_INFO_LVL_9,
  85                                            MCA_BASE_VAR_SCOPE_READONLY,
  86                                            &ompi_pml_cm.free_list_num);
  87 
  88     ompi_pml_cm.free_list_max = -1;
  89     (void) mca_base_component_var_register(&mca_pml_cm_component.pmlm_version, "free_list_max",
  90                                            "Maximum size of request free lists",
  91                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  92                                            OPAL_INFO_LVL_9,
  93                                            MCA_BASE_VAR_SCOPE_READONLY,
  94                                            &ompi_pml_cm.free_list_max);
  95 
  96     ompi_pml_cm.free_list_inc = 64;
  97     (void) mca_base_component_var_register(&mca_pml_cm_component.pmlm_version, "free_list_inc",
  98                                            "Number of elements to add when growing request free lists",
  99                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
 100                                            OPAL_INFO_LVL_9,
 101                                            MCA_BASE_VAR_SCOPE_READONLY,
 102                                            &ompi_pml_cm.free_list_inc);
 103 
 104     return OPAL_SUCCESS;
 105 }
 106 
 107 static int
 108 mca_pml_cm_component_open(void)
 109 {
 110     int ret;
 111 
 112     ret = mca_base_framework_open(&ompi_mtl_base_framework, 0);
 113     if (OMPI_SUCCESS == ret) {
 114       
 115       if (0 == opal_list_get_size(&ompi_mtl_base_framework.framework_components)) {
 116         ret = OPAL_ERR_NOT_AVAILABLE;
 117       }
 118     }
 119 
 120     return ret;
 121 }
 122 
 123 
 124 static int
 125 mca_pml_cm_component_close(void)
 126 {
 127     return mca_base_framework_close(&ompi_mtl_base_framework);
 128 }
 129 
 130 
 131 static mca_pml_base_module_t*
 132 mca_pml_cm_component_init(int* priority,
 133                           bool enable_progress_threads,
 134                           bool enable_mpi_threads)
 135 {
 136     int ret;
 137 
 138     *priority = -1;
 139 
 140     opal_output_verbose( 10, 0,
 141                          "in cm pml priority is %d\n", *priority);
 142     
 143     ret = ompi_mtl_base_select(enable_progress_threads, enable_mpi_threads, priority);
 144     if (OMPI_SUCCESS != ret) {
 145         return NULL;
 146     }
 147 
 148     if (ompi_mtl->mtl_flags & MCA_MTL_BASE_FLAG_REQUIRE_WORLD) {
 149         ompi_pml_cm.super.pml_flags |= MCA_PML_BASE_FLAG_REQUIRE_WORLD;
 150     }
 151 
 152     
 153 
 154     ompi_pml_cm.super.pml_max_contextid = ompi_mtl->mtl_max_contextid;
 155     ompi_pml_cm.super.pml_max_tag = ompi_mtl->mtl_max_tag;
 156 
 157     return &ompi_pml_cm.super;
 158 }
 159 
 160 
 161 static int
 162 mca_pml_cm_component_fini(void)
 163 {
 164     if (NULL != ompi_mtl) {
 165         return OMPI_MTL_CALL(finalize(ompi_mtl));
 166     }
 167 
 168     return OMPI_SUCCESS;
 169 }
 170