2004-06-29 08:50:40 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-06-29 08:50:40 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
2004-08-19 03:15:48 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
#include "orte_config.h"
|
2004-08-19 03:15:48 +04:00
|
|
|
|
2004-06-29 08:50:40 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2004-10-20 05:03:09 +04:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2004-06-29 08:50:40 +04:00
|
|
|
#include <unistd.h>
|
2004-10-20 05:03:09 +04:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
2004-06-29 11:02:57 +04:00
|
|
|
#include <sys/types.h>
|
2004-10-20 05:03:09 +04:00
|
|
|
#endif
|
2004-06-29 08:50:40 +04:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/orte_constants.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/util/proc_info.h"
|
2004-06-29 08:50:40 +04:00
|
|
|
|
2006-08-20 19:54:04 +04:00
|
|
|
ORTE_DECLSPEC orte_proc_info_t orte_process_info = {
|
2005-03-14 23:57:21 +03:00
|
|
|
/* .my_name = */ NULL,
|
2006-12-07 06:11:20 +03:00
|
|
|
/* ,app_num = */ -1,
|
2005-05-24 17:39:15 +04:00
|
|
|
/* .singleton = */ false,
|
2005-03-14 23:57:21 +03:00
|
|
|
/* .vpid_start = */ 0,
|
|
|
|
/* .num_procs = */ 1,
|
Compute and pass the local_rank and local number of procs (in that proc's job) on the node.
To be precise, given this hypothetical launching pattern:
host1: vpids 0, 2, 4, 6
host2: vpids 1, 3, 5, 7
The local_rank for these procs would be:
host1: vpids 0->local_rank 0, v2->lr1, v4->lr2, v6->lr3
host2: vpids 1->local_rank 0, v3->lr1, v5->lr2, v7->lr3
and the number of local procs on each node would be four. If vpid=0 then does a comm_spawn of one process on host1, the values of the parent job would remain unchanged. The local_rank of the child process would be 0 and its num_local_procs would be 1 since it is in a separate jobid.
I have verified this functionality for the rsh case - need to verify that slurm and other cases also get the right values. Some consolidation of common code is probably going to occur in the SDS components to make this simpler and more maintainable in the future.
This commit was SVN r14706.
2007-05-21 18:30:10 +04:00
|
|
|
/* .local_rank = */ ORTE_VPID_INVALID,
|
|
|
|
/* .num_local_procs = */ 0,
|
2004-06-29 08:50:40 +04:00
|
|
|
/* .pid = */ 0,
|
2004-07-08 16:43:30 +04:00
|
|
|
/* .seed = */ false,
|
2005-03-14 23:57:21 +03:00
|
|
|
/* .daemon = */ false,
|
|
|
|
/* .ns_replica_uri = */ NULL,
|
|
|
|
/* .gpr_replica_uri = */ NULL,
|
Not as bad as this all may look. Tim and I made a significant change to the way we handle the startup of the oob, the seed, etc. We have made it backwards-compatible so that mpirun2 and singleton operations remain working. We had to adjust the name server and gpr as well, plus the process_info structure.
This also includes a checkpoint update to openmpi.c and ompid.c. I have re-enabled the ompid compile.
This latter raises an important point. The trunk compiles the programs like ompid just fine under Linux. It also does just fine for OSX under the dynamic libraries. However, we are seeing errors when compiling under OSX for the static case - the linker seems to have trouble resolving some variable names, even though linker diagnostics show the variables as being defined. Thus, a warning to Mac users that you may have to locally turn things off if you are trying to do static compiles. We ask, however, that you don't commit those changes that turn things off for everyone else - instead, let's try to figure out why the static compile is having a problem, and let everyone else continue to work.
Thanks
Ralph
This commit was SVN r2534.
2004-09-08 07:59:06 +04:00
|
|
|
/* .ns_replica = */ NULL,
|
|
|
|
/* .gpr_replica = */ NULL,
|
2004-08-24 01:39:22 +04:00
|
|
|
/* .tmpdir_base = */ NULL,
|
2004-08-29 20:37:02 +04:00
|
|
|
/* .top_session_dir = */ NULL,
|
2004-06-29 08:50:40 +04:00
|
|
|
/* .universe_session_dir = */ NULL,
|
|
|
|
/* .job_session_dir = */ NULL,
|
|
|
|
/* .proc_session_dir = */ NULL,
|
|
|
|
/* .sock_stdin = */ NULL,
|
|
|
|
/* .sock_stdout = */ NULL,
|
2005-05-22 07:11:33 +04:00
|
|
|
/* .sock_stderr = */ NULL
|
|
|
|
};
|
2004-06-29 08:50:40 +04:00
|
|
|
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
int orte_proc_info(void)
|
2004-06-29 08:50:40 +04:00
|
|
|
{
|
2004-07-14 22:08:34 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
int id, tmp;
|
|
|
|
|
|
|
|
/* all other params are set elsewhere */
|
|
|
|
|
2005-03-24 18:45:44 +03:00
|
|
|
id = mca_base_param_register_int("seed", NULL, NULL, NULL, orte_process_info.seed);
|
2005-03-14 23:57:21 +03:00
|
|
|
mca_base_param_lookup_int(id, &tmp);
|
2006-08-28 22:59:16 +04:00
|
|
|
orte_process_info.seed = OPAL_INT_TO_BOOL(tmp);
|
2006-09-15 01:29:51 +04:00
|
|
|
/* if we are a seed, then make sure the daemon flag is NOT set so that
|
|
|
|
* framework components are properly selected
|
|
|
|
*/
|
|
|
|
if (orte_process_info.seed) {
|
|
|
|
orte_process_info.daemon = false;
|
|
|
|
}
|
2004-07-14 22:08:34 +04:00
|
|
|
|
2006-12-07 06:11:20 +03:00
|
|
|
id = mca_base_param_register_int("orte", "app", "num", NULL, -1);
|
|
|
|
mca_base_param_lookup_int(id, &tmp);
|
|
|
|
orte_process_info.app_num = tmp;
|
|
|
|
|
2005-03-24 18:45:44 +03:00
|
|
|
id = mca_base_param_register_string("gpr", "replica", "uri", NULL, orte_process_info.gpr_replica_uri);
|
|
|
|
mca_base_param_lookup_string(id, &(orte_process_info.gpr_replica_uri));
|
2005-07-09 01:01:37 +04:00
|
|
|
mca_base_param_set_internal(id, true);
|
2004-06-29 08:50:40 +04:00
|
|
|
|
2005-03-24 18:45:44 +03:00
|
|
|
id = mca_base_param_register_string("ns", "replica", "uri", NULL, orte_process_info.ns_replica_uri);
|
|
|
|
mca_base_param_lookup_string(id, &(orte_process_info.ns_replica_uri));
|
2005-07-09 01:01:37 +04:00
|
|
|
mca_base_param_set_internal(id, true);
|
2004-06-29 08:50:40 +04:00
|
|
|
|
2005-03-24 18:45:44 +03:00
|
|
|
id = mca_base_param_register_string("tmpdir", "base", NULL, NULL, orte_process_info.tmpdir_base);
|
2005-03-14 23:57:21 +03:00
|
|
|
mca_base_param_lookup_string(id, &(orte_process_info.tmpdir_base));
|
2004-07-14 22:08:34 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/* get the process id */
|
|
|
|
orte_process_info.pid = getpid();
|
2004-07-14 22:08:34 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
return ORTE_SUCCESS;
|
2004-06-29 08:50:40 +04:00
|
|
|
}
|
2005-03-19 02:40:08 +03:00
|
|
|
|
|
|
|
|
|
|
|
int orte_proc_info_finalize(void)
|
|
|
|
{
|
|
|
|
if (NULL != orte_process_info.my_name) {
|
|
|
|
free(orte_process_info.my_name);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.my_name = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.ns_replica_uri) {
|
|
|
|
free(orte_process_info.ns_replica_uri);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.ns_replica_uri = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.gpr_replica_uri) {
|
|
|
|
free(orte_process_info.gpr_replica_uri);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.gpr_replica_uri = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.ns_replica) {
|
|
|
|
free(orte_process_info.ns_replica);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.ns_replica = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.gpr_replica) {
|
|
|
|
free(orte_process_info.gpr_replica);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.gpr_replica = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.tmpdir_base) {
|
|
|
|
free(orte_process_info.tmpdir_base);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.tmpdir_base = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.top_session_dir) {
|
|
|
|
free(orte_process_info.top_session_dir);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.top_session_dir = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.universe_session_dir) {
|
|
|
|
free(orte_process_info.universe_session_dir);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.universe_session_dir = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.job_session_dir) {
|
|
|
|
free(orte_process_info.job_session_dir);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.job_session_dir = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.proc_session_dir) {
|
|
|
|
free(orte_process_info.proc_session_dir);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.proc_session_dir = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.sock_stdin) {
|
|
|
|
free(orte_process_info.sock_stdin);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.sock_stdin = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.sock_stdout) {
|
|
|
|
free(orte_process_info.sock_stdout);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.sock_stdout = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != orte_process_info.sock_stderr) {
|
|
|
|
free(orte_process_info.sock_stderr);
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.sock_stderr = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.seed = false;
|
2005-05-24 17:39:15 +04:00
|
|
|
orte_process_info.singleton = false;
|
2005-05-22 07:11:33 +04:00
|
|
|
orte_process_info.daemon = false;
|
|
|
|
|
2005-03-19 02:40:08 +03:00
|
|
|
return ORTE_SUCCESS;
|
2005-03-22 03:31:17 +03:00
|
|
|
}
|