Checkpoint the new openmpi/daemon development. Shouldn't impact anyone out there.
This commit was SVN r2523.
Этот коммит содержится в:
родитель
718be11bdb
Коммит
02f1342291
@ -30,8 +30,9 @@ libruntime_la_SOURCES = \
|
||||
ompi_rte_llm.c \
|
||||
ompi_rte_monitor.c \
|
||||
ompi_rte_cmd_line_setup.c \
|
||||
ompi_rte_universe_exists.c \
|
||||
ompi_rte_parse_seed_cmd_line.c \
|
||||
ompi_rte_local_universe_exists.c \
|
||||
ompi_rte_parse_cmd_line.c \
|
||||
ompi_rte_parse_daemon_cmd_line.c \
|
||||
ompi_rte_pcm.c
|
||||
|
||||
# Conditionally install the header files
|
||||
|
@ -12,33 +12,60 @@
|
||||
|
||||
#include "util/cmd_line.h"
|
||||
|
||||
#include "runtime/runtime.h"
|
||||
|
||||
void ompi_rte_cmd_line_setup(ompi_cmd_line_t *cmd_line)
|
||||
{
|
||||
/* setup the rte command line arguments */
|
||||
ompi_cmd_line_make_opt(cmd_line,
|
||||
's', "seed", 0,
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_daemon_cmd_line */
|
||||
's', "seed", "seed", 0,
|
||||
"Set the daemon seed to true.");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line,
|
||||
'u', "universe", 1,
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_daemon_cmd_line */
|
||||
'\0', "probe", "probe", 0,
|
||||
"Define as probe");
|
||||
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_cmd_line */
|
||||
'u', "universe", "universe", 1,
|
||||
"Specify the Open MPI universe");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line,
|
||||
't', "tmpdir", 1,
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_cmd_line */
|
||||
'\0', "tmpdir", "tmpdir", 1,
|
||||
"Specify the Open MPI prefix for the session directory");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 'w', "webserver", 0,
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_daemon_cmd_line */
|
||||
'\0', "persistent", "persistent", 0,
|
||||
"Universe is to be persistent");
|
||||
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_daemon_cmd_line */
|
||||
'w', "webserver", "webserver", 0,
|
||||
"Web server available");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 's', "silent", 0,
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_daemon_cmd_line */
|
||||
's', "silent", "silent", 0,
|
||||
"No console prompt - operate silently");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 'f', "script", 1,
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_daemon_cmd_line */
|
||||
'f', "script", "script", 1,
|
||||
"Read commands from script file");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 'c', "scope", 1,
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_daemon_cmd_line */
|
||||
'\0', "scope", "scope", 1,
|
||||
"Scope of this universe");
|
||||
|
||||
ompi_cmd_line_make_opt(cmd_line, 'h', "hostfile", 1,
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_daemon_cmd_line */
|
||||
'\0', "hostfile", "hostfile", 1,
|
||||
"Hostfile for this universe");
|
||||
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_daemon_cmd_line */
|
||||
'\0', "nameserver", "nameserver", 0,
|
||||
"Setup a name server replica");
|
||||
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_daemon_cmd_line */
|
||||
'\0', "registry", "registry", 0,
|
||||
"Setup a GPR replica");
|
||||
|
||||
ompi_cmd_line_make_opt3(cmd_line, /* read in ompi_rte_parse_cmd_line */
|
||||
'\0', "initcontact", "initcontact", 1,
|
||||
"Initial oob contact info");
|
||||
}
|
||||
|
@ -98,7 +98,10 @@ ompi_universe_t ompi_universe_info = {
|
||||
/* .pid = */ 0,
|
||||
/* .persistence = */ false,
|
||||
/* .scope = */ "local",
|
||||
/* .probe = */ false,
|
||||
/* .silent_mode = */ true,
|
||||
/* .ns_replica = */ false,
|
||||
/* .gpr_replica = */ false,
|
||||
/* .web_server = */ false,
|
||||
/* .socket_contact_info = */ NULL,
|
||||
/* .oob_contact_info = */ NULL,
|
||||
@ -137,6 +140,8 @@ int ompi_rte_init_stage1(bool *allow_multi_user_threads, bool *have_hidden_threa
|
||||
}
|
||||
user_threads = true;
|
||||
hidden_threads = false;
|
||||
|
||||
|
||||
if (OMPI_SUCCESS != (ret = mca_oob_base_init(&user_threads,
|
||||
&hidden_threads))) {
|
||||
/* JMS show_help */
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "util/output.h"
|
||||
#include "util/sys_info.h"
|
||||
#include "util/proc_info.h"
|
||||
#include "util/os_path.h"
|
||||
@ -28,24 +29,29 @@
|
||||
|
||||
|
||||
|
||||
int ompi_rte_universe_exists(char *host, char *name, char *tmpdir, char *oob_contact_info)
|
||||
int ompi_rte_local_universe_exists()
|
||||
{
|
||||
char *contact_file;
|
||||
int32_t command, recv_tag;
|
||||
int ret;
|
||||
ompi_process_name_t seed={0,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 (0 != strncmp(host, ompi_system_info.nodename, strlen(ompi_system_info.nodename))) { /* remote host specified */
|
||||
fprintf(stderr, "remote hosts not currently supported\n");
|
||||
if (0 != strncmp(ompi_universe_info.host, ompi_system_info.nodename, strlen(ompi_system_info.nodename))) { /* remote host specified */
|
||||
ompi_output(0, "remote hosts not supported");
|
||||
return OMPI_ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* check to see if local universe already exists */
|
||||
if (OMPI_SUCCESS == ompi_session_dir(false, tmpdir, ompi_system_info.user, ompi_system_info.nodename, NULL,
|
||||
name, NULL, NULL)) { /* found */
|
||||
if (OMPI_SUCCESS == ompi_session_dir(false,
|
||||
ompi_process_info.tmpdir_base,
|
||||
ompi_system_info.user,
|
||||
ompi_system_info.nodename,
|
||||
NULL,
|
||||
ompi_universe_info.name,
|
||||
NULL,
|
||||
NULL)) { /* found */
|
||||
/* check for "contact-info" file. if present, read it in. */
|
||||
contact_file = ompi_os_path(false, ompi_process_info.universe_session_dir,
|
||||
"universe-setup.txt", NULL);
|
||||
@ -55,13 +61,16 @@ int ompi_rte_universe_exists(char *host, char *name, char *tmpdir, char *oob_con
|
||||
}
|
||||
|
||||
if (!ompi_universe_info.persistence || /* not persistent... */
|
||||
(0 == strncmp(ompi_universe_info.scope, "local", strlen("local")))) { /* ...or no connection allowed */
|
||||
(0 == strncmp(ompi_universe_info.scope, "exclusive", strlen("exclusive")))) { /* ...or no connection allowed */
|
||||
/* also need to check "local" and that we did not specify the exact
|
||||
* matching universe name
|
||||
*/
|
||||
return OMPI_ERR_NO_CONNECTION_ALLOWED;
|
||||
}
|
||||
|
||||
/* if persistent, set contact info... */
|
||||
if (OMPI_SUCCESS != mca_oob_set_contact_info(ompi_universe_info.oob_contact_info)) { /* set contact info */
|
||||
fprintf(stderr, "error setting oob contact info - please report error to bugs@open-mpi.org\n");
|
||||
ompi_output(0, "error setting oob contact info - please report error to bugs@open-mpi.org\n");
|
||||
return OMPI_ERR_FATAL;
|
||||
}
|
||||
|
||||
@ -74,4 +83,6 @@ int ompi_rte_universe_exists(char *host, char *name, char *tmpdir, char *oob_con
|
||||
ompi_process_info.my_universe = strdup(ompi_universe_info.name);
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
return OMPI_ERR_NOT_FOUND;
|
||||
}
|
@ -11,13 +11,14 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "util/output.h"
|
||||
#include "util/cmd_line.h"
|
||||
#include "util/sys_info.h"
|
||||
#include "util/proc_info.h"
|
||||
|
||||
#include "runtime/runtime.h"
|
||||
|
||||
void ompi_rte_parse_seed_cmd_line(ompi_cmd_line_t *cmd_line)
|
||||
void ompi_rte_parse_cmd_line(ompi_cmd_line_t *cmd_line)
|
||||
{
|
||||
char *universe, *tmp;
|
||||
|
||||
@ -32,6 +33,7 @@ void ompi_rte_parse_seed_cmd_line(ompi_cmd_line_t *cmd_line)
|
||||
}
|
||||
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 */
|
||||
/* could be in form remote-uid@remote-host:universe */
|
||||
@ -50,15 +52,8 @@ void ompi_rte_parse_seed_cmd_line(ompi_cmd_line_t *cmd_line)
|
||||
ompi_universe_info.name = strdup(universe);
|
||||
}
|
||||
}
|
||||
|
||||
/* get desired universe scope, if specified */
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "scope")) {
|
||||
if (NULL == ompi_cmd_line_get_param(cmd_line, "scope", 0, 0)) {
|
||||
fprintf(stderr, "error retrieving universe scope - please report error to bugs@open-mpi.org\n");
|
||||
exit(1);
|
||||
}
|
||||
ompi_universe_info.scope = strdup(ompi_cmd_line_get_param(cmd_line, "scope", 0, 0));
|
||||
}
|
||||
/* copy the universe name into the process_info structure */
|
||||
ompi_process_info.my_universe = strdup(ompi_universe_info.name);
|
||||
|
||||
/* get the temporary directory name for the session directory, if provided on command line */
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "tmpdir")) {
|
||||
@ -70,40 +65,4 @@ void ompi_rte_parse_seed_cmd_line(ompi_cmd_line_t *cmd_line)
|
||||
} else {
|
||||
ompi_process_info.tmpdir_base = NULL;
|
||||
}
|
||||
|
||||
/* find out if silent */
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "silent")) {
|
||||
ompi_universe_info.silent_mode = true;
|
||||
} else {
|
||||
ompi_universe_info.silent_mode = false;
|
||||
}
|
||||
|
||||
/* find out if web interface is desired */
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "webserver")) {
|
||||
ompi_universe_info.web_server = true;
|
||||
} else {
|
||||
ompi_universe_info.web_server = false;
|
||||
}
|
||||
|
||||
/* find out if script is to be executed */
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "script")) {
|
||||
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);
|
||||
}
|
||||
ompi_universe_info.scriptfile = strdup(ompi_cmd_line_get_param(cmd_line, "script", 0, 0));
|
||||
} else {
|
||||
ompi_universe_info.scriptfile = NULL;
|
||||
}
|
||||
|
||||
/* Find out if hostfile specified */
|
||||
if (ompi_cmd_line_is_taken(cmd_line, "hostfile")) {
|
||||
if (NULL == ompi_cmd_line_get_param(cmd_line, "hostfile", 0, 0)) {
|
||||
fprintf(stderr, "error retrieving host file name - please report error to bugs@open-mpi.org\n");
|
||||
exit(1);
|
||||
}
|
||||
ompi_universe_info.hostfile = strdup(ompi_cmd_line_get_param(cmd_line, "hostfile", 0, 0));
|
||||
} else {
|
||||
ompi_universe_info.hostfile = NULL;
|
||||
}
|
||||
}
|
@ -40,7 +40,10 @@ extern "C" {
|
||||
pid_t pid;
|
||||
bool persistence;
|
||||
char *scope;
|
||||
bool probe;
|
||||
bool silent_mode;
|
||||
bool ns_replica;
|
||||
bool gpr_replica;
|
||||
bool web_server;
|
||||
char *socket_contact_info;
|
||||
char *oob_contact_info;
|
||||
@ -246,18 +249,29 @@ extern "C" {
|
||||
/**
|
||||
* Parse the rte command line for options
|
||||
*
|
||||
* Parses the specified command line for rte/seed daemon specific options.
|
||||
* Parses the specified command line for rte specific options.
|
||||
* Fills the relevant global structures with the information obtained.
|
||||
*
|
||||
* @param cmd_line Command line to be parsed.
|
||||
* @retval None
|
||||
*/
|
||||
void ompi_rte_parse_seed_cmd_line(ompi_cmd_line_t *cmd_line);
|
||||
void ompi_rte_parse_cmd_line(ompi_cmd_line_t *cmd_line);
|
||||
|
||||
/**
|
||||
* Parse the rte command line for daemon-specific options
|
||||
*
|
||||
* Parses the specified command line for rte daemon-specific options.
|
||||
* Fills the relevant global structures with the information obtained.
|
||||
*
|
||||
* @param cmd_line Command line to be parsed.
|
||||
* @retval None
|
||||
*/
|
||||
void ompi_rte_parse_daemon_cmd_line(ompi_cmd_line_t *cmd_line);
|
||||
|
||||
/**
|
||||
* Check for universe existence
|
||||
*
|
||||
* Checks to see if a specified universe exists. If so, attempts
|
||||
* Checks to see if a specified universe exists on the local host. If so, attempts
|
||||
* to connect to verify that the universe is accepting connections.
|
||||
*
|
||||
* @param None Reads everything from the process_info and system_info
|
||||
@ -272,8 +286,7 @@ extern "C" {
|
||||
* @retval OMPI_CONNECTION_REFUSED Universe found and contact made, but
|
||||
* universe refused to allow connection.
|
||||
*/
|
||||
int ompi_rte_universe_exists(char *host, char *name, char *tmpdir,
|
||||
char *oob_contact_inf);
|
||||
int ompi_rte_local_universe_exists(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "runtime/runtime.h"
|
||||
#include "runtime/universe_connect.h"
|
||||
#include "util/output.h"
|
||||
#include "util/sys_info.h"
|
||||
#include "util/cmd_line.h"
|
||||
#include "util/common_cmd_line.h"
|
||||
@ -38,92 +39,86 @@ const char *type_base = "base";
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
char **tmp;
|
||||
|
||||
bool multi_thread = false;
|
||||
bool hidden_thread = false;
|
||||
|
||||
ompi_cmd_line_t *mca_cmd_line=NULL;
|
||||
|
||||
/* /\* */
|
||||
/* * Intialize the Open MPI environment */
|
||||
/* *\/ */
|
||||
/* if (OMPI_SUCCESS != ompi_init(argc, argv)) { */
|
||||
/* /\* BWB show_help *\/ */
|
||||
/* printf("show_help: ompi_init failed\n"); */
|
||||
/* return ret; */
|
||||
/* } */
|
||||
/* require tcp oob */
|
||||
setenv("OMPI_MCA_oob_base_include", "tcp", 1);
|
||||
|
||||
/* /\* get the system info *\/ */
|
||||
/* ompi_sys_info(); */
|
||||
/*
|
||||
* Intialize the Open MPI environment
|
||||
*/
|
||||
if (OMPI_SUCCESS != ompi_init(argc, argv)) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: ompi_init failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* /\* 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 the system info */
|
||||
ompi_sys_info();
|
||||
|
||||
/* 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); */
|
||||
/* } */
|
||||
ompi_output(0, "HEY - YOU CALLED ME");
|
||||
tmp = argv;
|
||||
for (i=0; i<argc; i++) {
|
||||
ompi_output(0, "\tompid args: %d %s", i,*tmp);
|
||||
tmp++;
|
||||
}
|
||||
|
||||
/* /\* setup the rte command line arguments *\/ */
|
||||
/* cmd_line = OBJ_NEW(ompi_cmd_line_t); */
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/* ompi_cmd_line_make_opt(cmd_line, */
|
||||
/* 'u', "universe", 1, */
|
||||
/* "Specify the Open MPI universe"); */
|
||||
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);
|
||||
}
|
||||
|
||||
/* ompi_cmd_line_make_opt(cmd_line, */
|
||||
/* 't', "tmpdir", 1, */
|
||||
/* "Specify the Open MPI prefix for the session directory"); */
|
||||
if (ompi_cmd_line_is_taken(ompi_common_cmd_line, "version") ||
|
||||
ompi_cmd_line_is_taken(ompi_common_cmd_line, "v")) {
|
||||
printf("...showing off my version!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* ompi_cmd_line_make_opt(cmd_line, 'w', "webserver", 0, */
|
||||
/* "Web server available"); */
|
||||
/* setup rte command line arguments */
|
||||
cmd_line = OBJ_NEW(ompi_cmd_line_t);
|
||||
ompi_rte_cmd_line_setup(cmd_line);
|
||||
|
||||
/* ompi_cmd_line_make_opt(cmd_line, 's', "silent", 0, */
|
||||
/* "No console prompt - operate silently"); */
|
||||
/*
|
||||
* setup mca command line arguments
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = mca_base_cmd_line_setup(cmd_line))) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: mca_base_cmd_line_setup failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ompi_cmd_line_make_opt(cmd_line, 'f', "script", 1, */
|
||||
/* "Read commands from script file"); */
|
||||
if (OMPI_SUCCESS != mca_base_cmd_line_process_args(cmd_line)) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: mca_base_cmd_line_process_args\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* /\* */
|
||||
/* * setup mca command line arguments */
|
||||
/* *\/ */
|
||||
/* mca_cmd_line = OBJ_NEW(ompi_cmd_line_t); */
|
||||
/* 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; */
|
||||
/* } */
|
||||
/* parse the local commands */
|
||||
if (OMPI_SUCCESS != ompi_cmd_line_parse(cmd_line, true, argc, argv)) {
|
||||
exit(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); */
|
||||
/* } */
|
||||
/* parse the cmd_line for rte options - provides the universe name
|
||||
* and temp directory base, if provided by user. Both loaded into
|
||||
* ompi_universe_info and ompi_process_info structures as specified
|
||||
*/
|
||||
ompi_rte_parse_cmd_line(cmd_line);
|
||||
|
||||
|
||||
/* /\* 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 -seed is used to start the universe (seed) daemon.\n"); */
|
||||
/* printf("\n"); */
|
||||
/* #else */
|
||||
/* show_help("ompid", "usage", NULL); */
|
||||
/* #endif */
|
||||
/* exit(1); */
|
||||
/* } */
|
||||
|
||||
|
||||
/* if (OMPI_SUCCESS != (ret = mca_base_open())) { */
|
||||
@ -181,6 +176,35 @@ int main(int argc, char *argv[])
|
||||
/* /\* */
|
||||
/* * if seed, call open functions of comm frameworks (oob, socket, etc.) to */
|
||||
/* * get contact info. write contact info into universe session directory */
|
||||
|
||||
/* /\* get OOB contact info *\/ */
|
||||
/* ompi_universe.oob_contact_info = mca_oob_get_contact_info(); */
|
||||
|
||||
/* /\* get Web contact info *\/ */
|
||||
/* ompi_universe.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); */
|
||||
|
||||
/* if (OMPI_SUCCESS != ompi_write_universe_setup_file(contact_file, &ompi_universe)) { */
|
||||
/* fprintf(stderr, "couldn't write universe setup file: %s\n", contact_file); */
|
||||
/* exit(1); */
|
||||
/* } */
|
||||
|
||||
/* /\* put info on the registry *\/ */
|
||||
|
||||
/* fprintf(stderr, "openmpi: entering event loop\n"); */
|
||||
/* /\* event loop *\/ */
|
||||
|
||||
|
||||
/* /\* if hostfile, startup virtual machine *\/ */
|
||||
/* /\* check registry for nodes in hostfile - if not found, add them *\/ */
|
||||
/* /\* send command - ompi_vm_startup to seed that causes it to read registry segment, check if ompid already */
|
||||
/* * on each node, spin one up if not *\/ */
|
||||
|
||||
|
||||
|
||||
/* * as file "contact-info" so others can find us. */
|
||||
/* *\/ */
|
||||
|
||||
@ -194,6 +218,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* OBJ_RELEASE(cmd_line); */
|
||||
/* mca_base_close(); */
|
||||
/* ompi_finalize(); */
|
||||
/* return 0; */
|
||||
ompi_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
@ -16,51 +16,53 @@
|
||||
*/
|
||||
#define OMPI_DAEMON_OOB_PACK_CMD OMPI_INT16
|
||||
|
||||
#define OMPI_DAEMON_INITIAL_CONTACT_CMD 0x01
|
||||
#define OMPI_DAEMON_CONTACT_ACK_CMD 0x02
|
||||
#define OMPI_DAEMON_HOSTFILE_CMD 0x01
|
||||
#define OMPI_DAEMON_SCRIPTFILE_CMD 0x02
|
||||
|
||||
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
|
||||
typedef char *type_vector_t;
|
||||
typedef uint16_t ompi_daemon_cmd_flag_t;
|
||||
|
||||
extern bool pretty;
|
||||
extern ompi_cmd_line_t *cmd_line;
|
||||
typedef char *type_vector_t;
|
||||
|
||||
extern const char *type_all;
|
||||
extern const char *type_ompi;
|
||||
extern const char *type_base;
|
||||
extern type_vector_t mca_types;
|
||||
extern bool pretty;
|
||||
extern ompi_cmd_line_t *cmd_line;
|
||||
|
||||
/*
|
||||
* Version-related strings and functions
|
||||
*/
|
||||
extern const char *type_all;
|
||||
extern const char *type_ompi;
|
||||
extern const char *type_base;
|
||||
extern type_vector_t mca_types;
|
||||
|
||||
extern const char *ver_full;
|
||||
extern const char *ver_major;
|
||||
extern const char *ver_minor;
|
||||
extern const char *ver_release;
|
||||
extern const char *ver_alpha;
|
||||
extern const char *ver_beta;
|
||||
extern const char *ver_svn;
|
||||
/*
|
||||
* Version-related strings and functions
|
||||
*/
|
||||
|
||||
void do_version(bool want_all, ompi_cmd_line_t *cmd_line);
|
||||
void show_ompi_version(const char *scope);
|
||||
extern const char *ver_full;
|
||||
extern const char *ver_major;
|
||||
extern const char *ver_minor;
|
||||
extern const char *ver_release;
|
||||
extern const char *ver_alpha;
|
||||
extern const char *ver_beta;
|
||||
extern const char *ver_svn;
|
||||
|
||||
/*
|
||||
* Parameter/configuration-related functions
|
||||
*/
|
||||
void do_version(bool want_all, ompi_cmd_line_t *cmd_line);
|
||||
void show_ompi_version(const char *scope);
|
||||
|
||||
extern char *param_all;
|
||||
/*
|
||||
* Parameter/configuration-related functions
|
||||
*/
|
||||
|
||||
extern char *path_prefix;
|
||||
extern char *path_bindir;
|
||||
extern char *path_libdir;
|
||||
extern char *path_incdir;
|
||||
extern char *path_pkglibdir;
|
||||
extern char *path_sysconfdir;
|
||||
extern char *param_all;
|
||||
|
||||
extern char *path_prefix;
|
||||
extern char *path_bindir;
|
||||
extern char *path_libdir;
|
||||
extern char *path_incdir;
|
||||
extern char *path_pkglibdir;
|
||||
extern char *path_sysconfdir;
|
||||
|
||||
|
||||
#endif /* OMPID_H */
|
||||
|
@ -12,42 +12,51 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "event/event.h"
|
||||
#include "include/constants.h"
|
||||
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
#include "util/os_path.h"
|
||||
#include "util/pack.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 "event/event.h"
|
||||
#include "util/universe_setup_file_io.h"
|
||||
|
||||
#include "mca/base/base.h"
|
||||
#include "mca/oob/base/base.h"
|
||||
#include "mca/ns/base/base.h"
|
||||
#include "mca/pcm/base/base.h"
|
||||
|
||||
#include "tools/ompid/ompid.h"
|
||||
|
||||
#include "util/universe_setup_file_io.h"
|
||||
#include "runtime/universe_connect.h"
|
||||
#include "runtime/runtime.h"
|
||||
|
||||
extern char** environ;
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
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;
|
||||
char *contact_file;
|
||||
int ret;
|
||||
ompi_cmd_line_t *cmd_line = NULL;
|
||||
char *universe = NULL, *tmp=NULL, **tmp2=NULL;
|
||||
char *contact_info=NULL;
|
||||
char **seed_argv;
|
||||
pid_t pid;
|
||||
bool persistent, silent, script, webserver;
|
||||
bool multi_thread = false;
|
||||
bool hidden_thread = false;
|
||||
|
||||
tmp = universe_name = remote_host = remote_uid = script_file = NULL;
|
||||
persistent = silent = script = webserver = false;
|
||||
int ret, i, seed_argc;
|
||||
ompi_rte_node_schedule_t *sched;
|
||||
char cwd[MAXPATHLEN];
|
||||
ompi_list_t *nodelist = NULL;
|
||||
ompi_list_t schedlist;
|
||||
|
||||
/* require tcp oob */
|
||||
setenv("OMPI_MCA_oob_base_include", "tcp", 1);
|
||||
@ -66,6 +75,10 @@ int main(int argc, char **argv)
|
||||
ompi_universe_info.host = strdup(ompi_system_info.nodename);
|
||||
ompi_universe_info.uid = strdup(ompi_system_info.user);
|
||||
|
||||
/* give myself default bootstrap name */
|
||||
ompi_process_info.name = ns_base_create_process_name(MCA_NS_BASE_CELLID_MAX,
|
||||
MCA_NS_BASE_JOBID_MAX,
|
||||
MCA_NS_BASE_VPID_MAX);
|
||||
|
||||
/* setup to read common command line options that span all Open MPI programs */
|
||||
if (OMPI_SUCCESS != (ret = ompi_common_cmd_line_init(argc, argv))) {
|
||||
@ -91,14 +104,13 @@ int main(int argc, char **argv)
|
||||
/*
|
||||
* setup mca command line arguments
|
||||
*/
|
||||
mca_cmd_line = OBJ_NEW(ompi_cmd_line_t);
|
||||
if (OMPI_SUCCESS != (ret = mca_base_cmd_line_setup(mca_cmd_line))) {
|
||||
if (OMPI_SUCCESS != (ret = mca_base_cmd_line_setup(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)) {
|
||||
if (OMPI_SUCCESS != mca_base_cmd_line_process_args(cmd_line)) {
|
||||
/* BWB show_help */
|
||||
printf("show_help: mca_base_cmd_line_process_args\n");
|
||||
return ret;
|
||||
@ -110,87 +122,160 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
/* /\* parse the cmd_line for seed daemon options *\/ */
|
||||
/* ompi_rte_parse_seed_cmd_line(cmd_line); */
|
||||
/* parse the cmd_line for rte options */
|
||||
ompi_rte_parse_cmd_line(cmd_line);
|
||||
|
||||
/* /\* check for universe existence *\/ */
|
||||
/* if (OMPI_SUCCESS != ompi_rte_universe_exists()) { */
|
||||
/* /\* check exit codes */
|
||||
/* * exists, but connect not allowed or refused *\/ */
|
||||
/* /\*define unique name based on current one and start new universe *\/ */
|
||||
/* pid = getpid(); */
|
||||
/* if (0 < asprintf(&ompi_universe.name, "%s-%d", universe, pid)) { */
|
||||
/* fprintf(stderr, "error creating unique universe name - please report error to bugs@open-mpi.org\n"); */
|
||||
/* exit(1); */
|
||||
|
||||
/** RHC - THIS NEEDS TO BE FIXED **/
|
||||
ompi_process_info.seed = true;
|
||||
setenv("OMPI_MCA_oob_base_include", "tcp", 1);
|
||||
|
||||
|
||||
/* start the initial barebones RTE (just OOB) so we can check universe existence */
|
||||
if (OMPI_SUCCESS != (ret = mca_base_open())) {
|
||||
/* JMS show_help */
|
||||
printf("show_help: mca_base_open failed\n");
|
||||
exit(ret);
|
||||
}
|
||||
ompi_rte_init_stage1(&multi_thread, &hidden_thread);
|
||||
|
||||
/* check for local universe existence */
|
||||
if ((0 == strncmp(ompi_universe_info.host, ompi_system_info.nodename, strlen(ompi_system_info.nodename))) &&
|
||||
(OMPI_SUCCESS != (ret = ompi_rte_local_universe_exists())) &&
|
||||
(OMPI_ERR_NOT_IMPLEMENTED != ret)) {
|
||||
|
||||
if (OMPI_ERR_NOT_FOUND != ret) {
|
||||
/* if not found, then keep current name. otherwise,
|
||||
* define unique name based on current one.
|
||||
* either way, start new universe
|
||||
*/
|
||||
universe = strdup(ompi_universe_info.name);
|
||||
free(ompi_universe_info.name);
|
||||
pid = getpid();
|
||||
if (0 < asprintf(&ompi_universe_info.name, "%s-%d", universe, pid)) {
|
||||
fprintf(stderr, "error creating unique universe name - please report error to bugs@open-mpi.org\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
ompi_process_info.my_universe = strdup(ompi_universe_info.name);
|
||||
|
||||
/* parse command line for rest of seed options */
|
||||
ompi_rte_parse_daemon_cmd_line(cmd_line);
|
||||
|
||||
/* does not exist - need to start it locally
|
||||
* using fork/exec process
|
||||
*/
|
||||
if ((pid = fork()) < 0) {
|
||||
fprintf(stderr, "unable to start universe - please report error to bugs@open-mpi.org\n");
|
||||
exit(-1);
|
||||
} else if (pid == 0) { /* child process does the exec */
|
||||
|
||||
/* build the command line options for the seed
|
||||
* including universe name and tmpdir_base
|
||||
*/
|
||||
seed_argv = NULL;
|
||||
ompi_argv_append(&seed_argc, &seed_argv, "ompid");
|
||||
ompi_argv_append(&seed_argc, &seed_argv, "-seed");
|
||||
ompi_argv_append(&seed_argc, &seed_argv, "-nameserver");
|
||||
ompi_argv_append(&seed_argc, &seed_argv, "-registry");
|
||||
asprintf(&tmp, "-scope %s", ompi_universe_info.scope);
|
||||
ompi_argv_append(&seed_argc, &seed_argv, tmp);
|
||||
free(tmp);
|
||||
if (ompi_universe_info.persistence) {
|
||||
ompi_argv_append(&seed_argc, &seed_argv, "-persistent");
|
||||
}
|
||||
if (ompi_universe_info.web_server) {
|
||||
ompi_argv_append(&seed_argc, &seed_argv, "-webserver");
|
||||
}
|
||||
if (NULL != ompi_universe_info.scriptfile) {
|
||||
asprintf(&tmp, "-script %s", ompi_universe_info.scriptfile);
|
||||
ompi_argv_append(&seed_argc, &seed_argv, tmp);
|
||||
free(tmp);
|
||||
}
|
||||
if (NULL != ompi_universe_info.hostfile) {
|
||||
asprintf(&tmp, "-hostfile %s", ompi_universe_info.hostfile);
|
||||
ompi_argv_append(&seed_argc, &seed_argv, tmp);
|
||||
free(tmp);
|
||||
}
|
||||
/* provide my contact info */
|
||||
contact_info = mca_oob_get_contact_info();
|
||||
asprintf(&tmp, "-initcontact %s", contact_info);
|
||||
ompi_argv_append(&seed_argc, &seed_argv, tmp);
|
||||
free(contact_info);
|
||||
free(tmp);
|
||||
/* add options for universe name and tmpdir_base, if provided */
|
||||
asprintf(&tmp, "-universe %s", ompi_universe_info.name);
|
||||
ompi_argv_append(&seed_argc, &seed_argv, tmp);
|
||||
free(tmp);
|
||||
if (NULL != ompi_process_info.tmpdir_base) {
|
||||
asprintf(&tmp, "-tmpdir %s", ompi_process_info.tmpdir_base);
|
||||
ompi_argv_append(&seed_argc, &seed_argv, tmp);
|
||||
free(tmp);
|
||||
}
|
||||
/* mca_pcm_base_build_base_env(environ, &(sched->env)); */
|
||||
|
||||
/* fprintf(stderr, "getting ready to disgorge\n"); */
|
||||
|
||||
/* tmp2 = seed_argv; */
|
||||
/* for (i=0; i<seed_argc; i++) { */
|
||||
/* fprintf(stderr, "i %d %s\n", i, *tmp2); */
|
||||
/* tmp2++; */
|
||||
/* } */
|
||||
|
||||
/* /\* does not exist - need to start *\/ */
|
||||
/* if (OMPI_SUCCESS != ompi_rte_universe_initiate()) { */
|
||||
/* fprintf(stderr, "unable to start universe services - please report error to bugs@open-mpi.org\n"); */
|
||||
/* exit(1); */
|
||||
/* } */
|
||||
/* } */
|
||||
/*
|
||||
* spawn the seed
|
||||
*/
|
||||
if (0 > execv("../ompid/.libs/ompid", seed_argv)) {
|
||||
fprintf(stderr, "unable to exec daemon - please report error to bugs@open-mpi.org\n");
|
||||
fprintf(stderr, "errno: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
} else { /* check for remote universe existence */
|
||||
/* future implementation: launch probe daemon, providing my contact info, probe
|
||||
* checks for session directory on remote machine and transmits back results
|
||||
* then probe dies
|
||||
*/
|
||||
}
|
||||
|
||||
/* /\* universe already exists and we can connect - see what else needs doing *\/ */
|
||||
/* goto OPERATE; */
|
||||
|
||||
/* } */
|
||||
|
||||
/* /\* universe must not already exist, so create it from scratch *\/ */
|
||||
/* STARTUP: */
|
||||
|
||||
/* /\* spinoff ompid with "seed" flag set - it will become the seed daemon for this universe *\/ */
|
||||
|
||||
/* /\* */
|
||||
/* * 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 *\/ */
|
||||
/* ompi_universe.oob_contact_info = mca_oob_get_contact_info(); */
|
||||
|
||||
/* /\* get Web contact info *\/ */
|
||||
/* ompi_universe.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); */
|
||||
|
||||
/* if (OMPI_SUCCESS != ompi_write_universe_setup_file(contact_file, &ompi_universe)) { */
|
||||
/* fprintf(stderr, "couldn't write universe setup file: %s\n", contact_file); */
|
||||
/* exit(1); */
|
||||
/* } */
|
||||
|
||||
/* /\* put info on the registry *\/ */
|
||||
|
||||
/* fprintf(stderr, "openmpi: entering event loop\n"); */
|
||||
/* /\* event loop *\/ */
|
||||
/* ompi_event_loop(0); */
|
||||
/* /\* spawn console process *\/ */
|
||||
/* if (!silent) { */
|
||||
/* fprintf(stderr, "SUCCESS - spawned console process!\n"); */
|
||||
/* } */
|
||||
|
||||
/* OPERATE: */
|
||||
/* /\* if hostfile, startup virtual machine *\/ */
|
||||
/* /\* check registry for nodes in hostfile - if not found, add them *\/ */
|
||||
/* /\* send command - ompi_vm_startup to seed that causes it to read registry segment, check if ompid already */
|
||||
/* * on each node, spin one up if not *\/ */
|
||||
|
||||
/* /\* if console, kickoff console - point comm at universe *\/ */
|
||||
|
||||
/* /\* all done, so exit! *\/ */
|
||||
/* exit(0); */
|
||||
/* if console, kickoff console - point comm at universe */
|
||||
|
||||
/* all done, so exit! */
|
||||
exit(0);
|
||||
|
||||
}
|
||||
|
||||
/* /\* start the rest of the RTE *\/ */
|
||||
/* ompi_rte_init_stage2(&multi_thread, &hidden_thread); */
|
||||
|
||||
/* fprintf(stderr, "allocating procesors\n"); */
|
||||
|
||||
/* /\* allocate a processor to the job *\/ */
|
||||
/* nodelist = ompi_rte_allocate_resources(0, 0, 1); */
|
||||
/* if (NULL == nodelist) { */
|
||||
/* /\* BWB show_help *\/ */
|
||||
/* printf("show_help: ompi_rte_allocate_resources failed\n"); */
|
||||
/* exit(-1); */
|
||||
/* } */
|
||||
|
||||
/* fprintf(stderr, "scheduling\n"); */
|
||||
|
||||
/* /\* */
|
||||
/* * "schedule" seed process */
|
||||
/* *\/ */
|
||||
/* OBJ_CONSTRUCT(&schedlist, ompi_list_t); */
|
||||
/* sched = OBJ_NEW(ompi_rte_node_schedule_t); */
|
||||
/* ompi_list_append(&schedlist, (ompi_list_item_t*) sched); */
|
||||
/* ompi_argv_append(&(sched->argc), &(sched->argv), */
|
||||
/* "/Users/rcastain/Documents/OpenMPI/src/tools/ompid/ompid"); */
|
||||
/* /\* ompi_cmd_line_get_tail(cmd_line, &(sched->argc), &(sched->argv)); *\/ */
|
||||
|
||||
/* if (OMPI_SUCCESS != mca_pcm.pcm_spawn_procs(0, &schedlist)) { */
|
||||
/* printf("show_help: woops! the seed didn't spawn :( \n"); */
|
||||
/* exit(-1); */
|
||||
/* } */
|
||||
/* getcwd(cwd, MAXPATHLEN); */
|
||||
/* sched->cwd = strdup(cwd); */
|
||||
/* sched->nodelist = nodelist; */
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user