Skip to content

Commit 312da28

Browse files
rhc54hppritcha
authored andcommitted
Add support for PMIX_MEM_ALLOC_KIND
Add a new cmd line option that corresponds to this attribute. Add the attribute to the prun payload. When received, it will default to including in the job info for the spawned job. Add query support for it. Signed-off-by: Ralph Castain <rhc@pmix.org> (cherry picked from commit 3957789)
1 parent 1d867e8 commit 312da28

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

src/mca/schizo/prte/schizo_prte.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ static struct option prterunoptions[] = {
196196
PMIX_OPTION_SHORT_DEFINE(PRTE_CLI_PRELOAD_BIN, PMIX_ARG_NONE, 's'),
197197
PMIX_OPTION_DEFINE(PRTE_CLI_DO_NOT_AGG_HELP, PMIX_ARG_NONE),
198198
PMIX_OPTION_DEFINE(PRTE_CLI_FWD_ENVIRON, PMIX_ARG_OPTIONAL),
199+
PMIX_OPTION_DEFINE(PRTE_CLI_MEM_ALLOC_KIND, PMIX_ARG_REQD),
199200

200201
// output options
201202
PMIX_OPTION_DEFINE(PRTE_CLI_OUTPUT, PMIX_ARG_REQD),
@@ -310,6 +311,7 @@ static struct option prunoptions[] = {
310311
PMIX_OPTION_SHORT_DEFINE(PRTE_CLI_PRELOAD_BIN, PMIX_ARG_NONE, 's'),
311312
PMIX_OPTION_DEFINE(PRTE_CLI_DO_NOT_AGG_HELP, PMIX_ARG_NONE),
312313
PMIX_OPTION_DEFINE(PRTE_CLI_FWD_ENVIRON, PMIX_ARG_OPTIONAL),
314+
PMIX_OPTION_DEFINE(PRTE_CLI_MEM_ALLOC_KIND, PMIX_ARG_REQD),
313315

314316
// output options
315317
PMIX_OPTION_DEFINE(PRTE_CLI_OUTPUT, PMIX_ARG_REQD),

src/prted/pmix/pmix_server_queries.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ static void _query(int sd, short args, void *cbdata)
9090
pmix_proc_info_t *procinfo;
9191
pmix_data_array_t dry;
9292
prte_proc_t *proct;
93-
pmix_proc_t *proc;
93+
pmix_proc_t *proc, pproc;
94+
pmix_info_t info;
9495
size_t sz;
9596
PRTE_HIDE_UNUSED_PARAMS(sd, args);
9697

@@ -823,6 +824,27 @@ static void _query(int sd, short args, void *cbdata)
823824
}
824825
#endif
825826

827+
#ifdef PMIX_MEM_ALLOC_KIND
828+
} else if (0 == strcmp(q->keys[n], PMIX_MEM_ALLOC_KIND)) {
829+
pmix_value_t *value;
830+
jdata = prte_get_job_data_object(jobid);
831+
if (NULL == jdata) {
832+
ret = PMIX_ERR_NOT_FOUND;
833+
goto done;
834+
}
835+
PMIX_LOAD_PROCID(&pproc, jobid, PMIX_RANK_WILDCARD);
836+
PMIX_INFO_LOAD(&info, PMIX_IMMEDIATE, NULL, PMIX_BOOL);
837+
ret = PMIx_Get(&pproc, PMIX_MEM_ALLOC_KIND, &info, 1, (void**)&value);
838+
if (PMIX_SUCCESS != ret) {
839+
goto done;
840+
}
841+
PMIX_INFO_LIST_ADD(rc, results, PMIX_MEM_ALLOC_KIND, value->data.string, PMIX_STRING);
842+
PMIX_VALUE_RELEASE(value);
843+
if (PMIX_SUCCESS != rc) {
844+
PMIX_ERROR_LOG(rc);
845+
goto done;
846+
}
847+
#endif
826848
} else {
827849
fprintf(stderr, "Query for unrecognized attribute: %s\n", q->keys[n]);
828850
}

src/prted/prun_common.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,13 @@ int prun_common(pmix_cli_result_t *results,
661661
PMIX_INFO_LIST_ADD(ret, jinfo, PMIX_LOG_AGG, &flag, PMIX_BOOL);
662662
}
663663

664+
#ifdef PMIX_MEM_ALLOC_KIND
665+
opt = pmix_cmd_line_get_param(results, PRTE_CLI_MEM_ALLOC_KIND);
666+
if (NULL != opt) {
667+
PMIX_INFO_LIST_ADD(ret, jinfo, PMIX_MEM_ALLOC_KIND, opt->values[0], PMIX_STRING);
668+
}
669+
#endif
670+
664671
/* give the schizo components a chance to add to the job info */
665672
schizo->job_info(results, jinfo);
666673

src/util/prte_cmd_line.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights
1616
* reserved.
1717
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
18-
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
18+
* Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
1919
* $COPYRIGHT$
2020
*
2121
* Additional copyrights may follow
@@ -108,6 +108,7 @@ BEGIN_C_DECLS
108108
#define PRTE_CLI_SET_CWD_SESSION "set-cwd-to-session-dir" // none
109109
#define PRTE_CLI_ENABLE_RECOVERY "enable-recovery" // none
110110
#define PRTE_CLI_DISABLE_RECOVERY "disable-recovery" // none
111+
#define PRTE_CLI_MEM_ALLOC_KIND "memory-alloc-kinds" // required
111112

112113
// Placement options
113114
#define PRTE_CLI_MAPBY "map-by" // required

0 commit comments

Comments
 (0)