This source file includes following definitions.
- mca_spml_base_register
- mca_spml_base_finalize
- mca_spml_base_close
- mca_spml_base_open
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 #include "oshmem_config.h"
  17 #include <stdio.h>
  18 
  19 #include <string.h>
  20 #ifdef HAVE_UNISTD_H
  21 #include <unistd.h>
  22 #endif  
  23 #include "oshmem/mca/mca.h"
  24 #include "opal/util/output.h"
  25 #include "opal/mca/base/base.h"
  26 
  27 #include "oshmem/constants.h"
  28 #include "oshmem/util/oshmem_util.h"
  29 #include "oshmem/mca/spml/spml.h"
  30 #include "oshmem/mca/spml/base/base.h"
  31 #include "oshmem/mca/spml/base/spml_base_request.h"
  32 
  33 
  34 
  35 
  36 
  37 
  38 
  39 #include "oshmem/mca/spml/base/static-components.h"
  40 
  41 #define xstringify(spml) #spml
  42 #define stringify(spml) xstringify(spml)
  43 
  44 
  45 
  46 
  47 mca_spml_base_module_t mca_spml = {0};
  48 
  49 mca_spml_base_component_t mca_spml_base_selected_component = {{0}};
  50 opal_pointer_array_t mca_spml_base_spml = {{0}};
  51 
  52 
  53 static int mca_spml_base_register(mca_base_register_flag_t flags)
  54 {
  55     return OMPI_SUCCESS;
  56 }
  57 
  58 int mca_spml_base_finalize(void)
  59 {
  60     if (NULL != mca_spml_base_selected_component.spmlm_finalize) {
  61         return mca_spml_base_selected_component.spmlm_finalize();
  62     }
  63     return OSHMEM_SUCCESS;
  64 }
  65 
  66 static int mca_spml_base_close(void)
  67 {
  68     int i, j;
  69 
  70     
  71 
  72 
  73 
  74 
  75     OBJ_DESTRUCT(&mca_spml_base_put_requests);
  76     OBJ_DESTRUCT(&mca_spml_base_get_requests);
  77 
  78     
  79     j = opal_pointer_array_get_size(&mca_spml_base_spml);
  80     for (i = 0; i < j; i++) {
  81         char * tmp_val;
  82         tmp_val = (char *) opal_pointer_array_get_item(&mca_spml_base_spml, i);
  83         if (NULL == tmp_val) {
  84             continue;
  85         }
  86         free(tmp_val);
  87     }
  88     OBJ_DESTRUCT(&mca_spml_base_spml);
  89 
  90     
  91     return mca_base_framework_components_close(&oshmem_spml_base_framework, NULL);
  92 }
  93 
  94 
  95 
  96 
  97 
  98 static int mca_spml_base_open(mca_base_open_flag_t flags)
  99 {
 100     
 101 
 102 
 103 
 104 
 105 
 106 
 107     OBJ_CONSTRUCT(&mca_spml_base_put_requests, opal_free_list_t);
 108     OBJ_CONSTRUCT(&mca_spml_base_get_requests, opal_free_list_t);
 109 
 110     OBJ_CONSTRUCT(&mca_spml_base_spml, opal_pointer_array_t);
 111 
 112     oshmem_framework_open_output(&oshmem_spml_base_framework);
 113 
 114     
 115     if (OPAL_SUCCESS !=
 116         mca_base_framework_components_open(&oshmem_spml_base_framework, flags)) {
 117         return OSHMEM_ERROR;
 118     }
 119 
 120     
 121 
 122 
 123     mca_spml_base_selected_component.spmlm_finalize = NULL;
 124 
 125     
 126 
 127 
 128 
 129 
 130 
 131 
 132 
 133 #if MCA_ompi_pml_DIRECT_CALL
 134     opal_pointer_array_add(&mca_spml_base_spml,
 135                            strdup(stringify(MCA_oshmem_spml_DIRECT_CALL_COMPONENT)));
 136 #else
 137     {
 138         const char **default_spml = NULL;
 139         int var_id;
 140 
 141         var_id = mca_base_var_find("oshmem", "spml", NULL, NULL);
 142         mca_base_var_get_value(var_id, &default_spml, NULL, NULL);
 143 
 144         if( (NULL == default_spml || NULL == default_spml[0] ||
 145              0 == strlen(default_spml[0])) || (default_spml[0][0] == '^') ) {
 146             opal_pointer_array_add(&mca_spml_base_spml, strdup("ikrit"));
 147             opal_pointer_array_add(&mca_spml_base_spml, strdup("ucx"));
 148         } else {
 149             opal_pointer_array_add(&mca_spml_base_spml, strdup(default_spml[0]));
 150         }
 151     }
 152 #endif
 153 
 154     return OSHMEM_SUCCESS;
 155 }
 156 
 157 MCA_BASE_FRAMEWORK_DECLARE(oshmem, spml,
 158                            "OSHMEM SPML",
 159                            mca_spml_base_register,
 160                            mca_spml_base_open,
 161                            mca_spml_base_close,
 162                            mca_spml_base_static_components,
 163                            MCA_BASE_FRAMEWORK_FLAG_DEFAULT);