1
1

Cache the old orte/regx components

In case someone wants to restore and use them - leave them as
opal_ignore'd for now

Signed-off-by: Ralph Castain <rhc@pmix.org>
Этот коммит содержится в:
Ralph Castain 2019-02-08 11:25:35 -08:00
родитель e56ee1e06a
Коммит fc0b0938a7
12 изменённых файлов: 849 добавлений и 0 удалений

0
opal/mca/compress/fwd/.opal_ignore Обычный файл
Просмотреть файл

36
opal/mca/compress/fwd/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,36 @@
#
# Copyright (c) 2016-2019 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
opal/mca/compress/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

300
opal/mca/compress/fwd/regx_fwd.c Обычный файл
Просмотреть файл

@ -0,0 +1,300 @@
/*
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). 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/util/show_help.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rmaps/base/base.h"
#include "orte/mca/routed/routed.h"
#include "orte/mca/regx/base/base.h"
#include "regx_fwd.h"
static int nidmap_create(opal_pointer_array_t *pool, char **regex);
orte_regx_base_module_t orte_regx_fwd_module = {
.nidmap_create = nidmap_create,
.nidmap_parse = orte_regx_base_nidmap_parse,
.extract_node_names = orte_regx_base_extract_node_names,
.encode_nodemap = orte_regx_base_encode_nodemap,
.decode_daemon_nodemap = orte_regx_base_decode_daemon_nodemap,
.generate_ppn = orte_regx_base_generate_ppn,
.parse_ppn = orte_regx_base_parse_ppn
};
static int nidmap_create(opal_pointer_array_t *pool, char **regex)
{
char *node;
char prefix[ORTE_MAX_NODE_PREFIX];
int i, j, n, len, startnum, nodenum, numdigits;
bool found;
char *suffix, *sfx, *nodenames;
orte_regex_node_t *ndreg;
orte_regex_range_t *range, *rng;
opal_list_t nodenms, dvpids;
opal_list_item_t *item, *itm2;
char **regexargs = NULL, *tmp, *tmp2;
orte_node_t *nptr;
orte_vpid_t vpid;
OBJ_CONSTRUCT(&nodenms, opal_list_t);
OBJ_CONSTRUCT(&dvpids, opal_list_t);
rng = NULL;
for (n=0; n < pool->size; n++) {
if (NULL == (nptr = (orte_node_t*)opal_pointer_array_get_item(pool, n))) {
continue;
}
/* if no daemon has been assigned, then this node is not being used */
if (NULL == nptr->daemon) {
vpid = -1; // indicates no daemon assigned
} else {
vpid = nptr->daemon->name.vpid;
}
/* deal with the daemon vpid - see if it is next in the
* current range */
if (NULL == rng) {
/* just starting */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
} else if (UINT32_MAX == vpid) {
if (-1 == rng->vpid) {
rng->cnt++;
} else {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
}
} else if (-1 == rng->vpid) {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
} else {
/* is this the next in line */
if (vpid == (orte_vpid_t)(rng->vpid + rng->cnt)) {
rng->cnt++;
} else {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
}
}
node = nptr->name;
/* determine this node's prefix by looking for first digit char */
len = strlen(node);
startnum = -1;
memset(prefix, 0, ORTE_MAX_NODE_PREFIX);
for (i=0, j=0; i < len; i++) {
/* valid hostname characters are ascii letters, digits and the '-' character. */
if (isdigit(node[i])) {
/* count the size of the numeric field - but don't
* add the digits to the prefix
*/
if (startnum < 0) {
/* okay, this defines end of the prefix */
startnum = i;
}
continue;
}
/* this must be either an alpha, a '.', or '-' */
if (!isalpha(node[i]) && '-' != node[i] && '.' != node[i]) {
orte_show_help("help-regex.txt", "regex:invalid-name", true, node);
return ORTE_ERR_SILENT;
}
if (startnum < 0) {
prefix[j++] = node[i];
}
}
if (startnum < 0) {
/* can't compress this name - just add it to the list */
ndreg = OBJ_NEW(orte_regex_node_t);
ndreg->prefix = strdup(node);
opal_list_append(&nodenms, &ndreg->super);
continue;
}
/* convert the digits and get any suffix */
nodenum = strtol(&node[startnum], &sfx, 10);
if (NULL != sfx) {
suffix = strdup(sfx);
numdigits = (int)(sfx - &node[startnum]);
} else {
suffix = NULL;
numdigits = (int)strlen(&node[startnum]);
}
/* is this node name already on our list? */
found = false;
if (0 != opal_list_get_size(&nodenms)) {
ndreg = (orte_regex_node_t*)opal_list_get_last(&nodenms);
if ((0 < strlen(prefix) && NULL == ndreg->prefix) ||
(0 == strlen(prefix) && NULL != ndreg->prefix) ||
(0 < strlen(prefix) && NULL != ndreg->prefix &&
0 != strcmp(prefix, ndreg->prefix)) ||
(NULL == suffix && NULL != ndreg->suffix) ||
(NULL != suffix && NULL == ndreg->suffix) ||
(NULL != suffix && NULL != ndreg->suffix &&
0 != strcmp(suffix, ndreg->suffix)) ||
(numdigits != ndreg->num_digits)) {
found = false;
} else {
/* found a match - flag it */
found = true;
}
}
if (found) {
range = (orte_regex_range_t*)opal_list_get_last(&ndreg->ranges);
if (NULL == range) {
/* first range for this nodeid */
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
/* see if the node number is out of sequence */
} else if (nodenum != (range->vpid + range->cnt)) {
/* start a new range */
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
} else {
/* everything matches - just increment the cnt */
range->cnt++;
}
} else {
/* need to add it */
ndreg = OBJ_NEW(orte_regex_node_t);
if (0 < strlen(prefix)) {
ndreg->prefix = strdup(prefix);
}
if (NULL != suffix) {
ndreg->suffix = strdup(suffix);
}
ndreg->num_digits = numdigits;
opal_list_append(&nodenms, &ndreg->super);
/* record the first range for this nodeid - we took
* care of names we can't compress above
*/
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
}
if (NULL != suffix) {
free(suffix);
}
}
/* begin constructing the regular expression */
while (NULL != (item = opal_list_remove_first(&nodenms))) {
ndreg = (orte_regex_node_t*)item;
/* if no ranges, then just add the name */
if (0 == opal_list_get_size(&ndreg->ranges)) {
if (NULL != ndreg->prefix) {
/* solitary node */
opal_asprintf(&tmp, "%s", ndreg->prefix);
opal_argv_append_nosize(&regexargs, tmp);
free(tmp);
}
OBJ_RELEASE(ndreg);
continue;
}
/* start the regex for this nodeid with the prefix */
if (NULL != ndreg->prefix) {
opal_asprintf(&tmp, "%s[%d:", ndreg->prefix, ndreg->num_digits);
} else {
opal_asprintf(&tmp, "[%d:", ndreg->num_digits);
}
/* add the ranges */
while (NULL != (itm2 = opal_list_remove_first(&ndreg->ranges))) {
range = (orte_regex_range_t*)itm2;
if (1 == range->cnt) {
opal_asprintf(&tmp2, "%s%u,", tmp, range->vpid);
} else {
opal_asprintf(&tmp2, "%s%u-%u,", tmp, range->vpid, range->vpid + range->cnt - 1);
}
free(tmp);
tmp = tmp2;
OBJ_RELEASE(range);
}
/* replace the final comma */
tmp[strlen(tmp)-1] = ']';
if (NULL != ndreg->suffix) {
/* add in the suffix, if provided */
opal_asprintf(&tmp2, "%s%s", tmp, ndreg->suffix);
free(tmp);
tmp = tmp2;
}
opal_argv_append_nosize(&regexargs, tmp);
free(tmp);
OBJ_RELEASE(ndreg);
}
/* assemble final result */
nodenames = opal_argv_join(regexargs, ',');
/* cleanup */
opal_argv_free(regexargs);
OBJ_DESTRUCT(&nodenms);
/* do the same for the vpids */
tmp = NULL;
while (NULL != (item = opal_list_remove_first(&dvpids))) {
rng = (orte_regex_range_t*)item;
if (1 < rng->cnt) {
if (NULL == tmp) {
opal_asprintf(&tmp, "%u(%u)", rng->vpid, rng->cnt);
} else {
opal_asprintf(&tmp2, "%s,%u(%u)", tmp, rng->vpid, rng->cnt);
free(tmp);
tmp = tmp2;
}
} else {
if (NULL == tmp) {
opal_asprintf(&tmp, "%u", rng->vpid);
} else {
opal_asprintf(&tmp2, "%s,%u", tmp, rng->vpid);
free(tmp);
tmp = tmp2;
}
}
OBJ_RELEASE(rng);
}
OPAL_LIST_DESTRUCT(&dvpids);
/* now concatenate the results into one string */
opal_asprintf(&tmp2, "%s@%s", nodenames, tmp);
free(nodenames);
free(tmp);
*regex = tmp2;
return ORTE_SUCCESS;
}

