root/orte/mca/plm/isolated/plm_isolated.c

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

DEFINITIONS

This source file includes following definitions.
  1. isolated_init
  2. remote_spawn
  3. isolated_launch
  4. launch_daemons
  5. isolated_terminate_orteds
  6. isolated_finalize

   1 /*
   2  * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2007 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2006-2007 Cisco Systems, Inc.  All rights reserved.
  13  * Copyright (c) 2007-2012 Los Alamos National Security, LLC.  All rights
  14  *                         reserved.
  15  * Copyright (c) 2008-2009 Sun Microsystems, Inc.  All rights reserved.
  16  * Copyright (c) 2011      IBM Corporation.  All rights reserved.
  17  * Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
  18  * Copyright (c) 2017      Research Organization for Information Science
  19  *                         and Technology (RIST). All rights reserved.
  20  * $COPYRIGHT$
  21  *
  22  * Additional copyrights may follow
  23  *
  24  * $HEADER$
  25  *
  26  * These symbols are in a file by themselves to provide nice linker
  27  * semantics.  Since linkers generally pull in symbols by object
  28  * files, keeping these symbols as the only symbols in this file
  29  * prevents utility programs such as "ompi_info" from having to import
  30  * entire components just to query their version and parameters.
  31  */
  32 
  33 #include "orte_config.h"
  34 #include "orte/constants.h"
  35 
  36 #include "opal/util/output.h"
  37 #include "opal/mca/event/event.h"
  38 
  39 #include "orte/util/show_help.h"
  40 #include "orte/runtime/orte_globals.h"
  41 #include "orte/util/name_fns.h"
  42 #include "orte/util/proc_info.h"
  43 #include "orte/util/threads.h"
  44 
  45 #include "orte/mca/errmgr/errmgr.h"
  46 #include "orte/mca/state/state.h"
  47 
  48 #include "orte/mca/plm/plm.h"
  49 #include "orte/mca/plm/base/base.h"
  50 #include "orte/mca/plm/base/plm_private.h"
  51 #include "orte/mca/plm/isolated/plm_isolated.h"
  52 
  53 static int isolated_init(void);
  54 static int isolated_launch(orte_job_t *jdata);
  55 static int remote_spawn(void);
  56 static int isolated_terminate_orteds(void);
  57 static int isolated_finalize(void);
  58 
  59 orte_plm_base_module_t orte_plm_isolated_module = {
  60     isolated_init,
  61     orte_plm_base_set_hnp_name,
  62     isolated_launch,
  63     remote_spawn,
  64     orte_plm_base_orted_terminate_job,
  65     isolated_terminate_orteds,
  66     orte_plm_base_orted_kill_local_procs,
  67     orte_plm_base_orted_signal_local_procs,
  68     isolated_finalize
  69 };
  70 
  71 static void launch_daemons(int fd, short args, void *cbdata);
  72 
  73 /**
  74  * Init the module
  75  */
  76 static int isolated_init(void)
  77 {
  78     int rc;
  79 
  80     /* point to our launch command */
  81     if (ORTE_SUCCESS != (rc = orte_state.add_job_state(ORTE_JOB_STATE_LAUNCH_DAEMONS,
  82                                                        launch_daemons, ORTE_SYS_PRI))) {
  83         ORTE_ERROR_LOG(rc);
  84         return rc;
  85     }
  86 
  87     /* start the recvs */
  88     if (ORTE_SUCCESS != (rc = orte_plm_base_comm_start())) {
  89         ORTE_ERROR_LOG(rc);
  90     }
  91 
  92     return rc;
  93 }
  94 
  95 /*
  96  * launch a set of daemons from a remote daemon
  97  */
  98 static int remote_spawn(void)
  99 {
 100     /* unused function in this mode */
 101     return ORTE_SUCCESS;
 102 }
 103 
 104 static int isolated_launch(orte_job_t *jdata)
 105 {
 106     if (ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_RESTART)) {
 107         /* this is a restart situation - skip to the mapping stage */
 108         ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_MAP);
 109     } else {
 110         /* new job - set it up */
 111         ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_INIT);
 112     }
 113     return ORTE_SUCCESS;
 114 }
 115 
 116 static void launch_daemons(int fd, short args, void *cbdata)
 117 {
 118     orte_state_caddy_t *state = (orte_state_caddy_t*)cbdata;
 119 
 120     ORTE_ACQUIRE_OBJECT(state);
 121 
 122     /* there are no daemons to launch, so just trigger the
 123      * daemon-launch-complete state
 124      */
 125     ORTE_ACTIVATE_JOB_STATE(state->jdata, ORTE_JOB_STATE_DAEMONS_REPORTED);
 126     OBJ_RELEASE(state);
 127 }
 128 
 129 static int isolated_terminate_orteds(void)
 130 {
 131     int rc;
 132 
 133     /* send ourselves the halt command */
 134     if (ORTE_SUCCESS != (rc = orte_plm_base_orted_exit(ORTE_DAEMON_EXIT_CMD))) {
 135         ORTE_ERROR_LOG(rc);
 136     }
 137     return rc;
 138 }
 139 
 140 static int isolated_finalize(void)
 141 {
 142     int rc;
 143 
 144     /* cleanup any pending recvs */
 145     if (ORTE_SUCCESS != (rc = orte_plm_base_comm_stop())) {
 146         ORTE_ERROR_LOG(rc);
 147     }
 148 
 149     return rc;
 150 }

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