Need to commit these so I can make a name change to one of the files. I'm in the process of making
a substantial revamp of the session directory system, and the ompi_system_info structure, in accordance with the startup/shutdown design released last week. If you are using either the session directories or the ompi_system_info structure, I would recommend avoiding them for the next couple of days as these files are undergoing considerable change. The documentation will be updated as well during this process. This commit was SVN r1495.
Этот коммит содержится в:
родитель
aae2fc0a78
Коммит
bca14b684c
@ -20,6 +20,7 @@ headers = \
|
||||
output.h \
|
||||
path.h \
|
||||
sys_info.h \
|
||||
proc_info.h \
|
||||
os_path.h \
|
||||
os_create_dirpath.h \
|
||||
os_session_dir.h \
|
||||
@ -35,6 +36,7 @@ libutil_la_SOURCES = \
|
||||
malloc.c \
|
||||
output.c \
|
||||
path.c \
|
||||
proc_info.c \
|
||||
sys_info.c \
|
||||
os_path.c \
|
||||
os_create_dirpath.c \
|
||||
|
@ -31,15 +31,16 @@
|
||||
#include "include/constants.h"
|
||||
|
||||
#include "util/sys_info.h"
|
||||
#include "util/proc_info.h"
|
||||
#include "util/os_path.h"
|
||||
#include "util/os_create_dirpath.h"
|
||||
#include "util/os_session_dir.h"
|
||||
#include "util/session_dir.h"
|
||||
|
||||
static int ompi_check_dir(bool create, char *directory);
|
||||
int ompi_check_dir(bool create, char *directory);
|
||||
|
||||
#define OMPI_DEFAULT_TMPDIR "tmp"
|
||||
|
||||
static int ompi_check_dir(bool create, char *directory)
|
||||
int ompi_check_dir(bool create, char *directory)
|
||||
{
|
||||
struct stat buf;
|
||||
mode_t my_mode = S_IRWXU; /* at the least, I need to be able to do anything */
|
||||
@ -55,12 +56,36 @@ static int ompi_check_dir(bool create, char *directory)
|
||||
return(OMPI_ERROR); /* couldn't find it, or don't have access rights, and not asked to create it */
|
||||
}
|
||||
|
||||
char *ompi_find_session_dir(bool create, char *prefix)
|
||||
char *ompi_session_dir(bool create, char *prefix, char *user, char *universe, char *job, char *proc)
|
||||
{
|
||||
char *tmpprefix=NULL, *tmp=NULL;
|
||||
char sessions[PATH_MAX];
|
||||
char *sessions;
|
||||
int length=0;
|
||||
|
||||
sprintf(sessions, "openmpi-sessions-%s", ompi_system_info.user);
|
||||
if (NULL == user || NULL == universe) { /* error conditions - have to provide at least that much */
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
length = strlen("openmpi-sessions-") + strlen(user) + strlen(universe) + 2;
|
||||
|
||||
if (NULL == job && NULL != proc) { /* can't give a proc without a job */
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (NULL != proc) {
|
||||
length = length + strlen(job) + strlen(proc) + 2;
|
||||
sessions = (char *)malloc(length*sizeof(char));
|
||||
sprintf(sessions, "openmpi-sessions-%s%s%s%s%s%s%s", user, ompi_system_info.path_sep, universe,
|
||||
ompi_system_info.path_sep, job, ompi_system_info.path_sep, proc);
|
||||
} else if (NULL != job) {
|
||||
length = length + strlen(job) + 1;
|
||||
sessions = (char *)malloc(length*sizeof(char));
|
||||
sprintf(sessions, "openmpi-sessions-%s%s%s%s%s", user, ompi_system_info.path_sep, universe,
|
||||
ompi_system_info.path_sep, job);
|
||||
} else {
|
||||
sessions = (char *)malloc(length*sizeof(char));
|
||||
sprintf(sessions, "openmpi-sessions-%s%s%s", user, ompi_system_info.path_sep, universe);
|
||||
}
|
||||
|
||||
if (NULL != prefix) {
|
||||
tmpprefix = strdup(ompi_os_path(false, prefix, sessions, NULL)); /* make sure it's an absolute pathname */
|
||||
@ -135,67 +160,3 @@ char *ompi_find_session_dir(bool create, char *prefix)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ompi_session_dir_init
|
||||
*/
|
||||
|
||||
int ompi_session_dir_init(char *prefix, char *universe)
|
||||
{
|
||||
|
||||
char *tmpsuffix = NULL;
|
||||
char *tmpprefix = NULL;
|
||||
char *name;
|
||||
|
||||
/* check if universe is specified - if not, use "default-universe" */
|
||||
if (NULL == universe) {
|
||||
universe = strdup("default-universe");
|
||||
}
|
||||
|
||||
/* check to see if ompi_system_info populated - otherwise, error out */
|
||||
if (!ompi_system_info.init) {
|
||||
return(OMPI_ERROR);
|
||||
}
|
||||
|
||||
/* locate the ompi-sessions directory - create it if it doesn't exist */
|
||||
if (NULL == (tmpprefix = ompi_find_session_dir(true, prefix))) { /* couldn't find nor create the sessions directory */
|
||||
return (OMPI_ERROR);
|
||||
}
|
||||
|
||||
/* set up the name of the universe session directory, which is prefix/universe, and try to create it */
|
||||
name = ompi_os_path(false, tmpprefix, universe, NULL);
|
||||
if (OMPI_ERROR == ompi_os_create_dirpath(name, S_IRWXU)) { /* couldn't create the user directory */
|
||||
free(tmpprefix);
|
||||
free(name);
|
||||
return(OMPI_ERROR);
|
||||
}
|
||||
|
||||
/* store the sessions directory information */
|
||||
ompi_system_info.session_dir = strdup(name);
|
||||
|
||||
/* set up the prefix environment */
|
||||
/* after careful consideration, it was decided not to put this
|
||||
* back in the environment. Processes that inherit from this
|
||||
* process will have the right things to get the same answer. But
|
||||
* this became a major issue all around, because the session
|
||||
* prefix is not always the same across nodes and setting the env
|
||||
* caused MPIRUN to push the env variable out, which was just
|
||||
* causing major badness.
|
||||
*/
|
||||
|
||||
/* may need to include the ability to detect if the system is automatically putting a suffix
|
||||
* on our files. Not sure what this means yet, so nothing is implemented at this time.
|
||||
*/
|
||||
|
||||
/* clean up */
|
||||
if (tmpprefix != NULL) {
|
||||
free(tmpprefix);
|
||||
}
|
||||
if (tmpsuffix != NULL) {
|
||||
free(tmpsuffix);
|
||||
}
|
||||
if (name != NULL) {
|
||||
free(name);
|
||||
}
|
||||
|
||||
return(OMPI_SUCCESS);
|
||||
}
|
||||
|
@ -2,14 +2,16 @@
|
||||
* $HEADER$
|
||||
*/
|
||||
/** @file:
|
||||
* @page os_session_dir
|
||||
*
|
||||
* Find and/or create Open MPI session directory.
|
||||
*
|
||||
* The ompi_session_dir_init() function creates a temporary directory that is
|
||||
* The ompi_session_dir() function searches for a temporary directory that is
|
||||
* used by the Open MPI system for storing system-critical information. For a given
|
||||
* system and user, the function attempts to create a directory that will be used
|
||||
* system and user, the function attempts to find (or create, if not found and create is
|
||||
* requested) a directory that will be used
|
||||
* to independently house information for multiple universes, as the user creates
|
||||
* them. Thus, the function creates a directory tree of the form:
|
||||
* them. Thus, the function pursues a directory tree of the form:
|
||||
*
|
||||
* \par \em <prefix-dir>
|
||||
* An absolute path that identifies a temporary directory that is
|
||||
@ -30,77 +32,73 @@
|
||||
* local system. If none of these options are successful, the function returns an
|
||||
* error code.
|
||||
*
|
||||
* \par \em <openmpi-sessions>
|
||||
* This is a fixed name that serves as a concentrator for all Open MPI session
|
||||
* directories on the local system. If it doesn't already exist, this directory is
|
||||
* created with read-write-execute permissions for all. If it does exist, the access
|
||||
* permissions are checked to ensure they remain read-write-execute for all - if not,
|
||||
* \par \em <openmpi-sessions>-<user-id>
|
||||
* This serves as a concentrator for all Open MPI session
|
||||
* directories for this user on the local system. If it doesn't already exist, this directory is
|
||||
* created with read-write-execute permissions exclusively restricted to the user. If it does exist, the access
|
||||
* permissions are checked to ensure they are correct - if not, the program attempts to correct
|
||||
* them. If they can't' be changed to the correct values,
|
||||
* an error condition is returned.
|
||||
*
|
||||
* \par \em <user-id>
|
||||
* The user's id on the local system. For security purposes, this directory is created
|
||||
* with read-write-execute permissions exclusively restricted to the user. This also
|
||||
* allows multiple users to specify identical universe names without conflict.
|
||||
*
|
||||
* \par
|
||||
* Note: The <prefix>/openmpi-sessions/<user-id> directory is left on the system
|
||||
* Note: The <prefix>/openmpi-sessions-<user-id> directory is left on the system
|
||||
* upon termination of an application and/or an Open MPI universe for future use
|
||||
* by the user. Thus, when checking a potential location for the directory, the
|
||||
* ompi_session_dir_init() function first checks to see if an appropriate directory
|
||||
* ompi_session_tree_init() function first checks to see if an appropriate directory
|
||||
* already exists, and uses it if it does.
|
||||
*
|
||||
* \par \em <universe-name>
|
||||
* Finally, a directory is created for the specified universe name. This is the directory
|
||||
* A directory is created for the specified universe name. This is the directory
|
||||
* that will be used to house all information relating to the specific universe. If the
|
||||
* directory already exists (indicating that the user is joining an existing universe),
|
||||
* then the function ensures that the user has exclusive read-write-execute permissions
|
||||
* on the directory.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param prefix A pointer to a string identifying the root to be used for the session directory.
|
||||
* This value is provided by the user via the --tmpdir command-line option. If no value
|
||||
* is provided, prefix is passed by the calling program as a NULL value, and the
|
||||
* ompi_session_dir_init() function will attempt to find an appropriate root.
|
||||
*
|
||||
* @param universe A pointer to a string that specifies the name of the universe to be
|
||||
* established. This name is used to create the universe-specific sessions directory in
|
||||
* the user's openmpi-sessions directory. The universe-specific directory will be used
|
||||
* to store information required for universe operations. A NULL value will result in an
|
||||
* error condition being returned.
|
||||
* \par \em <job>
|
||||
* A directory is created for the specified job name. This will house all information relating
|
||||
* to that specific job, including directories for each process within that job on this host.
|
||||
*
|
||||
* @retval OMPI_ERROR If the directory could not be created, or if an existing directory
|
||||
* of the correct name is found, but cannot be set to the required access permissions.
|
||||
* \par \em <process>
|
||||
* A directory for the specific process, will house all information for that process.
|
||||
*
|
||||
* @retval OMPI_SUCCESS If the directory was successfully created with the required access
|
||||
* permissions
|
||||
*
|
||||
* In addition to the return values, the ompi_session_dir_init() function stores the
|
||||
* absolute path name of the session directory in the ompi_system_info.session_dir field
|
||||
* (see the ompi_sys_info() function for details on this structure).
|
||||
*
|
||||
*/
|
||||
|
||||
int ompi_session_dir_init(char *prefix, char *universe);
|
||||
|
||||
/** The ompi_find_session_dir() function searches either a user-specified location, or a
|
||||
* set of standard locations that might contain the "openmpi-sessions" directory. Once
|
||||
* The ompi_session_dir() function searches either a user-specified location, or a
|
||||
* set of standard locations that might contain the specified directory. Once
|
||||
* found, the function returns the pathname of that directory. The function calls the
|
||||
* ompi_check_dir() function.
|
||||
*/
|
||||
|
||||
/** @param create A boolean variable that indicates whether or not to create the "openmpi-sessions"
|
||||
/** @param create A boolean variable that indicates whether or not to create the specified
|
||||
* directory. If set to "false", the function only checks to see if an existing directory
|
||||
* can be found. This is typically used to locate an already existing universe for reconnection
|
||||
* purposes. If set to "true", then the function creates the "openmpi-sessions" directory, if possible.
|
||||
* @param prefix A string variable indicating where the user stipulated the "openmpi-sessions" directory
|
||||
* should be placed. A value of "NULL" indicates that the user specified no location - hence, the
|
||||
* purposes. If set to "true", then the function creates the directory, if possible.
|
||||
* @param prefix A string variable indicating where the user stipulated the directory
|
||||
* should be found or placed. A value of "NULL" indicates that the user specified no location - hence, the
|
||||
* function explores a range of "standard" locations.
|
||||
* @param user Name of the user to whom the universe belongs. This will be used to build the name of the
|
||||
* "openmpi-sessions-<user>" branch of the directory tree.
|
||||
* @param universe name of the universe being setup.
|
||||
* @param job Name of the job for which a session directory is to be created/found. NULL indicates
|
||||
* that only the universe directory is to be created/found.
|
||||
* @param proc Name of the process for which a session directory is to be created/found. NULL indicates
|
||||
* that only the job directory is to be created/found.
|
||||
*
|
||||
* @retval *path A pointer to a string containing the pathname of the "openmpi-sessions" directory.
|
||||
* @retval *path A pointer to a string containing the pathname of the directory.
|
||||
* A "NULL" value is returned if the directory cannot be found (if create is "false") or created (if
|
||||
* create is "true").
|
||||
*/
|
||||
|
||||
char *ompi_find_session_dir(bool create, char *prefix);
|
||||
char *ompi_session_dir(bool create, char *prefix, char *user, char *universe, char *job, char *proc);
|
||||
|
||||
/** The ompi_session_dir_finalize() function performs a cleanup of the session directory tree. It first
|
||||
* removes the session directory for the calling process. It then checks to see if the job-level session
|
||||
* directory is now empty - if so, it removes that level as well. Finally, it checks to see if the universe-level
|
||||
* session directory is now empty - if so, it also removes that level. This three-part "last-one-out"
|
||||
* procedure ensures that the directory tree is properly removed if all processes and applications
|
||||
* within a universe have completed.
|
||||
*
|
||||
* @param None
|
||||
* @retval OMPI_SUCCESS If the directory tree is properly cleaned up.
|
||||
* @retval OMPI_ERROR If something prevents the tree from being properly cleaned up.
|
||||
*/
|
||||
|
||||
int ompi_session_dir_finalize(void);
|
||||
|
106
src/util/proc_info.c
Обычный файл
106
src/util/proc_info.c
Обычный файл
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "util/sys_info.h"
|
||||
#include "util/os_path.h"
|
||||
#include "util/os_create_dirpath.h"
|
||||
#include "util/os_session_dir.h"
|
||||
#include "util/cmd_line.h"
|
||||
#include "util/common_cmd_line.h"
|
||||
|
||||
#include "util/proc_info.h"
|
||||
|
||||
ompi_proc_info_t ompi_process_info = {
|
||||
/* .init = */ false,
|
||||
/* .pid = */ 0,
|
||||
/* .name = */ NULL,
|
||||
/* .universe_session_dir = */ NULL,
|
||||
/* .job_session_dir = */ NULL,
|
||||
/* .proc_session_dir = */ NULL,
|
||||
/* .sock_stdin = */ NULL,
|
||||
/* .sock_stdout = */ NULL,
|
||||
/* .sock_stderr = */ NULL};
|
||||
|
||||
|
||||
int ompi_proc_info(void)
|
||||
{
|
||||
char *universe = NULL;
|
||||
char *tmpdir = NULL;
|
||||
char *procname, *procpath, *jobname, *jobpath;
|
||||
mode_t mode = S_IRWXU;
|
||||
|
||||
if (ompi_process_info.init) { /* already done this - don't do it again */
|
||||
return(OMPI_SUCCESS);
|
||||
}
|
||||
|
||||
/* get the process id */
|
||||
ompi_process_info.pid = getpid();
|
||||
|
||||
/* define process name */
|
||||
ompi_process_info.name = (ompi_process_name_t *)malloc(sizeof(ompi_process_name_t));
|
||||
ompi_process_info.name->cellid = 0;
|
||||
ompi_process_info.name->jobid = 1;
|
||||
ompi_process_info.name->procid = 2;
|
||||
sprintf(ompi_process_info.name->name, "%0x.%0x.%0x",
|
||||
ompi_process_info.name->cellid,
|
||||
ompi_process_info.name->jobid,
|
||||
ompi_process_info.name->procid);
|
||||
|
||||
/* see if user specified universe name */
|
||||
if (ompi_cmd_line_is_taken(ompi_common_cmd_line, "universe")) {
|
||||
if (NULL == ompi_cmd_line_get_param(ompi_common_cmd_line, "universe", 0, 0)) {
|
||||
return(OMPI_ERROR);
|
||||
}
|
||||
universe = strdup(ompi_cmd_line_get_param(ompi_common_cmd_line, "universe", 0, 0));
|
||||
}
|
||||
|
||||
/* see if user specified session directory prefix */
|
||||
if (ompi_cmd_line_is_taken(ompi_common_cmd_line, "tmpdir")) {
|
||||
if (NULL == ompi_cmd_line_get_param(ompi_common_cmd_line, "tmpdir", 0, 0)) {
|
||||
return(OMPI_ERROR);
|
||||
}
|
||||
tmpdir = strdup(ompi_cmd_line_get_param(ompi_common_cmd_line, "tmpdir", 0, 0));
|
||||
}
|
||||
|
||||
/* get the universe session directory setup */
|
||||
if (OMPI_ERROR == ompi_session_tree_init(tmpdir, universe)) {
|
||||
/* this is a serious error, so return the error condition */
|
||||
return(OMPI_ERROR);
|
||||
}
|
||||
|
||||
/* get the job session directory setup */
|
||||
sprintf(jobname, "%x", ompi_process_info.name->jobid);
|
||||
jobpath = ompi_os_path(false, ompi_process_info.universe_session_dir, jobname, NULL);
|
||||
if (OMPI_ERROR == ompi_os_create_dirpath(jobpath, mode)) {
|
||||
/* this is a serious error, so return the error condition */
|
||||
return(OMPI_ERROR);
|
||||
}
|
||||
ompi_process_info.job_session_dir = (char *)malloc((strlen(jobpath)+strlen(ompi_system_info.path_sep)+1)*sizeof(char));
|
||||
strcpy(ompi_process_info.job_session_dir, jobpath);
|
||||
ompi_process_info.job_session_dir = strcat(ompi_process_info.job_session_dir, ompi_system_info.path_sep);
|
||||
|
||||
|
||||
/* setup process session directory */
|
||||
sprintf(procname, "%x", ompi_process_info.name->procid);
|
||||
procpath = ompi_os_path(false, ompi_process_info.job_session_dir, procname, NULL);
|
||||
if (OMPI_ERROR == ompi_os_create_dirpath(procpath, mode)) { /* error in setting up the directory - cannot proceed */
|
||||
return(OMPI_ERROR);
|
||||
}
|
||||
ompi_process_info.proc_session_dir = (char *)malloc((strlen(procpath)+strlen(ompi_system_info.path_sep)+1)*sizeof(char));
|
||||
strcpy(ompi_process_info.proc_session_dir, procpath);
|
||||
ompi_process_info.proc_session_dir = strcat(ompi_process_info.proc_session_dir, ompi_system_info.path_sep);
|
||||
|
||||
ompi_process_info.init = true;
|
||||
return(OMPI_SUCCESS);
|
||||
}
|
68
src/util/proc_info.h
Обычный файл
68
src/util/proc_info.h
Обычный файл
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
/** @file:
|
||||
*
|
||||
* Populates global structure with process-specific information.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
#include "ns/name_server.h"
|
||||
|
||||
/**
|
||||
* Process information structure
|
||||
*
|
||||
* The ompi_proc_info() function fills the pid field, obtains the process name, and
|
||||
* creates the process session directory, storing that information in the global
|
||||
* structure. The structure also holds path names to the stdin, stdout, and
|
||||
* stderr temp files - however, these are initialized elsewhere.
|
||||
*
|
||||
*/
|
||||
struct ompi_proc_info_t {
|
||||
bool init; /**< Certifies that values have been filled.
|
||||
* Certifies that the ompi_sys_info() function has been
|
||||
* called at least once so fields have valid values
|
||||
*/
|
||||
pid_t pid; /**< Local process ID for this process */
|
||||
ompi_process_name_t *name; /**< Process name structure */
|
||||
char *universe_session_dir; /**< Location of user writable temp dir.
|
||||
* The session directory has the form
|
||||
* <prefix><openmpi-sessions-user><universe><job><process>, where the prefix
|
||||
* can either be provided by the user via the
|
||||
* --tmpdir command-line flag, the use of one of several
|
||||
* environmental variables, or else a default location. The
|
||||
* function ompi_session_dir_init() develops
|
||||
* the name of this directory, creates it, and stores the name
|
||||
* in this location.
|
||||
*/
|
||||
|
||||
char *job_session_dir; /**< Session directory for job */
|
||||
|
||||
char *proc_session_dir; /**< Session directory for the process */
|
||||
|
||||
char *sock_stdin; /**< Path name to temp file for stdin. */
|
||||
char *sock_stdout; /**< Path name to temp file for stdout. */
|
||||
char *sock_stderr; /**< Path name to temp file for stderr. */
|
||||
};
|
||||
typedef struct ompi_proc_info_t ompi_proc_info_t;
|
||||
|
||||
extern ompi_proc_info_t ompi_process_info;
|
||||
|
||||
/**
|
||||
* Global structure to store a wide range of information about the process.
|
||||
* ompi_proc_info populates a global variable with information about the process
|
||||
* being executing. This function should be
|
||||
* called only once to setup the information.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval OMPI_SUCCESS Successfully initialized the various fields.
|
||||
* @retval OMPI_ERROR Failed to initialize one or more fields.
|
||||
*/
|
||||
|
||||
int ompi_proc_info(void);
|
@ -13,34 +13,23 @@
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "util/sys_info.h"
|
||||
#include "util/os_session_dir.h"
|
||||
#include "util/cmd_line.h"
|
||||
#include "util/common_cmd_line.h"
|
||||
|
||||
ompi_sys_info_t ompi_system_info = {
|
||||
/* .init = */ false,
|
||||
/* .pid = */ 0,
|
||||
/* .sysname = */ NULL,
|
||||
/* .nodename = */ NULL,
|
||||
/* .release = */ NULL,
|
||||
/* .version = */ NULL,
|
||||
/* .machine = */ NULL,
|
||||
/* .path_sep = */ NULL,
|
||||
/* .user = */ NULL,
|
||||
/* .session_dir = */ NULL,
|
||||
/* .enviro = */ NULL,
|
||||
/* .suffix = */ NULL,
|
||||
/* .sock_stdin = */ NULL,
|
||||
/* .sock_stdout = */ NULL,
|
||||
/* .sock_stderr = */ NULL};
|
||||
|
||||
/* .init = */ false,
|
||||
/* .sysname = */ NULL,
|
||||
/* .nodename = */ NULL,
|
||||
/* .release = */ NULL,
|
||||
/* .version = */ NULL,
|
||||
/* .machine = */ NULL,
|
||||
/* .path_sep = */ NULL,
|
||||
/* .user = */ NULL,
|
||||
/* .enviro = */ NULL,
|
||||
/* .suffix = */ NULL};
|
||||
|
||||
int ompi_sys_info(void)
|
||||
{
|
||||
struct utsname sys_info;
|
||||
char *path_name, sep[2];
|
||||
char *universe = NULL;
|
||||
char *tmpdir = NULL;
|
||||
struct passwd *pwdent;
|
||||
|
||||
if (ompi_system_info.init) {
|
||||
@ -95,33 +84,8 @@ int ompi_sys_info(void)
|
||||
ompi_system_info.user = strdup("unknown");
|
||||
}
|
||||
|
||||
/* get the process id */
|
||||
ompi_system_info.pid = getpid();
|
||||
|
||||
/* set the init flag so that session_dir_init knows not to come back here */
|
||||
/* set the init flag */
|
||||
ompi_system_info.init = true; /* only indicates that we have been through here once - still have to test for NULL values */
|
||||
|
||||
/* see if user specified universe name */
|
||||
if (ompi_cmd_line_is_taken(ompi_common_cmd_line, "universe")) {
|
||||
if (NULL == ompi_cmd_line_get_param(ompi_common_cmd_line, "universe", 0, 0)) {
|
||||
return(OMPI_ERROR);
|
||||
}
|
||||
universe = strdup(ompi_cmd_line_get_param(ompi_common_cmd_line, "universe", 0, 0));
|
||||
}
|
||||
|
||||
/* see if user specified session directory prefix */
|
||||
if (ompi_cmd_line_is_taken(ompi_common_cmd_line, "tmpdir")) {
|
||||
if (NULL == ompi_cmd_line_get_param(ompi_common_cmd_line, "tmpdir", 0, 0)) {
|
||||
return(OMPI_ERROR);
|
||||
}
|
||||
tmpdir = strdup(ompi_cmd_line_get_param(ompi_common_cmd_line, "tmpdir", 0, 0));
|
||||
}
|
||||
|
||||
/* get the session directory setup */
|
||||
if (OMPI_ERROR == ompi_session_dir_init(tmpdir, universe)) {
|
||||
/* this is a serious error, so return the error condition */
|
||||
return(OMPI_ERROR);
|
||||
}
|
||||
|
||||
return(OMPI_SUCCESS);
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ struct ompi_sys_info_t {
|
||||
* Certifies that the ompi_sys_info() function has been
|
||||
* called at least once so fields have valid values
|
||||
*/
|
||||
pid_t pid; /* Process ID for this process */
|
||||
char *sysname; /**< Name of OS in use on this node. */
|
||||
char *nodename; /**< Fully qualified host name on the network. */
|
||||
char *release; /**< Release level of the operating system. */
|
||||
@ -41,16 +40,6 @@ struct ompi_sys_info_t {
|
||||
* upon the operating system
|
||||
*/
|
||||
char *user; /**< User id on this system. */
|
||||
char *session_dir; /**< Location of user writable temp dir.
|
||||
* The session directory has the form
|
||||
* <prefix><openmpi-sessions>, where the prefix
|
||||
* can either be provided by the user via the
|
||||
* --tmpdir command-line flag, the use of one of several
|
||||
* environmental variables, or else a default location. The
|
||||
* function ompi_session_dir_init() develops
|
||||
* the name of this directory, creates it, and stores the name
|
||||
* in this location.
|
||||
*/
|
||||
char *enviro; /**< Computing environment employed on this system.
|
||||
* Indicates the local computing environment for managing
|
||||
* and scheduling resources - e.g., SLURM, PBS, LSF, or BProc
|
||||
@ -61,9 +50,6 @@ struct ompi_sys_info_t {
|
||||
* to ensure uniqueness of the file name. This field records
|
||||
* that value for future use.
|
||||
*/
|
||||
char *sock_stdin; /**< Path name to temp file for stdin. */
|
||||
char *sock_stdout; /**< Path name to temp file for stdout. */
|
||||
char *sock_stderr; /**< Path name to temp file for stderr. */
|
||||
};
|
||||
typedef struct ompi_sys_info_t ompi_sys_info_t;
|
||||
|
||||
@ -72,8 +58,7 @@ extern ompi_sys_info_t ompi_system_info;
|
||||
/**
|
||||
* Discover and record a wide range of information about the system upon which
|
||||
* this code is executing. ompi_sys_info populates a global variable with information about the system
|
||||
* upon which the process is executing. This function can be executed multiple times - the universe
|
||||
* process through ompi_init(), and each application process via mpi_init().
|
||||
* upon which the process is executing.
|
||||
*
|
||||
* @retval None
|
||||
*/
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user