28
opal/mca/compress/fwd/regx_fwd.h Обычный файл
Просмотреть файл

@ -0,0 +1,28 @@
/*
* Copyright (c) 2016-2019 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_ */

44
opal/mca/compress/fwd/regx_fwd_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,44 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2016-2019 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;
}

0
opal/mca/compress/reverse/.opal_ignore Обычный файл
Просмотреть файл

36
opal/mca/compress/reverse/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,36 @@
#
# Copyright (c) 2016-2019 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
opal/mca/compress/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

319
opal/mca/compress/reverse/regx_reverse.c Обычный файл
Просмотреть файл

@ -0,0 +1,319 @@
/*
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2018 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). 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/util/show_help.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rmaps/base/base.h"
#include "orte/mca/routed/routed.h"
#include "orte/mca/regx/base/base.h"
#include "regx_reverse.h"
static int nidmap_create(opal_pointer_array_t *pool, char **regex);
orte_regx_base_module_t orte_regx_reverse_module = {
.nidmap_create = nidmap_create,
.nidmap_parse = orte_regx_base_nidmap_parse,
.extract_node_names = orte_regx_base_extract_node_names,
.encode_nodemap = orte_regx_base_encode_nodemap,
.decode_daemon_nodemap = orte_regx_base_decode_daemon_nodemap,
.generate_ppn = orte_regx_base_generate_ppn,
.parse_ppn = orte_regx_base_parse_ppn
};
static int nidmap_create(opal_pointer_array_t *pool, char **regex)
{
char *node;
char prefix[ORTE_MAX_NODE_PREFIX];
int i, j, n, len, startnum, nodenum, numdigits;
bool found;
char *suffix, *sfx, *nodenames;
orte_regex_node_t *ndreg;
orte_regex_range_t *range, *rng;
opal_list_t nodenms, dvpids;
opal_list_item_t *item, *itm2;
char **regexargs = NULL, *tmp, *tmp2;
orte_node_t *nptr;
orte_vpid_t vpid;
OBJ_CONSTRUCT(&nodenms, opal_list_t);
OBJ_CONSTRUCT(&dvpids, opal_list_t);
rng = NULL;
for (n=0; n < pool->size; n++) {
if (NULL == (nptr = (orte_node_t*)opal_pointer_array_get_item(pool, n))) {
continue;
}
/* if no daemon has been assigned, then this node is not being used */
if (NULL == nptr->daemon) {
vpid = -1; // indicates no daemon assigned
} else {
vpid = nptr->daemon->name.vpid;
}
/* deal with the daemon vpid - see if it is next in the
* current range */
if (NULL == rng) {
/* just starting */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
} else if (UINT32_MAX == vpid) {
if (-1 == rng->vpid) {
rng->cnt++;
} else {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
}
} else if (-1 == rng->vpid) {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
} else {
/* is this the next in line */
if (vpid == (orte_vpid_t)(rng->vpid + rng->cnt)) {
rng->cnt++;
} else {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
}
}
node = nptr->name;
opal_output_verbose(5, orte_regx_base_framework.framework_output,
"%s PROCESS NODE <%s>",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
node);
/* determine this node's prefix by looking for first digit char */
len = strlen(node);
startnum = -1;
memset(prefix, 0, ORTE_MAX_NODE_PREFIX);
numdigits = 0;
/* Valid hostname characters are:
* - ascii letters, digits, and the '-' character.
* Determine the prefix in reverse to better support hostnames like:
* c712f6n01, c699c086 where there are sets of digits, and the lowest
* set changes most frequently.
*/
startnum = -1;
memset(prefix, 0, ORTE_MAX_NODE_PREFIX);
numdigits = 0;
for (i=len-1; i >= 0; i--) {
// Count all of the digits
if( isdigit(node[i]) ) {
numdigits++;
continue;
}
else {
// At this point everything at and above position 'i' is prefix.
for( j = 0; j <= i; ++j) {
prefix[j] = node[j];
}
if (numdigits) {
startnum = j;
}
break;
}
}
opal_output_verbose(5, orte_regx_base_framework.framework_output,
"%s PROCESS NODE <%s> : reverse / prefix \"%s\" / numdigits %d",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
node, prefix, numdigits);
if (startnum < 0) {
/* can't compress this name - just add it to the list */
ndreg = OBJ_NEW(orte_regex_node_t);
ndreg->prefix = strdup(node);
opal_list_append(&nodenms, &ndreg->super);
continue;
}
/* convert the digits and get any suffix */
nodenum = strtol(&node[startnum], &sfx, 10);
if (NULL != sfx) {
suffix = strdup(sfx);
} else {
suffix = NULL;
}
/* is this node name already on our list? */
found = false;
if (0 != opal_list_get_size(&nodenms)) {
ndreg = (orte_regex_node_t*)opal_list_get_last(&nodenms);
if ((0 < strlen(prefix) && NULL == ndreg->prefix) ||
(0 == strlen(prefix) && NULL != ndreg->prefix) ||
(0 < strlen(prefix) && NULL != ndreg->prefix &&
0 != strcmp(prefix, ndreg->prefix)) ||
(NULL == suffix && NULL != ndreg->suffix) ||
(NULL != suffix && NULL == ndreg->suffix) ||
(NULL != suffix && NULL != ndreg->suffix &&
0 != strcmp(suffix, ndreg->suffix)) ||
(numdigits != ndreg->num_digits)) {
found = false;
} else {
/* found a match - flag it */
found = true;
}
}
if (found) {
/* get the last range on this nodeid - we do this
* to preserve order
*/
range = (orte_regex_range_t*)opal_list_get_last(&ndreg->ranges);
if (NULL == range) {
/* first range for this nodeid */
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
/* see if the node number is out of sequence */
} else if (nodenum != (range->vpid + range->cnt)) {
/* start a new range */
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
} else {
/* everything matches - just increment the cnt */
range->cnt++;
}
} else {
/* need to add it */
ndreg = OBJ_NEW(orte_regex_node_t);
if (0 < strlen(prefix)) {
ndreg->prefix = strdup(prefix);
}
if (NULL != suffix) {
ndreg->suffix = strdup(suffix);
}
ndreg->num_digits = numdigits;
opal_list_append(&nodenms, &ndreg->super);
/* record the first range for this nodeid - we took
* care of names we can't compress above
*/
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
}
if (NULL != suffix) {
free(suffix);
}
}
/* begin constructing the regular expression */
while (NULL != (item = opal_list_remove_first(&nodenms))) {
ndreg = (orte_regex_node_t*)item;
/* if no ranges, then just add the name */
if (0 == opal_list_get_size(&ndreg->ranges)) {
if (NULL != ndreg->prefix) {
/* solitary node */
opal_asprintf(&tmp, "%s", ndreg->prefix);
opal_argv_append_nosize(&regexargs, tmp);
free(tmp);
}
OBJ_RELEASE(ndreg);
continue;
}
/* start the regex for this nodeid with the prefix */
if (NULL != ndreg->prefix) {
opal_asprintf(&tmp, "%s[%d:", ndreg->prefix, ndreg->num_digits);
} else {
opal_asprintf(&tmp, "[%d:", ndreg->num_digits);
}
/* add the ranges */
while (NULL != (itm2 = opal_list_remove_first(&ndreg->ranges))) {
range = (orte_regex_range_t*)itm2;
if (1 == range->cnt) {
opal_asprintf(&tmp2, "%s%u,", tmp, range->vpid);
} else {
opal_asprintf(&tmp2, "%s%u-%u,", tmp, range->vpid, range->vpid + range->cnt - 1);
}
free(tmp);
tmp = tmp2;
OBJ_RELEASE(range);
}
/* replace the final comma */
tmp[strlen(tmp)-1] = ']';
if (NULL != ndreg->suffix) {
/* add in the suffix, if provided */
opal_asprintf(&tmp2, "%s%s", tmp, ndreg->suffix);
free(tmp);
tmp = tmp2;
}
opal_argv_append_nosize(&regexargs, tmp);
free(tmp);
OBJ_RELEASE(ndreg);
}
/* assemble final result */
nodenames = opal_argv_join(regexargs, ',');
/* cleanup */
opal_argv_free(regexargs);
OBJ_DESTRUCT(&nodenms);
/* do the same for the vpids */
tmp = NULL;
while (NULL != (item = opal_list_remove_first(&dvpids))) {
rng = (orte_regex_range_t*)item;
if (1 < rng->cnt) {
if (NULL == tmp) {
opal_asprintf(&tmp, "%u(%u)", rng->vpid, rng->cnt);
} else {
opal_asprintf(&tmp2, "%s,%u(%u)", tmp, rng->vpid, rng->cnt);
free(tmp);
tmp = tmp2;
}
} else {
if (NULL == tmp) {
opal_asprintf(&tmp, "%u", rng->vpid);
} else {
opal_asprintf(&tmp2, "%s,%u", tmp, rng->vpid);
free(tmp);
tmp = tmp2;
}
}
OBJ_RELEASE(rng);
}
OPAL_LIST_DESTRUCT(&dvpids);
/* now concatenate the results into one string */
opal_asprintf(&tmp2, "%s@%s", nodenames, tmp);
free(nodenames);
free(tmp);
*regex = tmp2;
return ORTE_SUCCESS;
}

28
opal/mca/compress/reverse/regx_reverse.h Обычный файл
Просмотреть файл

@ -0,0 +1,28 @@
/*
* Copyright (c) 2016-2019 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_ */

Просмотреть файл

@ -0,0 +1,44 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2016-2019 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;
}