d9acc93efa
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.
174 строки
5.5 KiB
C
174 строки
5.5 KiB
C
/*
|
|
* 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.
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
* University of Stuttgart. All rights reserved.
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
* All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#include "orte_config.h"
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#ifdef HAVE_UNISTD_H
|
|
#include <unistd.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
#include <sys/types.h>
|
|
#endif
|
|
|
|
#include "orte/orte_constants.h"
|
|
#include "opal/mca/base/base.h"
|
|
#include "opal/mca/base/mca_base_param.h"
|
|
|
|
#include "orte/util/proc_info.h"
|
|
|
|
ORTE_DECLSPEC orte_proc_info_t orte_process_info = {
|
|
/* .my_name = */ NULL,
|
|
/* ,app_num = */ -1,
|
|
/* .singleton = */ false,
|
|
/* .vpid_start = */ 0,
|
|
/* .num_procs = */ 1,
|
|
/* .local_rank = */ ORTE_VPID_INVALID,
|
|
/* .num_local_procs = */ 0,
|
|
/* .pid = */ 0,
|
|
/* .seed = */ false,
|
|
/* .daemon = */ false,
|
|
/* .ns_replica_uri = */ NULL,
|
|
/* .gpr_replica_uri = */ NULL,
|
|
/* .ns_replica = */ NULL,
|
|
/* .gpr_replica = */ NULL,
|
|
/* .tmpdir_base = */ NULL,
|
|
/* .top_session_dir = */ NULL,
|
|
/* .universe_session_dir = */ NULL,
|
|
/* .job_session_dir = */ NULL,
|
|
/* .proc_session_dir = */ NULL,
|
|
/* .sock_stdin = */ NULL,
|
|
/* .sock_stdout = */ NULL,
|
|
/* .sock_stderr = */ NULL
|
|
};
|
|
|
|
|
|
int orte_proc_info(void)
|
|
{
|
|
|
|
int id, tmp;
|
|
|
|
/* all other params are set elsewhere */
|
|
|
|
id = mca_base_param_register_int("seed", NULL, NULL, NULL, orte_process_info.seed);
|
|
mca_base_param_lookup_int(id, &tmp);
|
|
orte_process_info.seed = OPAL_INT_TO_BOOL(tmp);
|
|
/* 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;
|
|
}
|
|
|
|
id = mca_base_param_register_int("orte", "app", "num", NULL, -1);
|
|
mca_base_param_lookup_int(id, &tmp);
|
|
orte_process_info.app_num = tmp;
|
|
|
|
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));
|
|
mca_base_param_set_internal(id, true);
|
|
|
|
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));
|
|
mca_base_param_set_internal(id, true);
|
|
|
|
id = mca_base_param_register_string("tmpdir", "base", NULL, NULL, orte_process_info.tmpdir_base);
|
|
mca_base_param_lookup_string(id, &(orte_process_info.tmpdir_base));
|
|
|
|
/* get the process id */
|
|
orte_process_info.pid = getpid();
|
|
|
|
return ORTE_SUCCESS;
|
|
}
|
|
|
|
|
|
int orte_proc_info_finalize(void)
|
|
{
|
|
if (NULL != orte_process_info.my_name) {
|
|
free(orte_process_info.my_name);
|
|
orte_process_info.my_name = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.ns_replica_uri) {
|
|
free(orte_process_info.ns_replica_uri);
|
|
orte_process_info.ns_replica_uri = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.gpr_replica_uri) {
|
|
free(orte_process_info.gpr_replica_uri);
|
|
orte_process_info.gpr_replica_uri = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.ns_replica) {
|
|
free(orte_process_info.ns_replica);
|
|
orte_process_info.ns_replica = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.gpr_replica) {
|
|
free(orte_process_info.gpr_replica);
|
|
orte_process_info.gpr_replica = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.tmpdir_base) {
|
|
free(orte_process_info.tmpdir_base);
|
|
orte_process_info.tmpdir_base = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.top_session_dir) {
|
|
free(orte_process_info.top_session_dir);
|
|
orte_process_info.top_session_dir = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.universe_session_dir) {
|
|
free(orte_process_info.universe_session_dir);
|
|
orte_process_info.universe_session_dir = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.job_session_dir) {
|
|
free(orte_process_info.job_session_dir);
|
|
orte_process_info.job_session_dir = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.proc_session_dir) {
|
|
free(orte_process_info.proc_session_dir);
|
|
orte_process_info.proc_session_dir = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.sock_stdin) {
|
|
free(orte_process_info.sock_stdin);
|
|
orte_process_info.sock_stdin = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.sock_stdout) {
|
|
free(orte_process_info.sock_stdout);
|
|
orte_process_info.sock_stdout = NULL;
|
|
}
|
|
|
|
if (NULL != orte_process_info.sock_stderr) {
|
|
free(orte_process_info.sock_stderr);
|
|
orte_process_info.sock_stderr = NULL;
|
|
}
|
|
|
|
orte_process_info.seed = false;
|
|
orte_process_info.singleton = false;
|
|
orte_process_info.daemon = false;
|
|
|
|
return ORTE_SUCCESS;
|
|
}
|