Skip to content

Commit 125d236

Browse files
committed
Move from the use of regex to compression
We've been fighting the battle of trying to create a regex generator and parser that can handle arbitrary hostname schemes - without long-term success. The worst of it is that there is no way of checking to see if the computed regex is correct short of parsing it and doing a character-by-character comparison with the original string. Ugh...there has to be a better solution. One option is to investigate using 3rd-party regex libraries as those are coming from communities whose sole focus is resolving that problem. However, someone would need to spend the time to investigate it, and we'd have to find a license-friendly implementation. Another option is to quit beating our heads against the wall and just compress the information. It won't be as much of a reduction, but we also won't keep hitting scenarios where things break. In this case, it seems that "perfection" is definitely the enemy of "good enough". This PR implements the compression option while retaining the possibility of people adding regex-generating components. The compression code used in ORTE is consolidated into the opal/compress framework. That framework currently held bzip and gzip components for use in compressing checkpoint files - since we no longer support C/R, I have .opal_ignore'd those components. However, I have left the original framework APIs alone in case someone ever decides to redo C/R. The APIs of interest here are added to the framework - specifically, the "compress_block" and "decompress_block" functions. I then moved the ORTE zlib compression code into a new component in this framework. Unfortunately, the framework currently is a single-select one - i.e., only one active component at a time. Since I .opal_ignore'd the other two and made the priority of zlib high, this isn't a problem. However, if someone wants to re-enable bzip/gzip or add another component, they might need to transition opal/compress to a multi-select framework. Included changes: * Consolidate the compression code into the opal/compress framework * Move the ORTE zlib compression code into a new opal/compress/zlib component * Ignore the bzip and gzip components in opal/compress framework * Add a "compress_base_limit" MCA param to set the threshold above which we compress data - defaults to 4096 bytes * Delete stale brucks and rcd components from orte/grpcomm framework * Delete the orte/regx framework * Update the launch system to use opal/compress instead of string regex * Provide a default module if no zlib is available * Fix some misc multi-node issues * Properly generate the nidmap in response to a "connection warmup" message so the remote daemon knows the children it needs to launch. * Remove stale references to orte_node_regex * opal_byte_object_t's are not OPAL objects - properly release allocated memory. * Set the topology * Currently only handling homogeneous case * Update the compress framework files to conform * Consolidate open/close into one "frame" file. Ensure we open/close the framework Signed-off-by: Ralph Castain <rhc@pmix.org>
1 parent fcbc7ea commit 125d236

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1594
-4198
lines changed

ompi/op/op.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
1919
* Copyright (c) 2019 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
21+
* Copyright (c) 2018 Triad National Security, LLC. All rights
22+
* reserved.
2123
* $COPYRIGHT$
2224
*
2325
* Additional copyrights may follow

opal/mca/compress/base/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# University Research and Technology
44
# Corporation. All rights reserved.
55
# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
6+
# Copyright (c) 2019 Intel, Inc. All rights reserved.
67
# $COPYRIGHT$
78
#
89
# Additional copyrights may follow
@@ -14,7 +15,6 @@ headers += \
1415
base/base.h
1516

1617
libmca_compress_la_SOURCES += \
17-
base/compress_base_open.c \
18-
base/compress_base_close.c \
18+
base/compress_base_frame.c \
1919
base/compress_base_select.c \
2020
base/compress_base_fns.c

