📄 orte_init_stage1.c
字号:
/* * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. * Copyright (c) 2004-2005 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ *//** @file **/#include "orte_config.h"#include <sys/types.h>#ifdef HAVE_UNISTD_H#include <unistd.h>#endif#include "orte/orte_constants.h"#include "opal/event/event.h"#include "opal/util/output.h"#include "opal/util/show_help.h"#include "opal/threads/mutex.h"#include "opal/runtime/opal.h"#include "opal/mca/mca.h"#include "opal/mca/base/base.h"#include "opal/mca/base/mca_base_param.h"#include "opal/util/os_path.h"#include "opal/util/cmd_line.h"#include "opal/util/malloc.h"#include "orte/dss/dss.h"#include "orte/mca/rml/base/base.h"#include "orte/mca/errmgr/base/base.h"#include "orte/mca/iof/base/base.h"#include "orte/mca/ns/base/base.h"#include "orte/mca/sds/base/base.h"#include "orte/mca/gpr/base/base.h"#include "orte/mca/ras/base/base.h"#include "orte/mca/rds/base/base.h"#include "orte/mca/pls/base/base.h"#include "orte/mca/rmgr/base/base.h"#include "orte/mca/odls/base/base.h"#include "orte/mca/rmaps/base/base.h"#include "orte/mca/schema/base/base.h"#include "orte/mca/smr/base/base.h"#include "orte/util/univ_info.h"#include "orte/util/proc_info.h"#include "orte/util/session_dir.h"#include "orte/util/sys_info.h"#include "orte/util/universe_setup_file_io.h"/* these are to be cleaned up for 2.0 */#include "orte/mca/ras/base/ras_private.h"#include "orte/mca/rmgr/base/rmgr_private.h"#include "orte/runtime/runtime.h"#include "orte/runtime/runtime_internal.h"#include "orte/runtime/orte_wait.h"#include "orte/runtime/params.h"int orte_init_stage1(bool infrastructure){ int ret; char *error = NULL; char *jobid_str = NULL; char *procid_str = NULL; char *contact_path = NULL; orte_jobid_t my_jobid; orte_cellid_t my_cellid; if (orte_initialized) { return ORTE_SUCCESS; } /* register handler for errnum -> string conversion */ opal_error_register("ORTE", ORTE_ERR_BASE, ORTE_ERR_MAX, orte_err2str); /* Register all MCA Params */ if (ORTE_SUCCESS != (ret = orte_register_params(infrastructure))) { error = "orte_register_params"; goto error; } /* Ensure the system_info structure is instantiated and initialized */ if (ORTE_SUCCESS != (ret = orte_sys_info())) { error = "orte_sys_info"; goto error; } /* Ensure the process info structure is instantiated and initialized */ if (ORTE_SUCCESS != (ret = orte_proc_info())) { error = "orte_proc_info"; goto error; } /* Ensure the universe_info structure is instantiated and initialized */ if (ORTE_SUCCESS != (ret = orte_univ_info())) { error = "orte_univ_info"; goto error; } /* * Initialize the data storage service. */ if (ORTE_SUCCESS != (ret = orte_dss_open())) { error = "orte_dss_open"; goto error; } /* * Open the name services to ensure access to local functions */ if (ORTE_SUCCESS != (ret = orte_ns_base_open())) { error = "orte_ns_base_open"; goto error; } /* Open the error manager to activate error logging - needs local name services */ if (ORTE_SUCCESS != (ret = orte_errmgr_base_open())) { error = "orte_errmgr_base_open"; goto error; } /***** ERROR LOGGING NOW AVAILABLE *****/ /* * Initialize the event library */ if (ORTE_SUCCESS != (ret = opal_event_init())) { ORTE_ERROR_LOG(ret); error = "opal_event_init"; goto error; } /* * Intialize the general progress engine */ if (ORTE_SUCCESS != (ret = opal_progress_init())) { ORTE_ERROR_LOG(ret); error = "opal_progress_init"; goto error; } /* * Internal startup */ if (ORTE_SUCCESS != (ret = orte_wait_init())) { ORTE_ERROR_LOG(ret); error = "orte_wait_init"; goto error; } /* * Runtime Messaging Layer */ if (ORTE_SUCCESS != (ret = orte_rml_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_rml_base_open"; goto error; } /* * Runtime Messaging Layer */ if (ORTE_SUCCESS != (ret = orte_rml_base_select())) { ORTE_ERROR_LOG(ret); error = "orte_rml_base_select"; goto error; } /* * Registry */ if (ORTE_SUCCESS != (ret = orte_gpr_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_gpr_base_open"; goto error; } /* * Initialize schema utilities */ if (ORTE_SUCCESS != (ret = orte_schema_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_schema_base_open"; goto error; } /* * Initialize and select the Startup Discovery Service */ if (ORTE_SUCCESS != (ret = orte_sds_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_sds_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_sds_base_select())) { ORTE_ERROR_LOG(ret); error = "orte_sds_base_select"; goto error; } /* Try to connect to the universe */ if (ORTE_SUCCESS != (ret = orte_sds_base_contact_universe())) { ORTE_ERROR_LOG(ret); error = "orte_sds_base_contact_universe"; goto error; } /* * Name Server */ if (ORTE_SUCCESS != (ret = orte_ns_base_select())) { ORTE_ERROR_LOG(ret); error = "orte_ns_base_select"; goto error; } /* * Registry */ if (ORTE_SUCCESS != (ret = orte_gpr_base_select())) { ORTE_ERROR_LOG(ret); error = "orte_gpr_base_select"; goto error; } /* set contact info for ns/gpr */ if(NULL != orte_process_info.ns_replica_uri) { orte_rml.set_uri(orte_process_info.ns_replica_uri); } if(NULL != orte_process_info.gpr_replica_uri) { orte_rml.set_uri(orte_process_info.gpr_replica_uri); } /* set my name and the names of the procs I was started with */ if (ORTE_SUCCESS != (ret = orte_sds_base_set_name())) { ORTE_ERROR_LOG(ret); error = "orte_sds_base_set_name"; goto error; } /* all done with sds - clean up and call it a day */ orte_sds_base_close(); /* * Now that we know for certain if we are an HNP and/or a daemon, * setup the resource management frameworks. This includes opening * and selecting the daemon launch framework - that framework "knows" * what to do if it isn't in a daemon, and everyone needs that framework * to at least register its datatypes. */ if (ORTE_SUCCESS != (ret = orte_rds_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_rds_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_rds_base_select())) { ORTE_ERROR_LOG(ret); error = "orte_rds_base_select"; goto error; } if (ORTE_SUCCESS != (ret = orte_ras_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_ras_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_ras_base_find_available())) { ORTE_ERROR_LOG(ret); error = "orte_ras_base_find_available"; goto error; } if (ORTE_SUCCESS != (ret = orte_rmaps_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_rmaps_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_rmaps_base_find_available())) { ORTE_ERROR_LOG(ret); error = "orte_rmaps_base_find_available"; goto error; } if (ORTE_SUCCESS != (ret = orte_pls_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_pls_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_pls_base_select())) { ORTE_ERROR_LOG(ret); error = "orte_pls_base_select"; goto error; } if (ORTE_SUCCESS != (ret = orte_odls_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_odls_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_odls_base_select())) { ORTE_ERROR_LOG(ret); error = "orte_odls_base_select"; goto error; } if (ORTE_SUCCESS != (ret = orte_rmgr_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_rmgr_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_rmgr_base_select())) { ORTE_ERROR_LOG(ret); error = "orte_rmgr_base_select"; goto error; } /*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -