Skip to content

Commit

Permalink
Singletons need to create their own session directory tree
Browse files Browse the repository at this point in the history
We currently define the names of the various session directory
tree levels, but we never actually create those locations. This
causes (among other things) the shmem subsystem to emit error
messages about directories not being found or that we are
unable to determine if adequate size is available.

Refs #12784

Signed-off-by: Ralph Castain <[email protected]>
  • Loading branch information
rhc54 committed Jan 3, 2025
1 parent 88cd4a5 commit 9b8a417
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions ompi/runtime/ompi_rte.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights
* reserved.
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
* Copyright (c) 2021-2022 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*/
Expand Down Expand Up @@ -69,6 +69,7 @@ opal_process_name_t pmix_name_invalid = {UINT32_MAX, UINT32_MAX};
* session directory structure, then we shall cleanup after ourselves.
*/
static bool destroy_job_session_dir = false;
static bool destroy_proc_session_dir = false;

static int _setup_top_session_dir(char **sdir);
static int _setup_job_session_dir(char **sdir);
Expand Down Expand Up @@ -995,9 +996,12 @@ int ompi_rte_finalize(void)
opal_process_info.top_session_dir = NULL;
}

if (NULL != opal_process_info.proc_session_dir) {
if (NULL != opal_process_info.proc_session_dir && destroy_proc_session_dir) {
opal_os_dirpath_destroy(opal_process_info.proc_session_dir,
false, check_file);
free(opal_process_info.proc_session_dir);
opal_process_info.proc_session_dir = NULL;
destroy_proc_session_dir = false;
}

if (NULL != opal_process_info.app_sizes) {
Expand Down Expand Up @@ -1174,6 +1178,7 @@ static int _setup_top_session_dir(char **sdir)

static int _setup_job_session_dir(char **sdir)
{
int rc;
/* get the effective uid */
uid_t uid = geteuid();

Expand All @@ -1185,18 +1190,34 @@ static int _setup_job_session_dir(char **sdir)
opal_process_info.job_session_dir = NULL;
return OPAL_ERR_OUT_OF_RESOURCE;
}
rc = opal_os_dirpath_create(opal_process_info.job_session_dir, 0755);
if (OPAL_SUCCESS != rc) {
// could not create session dir
free(opal_process_info.job_session_dir);
opal_process_info.job_session_dir = NULL;
return rc;
}
destroy_job_session_dir = true;
return OPAL_SUCCESS;
}

static int _setup_proc_session_dir(char **sdir)
{
int rc;

if (0 > opal_asprintf(sdir, "%s/%d",
opal_process_info.job_session_dir,
opal_process_info.my_name.vpid)) {
opal_process_info.proc_session_dir = NULL;
return OPAL_ERR_OUT_OF_RESOURCE;
}

rc = opal_os_dirpath_create(opal_process_info.proc_session_dir, 0755);
if (OPAL_SUCCESS != rc) {
// could not create session dir
free(opal_process_info.proc_session_dir);
opal_process_info.proc_session_dir = NULL;
return rc;
}
destroy_proc_session_dir = true;
return OPAL_SUCCESS;
}

0 comments on commit 9b8a417

Please sign in to comment.