opal/mca/compress/base/base.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* University Research and Technology
44
* Corporation. All rights reserved.
55
*
6+
* Copyright (c) 2019 Intel, Inc. All rights reserved.
67
* $COPYRIGHT$
78
*
89
* Additional copyrights may follow
@@ -27,6 +28,12 @@
2728
extern "C" {
2829
#endif
2930

31+
typedef struct {
32+
size_t compress_limit;
33+
} opal_compress_base_t;
34+
35+
OPAL_DECLSPEC extern opal_compress_base_t opal_compress_base;
36+
3037
/**
3138
* Initialize the COMPRESS MCA framework
3239
*

opal/mca/compress/base/compress_base_close.c

Lines changed: 0 additions & 36 deletions
This file was deleted.

opal/mca/compress/base/compress_base_open.c renamed to opal/mca/compress/base/compress_base_frame.c

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* All rights reserved.
77
* Copyright (c) 2015 Research Organization for Information Science
88
* and Technology (RIST). All rights reserved.
9+
* Copyright (c) 2019 Intel, Inc. All rights reserved.
910
* $COPYRIGHT$
1011
*
1112
* Additional copyrights may follow
@@ -23,14 +24,31 @@
2324
/*
2425
* Globals
2526
*/
27+
static bool compress_block(uint8_t *inbytes,
28+
size_t inlen,
29+
uint8_t **outbytes,
30+
size_t *olen)
31+
{
32+
return false;
33+
}
34+
35+
static bool decompress_block(uint8_t **outbytes, size_t olen,
36+
uint8_t *inbytes, size_t len)
37+
{
38+
return false;
39+
}
40+
2641
opal_compress_base_module_t opal_compress = {
2742
NULL, /* init */
2843
NULL, /* finalize */
2944
NULL, /* compress */
3045
NULL, /* compress_nb */
3146
NULL, /* decompress */
32-
NULL /* decompress_nb */
47+
NULL, /* decompress_nb */
48+
compress_block,
49+
decompress_block
3350
};
51+
opal_compress_base_t opal_compress_base = {0};
3452

3553
opal_compress_base_component_t opal_compress_base_selected_component = {{0}};
3654

@@ -42,6 +60,12 @@ MCA_BASE_FRAMEWORK_DECLARE(opal, compress, "COMPRESS MCA",
4260

4361
static int opal_compress_base_register(mca_base_register_flag_t flags)
4462
{
63+
opal_compress_base.compress_limit = 4096;
64+
(void) mca_base_var_register("opal", "compress", "base", "limit",
65+
"Threshold beyond which data will be compressed",
66+
MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0, OPAL_INFO_LVL_3,
67+
MCA_BASE_VAR_SCOPE_READONLY, &opal_compress_base.compress_limit);
68+
4569
return OPAL_SUCCESS;
4670
}
4771

@@ -51,13 +75,17 @@ static int opal_compress_base_register(mca_base_register_flag_t flags)
5175
*/
5276
int opal_compress_base_open(mca_base_open_flag_t flags)
5377
{
54-
/* Compression currently only used with C/R */
55-
if(!opal_cr_is_enabled) {
56-
opal_output_verbose(10, opal_compress_base_framework.framework_output,
57-
"compress:open: FT is not enabled, skipping!");
58-
return OPAL_SUCCESS;
59-
}
60-
6178
/* Open up all available components */
6279
return mca_base_framework_components_open(&opal_compress_base_framework, flags);
6380
}
81+
82+
int opal_compress_base_close(void)
83+
{
84+
/* Call the component's finalize routine */
85+
if( NULL != opal_compress.finalize ) {
86+
opal_compress.finalize();
87+
}
88+
89+
/* Close all available modules that are open */
90+
return mca_base_framework_components_close (&opal_compress_base_framework, NULL);
91+
}

opal/mca/compress/base/compress_base_select.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*
88
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
99
* reserved.
10+
* Copyright (c) 2019 Intel, Inc. All rights reserved.
1011
* $COPYRIGHT$
1112
*
1213
* Additional copyrights may follow
@@ -29,26 +30,19 @@
2930

3031
int opal_compress_base_select(void)
3132
{
32-
int ret, exit_status = OPAL_SUCCESS;
33+
int ret = OPAL_SUCCESS;
3334
opal_compress_base_component_t *best_component = NULL;
3435
opal_compress_base_module_t *best_module = NULL;
3536

36-
/* Compression currently only used with C/R */
37-
if( !opal_cr_is_enabled ) {
38-
opal_output_verbose(10, opal_compress_base_framework.framework_output,
39-
"compress:open: FT is not enabled, skipping!");
40-
return OPAL_SUCCESS;
41-
}
42-
4337
/*
4438
* Select the best component
4539
*/
4640
if( OPAL_SUCCESS != mca_base_select("compress", opal_compress_base_framework.framework_output,
4741
&opal_compress_base_framework.framework_components,
4842
(mca_base_module_t **) &best_module,
4943
(mca_base_component_t **) &best_component, NULL) ) {
50-
/* This will only happen if no component was selected */
51-
exit_status = OPAL_ERROR;
44+
/* This will only happen if no component was selected,
45+
* in which case we use the default one */
5246
goto cleanup;
5347
}
5448

@@ -58,12 +52,11 @@ int opal_compress_base_select(void)
5852
/* Initialize the winner */
5953
if (NULL != best_module) {
6054
if (OPAL_SUCCESS != (ret = best_module->init()) ) {
61-
exit_status = ret;
6255
goto cleanup;
6356
}
6457
opal_compress = *best_module;
6558
}
6659

6760
cleanup:
68-
return exit_status;
61+
return ret;
6962
}

opal/mca/compress/bzip/compress_bzip_component.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* All rights reserved.
55
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
66
* reserved.
7+
* Copyright (c) 2019 Intel, Inc. All rights reserved.
78
* $COPYRIGHT$
89
*
910
* Additional copyrights may follow
@@ -65,22 +66,39 @@ opal_compress_bzip_component_t mca_compress_bzip_component = {
6566
}
6667
};
6768

69+
static bool nocompress(uint8_t *inbytes,
70+
size_t inlen,
71+
uint8_t **outbytes,
72+
size_t *olen)
73+
{
74+
return false;
75+
}
76+
77+
static bool nodecompress(uint8_t **outbytes, size_t olen,
78+
uint8_t *inbytes, size_t len)
79+
{
80+
return false;
81+
}
82+
6883
/*
6984
* Bzip module
7085
*/
7186
static opal_compress_base_module_t loc_module = {
7287
/** Initialization Function */
73-
opal_compress_bzip_module_init,
88+
.init = opal_compress_bzip_module_init,
7489
/** Finalization Function */
75-
opal_compress_bzip_module_finalize,
90+
.finalize = opal_compress_bzip_module_finalize,
7691

7792
/** Compress Function */
78-
opal_compress_bzip_compress,
79-
opal_compress_bzip_compress_nb,
93+
.compress = opal_compress_bzip_compress,
94+
.compress_nb = opal_compress_bzip_compress_nb,
8095

8196
/** Decompress Function */
82-
opal_compress_bzip_decompress,
83-
opal_compress_bzip_decompress_nb
97+
.decompress = opal_compress_bzip_decompress,
98+
.decompress_nb = opal_compress_bzip_decompress_nb,
99+
100+
.compress_block = nocompress,
101+
.decompress_block = nodecompress
84102
};
85103

86104
static int compress_bzip_register (void)

opal/mca/compress/compress.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
77
* reserved.
88
*
9+
* Copyright (c) 2019 Intel, Inc. All rights reserved.
910
* $COPYRIGHT$
1011
*
1112
* Additional copyrights may follow
@@ -82,6 +83,20 @@ typedef int (*opal_compress_base_module_decompress_fn_t)
8283
typedef int (*opal_compress_base_module_decompress_nb_fn_t)
8384
(char * cname, char **fname, pid_t *child_pid);
8485

86+
/**
87+
* Compress a string
88+
*
89+
* Arguments:
90+
*
91+
*/
92+
typedef bool (*opal_compress_base_module_compress_string_fn_t)(uint8_t *inbytes,
93+
size_t inlen,
94+
uint8_t **outbytes,
95+
size_t *olen);
96+
typedef bool (*opal_compress_base_module_decompress_string_fn_t)(uint8_t **outbytes, size_t olen,
97+
uint8_t *inbytes, size_t len);
98+
99+
85100
/**
86101
* Structure for COMPRESS components.
87102
*/
@@ -117,6 +132,10 @@ struct opal_compress_base_module_1_0_0_t {
117132
/** Decompress Interface */
118133
opal_compress_base_module_decompress_fn_t decompress;
119134
opal_compress_base_module_decompress_nb_fn_t decompress_nb;
135+
136+
/* COMPRESS STRING */
137+
opal_compress_base_module_compress_string_fn_t compress_block;
138+
opal_compress_base_module_decompress_string_fn_t decompress_block;
120139
};
121140
typedef struct opal_compress_base_module_1_0_0_t opal_compress_base_module_1_0_0_t;
122141
typedef struct opal_compress_base_module_1_0_0_t opal_compress_base_module_t;

0 commit comments

Comments
 (0)