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.
|
2011-06-24 00:38:02 +04:00
|
|
|
* Copyright (c) 2004-2011 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* 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.
|
2009-02-13 07:14:10 +03:00
|
|
|
* Copyright (c) 2009 Cisco Systems, Inc. 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"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/constants.h"
|
2004-08-19 03:15:48 +04:00
|
|
|
|
2004-06-29 08:50:40 +04:00
|
|
|
#include <stdio.h>
|
2008-03-24 02:10:15 +03:00
|
|
|
#include <stdlib.h>
|
2004-06-29 08:50:40 +04:00
|
|
|
#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 "opal/mca/base/base.h"
|
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
2008-06-18 12:10:02 +04:00
|
|
|
#include "opal/util/output.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/util/proc_info.h"
|
2004-06-29 08:50:40 +04:00
|
|
|
|
2011-08-27 02:16:14 +04:00
|
|
|
#if ORTE_ENABLE_EPOCH
|
|
|
|
#define ORTE_NAME_INVALID {ORTE_JOBID_INVALID, ORTE_VPID_INVALID, ORTE_EPOCH_MIN}
|
|
|
|
#else
|
|
|
|
#define ORTE_NAME_INVALID {ORTE_JOBID_INVALID, ORTE_VPID_INVALID}
|
|
|
|
#endif
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
ORTE_DECLSPEC orte_proc_info_t orte_process_info = {
|
2011-08-27 02:16:14 +04:00
|
|
|
/* .my_name = */ ORTE_NAME_INVALID,
|
|
|
|
/* .my_daemon = */ ORTE_NAME_INVALID,
|
2008-02-28 04:57:57 +03:00
|
|
|
/* .my_daemon_uri = */ NULL,
|
2011-08-27 02:16:14 +04:00
|
|
|
/* .my_hnp = */ ORTE_NAME_INVALID,
|
2008-02-28 04:57:57 +03:00
|
|
|
/* .my_hnp_uri = */ NULL,
|
2011-08-27 02:16:14 +04:00
|
|
|
/* .my_parent = */ ORTE_NAME_INVALID,
|
2010-02-27 20:37:34 +03:00
|
|
|
/* .hnp_pid = */ 0,
|
|
|
|
/* .app_num = */ 0,
|
2005-03-14 23:57:21 +03:00
|
|
|
/* .num_procs = */ 1,
|
2011-06-24 00:38:02 +04:00
|
|
|
/* .max_procs = */ 1,
|
2010-05-04 06:40:09 +04:00
|
|
|
/* .num_daemons = */ 1,
|
2009-02-19 23:45:07 +03:00
|
|
|
/* .num_nodes = */ 1,
|
2008-03-24 02:10:15 +03:00
|
|
|
/* .nodename = */ NULL,
|
2004-06-29 08:50:40 +04:00
|
|
|
/* .pid = */ 0,
|
2009-05-04 15:07:40 +04:00
|
|
|
/* .proc_type = */ ORTE_PROC_TYPE_NONE,
|
2008-04-30 23:49:53 +04:00
|
|
|
/* .sync_buf = */ NULL,
|
2009-01-30 21:31:43 +03:00
|
|
|
/* .my_port = */ 0,
|
2010-01-10 05:21:30 +03:00
|
|
|
/* .num_restarts = */ 0,
|
2011-10-20 00:18:14 +04:00
|
|
|
/* .my_node_rank = */ ORTE_NODE_RANK_INVALID,
|
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
|
|
|
/* .job_session_dir = */ NULL,
|
|
|
|
/* .proc_session_dir = */ NULL,
|
|
|
|
/* .sock_stdin = */ NULL,
|
|
|
|
/* .sock_stdout = */ NULL,
|
2011-06-17 18:50:00 +04:00
|
|
|
/* .sock_stderr = */ NULL,
|
At long last, the fabled revision to the affinity system has arrived. A more detailed explanation of how this all works will be presented here:
https://svn.open-mpi.org/trac/ompi/wiki/ProcessPlacement
The wiki page is incomplete at the moment, but I hope to complete it over the next few days. I will provide updates on the devel list. As the wiki page states, the default and most commonly used options remain unchanged (except as noted below). New, esoteric and complex options have been added, but unless you are a true masochist, you are unlikely to use many of them beyond perhaps an initial curiosity-motivated experimentation.
In a nutshell, this commit revamps the map/rank/bind procedure to take into account topology info on the compute nodes. I have, for the most part, preserved the default behaviors, with three notable exceptions:
1. I have at long last bowed my head in submission to the system admin's of managed clusters. For years, they have complained about our default of allowing users to oversubscribe nodes - i.e., to run more processes on a node than allocated slots. Accordingly, I have modified the default behavior: if you are running off of hostfile/dash-host allocated nodes, then the default is to allow oversubscription. If you are running off of RM-allocated nodes, then the default is to NOT allow oversubscription. Flags to override these behaviors are provided, so this only affects the default behavior.
2. both cpus/rank and stride have been removed. The latter was demanded by those who didn't understand the purpose behind it - and I agreed as the users who requested it are no longer using it. The former was removed temporarily pending implementation.
3. vm launch is now the sole method for starting OMPI. It was just too darned hard to maintain multiple launch procedures - maybe someday, provided someone can demonstrate a reason to do so.
As Jeff stated, it is impossible to fully test a change of this size. I have tested it on Linux and Mac, covering all the default and simple options, singletons, and comm_spawn. That said, I'm sure others will find problems, so I'll be watching MTT results until this stabilizes.
This commit was SVN r25476.
2011-11-15 07:40:11 +04:00
|
|
|
#if OPAL_HAVE_HWLOC
|
|
|
|
/* .bind_level = */ OPAL_HWLOC_NODE_LEVEL,
|
|
|
|
/* .bind_idx = */ 0,
|
|
|
|
#endif
|
2011-06-17 18:50:00 +04:00
|
|
|
/* .job_name = */ NULL,
|
|
|
|
/* .job_instance = */ NULL,
|
|
|
|
/* .executable = */ NULL,
|
|
|
|
/* .app_rank = */ -1
|
2005-05-22 07:11:33 +04:00
|
|
|
};
|
2004-06-29 08:50:40 +04:00
|
|
|
|
2008-03-25 05:10:42 +03:00
|
|
|
static bool init=false;
|
2004-06-29 08:50:40 +04:00
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
int orte_proc_info(void)
|
2004-06-29 08:50:40 +04:00
|
|
|
{
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
int tmp;
|
|
|
|
char *uri, *ptr;
|
2008-03-24 02:10:15 +03:00
|
|
|
char hostname[ORTE_MAX_HOSTNAME_SIZE];
|
2008-03-25 05:10:42 +03:00
|
|
|
|
|
|
|
if (init) {
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
init = true;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
mca_base_param_reg_string_name("orte", "hnp_uri",
|
|
|
|
"HNP contact info",
|
|
|
|
true, false, NULL, &uri);
|
|
|
|
if (NULL != uri) {
|
|
|
|
/* the uri value passed to us will have quote marks around it to protect
|
|
|
|
* the value if passed on the command line. We must remove those
|
|
|
|
* to have a correct uri string
|
|
|
|
*/
|
|
|
|
if ('"' == uri[0]) {
|
|
|
|
/* if the first char is a quote, then so will the last one be */
|
2009-02-09 23:40:17 +03:00
|
|
|
uri[strlen(uri)-1] = '\0';
|
2008-02-28 04:57:57 +03:00
|
|
|
ptr = &uri[1];
|
|
|
|
} else {
|
|
|
|
ptr = &uri[0];
|
|
|
|
}
|
2009-03-06 00:56:03 +03:00
|
|
|
orte_process_info.my_hnp_uri = strdup(ptr);
|
2008-02-28 04:57:57 +03:00
|
|
|
free(uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
mca_base_param_reg_string_name("orte", "local_daemon_uri",
|
|
|
|
"Daemon contact info",
|
2009-02-09 23:40:17 +03:00
|
|
|
true, false, NULL, &(uri));
|
|
|
|
|
|
|
|
if (NULL != uri) {
|
|
|
|
/* the uri value passed to us may have quote marks around it to protect
|
|
|
|
* the value if passed on the command line. We must remove those
|
|
|
|
* to have a correct uri string
|
|
|
|
*/
|
|
|
|
if ('"' == uri[0]) {
|
|
|
|
/* if the first char is a quote, then so will the last one be */
|
|
|
|
uri[strlen(uri)-1] = '\0';
|
|
|
|
ptr = &uri[1];
|
|
|
|
} else {
|
|
|
|
ptr = &uri[0];
|
|
|
|
}
|
2009-03-06 00:56:03 +03:00
|
|
|
orte_process_info.my_daemon_uri = strdup(ptr);
|
2009-02-09 23:40:17 +03:00
|
|
|
free(uri);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
mca_base_param_reg_int_name("orte", "app_num",
|
|
|
|
"Index of the app_context that defines this proc",
|
2010-02-27 20:37:34 +03:00
|
|
|
true, false, 0, &tmp);
|
2009-03-06 00:56:03 +03:00
|
|
|
orte_process_info.app_num = tmp;
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/* get the process id */
|
2009-03-06 00:56:03 +03:00
|
|
|
orte_process_info.pid = getpid();
|
2004-07-14 22:08:34 +04:00
|
|
|
|
2008-03-24 02:10:15 +03:00
|
|
|
/* get the nodename */
|
2011-11-30 03:24:52 +04:00
|
|
|
gethostname(hostname, ORTE_MAX_HOSTNAME_SIZE);
|
2009-03-06 00:56:03 +03:00
|
|
|
orte_process_info.nodename = strdup(hostname);
|
2008-04-30 23:49:53 +04:00
|
|
|
|
2009-02-19 23:45:07 +03:00
|
|
|
/* get the number of nodes in the job */
|
|
|
|
mca_base_param_reg_int_name("orte", "num_nodes",
|
|
|
|
"Number of nodes in the job",
|
|
|
|
true, false,
|
2009-03-06 00:56:03 +03:00
|
|
|
orte_process_info.num_nodes, &tmp);
|
|
|
|
orte_process_info.num_nodes = tmp;
|
2009-02-19 23:45:07 +03:00
|
|
|
|
2010-01-10 05:21:30 +03:00
|
|
|
/* get the number of times this proc has restarted */
|
|
|
|
mca_base_param_reg_int_name("orte", "num_restarts",
|
|
|
|
"Number of times this proc has restarted",
|
|
|
|
true, false, 0, &tmp);
|
|
|
|
orte_process_info.num_restarts = tmp;
|
|
|
|
|
2011-06-17 18:50:00 +04:00
|
|
|
mca_base_param_reg_string_name("orte", "job_name",
|
|
|
|
"Job name",
|
|
|
|
true, false, NULL, &orte_process_info.job_name);
|
|
|
|
|
|
|
|
mca_base_param_reg_string_name("orte", "job_instance",
|
|
|
|
"Job instance",
|
|
|
|
true, false, NULL, &orte_process_info.job_instance);
|
|
|
|
|
|
|
|
mca_base_param_reg_string_name("orte", "executable",
|
|
|
|
"Executable",
|
|
|
|
true, false, NULL, &orte_process_info.executable);
|
|
|
|
|
|
|
|
mca_base_param_reg_int_name("orte", "app_rank",
|
|
|
|
"Rank of this proc within its app_context",
|
|
|
|
true, false, 0, &tmp);
|
|
|
|
orte_process_info.app_rank = tmp;
|
|
|
|
|
2011-10-20 00:18:14 +04:00
|
|
|
/* get my node rank in case we are using static ports - this won't
|
|
|
|
* be present for daemons, so don't error out if we don't have it
|
|
|
|
*/
|
|
|
|
mca_base_param_reg_int_name("orte", "ess_node_rank", "Process node rank",
|
|
|
|
true, false, ORTE_NODE_RANK_INVALID, &tmp);
|
|
|
|
orte_process_info.my_node_rank = (orte_node_rank_t)tmp;
|
|
|
|
|
2008-04-30 23:49:53 +04:00
|
|
|
/* setup the sync buffer */
|
2009-03-06 00:56:03 +03:00
|
|
|
orte_process_info.sync_buf = OBJ_NEW(opal_buffer_t);
|
2008-03-24 02:10:15 +03: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)
|
|
|
|
{
|
2008-03-25 05:10:42 +03:00
|
|
|
if (!init) {
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
if (NULL != orte_process_info.tmpdir_base) {
|
|
|
|
free(orte_process_info.tmpdir_base);
|
|
|
|
orte_process_info.tmpdir_base = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
if (NULL != orte_process_info.top_session_dir) {
|
|
|
|
free(orte_process_info.top_session_dir);
|
|
|
|
orte_process_info.top_session_dir = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
if (NULL != orte_process_info.job_session_dir) {
|
|
|
|
free(orte_process_info.job_session_dir);
|
|
|
|
orte_process_info.job_session_dir = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
if (NULL != orte_process_info.proc_session_dir) {
|
|
|
|
free(orte_process_info.proc_session_dir);
|
|
|
|
orte_process_info.proc_session_dir = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
if (NULL != orte_process_info.nodename) {
|
|
|
|
free(orte_process_info.nodename);
|
|
|
|
orte_process_info.nodename = NULL;
|
2008-03-24 02:10:15 +03:00
|
|
|
}
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
if (NULL != orte_process_info.sock_stdin) {
|
|
|
|
free(orte_process_info.sock_stdin);
|
|
|
|
orte_process_info.sock_stdin = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
if (NULL != orte_process_info.sock_stdout) {
|
|
|
|
free(orte_process_info.sock_stdout);
|
|
|
|
orte_process_info.sock_stdout = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
if (NULL != orte_process_info.sock_stderr) {
|
|
|
|
free(orte_process_info.sock_stderr);
|
|
|
|
orte_process_info.sock_stderr = NULL;
|
2005-03-19 02:40:08 +03:00
|
|
|
}
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
if (NULL != orte_process_info.my_hnp_uri) {
|
|
|
|
free(orte_process_info.my_hnp_uri);
|
|
|
|
orte_process_info.my_hnp_uri = NULL;
|
2009-02-13 07:14:10 +03:00
|
|
|
}
|
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
if (NULL != orte_process_info.my_daemon_uri) {
|
|
|
|
free(orte_process_info.my_daemon_uri);
|
|
|
|
orte_process_info.my_daemon_uri = NULL;
|
2009-02-13 07:14:10 +03:00
|
|
|
}
|
|
|
|
|
2009-05-04 15:07:40 +04:00
|
|
|
orte_process_info.proc_type = ORTE_PROC_TYPE_NONE;
|
2005-05-22 07:11:33 +04:00
|
|
|
|
2009-03-06 00:56:03 +03:00
|
|
|
OBJ_RELEASE(orte_process_info.sync_buf);
|
|
|
|
orte_process_info.sync_buf = NULL;
|
2008-05-01 21:48:13 +04:00
|
|
|
|
2008-03-25 05:10:42 +03:00
|
|
|
init = false;
|
2005-03-19 02:40:08 +03:00
|
|
|
return ORTE_SUCCESS;
|
2005-03-22 03:31:17 +03:00
|
|
|
}
|