Begin knitting the openmpi program using the name server, registry, etc. Changes include:
- modified rte_init to utilize name server, interface to session directory system - added fields to system_info and proc_info - created a utility for converting process into daemon - modified openmpi to interface to various functions, spawn universe, record contact info, etc. Program almost complete. - began building ompid daemon This commit was SVN r2270.
Этот коммит содержится в:
родитель
f40018bb4a
Коммит
b2868d0158
@ -85,154 +85,161 @@
|
||||
*/
|
||||
int ompi_rte_init(bool *allow_multi_user_threads, bool *have_hidden_threads)
|
||||
{
|
||||
int ret;
|
||||
bool user_threads, hidden_threads;
|
||||
char *jobid_str=NULL, *procid_str=NULL;
|
||||
int ret;
|
||||
bool user_threads, hidden_threads;
|
||||
char *jobid_str=NULL, *procid_str=NULL;
|
||||
|
||||
*allow_multi_user_threads = true;
|
||||
*have_hidden_threads = false;
|
||||
*allow_multi_user_threads = true;
|
||||
*have_hidden_threads = false;
|
||||
|
||||
/*
|
||||
* Name Server
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_ns_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in ns_base_open\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_ns_base_select(&user_threads,
|
||||
&hidden_threads))) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in ns_base_select\n");
|
||||
return ret;
|
||||
}
|
||||
*allow_multi_user_threads &= user_threads;
|
||||
*have_hidden_threads |= hidden_threads;
|
||||
ompi_output(0, "entered rte_init - starting name server");
|
||||
/*
|
||||
* Name Server
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_ns_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in ns_base_open\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_ns_base_select(&user_threads,
|
||||
&hidden_threads))) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in ns_base_select\n");
|
||||
return ret;
|
||||
}
|
||||
*allow_multi_user_threads &= user_threads;
|
||||
*have_hidden_threads |= hidden_threads;
|
||||
|
||||
/*
|
||||
* Process Control and Monitoring Client
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_pcmclient_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in pcmclient_base_open\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_pcmclient_base_select(&user_threads,
|
||||
&hidden_threads))) {
|
||||
printf("show_help: ompi_rte_init failed in pcmclient_base_select\n");
|
||||
/* JMS show_help */
|
||||
return ret;
|
||||
}
|
||||
*allow_multi_user_threads &= user_threads;
|
||||
*have_hidden_threads |= hidden_threads;
|
||||
ompi_output(0, "starting pcm-client");
|
||||
/*
|
||||
* Process Control and Monitoring Client
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_pcmclient_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in pcmclient_base_open\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_pcmclient_base_select(&user_threads,
|
||||
&hidden_threads))) {
|
||||
printf("show_help: ompi_rte_init failed in pcmclient_base_select\n");
|
||||
/* JMS show_help */
|
||||
return ret;
|
||||
}
|
||||
*allow_multi_user_threads &= user_threads;
|
||||
*have_hidden_threads |= hidden_threads;
|
||||
|
||||
/*
|
||||
* Allocation code - open only. pcm will init if needed
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_llm_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in llm_base_open\n");
|
||||
return ret;
|
||||
}
|
||||
ompi_output(0, "starting llm");
|
||||
|
||||
/*
|
||||
* Process Control and Monitoring
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_pcm_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in pcm_base_open\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_pcm_base_select(&user_threads,
|
||||
&hidden_threads))) {
|
||||
printf("show_help: ompi_rte_init failed in pcm_base_select\n");
|
||||
/* JMS show_help */
|
||||
return ret;
|
||||
}
|
||||
*allow_multi_user_threads &= user_threads;
|
||||
*have_hidden_threads |= hidden_threads;
|
||||
/*
|
||||
* Allocation code - open only. pcm will init if needed
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_llm_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in llm_base_open\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Out of Band Messaging
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_oob_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in oob_base_open\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_oob_base_init(&user_threads,
|
||||
&hidden_threads))) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in mca_oob_base_init()\n");
|
||||
return ret;
|
||||
}
|
||||
*allow_multi_user_threads &= user_threads;
|
||||
*have_hidden_threads |= hidden_threads;
|
||||
ompi_output(0, "starting pcm");
|
||||
|
||||
/*
|
||||
* Registry
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_gpr_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in mca_gpr_base_open()\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_gpr_base_select(&user_threads,
|
||||
&hidden_threads))) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in mca_gpr_base_select()\n");
|
||||
return ret;
|
||||
}
|
||||
*allow_multi_user_threads &= user_threads;
|
||||
*have_hidden_threads |= hidden_threads;
|
||||
/*
|
||||
* Process Control and Monitoring
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_pcm_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in pcm_base_open\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_pcm_base_select(&user_threads,
|
||||
&hidden_threads))) {
|
||||
printf("show_help: ompi_rte_init failed in pcm_base_select\n");
|
||||
/* JMS show_help */
|
||||
return ret;
|
||||
}
|
||||
*allow_multi_user_threads &= user_threads;
|
||||
*have_hidden_threads |= hidden_threads;
|
||||
|
||||
/*
|
||||
* Fill in the various important structures
|
||||
*/
|
||||
/* proc structure startup */
|
||||
ompi_proc_info();
|
||||
ompi_output(0, "starting oob");
|
||||
|
||||
/* universe name */
|
||||
/* BWB - fix me fix me fix me */
|
||||
/*
|
||||
* Out of Band Messaging
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_oob_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in oob_base_open\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_oob_base_init(&user_threads,
|
||||
&hidden_threads))) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in mca_oob_base_init()\n");
|
||||
return ret;
|
||||
}
|
||||
*allow_multi_user_threads &= user_threads;
|
||||
*have_hidden_threads |= hidden_threads;
|
||||
|
||||
/* session directory */
|
||||
if(0 > asprintf(&jobid_str, "%-d", ompi_process_info.name->jobid)) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
ompi_output(0, "starting gpr");
|
||||
|
||||
if(0 > asprintf(&procid_str, "%-d", ompi_process_info.name->vpid)) {
|
||||
if (jobid_str != NULL) free(jobid_str);
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
/*
|
||||
* Registry
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_gpr_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in mca_gpr_base_open()\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_gpr_base_select(&user_threads,
|
||||
&hidden_threads))) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: ompi_rte_init failed in mca_gpr_base_select()\n");
|
||||
return ret;
|
||||
}
|
||||
*allow_multi_user_threads &= user_threads;
|
||||
*have_hidden_threads |= hidden_threads;
|
||||
|
||||
if (OMPI_ERROR == ompi_session_dir(true, NULL, ompi_system_info.user,
|
||||
ompi_system_info.nodename, NULL,
|
||||
"bOb", jobid_str, procid_str)) {
|
||||
if (jobid_str != NULL) free(jobid_str);
|
||||
if (procid_str != NULL) free(procid_str);
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
ompi_output(0, "calling proc_info");
|
||||
|
||||
/*
|
||||
* Fill in the various important structures
|
||||
*/
|
||||
/* proc structure startup */
|
||||
ompi_proc_info();
|
||||
|
||||
ompi_output(0, "doing session_dir");
|
||||
|
||||
/* session directory */
|
||||
jobid_str = ompi_name_server.get_jobid_string(ompi_process_info.name);
|
||||
procid_str = ompi_name_server.get_vpid_string(ompi_process_info.name);
|
||||
if (OMPI_ERROR == ompi_session_dir(true,
|
||||
ompi_process_info.tmpdir_base,
|
||||
ompi_system_info.user,
|
||||
ompi_system_info.nodename, NULL,
|
||||
ompi_process_info.my_universe,
|
||||
jobid_str, procid_str)) {
|
||||
if (jobid_str != NULL) free(jobid_str);
|
||||
if (procid_str != NULL) free(procid_str);
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Call back into NS/GPR/OOB to allow them to do any final initialization
|
||||
* (e.g. register callbacks w/ OOB, put contact info in register).
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = ompi_name_server.init())) {
|
||||
printf("show_help: ompi_rte_init failed in ompi_name_server.init()\n");
|
||||
return ret;
|
||||
}
|
||||
/*
|
||||
* Call back into NS/GPR/OOB to allow them to do any final initialization
|
||||
* (e.g. register callbacks w/ OOB, put contact info in register).
|
||||
*/
|
||||
/* if (OMPI_SUCCESS != (ret = ompi_name_server.init())) { */
|
||||
/* printf("show_help: ompi_rte_init failed in ompi_name_server.init()\n"); */
|
||||
/* return ret; */
|
||||
/* } */
|
||||
|
||||
if (OMPI_SUCCESS != (ret = mca_oob_base_register())) {
|
||||
printf("show_help: ompi_rte_init failed in mca_oob_base_register()\n");
|
||||
return ret;
|
||||
}
|
||||
/* if (OMPI_SUCCESS != (ret = mca_oob_base_register())) { */
|
||||
/* printf("show_help: ompi_rte_init failed in mca_oob_base_register()\n"); */
|
||||
/* return ret; */
|
||||
/* } */
|
||||
|
||||
|
||||
/*
|
||||
* All done
|
||||
*/
|
||||
return OMPI_SUCCESS;
|
||||
/*
|
||||
* All done
|
||||
*/
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,10 +13,14 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "runtime/runtime.h"
|
||||
#include "util/output.h"
|
||||
#include "runtime/universe_connect.h"
|
||||
#include "util/sys_info.h"
|
||||
#include "util/cmd_line.h"
|
||||
#include "util/common_cmd_line.h"
|
||||
#include "util/proc_info.h"
|
||||
#include "communicator/communicator.h"
|
||||
#include "util/session_dir.h"
|
||||
#include "util/printf.h"
|
||||
#include "util/daemon_init.h"
|
||||
#include "mca/base/base.h"
|
||||
#include "tools/ompid/ompid.h"
|
||||
|
||||
@ -33,80 +37,120 @@ const char *type_base = "base";
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
bool multi_thread = false;
|
||||
bool hidden_thread = false;
|
||||
bool multi_thread = false;
|
||||
bool hidden_thread = false;
|
||||
|
||||
/* Start OMPI process */
|
||||
ompi_cmd_line_t *mca_cmd_line=NULL;
|
||||
|
||||
if (OMPI_SUCCESS != ompi_init(argc, argv)) {
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* Intialize the Open MPI environment
|
||||
*/
|
||||
if (OMPI_SUCCESS != ompi_init(argc, argv)) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: ompi_init failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Initialize the argv parsing handle */
|
||||
/* get the system info */
|
||||
ompi_sys_info();
|
||||
|
||||
cmd_line = ompi_cmd_line_create();
|
||||
if (NULL == cmd_line) {
|
||||
ret = errno;
|
||||
#if 0
|
||||
show_help(NULL, "lib-call-fail", "ompi_cmd_line_create", NULL);
|
||||
#endif
|
||||
exit(ret);
|
||||
}
|
||||
ompi_cmd_line_make_opt(cmd_line, 'v', "version", 0,
|
||||
"Show version of this application");
|
||||
ompi_cmd_line_make_opt(cmd_line, 'h', "help", 0,
|
||||
"Show this help message");
|
||||
ompi_cmd_line_make_opt(cmd_line, 's', "seed", 0,
|
||||
"Set the daemon seed to true.");
|
||||
/* setup to read common command line options that span all Open MPI programs */
|
||||
if (OMPI_SUCCESS != (ret = ompi_common_cmd_line_init(argc, argv))) {
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
/* Get MCA parameters, if any */
|
||||
|
||||
mca_base_cmd_line_setup(cmd_line);
|
||||
if (ompi_cmd_line_is_taken(ompi_common_cmd_line, "help") ||
|
||||
ompi_cmd_line_is_taken(ompi_common_cmd_line, "h")) {
|
||||
printf("...showing ompi_info help message...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Do the parsing */
|
||||
/* setup the rte command line arguments */
|
||||
cmd_line = ompi_cmd_line_create();
|
||||
ompi_cmd_line_make_opt(cmd_line, 's', "seed", 0,
|
||||
"Set the daemon seed to true.");
|
||||
|
||||
if (OMPI_SUCCESS != ompi_cmd_line_parse(cmd_line, false, argc, argv) ||
|
||||
ompi_cmd_line_is_taken(cmd_line, "help") ){
|
||||
ompi_cmd_line_make_opt(cmd_line,
|
||||
'u', "universe", 1,
|
||||
"Specify the Open MPI universe");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line,
|
||||
't', "tmpdir", 1,
|
||||
"Specify the Open MPI prefix for the session directory");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 'w', "webserver", 0,
|
||||
"Web server available");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 's', "silent", 0,
|
||||
"No console prompt - operate silently");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 'f', "script", 1,
|
||||
"Read commands from script file");
|
||||
|
||||
/*
|
||||
* setup mca command line arguments
|
||||
*/
|
||||
mca_cmd_line = ompi_cmd_line_create();
|
||||
if (OMPI_SUCCESS != (ret = mca_base_cmd_line_setup(mca_cmd_line))) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: mca_base_cmd_line_setup failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != mca_base_cmd_line_process_args(mca_cmd_line)) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: mca_base_cmd_line_process_args\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != ompi_cmd_line_parse(cmd_line, true, argc, argv)) {
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
/* Do the parsing */
|
||||
|
||||
if (ompi_cmd_line_is_taken(ompi_common_cmd_line, "help")) {
|
||||
#if 1
|
||||
printf("...showing ompid help message...\n");
|
||||
printf("\nThe following optional arguments are available: --v --h --seeded\n");
|
||||
printf("\t ompid --h is used to display this information\n");
|
||||
printf("\t ompid --v is used to display the version of this application\n");
|
||||
printf("\t ompid --seeded is used to start a daemon seed.\n");
|
||||
printf("\n");
|
||||
printf("...showing ompid help message...\n");
|
||||
printf("\nThe following optional arguments are available: --v --h --seeded\n");
|
||||
printf("\t ompid -h is used to display this information\n");
|
||||
printf("\t ompid -v is used to display the version of this application\n");
|
||||
printf("\t ompid -seed is used to start the universe (seed) daemon.\n");
|
||||
printf("\n");
|
||||
#else
|
||||
show_help("ompid", "usage", NULL);
|
||||
show_help("ompid", "usage", NULL);
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
mca_base_cmd_line_process_args(cmd_line);
|
||||
|
||||
if (OMPI_SUCCESS != (ret = mca_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: mca_base_open failed\n");
|
||||
return ret;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: mca_base_open failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Execute the desired action(s) */
|
||||
/* Execute the desired action(s) */
|
||||
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "version")) {
|
||||
printf ("ompid (OpenMpi Daemon) version: 0\n");
|
||||
}
|
||||
if (ompi_cmd_line_is_taken(ompi_common_cmd_line, "version")) {
|
||||
printf ("ompid (OpenMpi Daemon) version: 0\n");
|
||||
}
|
||||
|
||||
/* If there is a seed argument, this is the magic
|
||||
* seed daemon.
|
||||
*/
|
||||
if ( ompi_cmd_line_is_taken(cmd_line, "seed") )
|
||||
ompi_process_info.seed = true;
|
||||
/* If there is a seed argument, this is the magic
|
||||
* seed daemon.
|
||||
*/
|
||||
if ( ompi_cmd_line_is_taken(cmd_line, "seed")) {
|
||||
ompi_process_info.seed = true;
|
||||
/* create session directory */
|
||||
}
|
||||
|
||||
|
||||
/* before calling anything we to call rte init */
|
||||
if (OMPI_SUCCESS != ompi_rte_init(&multi_thread, &hidden_thread)) {
|
||||
printf("ompid: ompi_rte_init failed\n");
|
||||
/* before calling anything we to call rte init */
|
||||
if (OMPI_SUCCESS != ompi_rte_init(&multi_thread, &hidden_thread)) {
|
||||
printf("ompid: ompi_rte_init failed\n");
|
||||
|
||||
/* Do a partial clean-up. This needs to be reviewed
|
||||
* at a later date to make certain we are not
|
||||
@ -116,20 +160,26 @@ int main(int argc, char *argv[])
|
||||
ompi_cmd_line_free(cmd_line);
|
||||
mca_base_close();
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Add in the calls to initialize the services */
|
||||
|
||||
/* Add the section for the event loop... */
|
||||
/*
|
||||
* if seed, call open functions of comm frameworks (oob, socket, etc.) to
|
||||
* get contact info. write contact info into universe session directory
|
||||
* as file "contact-info" so others can find us.
|
||||
*/
|
||||
|
||||
/* All done */
|
||||
/* Add in the calls to initialize the services */
|
||||
|
||||
/* Close services */
|
||||
/* Add the section for the event loop... */
|
||||
|
||||
ompi_cmd_line_free(cmd_line);
|
||||
mca_base_close();
|
||||
ompi_finalize();
|
||||
return 0;
|
||||
/* All done */
|
||||
|
||||
/* Close services */
|
||||
|
||||
ompi_cmd_line_free(cmd_line);
|
||||
mca_base_close();
|
||||
ompi_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
@ -29,15 +29,7 @@ openmpi_LDADD = \
|
||||
$(libs) \
|
||||
$(LIBMPI_EXTRA_LIBS) \
|
||||
$(LIBOMPI_EXTRA_LIBS) \
|
||||
$(top_builddir)/src/util/os_path.lo \
|
||||
$(top_builddir)/src/util/os_create_dirpath.lo \
|
||||
$(top_builddir)/src/util/session_dir.lo \
|
||||
$(top_builddir)/src/util/proc_info.lo \
|
||||
$(top_builddir)/src/util/cmd_line.lo \
|
||||
$(top_builddir)/src/util/common_cmd_line.lo \
|
||||
$(top_builddir)/src/runtime/universe_init.lo \
|
||||
$(top_builddir)/src/runtime/universe_connect.lo \
|
||||
$(top_builddir)/src/util/sys_info.lo
|
||||
$(top_builddir)/src/libmpi.la
|
||||
|
||||
openmpi_DFLAGS = $(LIBMPI_EXTRA_LDFLAGS) $(LIBOMPI_EXTRA_LDFLAGS)
|
||||
openmpi_DEPENDENCIES = $(libs) \
|
||||
|
@ -1,33 +1,32 @@
|
||||
/*
|
||||
openmpi.c - main program for spawning persistent universe.
|
||||
openmpi.c - main program for spawning persistent universe.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Authors: Ralph H. Castain <rhc@lanl.gov>
|
||||
Authors: Ralph H. Castain <rhc@lanl.gov>
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
*/
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "runtime/runtime.h"
|
||||
#include "runtime/universe_connect.h"
|
||||
#include "util/os_path.h"
|
||||
#include "util/sys_info.h"
|
||||
#include "util/cmd_line.h"
|
||||
#include "util/common_cmd_line.h"
|
||||
|
||||
#include "util/proc_info.h"
|
||||
#include "util/session_dir.h"
|
||||
/* #include "runtime/universe_init.h" */
|
||||
#include "runtime/universe_connect.h"
|
||||
#include "util/printf.h"
|
||||
#include "util/daemon_init.h"
|
||||
#include "mca/base/base.h"
|
||||
#include "tools/openmpi/openmpi.h"
|
||||
|
||||
/* BWB - fix me - removed to be cleaned up later... */
|
||||
#define ompi_universe_init(a)
|
||||
|
||||
|
||||
ompi_universe_t ompi_universe = {
|
||||
/* .name = */ NULL,
|
||||
@ -43,48 +42,100 @@ ompi_universe_t ompi_universe = {
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ompi_cmd_line_t *cmd_line = NULL;
|
||||
ompi_cmd_line_t *cmd_line = NULL, *mca_cmd_line=NULL;
|
||||
char *tmpdir = NULL;
|
||||
char *universe = NULL;
|
||||
char *tmp, *universe_name, *remote_host, *remote_uid;
|
||||
char *script_file, *socket_contact_info, *oob_contact_info;
|
||||
int ret;
|
||||
bool persistent, silent, script, webserver;
|
||||
bool multi_thread = false;
|
||||
bool hidden_thread = false;
|
||||
FILE *fp;
|
||||
|
||||
tmp = universe_name = remote_host = remote_uid = NULL;
|
||||
tmp = universe_name = remote_host = remote_uid = script_file = NULL;
|
||||
persistent = silent = script = webserver = false;
|
||||
|
||||
/* setup to read common command line options that span all Open MPI programs */
|
||||
ompi_common_cmd_line_init(argc, argv);
|
||||
/* require tcp oob */
|
||||
setenv("OMPI_MCA_oob_base_include", "tcp", 1);
|
||||
|
||||
/* setup to check non-common command line options - ones specific to this program */
|
||||
cmd_line = ompi_cmd_line_create();
|
||||
if (NULL == cmd_line) {
|
||||
fprintf(stderr,"openmpi: Command line handle could not be created - please report error to bugs@open-mpi.org");
|
||||
exit(errno);
|
||||
/*
|
||||
* Intialize the Open MPI environment
|
||||
*/
|
||||
if (OMPI_SUCCESS != ompi_init(argc, argv)) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: ompi_init failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 'v', "version", 0,
|
||||
"Show version of Open MPI and this program");
|
||||
ompi_cmd_line_make_opt(cmd_line, 'w', "webserver", 1,
|
||||
/* get the system info and setup defaults */
|
||||
ompi_sys_info();
|
||||
ompi_universe.host = strdup(ompi_system_info.nodename);
|
||||
ompi_universe.uid = strdup(ompi_system_info.user);
|
||||
ompi_universe.name = strdup("default-universe");
|
||||
|
||||
|
||||
/* setup to read common command line options that span all Open MPI programs */
|
||||
if (OMPI_SUCCESS != (ret = ompi_common_cmd_line_init(argc, argv))) {
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
if (ompi_cmd_line_is_taken(ompi_common_cmd_line, "help") ||
|
||||
ompi_cmd_line_is_taken(ompi_common_cmd_line, "h")) {
|
||||
printf("...showing ompi_info help message...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* setup the rte command line arguments */
|
||||
cmd_line = ompi_cmd_line_create();
|
||||
ompi_cmd_line_make_opt(cmd_line, 's', "seed", 0,
|
||||
"Set the daemon seed to true.");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line,
|
||||
'u', "universe", 1,
|
||||
"Specify the Open MPI universe");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line,
|
||||
't', "tmpdir", 1,
|
||||
"Specify the Open MPI prefix for the session directory");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 'w', "webserver", 0,
|
||||
"Web server available");
|
||||
ompi_cmd_line_make_opt(cmd_line, 's', "silent", 1,
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 's', "silent", 0,
|
||||
"No console prompt - operate silently");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 'f', "script", 1,
|
||||
"Read commands from script file");
|
||||
ompi_cmd_line_make_opt(cmd_line, 'h', "help", 0,
|
||||
"Show help for this function");
|
||||
|
||||
if ((OMPI_SUCCESS != ompi_cmd_line_parse(cmd_line, false, argc, argv)) ||
|
||||
ompi_cmd_line_is_taken(cmd_line, "help")) {
|
||||
fprintf(stderr, "...showing openmpi help message...\n");
|
||||
exit(1);
|
||||
/*
|
||||
* setup mca command line arguments
|
||||
*/
|
||||
mca_cmd_line = ompi_cmd_line_create();
|
||||
if (OMPI_SUCCESS != (ret = mca_base_cmd_line_setup(mca_cmd_line))) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: mca_base_cmd_line_setup failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != mca_base_cmd_line_process_args(mca_cmd_line)) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: mca_base_cmd_line_process_args\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != ompi_cmd_line_parse(cmd_line, true, argc, argv)) {
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
/* get universe name and store it, if user specified it */
|
||||
/* otherwise, stick with default 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)) {
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "universe")) {
|
||||
if (NULL == ompi_cmd_line_get_param(cmd_line, "universe", 0, 0)) {
|
||||
fprintf(stderr, "error retrieving universe name - please report error to bugs@open-mpi.org\n");
|
||||
exit(1);
|
||||
}
|
||||
universe = strdup(ompi_cmd_line_get_param(ompi_common_cmd_line, "universe", 0, 0));
|
||||
universe = strdup(ompi_cmd_line_get_param(cmd_line, "universe", 0, 0));
|
||||
|
||||
if (NULL != (tmp = strchr(universe, ':'))) { /* name contains remote host */
|
||||
/* get the host name, and the universe name separated */
|
||||
@ -103,62 +154,139 @@ int main(int argc, char **argv)
|
||||
} else { /* no remote host - just universe name provided */
|
||||
ompi_universe.name = strdup(universe);
|
||||
}
|
||||
} else {
|
||||
ompi_universe.name = strdup("default-universe");
|
||||
}
|
||||
|
||||
/* get the temporary directory name for the session directory, if provided on command line */
|
||||
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)) {
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "tmpdir")) {
|
||||
if (NULL == ompi_cmd_line_get_param(cmd_line, "tmpdir", 0, 0)) {
|
||||
fprintf(stderr, "error retrieving tmpdir name - please report error to bugs@open-mpi.org\n");
|
||||
exit(1);
|
||||
}
|
||||
tmpdir = strdup(ompi_cmd_line_get_param(ompi_common_cmd_line, "tmpdir", 0, 0));
|
||||
tmpdir = strdup(ompi_cmd_line_get_param(cmd_line, "tmpdir", 0, 0));
|
||||
} else {
|
||||
tmpdir = NULL;
|
||||
}
|
||||
|
||||
/* startup the MCA so we can use OOB */
|
||||
/* if (OMPI_ERROR == ompi_mca_init()) {
|
||||
fprintf(stderr, "MCA could not start - please report error to bugs@open-mpi.org\n");
|
||||
exit (1);
|
||||
}
|
||||
*/
|
||||
/* find out if silent */
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "silent")) {
|
||||
silent = true;
|
||||
}
|
||||
|
||||
/* find out if web interface is desired */
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "webserver")) {
|
||||
webserver = true;
|
||||
}
|
||||
|
||||
/* find out if script is to be executed */
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "script")) {
|
||||
script = true;
|
||||
if (NULL == ompi_cmd_line_get_param(cmd_line, "script", 0, 0)) {
|
||||
fprintf(stderr, "error retrieving script file name - please report error to bugs@open-mpi.org\n");
|
||||
exit(1);
|
||||
}
|
||||
script_file = strdup(ompi_cmd_line_get_param(cmd_line, "script", 0, 0));
|
||||
}
|
||||
|
||||
/* does universe already exist on specified host? Check session directory to see */
|
||||
/* don't know how to handle remote host yet - only cover localhost */
|
||||
|
||||
if (NULL == ompi_universe.host) { /* localhost specified */
|
||||
if (NULL == (tmp = ompi_session_dir(false, tmpdir, ompi_system_info.user, ompi_universe.name,
|
||||
NULL, NULL))) { /* not found */
|
||||
if (NULL == ompi_universe.host) { /* localhost specified or defaulted */
|
||||
if (OMPI_SUCCESS == ompi_session_dir(false, tmpdir, ompi_system_info.user, ompi_system_info.nodename, NULL,
|
||||
ompi_universe.name, NULL, NULL)) { /* found */
|
||||
fprintf(stderr, "think i found something\n");
|
||||
/* check for "contact-info" file. if present, read it in. if not present, wait one second (might
|
||||
* be race condition) and try again. second failure => abnormal termination, go ahead and create own
|
||||
* file and assume prior seed daemon died
|
||||
*/
|
||||
/* read the universe info - see if it's persistent */
|
||||
/* if not persistent, augment universe name until unique, create own universe and continue */
|
||||
/* if persistent, use contact info to connect */
|
||||
|
||||
/* if (OMPI_ERROR == ompi_universe_connect(tmp)) { /\* try to connect *\/ */
|
||||
/* /\* first failure - try to start universe and then try again *\/ */
|
||||
/* if (NULL == (tmp = ompi_universe_init(tmpdir, ompi_system_info.user, */
|
||||
/* ompi_universe.name))) { /\* couldn't create universe - error *\/ */
|
||||
/* fprintf(stderr, "could not create universe session directory tree - please report error to bugs@open-mpi.org\n"); */
|
||||
/* exit(1); */
|
||||
/* } */
|
||||
/* if (OMPI_ERROR == ompi_universe_connect(tmp)) { /\* try to connect *\/ */
|
||||
/* /\* second failure - we're doomed *\/ */
|
||||
/* fprintf(stderr, "could not connect to universe - please report error to bugs@open-mpi.org\n"); */
|
||||
/* exit(1); */
|
||||
/* } */
|
||||
/* } */
|
||||
} else {
|
||||
fprintf(stderr, "session dir not found - creating it - calling univ_init\n");
|
||||
/* setup universe and connections */
|
||||
if (NULL == (tmp = ompi_universe_init(tmpdir, ompi_system_info.user,
|
||||
ompi_universe.name))) { /* couldn't create universe - error */
|
||||
/* setup universe session directory */
|
||||
if (OMPI_SUCCESS != ompi_session_dir(true, tmpdir, ompi_system_info.user, ompi_system_info.nodename, NULL,
|
||||
ompi_universe.name, NULL, NULL)) { /* couldn't create session dir - error */
|
||||
fprintf(stderr, "could not create universe session directory tree - please report error to bugs@open-mpi.org\n");
|
||||
exit(1);
|
||||
}
|
||||
if (OMPI_ERROR == ompi_universe_connect(tmp)) { /* try to connect */
|
||||
/* failed - we're doomed */
|
||||
fprintf(stderr, "could not connect to universe - please report error to bugs@open-mpi.org\n");
|
||||
|
||||
/* convert myself to be the seed daemon */
|
||||
ompi_process_info.seed = true;
|
||||
ompi_process_info.my_universe = strdup(ompi_universe.name);
|
||||
|
||||
if (OMPI_SUCCESS != daemon_init(ompi_process_info.universe_session_dir)) {
|
||||
fprintf(stderr, "could not convert to daemon - please report error to bugs@open-mpi.org\n");
|
||||
exit(1);
|
||||
}
|
||||
} else { /* was found! read session info and try to connect */
|
||||
fprintf(stderr, "think i found something\n");
|
||||
if (OMPI_ERROR == ompi_universe_connect(tmp)) { /* try to connect */
|
||||
/* first failure - try to start universe and then try again */
|
||||
if (NULL == (tmp = ompi_universe_init(tmpdir, ompi_system_info.user,
|
||||
ompi_universe.name))) { /* couldn't create universe - error */
|
||||
fprintf(stderr, "could not create universe session directory tree - please report error to bugs@open-mpi.org\n");
|
||||
exit(1);
|
||||
}
|
||||
if (OMPI_ERROR == ompi_universe_connect(tmp)) { /* try to connect */
|
||||
/* second failure - we're doomed */
|
||||
fprintf(stderr, "could not connect to universe - please report error to bugs@open-mpi.org\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the Open MPI Run Time Environment
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: mca_base_open failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != ompi_rte_init(&multi_thread, &hidden_thread)) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: ompi_rte_init failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* get OOB contact info */
|
||||
oob_contact_info = mca_oob_get_contact_info();
|
||||
|
||||
/* get Web contact info */
|
||||
socket_contact_info = strdup("dum.add.for.tst");
|
||||
|
||||
/* save all pertinent info in universe file */
|
||||
contact_file = ompi_os_path(false, ompi_process_info.universe_session_dir,
|
||||
"universe-setup.txt", NULL);
|
||||
fp = fopen(contact_file, "w");
|
||||
if (NULL == fp) {
|
||||
ompi_output(0, "cannot open file to save contact info");
|
||||
exit(1);
|
||||
}
|
||||
fprintf(fp, "name: %s\n", ompi_universe.name);
|
||||
fprintf(fp, "host: %s\n", ompi_universe.host);
|
||||
fprintf(fp, "user: %s\n", ompi_universe.uid);
|
||||
if (persistent) {
|
||||
fprintf(fp, "state: persistent\n");
|
||||
} else {
|
||||
fprintf(fp, "state: non-persistent\n");
|
||||
}
|
||||
if (silent) {
|
||||
fprintf(fp, "mode: silent\n");
|
||||
} else {
|
||||
fprintf(fp, "mode: console\n");
|
||||
}
|
||||
if (webserver) {
|
||||
fprintf(fp, "socket: %s\n", socket_contact_info);
|
||||
}
|
||||
fprintf(fp, "oob: %s\n", oob_contact_info);
|
||||
fclose(fp);
|
||||
|
||||
}
|
||||
}
|
||||
/* spawn console process */
|
||||
if (!silent) {
|
||||
fprintf(stderr, "SUCCESS - spawned console process!\n");
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ headers = \
|
||||
os_create_dirpath.h \
|
||||
pow2.h \
|
||||
session_dir.h \
|
||||
daemon_init.h \
|
||||
strncpy.h
|
||||
|
||||
libutil_la_SOURCES = \
|
||||
@ -52,6 +53,7 @@ libutil_la_SOURCES = \
|
||||
os_create_dirpath.c \
|
||||
pow2.c \
|
||||
session_dir.c \
|
||||
daemon_init.c \
|
||||
strncpy.c
|
||||
|
||||
# Conditionally install the header files
|
||||
|
@ -27,16 +27,18 @@ int ompi_common_cmd_line_init(int argc, char **argv)
|
||||
|
||||
/* Setup the options that are allowable */
|
||||
|
||||
ompi_cmd_line_make_opt(ompi_common_cmd_line,
|
||||
'u', "--universe", 1,
|
||||
"Specify the Open MPI universe");
|
||||
ompi_cmd_line_make_opt(ompi_common_cmd_line,
|
||||
't', "--tmpdir", 1,
|
||||
"Specify the Open MPI prefix for the session directory");
|
||||
ompi_cmd_line_make_opt(ompi_common_cmd_line, 'v', "version", 0,
|
||||
"Show version of Open MPI and this program");
|
||||
|
||||
ompi_cmd_line_make_opt(ompi_common_cmd_line, 'h', "help", 0,
|
||||
"Show help for this function");
|
||||
|
||||
|
||||
/* Parse the command line */
|
||||
|
||||
ompi_cmd_line_parse(ompi_common_cmd_line, true, argc, argv);
|
||||
if (OMPI_SUCCESS != ompi_cmd_line_parse(ompi_common_cmd_line, true, argc, argv)) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* Done */
|
||||
|
||||
|
35
src/util/daemon_init.c
Обычный файл
35
src/util/daemon_init.c
Обычный файл
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
/** @file **/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "util/daemon_init.h"
|
||||
|
||||
int daemon_init(char *working_dir)
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
if ((pid = fork()) < 0) {
|
||||
return OMPI_ERROR;
|
||||
} else if (pid != 0) {
|
||||
exit(0); /* parent goes bye-bye */
|
||||
}
|
||||
/* child continues */
|
||||
setsid(); /* become session leader */
|
||||
|
||||
if (NULL != working_dir) {
|
||||
chdir(working_dir); /* change working directory */
|
||||
}
|
||||
|
||||
umask(0); /* clear file mode creation mask */
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
21
src/util/daemon_init.h
Обычный файл
21
src/util/daemon_init.h
Обычный файл
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
/** @file **/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
/*
|
||||
* Turn a process into a daemon.
|
||||
*
|
||||
* This function converts a process into a daemon in an orderly manner. It first forks a child process,
|
||||
* then the parent exits. The child continues on to become a session leader, reset the file mode creation
|
||||
* mask, and changes working directories to the one specified.
|
||||
*
|
||||
* @param working_dir Pointer to a character string containing the desired working directory. Providing
|
||||
* a value of NULL will cause the function to leave the program in the current working directory.
|
||||
*
|
||||
* @retval OMPI_SUCCESS Indicates that the conversion was successful
|
||||
* @retval OMPI_ERROR Indicates that the conversion was not successful - a fork could not be completed.
|
||||
*/
|
||||
int daemon_init(char *working_dir);
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "runtime/runtime.h"
|
||||
#include "mca/ns/ns.h"
|
||||
#include "mca/ns/base/base.h"
|
||||
#include "mca/pcm/pcm.h"
|
||||
#include "util/proc_info.h"
|
||||
#include "util/sys_info.h"
|
||||
@ -22,6 +22,8 @@ ompi_proc_info_t ompi_process_info = {
|
||||
/* .pid = */ 0,
|
||||
/* .name = */ NULL,
|
||||
/* .seed = */ false,
|
||||
/* .my_universe = */ NULL,
|
||||
/* .tmpdir_base = */ NULL,
|
||||
/* .universe_session_dir = */ NULL,
|
||||
/* .job_session_dir = */ NULL,
|
||||
/* .proc_session_dir = */ NULL,
|
||||
@ -44,7 +46,11 @@ int ompi_proc_info(void)
|
||||
ompi_process_info.pid = getpid();
|
||||
|
||||
/* set process name */
|
||||
if (ompi_process_info.seed) {
|
||||
ompi_process_info.name = ompi_name_server.create_process_name(0, 0, 0);
|
||||
} else {
|
||||
ompi_process_info.name = ompi_rte_get_self();
|
||||
}
|
||||
|
||||
/* set process to inited */
|
||||
ompi_process_info.init = true;
|
||||
|
@ -30,6 +30,8 @@ struct ompi_proc_info_t {
|
||||
pid_t pid; /**< Local process ID for this process */
|
||||
ompi_process_name_t *name; /**< Process name structure */
|
||||
bool seed; /**< Indicate whether or not this is seed daemon */
|
||||
char *my_universe; /**< The name of the universe to which this process belongs */
|
||||
char *tmpdir_base; /**< Base directory of the session dir tree */
|
||||
char *universe_session_dir; /**< Location of universe temp dir.
|
||||
* The session directory has the form
|
||||
* <prefix><openmpi-sessions-user><universe>, where the prefix
|
||||
|
@ -118,28 +118,44 @@ int ompi_session_dir(bool create, char *prefix, char *user, char *hostid, char *
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != prefix) { /* if a prefix is specified, this is the only place we look */
|
||||
fulldirpath = strdup(ompi_os_path(false, prefix, sessions, NULL)); /* make sure it's an absolute pathname */
|
||||
if (NULL != prefix) { /* if a prefix is specified, start looking here */
|
||||
tmp = strdup(prefix);
|
||||
fulldirpath = strdup(ompi_os_path(false, tmp, sessions, NULL)); /* make sure it's an absolute pathname */
|
||||
if (OMPI_SUCCESS == ompi_check_dir(create, fulldirpath)) { /* check for existence and access, or create it */
|
||||
return_code = OMPI_SUCCESS;
|
||||
goto COMPLETE;
|
||||
}
|
||||
else {
|
||||
return_code = OMPI_ERROR;
|
||||
goto CLEANUP; /* user specified location, but we can't access it nor create it */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* no prefix was specified, so check other options in order */
|
||||
if (NULL != getenv("OMPI_PREFIX_ENV")) {
|
||||
if (NULL != getenv("OMPI_PREFIX_ENV")) { /* we have prefix enviro var - try that next */
|
||||
tmp = strdup(getenv("OMPI_PREFIX_ENV"));
|
||||
fulldirpath = strdup(ompi_os_path(false, tmp, sessions, NULL));
|
||||
if (OMPI_SUCCESS == ompi_check_dir(create, fulldirpath)) { /* check for existence and access, or create it */
|
||||
return_code = OMPI_SUCCESS;
|
||||
goto COMPLETE;
|
||||
}
|
||||
} else if (NULL != getenv("TMPDIR")) {
|
||||
tmp = strdup(getenv("TMPDIR"));
|
||||
fulldirpath = strdup(ompi_os_path(false, tmp, sessions, NULL));
|
||||
if (OMPI_SUCCESS == ompi_check_dir(create, fulldirpath)) { /* check for existence and access, or create it */
|
||||
return_code = OMPI_SUCCESS;
|
||||
goto COMPLETE;
|
||||
}
|
||||
} else if (NULL != getenv("TMP")) {
|
||||
tmp = strdup(getenv("TMP"));
|
||||
fulldirpath = strdup(ompi_os_path(false, tmp, sessions, NULL));
|
||||
if (OMPI_SUCCESS == ompi_check_dir(create, fulldirpath)) { /* check for existence and access, or create it */
|
||||
return_code = OMPI_SUCCESS;
|
||||
goto COMPLETE;
|
||||
}
|
||||
} else {
|
||||
tmp = strdup(OMPI_DEFAULT_TMPDIR);
|
||||
}
|
||||
fulldirpath = strdup(ompi_os_path(false, tmp, sessions, NULL));
|
||||
if (OMPI_SUCCESS == ompi_check_dir(create, fulldirpath)) { /* check for existence and access, or create it */
|
||||
return_code = OMPI_SUCCESS;
|
||||
goto COMPLETE;
|
||||
} }
|
||||
|
||||
fulldirpath = strdup(ompi_os_path(false, tmp, sessions, NULL));
|
||||
if (OMPI_SUCCESS == ompi_check_dir(create, fulldirpath)) { /* check for existence and access, or create it */
|
||||
@ -151,20 +167,19 @@ int ompi_session_dir(bool create, char *prefix, char *user, char *hostid, char *
|
||||
}
|
||||
|
||||
COMPLETE:
|
||||
if (proc) {
|
||||
if (create) {
|
||||
ompi_process_info.proc_session_dir = strdup(fulldirpath);
|
||||
}
|
||||
fulldirpath = dirname(fulldirpath);
|
||||
}
|
||||
if (job) {
|
||||
if (create) {
|
||||
ompi_process_info.job_session_dir = strdup(fulldirpath);
|
||||
}
|
||||
fulldirpath = dirname(fulldirpath);
|
||||
}
|
||||
if (create) {
|
||||
if (proc) {
|
||||
ompi_process_info.proc_session_dir = strdup(fulldirpath);
|
||||
fulldirpath = dirname(fulldirpath);
|
||||
}
|
||||
|
||||
if (job) {
|
||||
ompi_process_info.job_session_dir = strdup(fulldirpath);
|
||||
fulldirpath = dirname(fulldirpath);
|
||||
}
|
||||
|
||||
ompi_process_info.universe_session_dir = strdup(fulldirpath);
|
||||
ompi_process_info.tmpdir_base = strdup(tmp);
|
||||
}
|
||||
|
||||
CLEANUP:
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user