This source file includes following definitions.
- MPI_Unpublish_name
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 
  25 #include "ompi_config.h"
  26 #include <stdio.h>
  27 
  28 #include "opal/class/opal_list.h"
  29 #include "opal/mca/pmix/pmix.h"
  30 #include "opal/util/argv.h"
  31 #include "opal/util/show_help.h"
  32 
  33 #include "ompi/mpi/c/bindings.h"
  34 #include "ompi/runtime/params.h"
  35 #include "ompi/communicator/communicator.h"
  36 #include "ompi/errhandler/errhandler.h"
  37 #include "ompi/info/info.h"
  38 
  39 #if OMPI_BUILD_MPI_PROFILING
  40 #if OPAL_HAVE_WEAK_SYMBOLS
  41 #pragma weak MPI_Unpublish_name = PMPI_Unpublish_name
  42 #endif
  43 #define MPI_Unpublish_name PMPI_Unpublish_name
  44 #endif
  45 
  46 static const char FUNC_NAME[] = "MPI_Unpublish_name";
  47 
  48 
  49 int MPI_Unpublish_name(const char *service_name, MPI_Info info,
  50                        const char *port_name)
  51 {
  52     int rc;
  53     char range[OPAL_MAX_INFO_VAL];
  54     int flag=0;
  55     opal_list_t pinfo;
  56     opal_value_t *rng;
  57     char **keys = NULL;
  58 
  59     if ( MPI_PARAM_CHECK ) {
  60         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  61 
  62         if ( NULL == port_name ) {
  63             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
  64                                           FUNC_NAME);
  65         }
  66         if ( NULL == service_name ) {
  67             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
  68                                           FUNC_NAME);
  69         }
  70         if (NULL == info || ompi_info_is_freed(info)) {
  71             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INFO,
  72                                           FUNC_NAME);
  73         }
  74     }
  75 
  76     if (NULL == opal_pmix.publish) {
  77         opal_show_help("help-mpi-api.txt",
  78                        "MPI function not supported",
  79                        true,
  80                        FUNC_NAME,
  81                        "Underlying runtime environment does not support name publishing functionality");
  82         return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
  83                                       OMPI_ERR_NOT_SUPPORTED,
  84                                       FUNC_NAME);
  85     }
  86 
  87     OPAL_CR_ENTER_LIBRARY();
  88     OBJ_CONSTRUCT(&pinfo, opal_list_t);
  89 
  90     
  91 
  92     if (MPI_INFO_NULL != info) {
  93         ompi_info_get (info, "range", sizeof(range) - 1, range, &flag);
  94         if (flag) {
  95             if (0 == strcmp(range, "nspace")) {
  96                 rng = OBJ_NEW(opal_value_t);
  97                 rng->key = strdup(OPAL_PMIX_RANGE);
  98                 rng->type = OPAL_INT;
  99                 rng->data.integer = OPAL_PMIX_RANGE_NAMESPACE;  
 100                 opal_list_append(&pinfo, &rng->super);
 101             } else if (0 == strcmp(range, "session")) {
 102                 rng = OBJ_NEW(opal_value_t);
 103                 rng->key = strdup(OPAL_PMIX_RANGE);
 104                 rng->type = OPAL_INT;
 105                 rng->data.integer = OPAL_PMIX_RANGE_SESSION; 
 106                 opal_list_append(&pinfo, &rng->super);
 107             } else {
 108                 
 109                 OPAL_LIST_DESTRUCT(&pinfo);
 110                 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
 111                                             FUNC_NAME);
 112             }
 113         }
 114     }
 115 
 116     
 117     opal_argv_append_nosize(&keys, service_name);
 118 
 119     rc = opal_pmix.unpublish(keys, &pinfo);
 120     opal_argv_free(keys);
 121     OPAL_LIST_DESTRUCT(&pinfo);
 122 
 123     if ( OPAL_SUCCESS != rc ) {
 124         if (OPAL_ERR_NOT_FOUND == rc) {
 125             
 126             rc = MPI_ERR_SERVICE;
 127         } else if (OPAL_ERR_PERM == rc) {
 128             
 129             rc = MPI_ERR_ACCESS;
 130         } else if (OPAL_ERR_NOT_SUPPORTED == rc) {
 131             
 132             rc = OMPI_ERR_NOT_SUPPORTED;
 133             opal_show_help("help-mpi-api.txt",
 134                            "MPI function not supported",
 135                            true,
 136                            FUNC_NAME,
 137                            "Underlying runtime environment does not support name publishing functionality");
 138         } else {
 139             rc = MPI_ERR_INTERN;
 140         }
 141 
 142         OPAL_CR_EXIT_LIBRARY();
 143         return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, rc, FUNC_NAME);
 144     }
 145 
 146     OPAL_CR_EXIT_LIBRARY();
 147     return MPI_SUCCESS;
 148 }