root/orte/mca/oob/alps/oob_alps_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. alps_component_open
  2. alps_component_close
  3. component_available
  4. component_startup
  5. component_shutdown
  6. component_send
  7. component_get_addr
  8. component_set_addr
  9. component_is_reachable
  10. component_ft_event

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2011 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2006-2015 Los Alamos National Security, LLC.
  14  *                         All rights reserved.
  15  * Copyright (c) 2009-2015 Cisco Systems, Inc.  All rights reserved.
  16  * Copyright (c) 2011      Oak Ridge National Labs.  All rights reserved.
  17  * Copyright (c) 2013-2018 Intel, Inc.  All rights reserved.
  18  * Copyright (c) 2014      NVIDIA Corporation.  All rights reserved.
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  24  *
  25  * In windows, many of the socket functions return an EWOULDBLOCK
  26  * instead of things like EAGAIN, EINPROGRESS, etc. It has been
  27  * verified that this will not conflict with other error codes that
  28  * are returned by these functions under UNIX/Linux environments
  29  */
  30 
  31 #include "orte_config.h"
  32 #include "orte/types.h"
  33 #include "opal/types.h"
  34 
  35 #ifdef HAVE_UNISTD_H
  36 #include <unistd.h>
  37 #endif
  38 #ifdef HAVE_SYS_TYPES_H
  39 #include <sys/types.h>
  40 #endif
  41 #include <fcntl.h>
  42 #ifdef HAVE_NETINET_IN_H
  43 #include <netinet/in.h>
  44 #endif
  45 #ifdef HAVE_ARPA_INET_H
  46 #include <arpa/inet.h>
  47 #endif
  48 #ifdef HAVE_NETDB_H
  49 #include <netdb.h>
  50 #endif
  51 #include <ctype.h>
  52 
  53 #include "opal/util/show_help.h"
  54 #include "opal/util/error.h"
  55 #include "opal/util/output.h"
  56 #include "opal/opal_socket_errno.h"
  57 #include "opal/util/if.h"
  58 #include "opal/util/net.h"
  59 #include "opal/util/argv.h"
  60 #include "opal/class/opal_hash_table.h"
  61 #include "opal/class/opal_list.h"
  62 
  63 #include "orte/mca/errmgr/errmgr.h"
  64 #include "orte/mca/ess/ess.h"
  65 #include "orte/mca/routed/routed.h"
  66 #include "orte/mca/state/state.h"
  67 #include "orte/mca/oob/oob.h"
  68 #include "orte/mca/oob/base/base.h"
  69 #include "orte/mca/common/alps/common_alps.h"
  70 #include "orte/util/name_fns.h"
  71 #include "orte/util/parse_options.h"
  72 #include "orte/util/show_help.h"
  73 #include "orte/runtime/orte_globals.h"
  74 
  75 static int alps_component_open(void);
  76 static int alps_component_close(void);
  77 static int component_available(void);
  78 static int component_startup(void);
  79 static void component_shutdown(void);
  80 static int component_send(orte_rml_send_t *msg);
  81 static char* component_get_addr(void);
  82 static int component_set_addr(orte_process_name_t *peer, char **uris);
  83 static bool component_is_reachable(char *routed, orte_process_name_t *peer);
  84 #if OPAL_ENABLE_FT_CR == 1
  85 static int component_ft_event(int state);
  86 #endif
  87 
  88 /*
  89  * Struct of function pointers and all that to let us be initialized
  90  */
  91 mca_oob_base_component_t mca_oob_alps_component = {
  92     .oob_base = {
  93         MCA_OOB_BASE_VERSION_2_0_0,
  94         .mca_component_name = "alps",
  95         MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
  96                               ORTE_RELEASE_VERSION),
  97         .mca_open_component = alps_component_open,
  98         .mca_close_component = alps_component_close,
  99     },
 100     .oob_data = {
 101         /* The component is checkpoint ready */
 102         MCA_BASE_METADATA_PARAM_CHECKPOINT
 103     },
 104     .priority = 30, // default priority of this transport
 105     .available = component_available,
 106     .startup = component_startup,
 107     .shutdown = component_shutdown,
 108     .send_nb = component_send,
 109     .get_addr = component_get_addr,
 110     .set_addr = component_set_addr,
 111     .is_reachable = component_is_reachable,
 112 #if OPAL_ENABLE_FT_CR == 1
 113     .ft_event = component_ft_event,
 114 #endif
 115 };
 116 
 117 /*
 118  * Initialize global variables used w/in this module.
 119  */
 120 static int alps_component_open(void)
 121 {
 122     return ORTE_SUCCESS;
 123 }
 124 
 125 static int alps_component_close(void)
 126 {
 127     return ORTE_SUCCESS;
 128 }
 129 
 130 static int component_available(void)
 131 {
 132     bool flag = false;
 133 
 134     /*
 135      * If I'm not a app proc can't use this component
 136      */
 137 
 138     if (!ORTE_PROC_IS_APP) {
 139         return ORTE_ERR_NOT_SUPPORTED;
 140     }
 141 
 142     /*
 143      * If I have a orte daemon, then I don't want to use this component
 144      */
 145 
 146     if (NULL != orte_process_info.my_daemon_uri) {
 147         return ORTE_ERR_NOT_SUPPORTED;
 148     }
 149 
 150     /*
 151      * make sure we're in a Cray PAGG container, and that we are also on
 152      * a compute node (i.e. we are thought of as a application task by
 153      * the cray job kernel module  - the thing that creates the PAGG
 154      */
 155 
 156     orte_common_alps_proc_in_pagg(&flag);
 157 
 158     if (flag) {
 159         opal_output_verbose(5, orte_oob_base_framework.framework_output,
 160                             "oob:alps: component_available called");
 161         return ORTE_SUCCESS;
 162     }
 163 
 164     return ORTE_ERR_NOT_AVAILABLE;
 165 }
 166 
 167 /* Start all modules */
 168 static int component_startup(void)
 169 {
 170     opal_output_verbose(2, orte_oob_base_framework.framework_output,
 171                         "%s ALPS STARTUP",
 172                         ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
 173 
 174     return ORTE_SUCCESS;
 175 }
 176 
 177 static void component_shutdown(void)
 178 {
 179     opal_output_verbose(2, orte_oob_base_framework.framework_output,
 180                         "%s ALPS SHUTDOWN",
 181                         ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
 182 }
 183 
 184 static int component_send(orte_rml_send_t *msg)
 185 {
 186     opal_output_verbose(10, orte_oob_base_framework.framework_output,
 187                         "%s oob:alps:send_nb to peer %s:%d this should not be happening",
 188                         ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
 189                         ORTE_NAME_PRINT(&msg->dst), msg->tag);
 190 
 191     return ORTE_ERR_NOT_SUPPORTED;
 192 }
 193 
 194 static char* component_get_addr(void)
 195 {
 196     char hn[OPAL_MAXHOSTNAMELEN], *cptr;
 197 
 198     /*
 199      * TODO: for aries want to plug in GNI addr here instead to
 200      * eventually be able to support connect/accept using aprun.
 201      */
 202 
 203     gethostname(hn, sizeof(hn));
 204 
 205     opal_asprintf(&cptr, "gni://%s:%d", hn, getpid());
 206 
 207     opal_output_verbose(10, orte_oob_base_framework.framework_output,
 208                         "%s oob:alps: component_get_addr invoked - %s",
 209                         ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),cptr);
 210     return cptr;
 211 }
 212 
 213 static int component_set_addr(orte_process_name_t *peer,
 214                               char **uris)
 215 {
 216     opal_output_verbose(10, orte_oob_base_framework.framework_output,
 217                         "%s oob:alps: component_set_addr invoked - this should not be happening",
 218                         ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
 219     return ORTE_ERR_NOT_SUPPORTED;
 220 }
 221 
 222 static bool component_is_reachable(char *routed, orte_process_name_t *peer)
 223 {
 224     opal_output_verbose(10, orte_oob_base_framework.framework_output,
 225                         "%s oob:alps: component_set_addr invoked - this should not be happening",
 226                         ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
 227     return false;
 228 }
 229 
 230 #if OPAL_ENABLE_FT_CR == 1
 231 static int component_ft_event(int state)
 232 {
 233     opal_output_verbose(2, orte_oob_base_framework.framework_output,
 234                         "%s ALPS EVENT", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
 235 
 236     return ORTE_ERR_NOT_SUPPORTED;
 237 }
 238 #endif

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