table of contents
- unstable 7.0.0~rc1-1
| PMIX_GENERATE_REGEX2(3) | OpenPMIx | PMIX_GENERATE_REGEX2(3) |
PMIx_generate_regex2 — Generate a compressed encoded representation of a list of values.
SYNOPSIS¶
#include <pmix_server.h> pmix_status_t PMIx_generate_regex2(const char *input,
pmix_info_t info[], size_t ninfo,
pmix_regex2_t *regex);
Python Syntax¶
from pmix import *
foo = PMIxServer()
# ... after a successful foo.init() ...
# the input may be a list of values or an already comma-delimited string
# the directives are a list of Python ``pmix_info_t`` dictionaries
rc, regex = foo.generate_regex2(["node001", "node002", "node003"], [])
# regex is {'type': str, 'bytes': bytes, 'len': int}
INPUT PARAMETERS¶
- input: A comma-separated list of values (for example, a list of node names) to be encoded.
- info: Optional array of pmix_info_t(5) <#man5-pmix-info-t> directives influencing the encoding (see DIRECTIVES). May be NULL.
- ninfo: Number of elements in the info array; zero if none.
OUTPUT PARAMETERS¶
- •
- regex: Pointer to caller-provided storage for a pmix_regex2_t(5) <#man5-pmix-regex2-t> structure into which the encoded representation is placed. The structure carries a colon-delimited type string identifying the encoding method, a bytes buffer holding the encoded representation (which may not be NULL-terminated), and a len giving the number of bytes. The caller is responsible for releasing the returned data (for example, via PMIx_Regex2_destruct).
DESCRIPTION¶
Given a comma-separated list of input values, generate a reduced-size representation of the input that can be passed to PMIx_server_register_nspace(3) <#man3-pmix-server-register-nspace> for processing, or expanded again with PMIx_parse_regex2(3) <#man3-pmix-parse-regex2>. The order of the individual values in the input string is preserved across the generate/parse operation.
PMIx_generate_regex2 replaces the deprecated PMIx_generate_regex. Rather than returning a raw char* — which incorrectly implied a NULL-terminated string — the new API returns a pmix_regex2_t, which properly conveys that the encoded output may be an arbitrary binary byte array. The precise encoding is implementation specific; the leading colon-delimited type string (e.g., "pmix", "raw", or "blob") identifies the method used so that a decoder can select the correct expansion algorithm.
PMIx_generate_regex2 also replaces the deprecated PMIx_generate_ppn, which encoded the per-node process map — a semicolon-delimited list of nodes, each holding a comma-delimited list of the ranks on that node (e.g., "0,1,2;3,4,5"). No separate API is required for that case: the encoding is agnostic to what the values represent, so the same call is used for both maps. Pass the process-map string as input and hand the resulting pmix_regex2_t to PMIx_server_register_nspace(3) <#man3-pmix-server-register-nspace> as the PMIX_PROC_MAP value with type PMIX_REGEX2, just as the node list is passed as PMIX_NODE_MAP.
The operation is performed synchronously in the caller’s thread; it does not thread-shift into the PMIx progress engine and does not invoke a callback.
DIRECTIVES¶
The info array is provided so that encoding behavior can be tuned or extended without changing the API signature. No standardized attributes are currently defined for this API; an implementation is free to define its own, and unrecognized directives are ignored. Callers that require no special handling may pass NULL / 0.
RETURN VALUE¶
Returns one of the following:
- PMIX_SUCCESS — the encoded representation was generated and placed in regex.
- PMIX_ERR_INIT — the PMIx library has not been initialized.
- PMIX_ERR_BAD_PARAM — regex was NULL.
Any other negative value indicates an appropriate error condition. PMIx error constants are defined in pmix_common.h.
NOTES¶
The returned pmix_regex2_t is owned by the caller and must be released when no longer needed. To communicate the encoded representation to a remote peer, pack it using PMIx_Data_pack with the PMIX_REGEX2 type; the pack/unpack routines handle the encoding-specific framing based on the type prefix.
See also:
Copyright¶
2014-2026, OpenPMIx Community
| September 27, 2026 |