root/orte/runtime/orte_finalize.c

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

DEFINITIONS

This source file includes following definitions.
  1. orte_finalize

   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2006 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 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) 2009      Cisco Systems, Inc.  All rights reserved.
  13  * Copyright (c) 2011-2013 Los Alamos National Security, LLC.
  14  *                         All rights reserved.
  15  * Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
  16  * Copyright (c) 2017      Research Organization for Information Science
  17  *                         and Technology (RIST). All rights reserved.
  18  * $COPYRIGHT$
  19  *
  20  * Additional copyrights may follow
  21  *
  22  * $HEADER$
  23  */
  24 
  25 /** @file **/
  26 
  27 #include "orte_config.h"
  28 #include "orte/constants.h"
  29 
  30 #include "opal/runtime/opal.h"
  31 #include "opal/util/output.h"
  32 #include "opal/util/argv.h"
  33 
  34 #include "orte/mca/ess/ess.h"
  35 #include "orte/mca/ess/base/base.h"
  36 #include "orte/mca/schizo/base/base.h"
  37 #include "orte/runtime/orte_globals.h"
  38 #include "orte/runtime/runtime.h"
  39 #include "orte/runtime/orte_locks.h"
  40 #include "orte/util/listener.h"
  41 #include "orte/util/name_fns.h"
  42 #include "orte/util/proc_info.h"
  43 #include "orte/util/show_help.h"
  44 
  45 int orte_finalize(void)
  46 {
  47     int rc;
  48 
  49     --orte_initialized;
  50     if (0 != orte_initialized) {
  51         /* check for mismatched calls */
  52         if (0 > orte_initialized) {
  53             opal_output(0, "%s MISMATCHED CALLS TO ORTE FINALIZE",
  54                         ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
  55         }
  56         return ORTE_ERROR;
  57     }
  58 
  59     /* protect against multiple calls */
  60     if (opal_atomic_trylock(&orte_finalize_lock)) {
  61         return ORTE_SUCCESS;
  62     }
  63 
  64     /* flag that we are finalizing */
  65     orte_finalizing = true;
  66 
  67     if (ORTE_PROC_IS_HNP || ORTE_PROC_IS_DAEMON) {
  68         /* stop listening for connections - will
  69          * be ignored if no listeners were registered */
  70         orte_stop_listening();
  71     }
  72 
  73     /* flush the show_help system */
  74     orte_show_help_finalize();
  75 
  76     /* call the finalize function for this environment */
  77     if (ORTE_SUCCESS != (rc = orte_ess.finalize())) {
  78         return rc;
  79     }
  80 
  81     /* close the ess itself */
  82     (void) mca_base_framework_close(&orte_ess_base_framework);
  83 
  84     /* finalize and close schizo */
  85     orte_schizo.finalize();
  86     (void) mca_base_framework_close(&orte_schizo_base_framework);
  87 
  88     /* Close the general debug stream */
  89     opal_output_close(orte_debug_output);
  90 
  91     if (NULL != orte_fork_agent) {
  92         opal_argv_free(orte_fork_agent);
  93     }
  94 
  95     /* destruct our process info */
  96     OBJ_DESTRUCT(&orte_process_info.super);
  97 
  98     /* finalize the opal utilities */
  99     rc = opal_finalize();
 100 
 101     return rc;
 102 }

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