Merge pull request #4699 from rhc54/topic/regx
Convert nidmap to regx framework
Этот коммит содержится в:
Коммит
614696f03c
@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -34,7 +34,6 @@
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/session_dir.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/threads.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
|
@ -9,7 +9,7 @@
|
||||
* Copyright (c) 2011 Oracle and/or all its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -49,7 +49,6 @@
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/threads.h"
|
||||
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -33,7 +33,6 @@
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/session_dir.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/threads.h"
|
||||
|
||||
#include "orte/mca/iof/base/base.h"
|
||||
|
@ -9,7 +9,7 @@
|
||||
* Copyright (c) 2011 Oracle and/or all its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -49,7 +49,6 @@
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/threads.h"
|
||||
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -30,8 +30,6 @@
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/mca/errmgr/base/base.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/regex.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
#include "orte/mca/ess/ess.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -29,8 +30,6 @@
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/mca/errmgr/base/base.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/regex.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
#include "orte/mca/ess/ess.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -37,7 +37,6 @@
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -58,6 +58,7 @@
|
||||
#include "orte/mca/iof/base/base.h"
|
||||
#include "orte/mca/plm/base/base.h"
|
||||
#include "orte/mca/odls/base/base.h"
|
||||
#include "orte/mca/regx/base/base.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/rmaps/base/base.h"
|
||||
#if OPAL_ENABLE_FT_CR == 1
|
||||
@ -68,8 +69,6 @@
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/session_dir.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/regex.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/mca/errmgr/base/base.h"
|
||||
#include "orte/mca/state/base/base.h"
|
||||
@ -519,9 +518,20 @@ int orte_ess_base_orted_setup(void)
|
||||
}
|
||||
if (ORTE_SUCCESS != (ret = orte_rmaps_base_select())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "orte_rmaps_base_find_available";
|
||||
error = "orte_rmaps_base_select";
|
||||
goto error;
|
||||
}
|
||||
if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_regx_base_framework, 0))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "orte_regx_base_open";
|
||||
goto error;
|
||||
}
|
||||
if (ORTE_SUCCESS != (ret = orte_regx_base_select())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "orte_regx_base_select";
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
/* if a topology file was given, then the rmaps framework open
|
||||
* will have reset our topology. Ensure we always get the right
|
||||
@ -545,7 +555,7 @@ int orte_ess_base_orted_setup(void)
|
||||
* own port, which we need in order to construct the nidmap
|
||||
*/
|
||||
if (NULL != orte_node_regex) {
|
||||
if (ORTE_SUCCESS != (ret = orte_util_nidmap_parse(orte_node_regex))) {
|
||||
if (ORTE_SUCCESS != (ret = orte_regx.nidmap_parse(orte_node_regex))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "construct nidmap";
|
||||
goto error;
|
||||
@ -565,7 +575,7 @@ int orte_ess_base_orted_setup(void)
|
||||
* build a nidmap from it - this will update the
|
||||
* routing plan as well
|
||||
*/
|
||||
if (ORTE_SUCCESS != (ret = orte_util_build_daemon_nidmap())) {
|
||||
if (ORTE_SUCCESS != (ret = orte_regx.build_daemon_nidmap())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "construct daemon map from static ports";
|
||||
goto error;
|
||||
|
3
orte/mca/ess/env/ess_env_module.c
поставляемый
3
orte/mca/ess/env/ess_env_module.c
поставляемый
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -63,7 +63,6 @@
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/session_dir.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/regex.h"
|
||||
|
||||
#include "orte/runtime/runtime.h"
|
||||
#include "orte/runtime/orte_wait.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
* Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2017 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -67,6 +67,7 @@
|
||||
#include "orte/mca/grpcomm/base/base.h"
|
||||
#include "orte/mca/iof/base/base.h"
|
||||
#include "orte/mca/ras/base/base.h"
|
||||
#include "orte/mca/regx/base/base.h"
|
||||
#include "orte/mca/plm/base/base.h"
|
||||
#include "orte/mca/plm/plm.h"
|
||||
#include "orte/mca/odls/base/base.h"
|
||||
@ -541,6 +542,16 @@ static int rte_init(void)
|
||||
error = "orte_rmaps_base_find_available";
|
||||
goto error;
|
||||
}
|
||||
if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_regx_base_framework, 0))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "orte_regx_base_open";
|
||||
goto error;
|
||||
}
|
||||
if (ORTE_SUCCESS != (ret = orte_regx_base_select())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "orte_regx_base_select";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* if a topology file was given, then the rmaps framework open
|
||||
* will have reset our topology. Ensure we always get the right
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -40,7 +40,6 @@
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/util/regex.h"
|
||||
|
||||
#include "orte/mca/ess/ess.h"
|
||||
#include "orte/mca/ess/base/base.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2016-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -60,7 +60,6 @@
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/pre_condition_transports.h"
|
||||
#include "orte/util/regex.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "orte/runtime/orte_wait.h"
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -36,7 +36,6 @@
|
||||
#include "opal/dss/dss.h"
|
||||
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/regex.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -36,7 +36,6 @@
|
||||
#include "opal/dss/dss.h"
|
||||
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/regex.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011-2016 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -43,7 +43,6 @@
|
||||
#include "orte/mca/routed/routed.h"
|
||||
#include "orte/mca/state/state.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/threads.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All
|
||||
* rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -26,13 +26,13 @@
|
||||
#include "opal/mca/pmix/pmix.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/regx/regx.h"
|
||||
#include "orte/mca/rml/base/base.h"
|
||||
#include "orte/mca/rml/base/rml_contact.h"
|
||||
#include "orte/mca/routed/base/base.h"
|
||||
#include "orte/mca/state/state.h"
|
||||
#include "orte/util/compress.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
|
||||
#include "orte/mca/grpcomm/base/base.h"
|
||||
@ -416,7 +416,7 @@ static void xcast_recv(int status, orte_process_name_t* sender,
|
||||
goto relay;
|
||||
}
|
||||
if (NULL != nidmap) {
|
||||
if (ORTE_SUCCESS != (ret = orte_util_nidmap_parse(nidmap))) {
|
||||
if (ORTE_SUCCESS != (ret = orte_regx.nidmap_parse(nidmap))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
goto relay;
|
||||
}
|
||||
@ -436,7 +436,7 @@ static void xcast_recv(int status, orte_process_name_t* sender,
|
||||
"%s grpcomm:direct:xcast updating daemon nidmap",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
||||
|
||||
if (ORTE_SUCCESS != (ret = orte_util_decode_daemon_nodemap(data))) {
|
||||
if (ORTE_SUCCESS != (ret = orte_regx.decode_daemon_nodemap(data))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
goto relay;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011-2017 Cisco Systems, Inc. All rights reserved
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 Mellanox Technologies Ltd. All rights reserved.
|
||||
@ -66,6 +66,7 @@
|
||||
#include "orte/mca/ess/base/base.h"
|
||||
#include "orte/mca/grpcomm/base/base.h"
|
||||
#include "orte/mca/plm/base/base.h"
|
||||
#include "orte/mca/regx/regx.h"
|
||||
#include "orte/mca/rml/base/rml_contact.h"
|
||||
#include "orte/mca/rmaps/rmaps_types.h"
|
||||
#include "orte/mca/rmaps/base/base.h"
|
||||
@ -78,10 +79,8 @@
|
||||
|
||||
#include "orte/util/context_fns.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/regex.h"
|
||||
#include "orte/util/session_dir.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/threads.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
@ -138,7 +137,7 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *buffer,
|
||||
/* if we couldn't provide the allocation regex on the orted
|
||||
* cmd line, then we need to provide all the info here */
|
||||
if (!orte_nidmap_communicated) {
|
||||
if (ORTE_SUCCESS != (rc = orte_util_nidmap_create(orte_node_pool, &nidmap))) {
|
||||
if (ORTE_SUCCESS != (rc = orte_regx.nidmap_create(orte_node_pool, &nidmap))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
@ -157,7 +156,7 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *buffer,
|
||||
orte_get_attribute(&jdata->attributes, ORTE_JOB_LAUNCHED_DAEMONS, NULL, OPAL_BOOL)) {
|
||||
flag = 1;
|
||||
opal_dss.pack(buffer, &flag, 1, OPAL_INT8);
|
||||
if (ORTE_SUCCESS != (rc = orte_util_encode_nodemap(buffer))) {
|
||||
if (ORTE_SUCCESS != (rc = orte_regx.encode_nodemap(buffer))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
@ -336,7 +335,7 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *buffer,
|
||||
|
||||
if (!orte_get_attribute(&jdata->attributes, ORTE_JOB_FULLY_DESCRIBED, NULL, OPAL_BOOL)) {
|
||||
/* compute and pack the ppn regex */
|
||||
if (ORTE_SUCCESS != (rc = orte_util_nidmap_generate_ppn(jdata, &nidmap))) {
|
||||
if (ORTE_SUCCESS != (rc = orte_regx.generate_ppn(jdata, &nidmap))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
@ -514,7 +513,7 @@ int orte_odls_base_default_construct_child_list(opal_buffer_t *buffer,
|
||||
}
|
||||
/* populate the node array of the job map and the proc array of
|
||||
* the job object so we know how many procs are on each node */
|
||||
if (ORTE_SUCCESS != (rc = orte_util_nidmap_parse_ppn(jdata, ppn))) {
|
||||
if (ORTE_SUCCESS != (rc = orte_regx.parse_ppn(jdata, ppn))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
free(ppn);
|
||||
goto REPORT_ERROR;
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Copyright (c) 2009 Institut National de Recherche en Informatique
|
||||
* et Automatique. All rights reserved.
|
||||
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
@ -51,6 +51,7 @@
|
||||
#include "orte/mca/iof/base/base.h"
|
||||
#include "orte/mca/odls/base/base.h"
|
||||
#include "orte/mca/ras/base/base.h"
|
||||
#include "orte/mca/regx/regx.h"
|
||||
#include "orte/mca/rmaps/rmaps.h"
|
||||
#include "orte/mca/rmaps/base/base.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
@ -71,10 +72,8 @@
|
||||
#include "orte/runtime/orte_quit.h"
|
||||
#include "orte/util/compress.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/pre_condition_transports.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/regex.h"
|
||||
#include "orte/util/threads.h"
|
||||
#include "orte/mca/state/state.h"
|
||||
#include "orte/mca/state/base/base.h"
|
||||
@ -1561,7 +1560,7 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv,
|
||||
|
||||
/* convert the nodes with daemons to a regex */
|
||||
param = NULL;
|
||||
if (ORTE_SUCCESS != (rc = orte_util_nidmap_create(orte_node_pool, ¶m))) {
|
||||
if (ORTE_SUCCESS != (rc = orte_regx.nidmap_create(orte_node_pool, ¶m))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
@ -78,7 +78,6 @@
|
||||
#include "orte/runtime/orte_wait.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/threads.h"
|
||||
|
||||
|
30
orte/mca/regx/Makefile.am
Обычный файл
30
orte/mca/regx/Makefile.am
Обычный файл
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# main library setup
|
||||
noinst_LTLIBRARIES = libmca_regx.la
|
||||
libmca_regx_la_SOURCES =
|
||||
|
||||
# pkgdata setup
|
||||
dist_ortedata_DATA =
|
||||
|
||||
# local files
|
||||
headers = regx.h
|
||||
libmca_regx_la_SOURCES += $(headers)
|
||||
|
||||
# Conditionally install the header files
|
||||
if WANT_INSTALL_HEADERS
|
||||
ortedir = $(orteincludedir)/$(subdir)
|
||||
nobase_orte_HEADERS = $(headers)
|
||||
endif
|
||||
|
||||
include base/Makefile.am
|
||||
|
||||
distclean-local:
|
||||
rm -f base/static-components.h
|
15
orte/mca/regx/base/Makefile.am
Обычный файл
15
orte/mca/regx/base/Makefile.am
Обычный файл
@ -0,0 +1,15 @@
|
||||
#
|
||||
# Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
headers += \
|
||||
base/base.h
|
||||
|
||||
libmca_regx_la_SOURCES += \
|
||||
base/regx_base_frame.c \
|
||||
base/regx_base_select.c
|
40
orte/mca/regx/base/base.h
Обычный файл
40
orte/mca/regx/base/base.h
Обычный файл
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
/** @file:
|
||||
* regx framework base functionality.
|
||||
*/
|
||||
|
||||
#ifndef ORTE_MCA_REGX_BASE_H
|
||||
#define ORTE_MCA_REGX_BASE_H
|
||||
|
||||
/*
|
||||
* includes
|
||||
*/
|
||||
#include "orte_config.h"
|
||||
#include "orte/types.h"
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "orte/mca/mca.h"
|
||||
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
#include "orte/mca/regx/regx.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/*
|
||||
* MCA Framework
|
||||
*/
|
||||
ORTE_DECLSPEC extern mca_base_framework_t orte_regx_base_framework;
|
||||
/* select all components */
|
||||
ORTE_DECLSPEC int orte_regx_base_select(void);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
7
orte/mca/regx/base/owner.txt
Обычный файл
7
orte/mca/regx/base/owner.txt
Обычный файл
@ -0,0 +1,7 @@
|
||||
#
|
||||
# owner/status file
|
||||
# owner: institution that is responsible for this package
|
||||
# status: e.g. active, maintenance, unmaintained
|
||||
#
|
||||
owner: INTEL
|
||||
status: active
|
77
orte/mca/regx/base/regx_base_frame.c
Обычный файл
77
orte/mca/regx/base/regx_base_frame.c
Обычный файл
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/constants.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "orte/mca/mca.h"
|
||||
#include "opal/util/argv.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
|
||||
#include "orte/mca/regx/base/base.h"
|
||||
/*
|
||||
* The following file was created by configure. It contains extern
|
||||
* statements and the definition of an array of pointers to each
|
||||
* component's public mca_base_component_t struct.
|
||||
*/
|
||||
|
||||
#include "orte/mca/regx/base/static-components.h"
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
orte_regx_base_module_t orte_regx = {0};
|
||||
|
||||
static int orte_regx_base_close(void)
|
||||
{
|
||||
/* give the selected module a chance to finalize */
|
||||
if (NULL != orte_regx.finalize) {
|
||||
orte_regx.finalize();
|
||||
}
|
||||
return mca_base_framework_components_close(&orte_regx_base_framework, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for finding and opening either all MCA components, or the one
|
||||
* that was specifically requested via a MCA parameter.
|
||||
*/
|
||||
static int orte_regx_base_open(mca_base_open_flag_t flags)
|
||||
{
|
||||
int rc;
|
||||
|
||||
/* Open up all available components */
|
||||
rc = mca_base_framework_components_open(&orte_regx_base_framework, flags);
|
||||
|
||||
/* All done */
|
||||
return rc;
|
||||
}
|
||||
|
||||
MCA_BASE_FRAMEWORK_DECLARE(orte, regx, "ORTE Regx Subsystem", NULL,
|
||||
orte_regx_base_open, orte_regx_base_close,
|
||||
mca_regx_base_static_components, 0);
|
||||
|
||||
/* OBJECT INSTANTIATIONS */
|
||||
static void nrcon(orte_nidmap_regex_t *p)
|
||||
{
|
||||
p->ctx = 0;
|
||||
p->nprocs = -1;
|
||||
p->cnt = 0;
|
||||
}
|
||||
OBJ_CLASS_INSTANCE(orte_nidmap_regex_t,
|
||||
opal_list_item_t,
|
||||
nrcon, NULL);
|
61
orte/mca/regx/base/regx_base_select.c
Обычный файл
61
orte/mca/regx/base/regx_base_select.c
Обычный файл
@ -0,0 +1,61 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2008 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) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/constants.h"
|
||||
|
||||
#include "orte/mca/mca.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
|
||||
#include "orte/mca/regx/base/base.h"
|
||||
|
||||
|
||||
/**
|
||||
* Function for selecting one component from all those that are
|
||||
* available.
|
||||
*/
|
||||
int orte_regx_base_select(void)
|
||||
{
|
||||
orte_regx_base_component_t *best_component = NULL;
|
||||
orte_regx_base_module_t *best_module = NULL;
|
||||
int rc = ORTE_SUCCESS;
|
||||
|
||||
/*
|
||||
* Select the best component
|
||||
*/
|
||||
if (OPAL_SUCCESS != mca_base_select("regx", orte_regx_base_framework.framework_output,
|
||||
&orte_regx_base_framework.framework_components,
|
||||
(mca_base_module_t **) &best_module,
|
||||
(mca_base_component_t **) &best_component, NULL)) {
|
||||
/* This will only happen if no component was selected */
|
||||
return ORTE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* Save the winner */
|
||||
orte_regx = *best_module;
|
||||
/* give it a chance to init */
|
||||
if (NULL != orte_regx.init) {
|
||||
rc = orte_regx.init();
|
||||
}
|
||||
return rc;
|
||||
}
|
37
orte/mca/regx/fwd/Makefile.am
Обычный файл
37
orte/mca/regx/fwd/Makefile.am
Обычный файл
@ -0,0 +1,37 @@
|
||||
#
|
||||
# Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
sources = \
|
||||
regx_fwd_component.c \
|
||||
regx_fwd.h \
|
||||
regx_fwd.c
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
# (for static builds).
|
||||
|
||||
if MCA_BUILD_orte_regx_fwd_DSO
|
||||
component_noinst =
|
||||
component_install = mca_regx_fwd.la
|
||||
else
|
||||
component_noinst = libmca_regx_fwd.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
mcacomponentdir = $(ortelibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_regx_fwd_la_SOURCES = $(sources)
|
||||
mca_regx_fwd_la_LDFLAGS = -module -avoid-version
|
||||
mca_regx_fwd_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_regx_fwd_la_SOURCES = $(sources)
|
||||
libmca_regx_fwd_la_LDFLAGS = -module -avoid-version
|
||||
|
7
orte/mca/regx/fwd/owner.txt
Обычный файл
7
orte/mca/regx/fwd/owner.txt
Обычный файл
@ -0,0 +1,7 @@
|
||||
#
|
||||
# owner/status file
|
||||
# owner: institution that is responsible for this package
|
||||
# status: e.g. active, maintenance, unmaintained
|
||||
#
|
||||
owner: INTEL
|
||||
status: active
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
29
orte/mca/regx/fwd/regx_fwd.h
Обычный файл
29
orte/mca/regx/fwd/regx_fwd.h
Обычный файл
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef _MCA_REGX_FwD_H_
|
||||
#define _MCA_REGX_FwD_H_
|
||||
|
||||
#include "orte_config.h"
|
||||
|
||||
#include "orte/types.h"
|
||||
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "orte/mca/regx/regx.h"
|
||||
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
ORTE_MODULE_DECLSPEC extern orte_regx_base_component_t mca_regx_fwd_component;
|
||||
extern orte_regx_base_module_t orte_regx_fwd_module;
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_REGX_FwD_H_ */
|
||||
|
45
orte/mca/regx/fwd/regx_fwd_component.c
Обычный файл
45
orte/mca/regx/fwd/regx_fwd_component.c
Обычный файл
@ -0,0 +1,45 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/types.h"
|
||||
#include "opal/types.h"
|
||||
|
||||
#include "opal/util/show_help.h"
|
||||
|
||||
#include "orte/mca/regx/regx.h"
|
||||
#include "regx_fwd.h"
|
||||
|
||||
static int component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
/*
|
||||
* Struct of function pointers and all that to let us be initialized
|
||||
*/
|
||||
orte_regx_base_component_t mca_regx_fwd_component = {
|
||||
.base_version = {
|
||||
MCA_REGX_BASE_VERSION_1_0_0,
|
||||
.mca_component_name = "fwd",
|
||||
MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
|
||||
ORTE_RELEASE_VERSION),
|
||||
.mca_query_component = component_query,
|
||||
},
|
||||
.base_data = {
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
},
|
||||
};
|
||||
|
||||
static int component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
*module = (mca_base_module_t*)&orte_regx_fwd_module;
|
||||
*priority = 10;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
123
orte/mca/regx/regx.h
Обычный файл
123
orte/mca/regx/regx.h
Обычный файл
@ -0,0 +1,123 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
/** @file:
|
||||
*
|
||||
* The Open RTE Personality Framework (regx)
|
||||
*
|
||||
* Multi-select framework so that multiple personalities can be
|
||||
* simultaneously supported
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ORTE_MCA_REGX_H
|
||||
#define ORTE_MCA_REGX_H
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/types.h"
|
||||
|
||||
#include "opal/class/opal_pointer_array.h"
|
||||
#include "opal/dss/dss_types.h"
|
||||
#include "orte/mca/mca.h"
|
||||
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/*
|
||||
* regx module functions
|
||||
*/
|
||||
|
||||
#define ORTE_MAX_NODE_PREFIX 50
|
||||
#define ORTE_CONTIG_NODE_CMD 0x01
|
||||
#define ORTE_NON_CONTIG_NODE_CMD 0x02
|
||||
|
||||
/**
|
||||
* REGX module functions - the modules are accessed via
|
||||
* the base stub functions
|
||||
*/
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
int ctx;
|
||||
int nprocs;
|
||||
int cnt;
|
||||
} orte_nidmap_regex_t;
|
||||
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_nidmap_regex_t);
|
||||
|
||||
/* initialize the module - allow it to do whatever one-time
|
||||
* things it requires */
|
||||
typedef int (*orte_regx_base_module_init_fn_t)(void);
|
||||
|
||||
typedef int (*orte_regx_base_module_nidmap_create_fn_t)(opal_pointer_array_t *pool, char **regex);
|
||||
typedef int (*orte_regx_base_module_nidmap_parse_fn_t)(char *regex);
|
||||
|
||||
/* create a regular expression describing the nodes in the
|
||||
* allocation */
|
||||
typedef int (*orte_regx_base_module_encode_nodemap_fn_t)(opal_buffer_t *buffer);
|
||||
|
||||
/* decode a regular expression created by the encode function
|
||||
* into the orte_node_pool array */
|
||||
typedef int (*orte_regx_base_module_decode_daemon_nodemap_fn_t)(opal_buffer_t *buffer);
|
||||
|
||||
typedef int (*orte_regx_base_module_build_daemon_nidmap_fn_t)(void);
|
||||
|
||||
/* create a regular expression describing the ppn for a job */
|
||||
typedef int (*orte_regx_base_module_generate_ppn_fn_t)(orte_job_t *jdata, char **ppn);
|
||||
|
||||
/* decode the ppn */
|
||||
typedef int (*orte_regx_base_module_parse_ppn_fn_t)(orte_job_t *jdata, char *ppn);
|
||||
|
||||
|
||||
/* give the component a chance to cleanup */
|
||||
typedef void (*orte_regx_base_module_finalize_fn_t)(void);
|
||||
|
||||
/*
|
||||
* regx module version 1.0.0
|
||||
*/
|
||||
typedef struct {
|
||||
orte_regx_base_module_init_fn_t init;
|
||||
orte_regx_base_module_nidmap_create_fn_t nidmap_create;
|
||||
orte_regx_base_module_nidmap_parse_fn_t nidmap_parse;
|
||||
orte_regx_base_module_encode_nodemap_fn_t encode_nodemap;
|
||||
orte_regx_base_module_decode_daemon_nodemap_fn_t decode_daemon_nodemap;
|
||||
orte_regx_base_module_build_daemon_nidmap_fn_t build_daemon_nidmap;
|
||||
orte_regx_base_module_generate_ppn_fn_t generate_ppn;
|
||||
orte_regx_base_module_parse_ppn_fn_t parse_ppn;
|
||||
orte_regx_base_module_finalize_fn_t finalize;
|
||||
} orte_regx_base_module_t;
|
||||
|
||||
ORTE_DECLSPEC extern orte_regx_base_module_t orte_regx;
|
||||
|
||||
/*
|
||||
* regx component
|
||||
*/
|
||||
|
||||
/**
|
||||
* regx component version 1.0.0
|
||||
*/
|
||||
typedef struct {
|
||||
/** Base MCA structure */
|
||||
mca_base_component_t base_version;
|
||||
/** Base MCA data */
|
||||
mca_base_component_data_t base_data;
|
||||
} orte_regx_base_component_t;
|
||||
|
||||
/**
|
||||
* Macro for use in components that are of type regx
|
||||
*/
|
||||
#define MCA_REGX_BASE_VERSION_1_0_0 \
|
||||
ORTE_MCA_BASE_VERSION_2_1_0("regx", 1, 0, 0)
|
||||
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
37
orte/mca/regx/reverse/Makefile.am
Обычный файл
37
orte/mca/regx/reverse/Makefile.am
Обычный файл
@ -0,0 +1,37 @@
|
||||
#
|
||||
# Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
sources = \
|
||||
regx_reverse_component.c \
|
||||
regx_reverse.h \
|
||||
regx_reverse.c
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
# (for static builds).
|
||||
|
||||
if MCA_BUILD_orte_regx_reverse_DSO
|
||||
component_noinst =
|
||||
component_install = mca_regx_reverse.la
|
||||
else
|
||||
component_noinst = libmca_regx_reverse.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
mcacomponentdir = $(ortelibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_regx_reverse_la_SOURCES = $(sources)
|
||||
mca_regx_reverse_la_LDFLAGS = -module -avoid-version
|
||||
mca_regx_reverse_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_regx_reverse_la_SOURCES = $(sources)
|
||||
libmca_regx_reverse_la_LDFLAGS = -module -avoid-version
|
||||
|
7
orte/mca/regx/reverse/owner.txt
Обычный файл
7
orte/mca/regx/reverse/owner.txt
Обычный файл
@ -0,0 +1,7 @@
|
||||
#
|
||||
# owner/status file
|
||||
# owner: institution that is responsible for this package
|
||||
# status: e.g. active, maintenance, unmaintained
|
||||
#
|
||||
owner: IBM
|
||||
status: active
|
74
orte/mca/regx/reverse/regx_reverse.c
Обычный файл
74
orte/mca/regx/reverse/regx_reverse.c
Обычный файл
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/types.h"
|
||||
#include "opal/types.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#include "opal/util/argv.h"
|
||||
#include "opal/util/basename.h"
|
||||
#include "opal/util/opal_environ.h"
|
||||
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/mca/regx/base/base.h"
|
||||
|
||||
#include "regx_reverse.h"
|
||||
|
||||
static int nidmap_create(opal_pointer_array_t *pool, char **regex);
|
||||
static int nidmap_parse(char *regex);
|
||||
static int encode_nodemap(opal_buffer_t *buffer);
|
||||
static int decode_daemon_nodemap(opal_buffer_t *buffer);
|
||||
static int generate_ppn(orte_job_t *jdata, char **ppn);
|
||||
static int parse_ppn(orte_job_t *jdata, char *ppn);
|
||||
|
||||
orte_regx_base_module_t orte_regx_reverse_module = {
|
||||
.nidmap_create = nidmap_create,
|
||||
.nidmap_parse = nidmap_parse,
|
||||
.encode_nodemap = encode_nodemap,
|
||||
.decode_daemon_nodemap = decode_daemon_nodemap,
|
||||
.generate_ppn = generate_ppn,
|
||||
.parse_ppn = parse_ppn
|
||||
};
|
||||
|
||||
static int nidmap_create(opal_pointer_array_t *pool, char **regex)
|
||||
{
|
||||
return ORTE_ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int nidmap_parse(char *regex)
|
||||
{
|
||||
return ORTE_ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int encode_nodemap(opal_buffer_t *buffer)
|
||||
{
|
||||
return ORTE_ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int decode_daemon_nodemap(opal_buffer_t *buffer)
|
||||
{
|
||||
return ORTE_ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int generate_ppn(orte_job_t *jdata, char **ppn)
|
||||
{
|
||||
return ORTE_ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int parse_ppn(orte_job_t *jdata, char *ppn)
|
||||
{
|
||||
return ORTE_ERR_NOT_IMPLEMENTED;
|
||||
}
|
29
orte/mca/regx/reverse/regx_reverse.h
Обычный файл
29
orte/mca/regx/reverse/regx_reverse.h
Обычный файл
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef _MCA_REGX_REVERSE_H_
|
||||
#define _MCA_REGX_REVERSE_H_
|
||||
|
||||
#include "orte_config.h"
|
||||
|
||||
#include "orte/types.h"
|
||||
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "orte/mca/regx/regx.h"
|
||||
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
ORTE_MODULE_DECLSPEC extern orte_regx_base_component_t mca_regx_reverse_component;
|
||||
extern orte_regx_base_module_t orte_regx_reverse_module;
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_REGX_ORTE_H_ */
|
||||
|
45
orte/mca/regx/reverse/regx_reverse_component.c
Обычный файл
45
orte/mca/regx/reverse/regx_reverse_component.c
Обычный файл
@ -0,0 +1,45 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/types.h"
|
||||
#include "opal/types.h"
|
||||
|
||||
#include "opal/util/show_help.h"
|
||||
|
||||
#include "orte/mca/regx/regx.h"
|
||||
#include "regx_reverse.h"
|
||||
|
||||
static int component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
/*
|
||||
* Struct of function pointers and all that to let us be initialized
|
||||
*/
|
||||
orte_regx_base_component_t mca_regx_reverse_component = {
|
||||
.base_version = {
|
||||
MCA_REGX_BASE_VERSION_1_0_0,
|
||||
.mca_component_name = "reverse",
|
||||
MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
|
||||
ORTE_RELEASE_VERSION),
|
||||
.mca_query_component = component_query,
|
||||
},
|
||||
.base_data = {
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
},
|
||||
};
|
||||
|
||||
static int component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
*module = (mca_base_module_t*)&orte_regx_reverse_module;
|
||||
*priority = 1;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2007-2012 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -29,7 +29,6 @@
|
||||
#include "orte/mca/rml/rml.h"
|
||||
#include "orte/mca/rml/rml_types.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "orte/runtime/orte_wait.h"
|
||||
#include "orte/runtime/runtime.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -25,11 +25,11 @@
|
||||
#include "orte/mca/odls/odls_types.h"
|
||||
#include "orte/mca/plm/base/base.h"
|
||||
#include "orte/mca/ras/base/base.h"
|
||||
#include "orte/mca/regx/regx.h"
|
||||
#include "orte/mca/rmaps/base/base.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
#include "orte/mca/rml/base/rml_contact.h"
|
||||
#include "orte/mca/routed/routed.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/session_dir.h"
|
||||
#include "orte/util/threads.h"
|
||||
#include "orte/runtime/orte_quit.h"
|
||||
@ -265,7 +265,7 @@ static void vm_ready(int fd, short args, void *cbdata)
|
||||
/* if we couldn't provide the allocation regex on the orted
|
||||
* cmd line, then we need to provide all the info here */
|
||||
if (!orte_nidmap_communicated) {
|
||||
if (ORTE_SUCCESS != (rc = orte_util_nidmap_create(orte_node_pool, &nidmap))) {
|
||||
if (ORTE_SUCCESS != (rc = orte_regx.nidmap_create(orte_node_pool, &nidmap))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(buf);
|
||||
return;
|
||||
@ -282,7 +282,7 @@ static void vm_ready(int fd, short args, void *cbdata)
|
||||
if (!orte_node_info_communicated) {
|
||||
flag = 1;
|
||||
opal_dss.pack(buf, &flag, 1, OPAL_INT8);
|
||||
if (ORTE_SUCCESS != (rc = orte_util_encode_nodemap(buf))) {
|
||||
if (ORTE_SUCCESS != (rc = orte_regx.encode_nodemap(buf))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(buf);
|
||||
return;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2016-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -58,7 +58,6 @@
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/session_dir.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/compress.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
* Copyright (c) 2009 Institut National de Recherche en Informatique
|
||||
* et Automatique. All rights reserved.
|
||||
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -72,7 +72,6 @@
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/session_dir.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/parse_options.h"
|
||||
#include "orte/mca/rml/base/rml_contact.h"
|
||||
#include "orte/util/pre_condition_transports.h"
|
||||
@ -83,6 +82,7 @@
|
||||
#include "orte/mca/ess/ess.h"
|
||||
#include "orte/mca/grpcomm/grpcomm.h"
|
||||
#include "orte/mca/grpcomm/base/base.h"
|
||||
#include "orte/mca/regx/regx.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
#include "orte/mca/rml/rml_types.h"
|
||||
#include "orte/mca/odls/odls.h"
|
||||
@ -1147,7 +1147,7 @@ static void node_regex_report(int status, orte_process_name_t* sender,
|
||||
}
|
||||
orte_node_regex = regex;
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_util_nidmap_parse(orte_node_regex))) {
|
||||
if (ORTE_SUCCESS != (rc = orte_regx.nidmap_parse(orte_node_regex))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2007-2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
*
|
||||
@ -48,7 +48,6 @@
|
||||
#include "orte/mca/schizo/base/base.h"
|
||||
#include "orte/util/listener.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/error_strings.h"
|
||||
#include "orte/orted/pmix/pmix_server.h"
|
||||
@ -217,7 +216,6 @@ int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags)
|
||||
if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) {
|
||||
/* let the pmix server register params */
|
||||
pmix_server_register_params();
|
||||
orte_util_nidmap_init();
|
||||
OPAL_TIMING_ENV_NEXT(tmng, "pmix_server_register_params");
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2016 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
@ -56,8 +56,6 @@ headers += \
|
||||
util/hostfile/hostfile_lex.h \
|
||||
util/dash_host/dash_host.h \
|
||||
util/comm/comm.h \
|
||||
util/nidmap.h \
|
||||
util/regex.h \
|
||||
util/attr.h \
|
||||
util/listener.h \
|
||||
util/compress.h \
|
||||
@ -77,8 +75,6 @@ lib@ORTE_LIB_PREFIX@open_rte_la_SOURCES += \
|
||||
util/hostfile/hostfile.c \
|
||||
util/dash_host/dash_host.c \
|
||||
util/comm/comm.c \
|
||||
util/nidmap.c \
|
||||
util/regex.c \
|
||||
util/attr.c \
|
||||
util/listener.c \
|
||||
util/compress.c
|
||||
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2011 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) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
/** @file:
|
||||
*
|
||||
* Populates global structure with system-specific information.
|
||||
*
|
||||
* Notes: add limits.h, compute size of integer and other types via sizeof(type)*CHAR_BIT
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ORTE_NIDMAP_H_
|
||||
#define _ORTE_NIDMAP_H_
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/types.h"
|
||||
|
||||
#include "opal/dss/dss_types.h"
|
||||
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
#define ORTE_MAX_NODE_PREFIX 50
|
||||
#define ORTE_CONTIG_NODE_CMD 0x01
|
||||
#define ORTE_NON_CONTIG_NODE_CMD 0x02
|
||||
|
||||
|
||||
ORTE_DECLSPEC void orte_util_nidmap_init(void);
|
||||
|
||||
ORTE_DECLSPEC int orte_util_nidmap_create(opal_pointer_array_t *pool, char **regex);
|
||||
ORTE_DECLSPEC int orte_util_nidmap_parse(char *regex);
|
||||
|
||||
/* create a regular expression describing the nodes in the
|
||||
* allocation */
|
||||
ORTE_DECLSPEC int orte_util_encode_nodemap(opal_buffer_t *buffer);
|
||||
|
||||
/* decode a regular expression created by the encode function
|
||||
* into the orte_node_pool array */
|
||||
ORTE_DECLSPEC int orte_util_decode_daemon_nodemap(opal_buffer_t *buffer);
|
||||
|
||||
ORTE_DECLSPEC int orte_util_build_daemon_nidmap(void);
|
||||
|
||||
/* create a regular expression describing the ppn for a job */
|
||||
ORTE_DECLSPEC int orte_util_nidmap_generate_ppn(orte_job_t *jdata, char **ppn);
|
||||
|
||||
/* decode the ppn */
|
||||
ORTE_DECLSPEC int orte_util_nidmap_parse_ppn(orte_job_t *jdata, char *ppn);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
@ -1,404 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2011 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) 2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
#include "orte_config.h"
|
||||
#include "orte/types.h"
|
||||
#include "orte/constants.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_IFADDRS_H
|
||||
#include <ifaddrs.h>
|
||||
#endif
|
||||
|
||||
#include "opal/util/argv.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/odls/odls_types.h"
|
||||
#include "orte/mca/rml/base/rml_contact.h"
|
||||
#include "orte/mca/rmaps/rmaps_types.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/util/nidmap.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "orte/mca/ess/ess.h"
|
||||
|
||||
#include "orte/util/regex.h"
|
||||
|
||||
#define ORTE_MAX_NODE_PREFIX 50
|
||||
|
||||
static int regex_parse_node_ranges(char *base, char *ranges, int num_digits, char *suffix, char ***names);
|
||||
static int regex_parse_node_range(char *base, char *range, int num_digits, char *suffix, char ***names);
|
||||
|
||||
int orte_regex_extract_node_names(char *regexp, char ***names)
|
||||
{
|
||||
int i, j, k, len, ret;
|
||||
char *base;
|
||||
char *orig, *suffix;
|
||||
bool found_range = false;
|
||||
bool more_to_come = false;
|
||||
int num_digits;
|
||||
|
||||
if (NULL == regexp) {
|
||||
*names = NULL;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
orig = base = strdup(regexp);
|
||||
if (NULL == base) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
||||
"%s regex:extract:nodenames: checking nodelist: %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
regexp));
|
||||
|
||||
do {
|
||||
/* Find the base */
|
||||
len = strlen(base);
|
||||
for (i = 0; i <= len; ++i) {
|
||||
if (base[i] == '[') {
|
||||
/* we found a range. this gets dealt with below */
|
||||
base[i] = '\0';
|
||||
found_range = true;
|
||||
break;
|
||||
}
|
||||
if (base[i] == ',') {
|
||||
/* we found a singleton node, and there are more to come */
|
||||
base[i] = '\0';
|
||||
found_range = false;
|
||||
more_to_come = true;
|
||||
break;
|
||||
}
|
||||
if (base[i] == '\0') {
|
||||
/* we found a singleton node */
|
||||
found_range = false;
|
||||
more_to_come = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 0 && !found_range) {
|
||||
/* we found a special character at the beginning of the string */
|
||||
orte_show_help("help-regex.txt", "regex:special-char", true, regexp);
|
||||
free(orig);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
|
||||
if (found_range) {
|
||||
/* If we found a range, get the number of digits in the numbers */
|
||||
i++; /* step over the [ */
|
||||
for (j=i; j < len; j++) {
|
||||
if (base[j] == ':') {
|
||||
base[j] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j >= len) {
|
||||
/* we didn't find the number of digits */
|
||||
orte_show_help("help-regex.txt", "regex:num-digits-missing", true, regexp);
|
||||
free(orig);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
num_digits = strtol(&base[i], NULL, 10);
|
||||
i = j + 1; /* step over the : */
|
||||
/* now find the end of the range */
|
||||
for (j = i; j < len; ++j) {
|
||||
if (base[j] == ']') {
|
||||
base[j] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j >= len) {
|
||||
/* we didn't find the end of the range */
|
||||
orte_show_help("help-regex.txt", "regex:end-range-missing", true, regexp);
|
||||
free(orig);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
/* check for a suffix */
|
||||
if (j+1 < len && base[j+1] != ',') {
|
||||
/* find the next comma, if present */
|
||||
for (k=j+1; k < len && base[k] != ','; k++);
|
||||
if (k < len) {
|
||||
base[k] = '\0';
|
||||
}
|
||||
suffix = strdup(&base[j+1]);
|
||||
if (k < len) {
|
||||
base[k] = ',';
|
||||
}
|
||||
j = k-1;
|
||||
} else {
|
||||
suffix = NULL;
|
||||
}
|
||||
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
||||
"%s regex:extract:nodenames: parsing range %s %s %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
base, base + i, suffix));
|
||||
|
||||
ret = regex_parse_node_ranges(base, base + i, num_digits, suffix, names);
|
||||
if (NULL != suffix) {
|
||||
free(suffix);
|
||||
}
|
||||
if (ORTE_SUCCESS != ret) {
|
||||
orte_show_help("help-regex.txt", "regex:bad-value", true, regexp);
|
||||
free(orig);
|
||||
return ret;
|
||||
}
|
||||
if (j+1 < len && base[j + 1] == ',') {
|
||||
more_to_come = true;
|
||||
base = &base[j + 2];
|
||||
} else {
|
||||
more_to_come = false;
|
||||
}
|
||||
} else {
|
||||
/* If we didn't find a range, just add the node */
|
||||
if(ORTE_SUCCESS != (ret = opal_argv_append_nosize(names, base))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
free(orig);
|
||||
return ret;
|
||||
}
|
||||
/* step over the comma */
|
||||
i++;
|
||||
/* set base equal to the (possible) next base to look at */
|
||||
base = &base[i];
|
||||
}
|
||||
} while(more_to_come);
|
||||
|
||||
free(orig);
|
||||
|
||||
/* All done */
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse one or more ranges in a set
|
||||
*
|
||||
* @param base The base text of the node name
|
||||
* @param *ranges A pointer to a range. This can contain multiple ranges
|
||||
* (i.e. "1-3,10" or "5" or "9,0100-0130,250")
|
||||
* @param ***names An argv array to add the newly discovered nodes to
|
||||
*/
|
||||
static int regex_parse_node_ranges(char *base, char *ranges, int num_digits, char *suffix, char ***names)
|
||||
{
|
||||
int i, len, ret;
|
||||
char *start, *orig;
|
||||
|
||||
/* Look for commas, the separator between ranges */
|
||||
|
||||
len = strlen(ranges);
|
||||
for (orig = start = ranges, i = 0; i < len; ++i) {
|
||||
if (',' == ranges[i]) {
|
||||
ranges[i] = '\0';
|
||||
ret = regex_parse_node_range(base, start, num_digits, suffix, names);
|
||||
if (ORTE_SUCCESS != ret) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
start = ranges + i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pick up the last range, if it exists */
|
||||
|
||||
if (start < orig + len) {
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
||||
"%s regex:parse:ranges: parse range %s (2)",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), start));
|
||||
|
||||
ret = regex_parse_node_range(base, start, num_digits, suffix, names);
|
||||
if (ORTE_SUCCESS != ret) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse a single range in a set and add the full names of the nodes
|
||||
* found to the names argv
|
||||
*
|
||||
* @param base The base text of the node name
|
||||
* @param *ranges A pointer to a single range. (i.e. "1-3" or "5")
|
||||
* @param ***names An argv array to add the newly discovered nodes to
|
||||
*/
|
||||
static int regex_parse_node_range(char *base, char *range, int num_digits, char *suffix, char ***names)
|
||||
{
|
||||
char *str, tmp[132];
|
||||
size_t i, k, start, end;
|
||||
size_t base_len, len;
|
||||
bool found;
|
||||
int ret;
|
||||
|
||||
if (NULL == base || NULL == range) {
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
|
||||
len = strlen(range);
|
||||
base_len = strlen(base);
|
||||
/* Silence compiler warnings; start and end are always assigned
|
||||
properly, below */
|
||||
start = end = 0;
|
||||
|
||||
/* Look for the beginning of the first number */
|
||||
|
||||
for (found = false, i = 0; i < len; ++i) {
|
||||
if (isdigit((int) range[i])) {
|
||||
if (!found) {
|
||||
start = atoi(range + i);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
||||
return ORTE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* Look for the end of the first number */
|
||||
|
||||
for (found = false; i < len; ++i) {
|
||||
if (!isdigit(range[i])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Was there no range, just a single number? */
|
||||
|
||||
if (i >= len) {
|
||||
end = start;
|
||||
found = true;
|
||||
} else {
|
||||
/* Nope, there was a range. Look for the beginning of the second
|
||||
* number
|
||||
*/
|
||||
for (; i < len; ++i) {
|
||||
if (isdigit(range[i])) {
|
||||
end = strtol(range + i, NULL, 10);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
||||
return ORTE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* Make strings for all values in the range */
|
||||
|
||||
len = base_len + num_digits + 32;
|
||||
if (NULL != suffix) {
|
||||
len += strlen(suffix);
|
||||
}
|
||||
str = (char *) malloc(len);
|
||||
if (NULL == str) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
for (i = start; i <= end; ++i) {
|
||||
memset(str, 0, len);
|
||||
strcpy(str, base);
|
||||
/* we need to zero-pad the digits */
|
||||
for (k=0; k < (size_t)num_digits; k++) {
|
||||
str[k+base_len] = '0';
|
||||
}
|
||||
memset(tmp, 0, 132);
|
||||
snprintf(tmp, 132, "%lu", (unsigned long)i);
|
||||
for (k=0; k < strlen(tmp); k++) {
|
||||
str[base_len + num_digits - k - 1] = tmp[strlen(tmp)-k-1];
|
||||
}
|
||||
/* if there is a suffix, add it */
|
||||
if (NULL != suffix) {
|
||||
strcat(str, suffix);
|
||||
}
|
||||
ret = opal_argv_append_nosize(names, str);
|
||||
if(ORTE_SUCCESS != ret) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
free(str);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
free(str);
|
||||
|
||||
/* All done */
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/***** CLASS INSTANTIATIONS ****/
|
||||
|
||||
static void range_construct(orte_regex_range_t *ptr)
|
||||
{
|
||||
ptr->vpid = 0;
|
||||
ptr->cnt = 0;
|
||||
}
|
||||
OBJ_CLASS_INSTANCE(orte_regex_range_t,
|
||||
opal_list_item_t,
|
||||
range_construct, NULL);
|
||||
|
||||
static void orte_regex_node_construct(orte_regex_node_t *ptr)
|
||||
{
|
||||
ptr->prefix = NULL;
|
||||
ptr->suffix = NULL;
|
||||
ptr->num_digits = 0;
|
||||
OBJ_CONSTRUCT(&ptr->ranges, opal_list_t);
|
||||
}
|
||||
static void orte_regex_node_destruct(orte_regex_node_t *ptr)
|
||||
{
|
||||
opal_list_item_t *item;
|
||||
|
||||
if (NULL != ptr->prefix) {
|
||||
free(ptr->prefix);
|
||||
}
|
||||
if (NULL != ptr->suffix) {
|
||||
free(ptr->suffix);
|
||||
}
|
||||
|
||||
while (NULL != (item = opal_list_remove_first(&ptr->ranges))) {
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
OBJ_DESTRUCT(&ptr->ranges);
|
||||
}
|
||||
OBJ_CLASS_INSTANCE(orte_regex_node_t,
|
||||
opal_list_item_t,
|
||||
orte_regex_node_construct,
|
||||
orte_regex_node_destruct);
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 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) 2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
/** @file:
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ORTE_REGEX_H_
|
||||
#define _ORTE_REGEX_H_
|
||||
|
||||
#include "orte_config.h"
|
||||
|
||||
#include "opal/class/opal_value_array.h"
|
||||
#include "opal/class/opal_list.h"
|
||||
|
||||
#include "orte/mca/odls/odls_types.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
int vpid;
|
||||
int cnt;
|
||||
int slots;
|
||||
orte_topology_t *t;
|
||||
} orte_regex_range_t;
|
||||
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_regex_range_t);
|
||||
|
||||
typedef struct {
|
||||
/* list object */
|
||||
opal_list_item_t super;
|
||||
char *prefix;
|
||||
char *suffix;
|
||||
int num_digits;
|
||||
opal_list_t ranges;
|
||||
} orte_regex_node_t;
|
||||
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_regex_node_t);
|
||||
|
||||
ORTE_DECLSPEC int orte_regex_extract_node_names(char *regexp, char ***names);
|
||||
|
||||
END_C_DECLS
|
||||
#endif
|
Загрузка…
x
Ссылка в новой задаче
Block a user