2008-02-28 04:57:57 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2008-02-28 08:32:23 +03:00
|
|
|
* Copyright (c) 2004-2008 The University of Tennessee and The University
|
2008-02-28 04:57:57 +03:00
|
|
|
* 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 (c) 2007 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
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
|
|
|
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
|
2008-02-28 04:57:57 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
#include "orte_config.h"
|
|
|
|
#include "orte/constants.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#include "opal/class/opal_list.h"
|
|
|
|
#include "opal/util/argv.h"
|
2009-02-14 05:26:12 +03:00
|
|
|
#include "opal/util/output.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/util/if.h"
|
|
|
|
#include "opal/mca/installdirs/installdirs.h"
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
#include "orte/util/show_help.h"
|
2008-03-24 02:10:15 +03:00
|
|
|
#include "orte/util/proc_info.h"
|
2008-03-05 07:54:57 +03:00
|
|
|
#include "orte/util/name_fns.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/mca/ras/ras_types.h"
|
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
|
|
|
|
#include "orte/util/hostfile/hostfile_lex.h"
|
|
|
|
#include "orte/util/hostfile/hostfile.h"
|
|
|
|
|
|
|
|
|
|
|
|
static const char *cur_hostfile_name = NULL;
|
|
|
|
|
|
|
|
static void hostfile_parse_error(int token)
|
|
|
|
{
|
|
|
|
switch (token) {
|
|
|
|
case ORTE_HOSTFILE_STRING:
|
This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-14 00:00:55 +04:00
|
|
|
orte_show_help("help-hostfile.txt", "parse_error_string",
|
2008-02-28 04:57:57 +03:00
|
|
|
true,
|
|
|
|
cur_hostfile_name,
|
|
|
|
orte_util_hostfile_line,
|
|
|
|
token,
|
|
|
|
orte_util_hostfile_value.sval);
|
|
|
|
break;
|
|
|
|
case ORTE_HOSTFILE_IPV4:
|
|
|
|
case ORTE_HOSTFILE_IPV6:
|
|
|
|
case ORTE_HOSTFILE_INT:
|
This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-14 00:00:55 +04:00
|
|
|
orte_show_help("help-hostfile.txt", "parse_error_int",
|
2008-02-28 04:57:57 +03:00
|
|
|
true,
|
|
|
|
cur_hostfile_name,
|
|
|
|
orte_util_hostfile_line,
|
|
|
|
token,
|
|
|
|
orte_util_hostfile_value.ival);
|
|
|
|
break;
|
|
|
|
default:
|
This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-14 00:00:55 +04:00
|
|
|
orte_show_help("help-hostfile.txt", "parse_error",
|
2008-02-28 04:57:57 +03:00
|
|
|
true,
|
|
|
|
cur_hostfile_name,
|
|
|
|
orte_util_hostfile_line,
|
|
|
|
token );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the integer following an = (actually may only return positive ints)
|
|
|
|
*/
|
|
|
|
static int hostfile_parse_int(void)
|
|
|
|
{
|
|
|
|
if (ORTE_HOSTFILE_EQUAL != orte_util_hostfile_lex())
|
|
|
|
return -1;
|
|
|
|
if (ORTE_HOSTFILE_INT != orte_util_hostfile_lex())
|
|
|
|
return -1;
|
|
|
|
return orte_util_hostfile_value.ival;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the string following an = (option to a keyword)
|
|
|
|
*/
|
|
|
|
static char *hostfile_parse_string(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
if (ORTE_HOSTFILE_EQUAL != orte_util_hostfile_lex()){
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
rc = orte_util_hostfile_lex();
|
|
|
|
if (ORTE_HOSTFILE_STRING != rc){
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return strdup(orte_util_hostfile_value.sval);
|
|
|
|
}
|
|
|
|
|
|
|
|
static orte_node_t* hostfile_lookup(opal_list_t* nodes, const char* name)
|
|
|
|
{
|
|
|
|
opal_list_item_t* item;
|
|
|
|
for(item = opal_list_get_first(nodes);
|
|
|
|
item != opal_list_get_end(nodes);
|
|
|
|
item = opal_list_get_next(item)) {
|
|
|
|
orte_node_t* node = (orte_node_t*)item;
|
|
|
|
if(strcmp(node->name, name) == 0) {
|
|
|
|
opal_list_remove_item(nodes, item);
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-04-17 17:50:59 +04:00
|
|
|
static int hostfile_parse_line(int token, opal_list_t* updates, opal_list_t* exclude, bool keep_all)
|
2008-02-28 04:57:57 +03:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
orte_node_t* node;
|
|
|
|
bool got_count = false;
|
|
|
|
bool got_max = false;
|
|
|
|
char* value;
|
|
|
|
char** argv;
|
|
|
|
char* node_name = NULL;
|
2009-01-15 21:11:50 +03:00
|
|
|
char* node_alias = NULL;
|
2008-02-28 04:57:57 +03:00
|
|
|
char* username = NULL;
|
|
|
|
int cnt;
|
|
|
|
int number_of_slots = 0;
|
2009-08-13 20:08:43 +04:00
|
|
|
char buff[64];
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
if (ORTE_HOSTFILE_STRING == token ||
|
|
|
|
ORTE_HOSTFILE_HOSTNAME == token ||
|
|
|
|
ORTE_HOSTFILE_INT == token ||
|
|
|
|
ORTE_HOSTFILE_IPV4 == token ||
|
|
|
|
ORTE_HOSTFILE_IPV6 == token) {
|
2008-03-05 07:54:57 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if(ORTE_HOSTFILE_INT == token) {
|
2008-03-26 01:41:25 +03:00
|
|
|
snprintf(buff, 64, "%d", orte_util_hostfile_value.ival);
|
2008-02-28 04:57:57 +03:00
|
|
|
value = buff;
|
|
|
|
} else {
|
|
|
|
value = orte_util_hostfile_value.sval;
|
|
|
|
}
|
|
|
|
argv = opal_argv_split (value, '@');
|
|
|
|
|
|
|
|
cnt = opal_argv_count (argv);
|
|
|
|
if (1 == cnt) {
|
|
|
|
node_name = strdup(argv[0]);
|
|
|
|
} else if (2 == cnt) {
|
|
|
|
username = strdup(argv[0]);
|
|
|
|
node_name = strdup(argv[1]);
|
|
|
|
} else {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "WARNING: Unhandled user@host-combination\n"); /* XXX */
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
|
|
|
opal_argv_free (argv);
|
|
|
|
|
2008-03-05 07:54:57 +03:00
|
|
|
/* if the first letter of the name is '^', then this is a node
|
|
|
|
* to be excluded. Remove the ^ character so the nodename is
|
|
|
|
* usable, and put it on the exclude list
|
|
|
|
*/
|
|
|
|
if ('^' == node_name[0]) {
|
|
|
|
int i, len;
|
|
|
|
len = strlen(node_name);
|
|
|
|
for (i=1; i < len; i++) {
|
|
|
|
node_name[i-1] = node_name[i];
|
|
|
|
}
|
|
|
|
node_name[len-1] = '\0'; /* truncate */
|
2008-04-17 17:50:59 +04:00
|
|
|
|
2009-09-30 10:47:48 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((3, orte_debug_output,
|
2008-04-17 17:50:59 +04:00
|
|
|
"%s hostfile: node %s is being excluded",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), node_name));
|
2008-04-17 17:50:59 +04:00
|
|
|
|
2008-03-05 07:54:57 +03:00
|
|
|
/* convert this into something globally unique */
|
|
|
|
if (strcmp(node_name, "localhost") == 0 || opal_ifislocal(node_name)) {
|
|
|
|
/* Nodename has been allocated, that is for sure */
|
2008-11-24 22:57:08 +03:00
|
|
|
if (orte_show_resolved_nodenames &&
|
2009-03-06 00:56:03 +03:00
|
|
|
0 != strcmp(node_name, orte_process_info.nodename)) {
|
2009-01-15 21:11:50 +03:00
|
|
|
node_alias = strdup(node_name);
|
2008-11-24 22:57:08 +03:00
|
|
|
}
|
2008-03-05 07:54:57 +03:00
|
|
|
free (node_name);
|
2009-03-06 00:56:03 +03:00
|
|
|
node_name = strdup(orte_process_info.nodename);
|
2008-03-05 07:54:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Do we need to make a new node object? First check to see
|
|
|
|
if it's already in the exclude list */
|
|
|
|
if (NULL == (node = hostfile_lookup(exclude, node_name))) {
|
|
|
|
node = OBJ_NEW(orte_node_t);
|
|
|
|
node->name = node_name;
|
2010-03-11 18:24:18 +03:00
|
|
|
if (NULL != username) {
|
|
|
|
node->username = strdup(username);
|
|
|
|
}
|
2008-03-05 07:54:57 +03:00
|
|
|
}
|
|
|
|
/* Note that we need to add this back to the exclude list.
|
|
|
|
If it was found, we just removed it (in hostfile_lookup()),
|
|
|
|
so this puts it back. If it was not found, then we have to
|
|
|
|
add it to the exclude list anyway. */
|
|
|
|
opal_list_append(exclude, &node->super);
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2009-01-15 21:11:50 +03:00
|
|
|
/* this is not a node to be excluded, so we need to process it and
|
|
|
|
* add it to the "include" list. See if this host is actually us.
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
if (strcmp(node_name, "localhost") == 0 || opal_ifislocal(node_name)) {
|
|
|
|
/* Nodename has been allocated, that is for sure */
|
2008-11-24 22:57:08 +03:00
|
|
|
if (orte_show_resolved_nodenames &&
|
2009-03-06 00:56:03 +03:00
|
|
|
0 != strcmp(node_name, orte_process_info.nodename)) {
|
2009-01-15 21:11:50 +03:00
|
|
|
node_alias = strdup(node_name);
|
2008-11-24 22:57:08 +03:00
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
free (node_name);
|
2009-03-06 00:56:03 +03:00
|
|
|
node_name = strdup(orte_process_info.nodename);
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
|
|
|
|
2009-09-30 10:47:48 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((3, orte_debug_output,
|
2008-04-17 17:50:59 +04:00
|
|
|
"%s hostfile: node %s is being included - keep all is %s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), node_name,
|
2008-04-17 17:50:59 +04:00
|
|
|
keep_all ? "TRUE" : "FALSE"));
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* Do we need to make a new node object? First check to see
|
2008-04-17 17:50:59 +04:00
|
|
|
* if we are keeping everything or if it's already in the updates
|
|
|
|
* list. Because we check keep_all first, if that is set we will
|
|
|
|
* not do the hostfile_lookup call, and thus won't remove the
|
|
|
|
* pre-existing node from the updates list
|
|
|
|
*/
|
|
|
|
if (keep_all || NULL == (node = hostfile_lookup(updates, node_name))) {
|
2008-02-28 04:57:57 +03:00
|
|
|
node = OBJ_NEW(orte_node_t);
|
|
|
|
node->name = node_name;
|
2010-03-11 18:24:18 +03:00
|
|
|
if (NULL != username) {
|
|
|
|
node->username = strdup(username);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
2009-01-15 21:11:50 +03:00
|
|
|
/* do we need to record an alias for this node? */
|
|
|
|
if (NULL != node_alias) {
|
|
|
|
/* add to list of aliases for this node - only add if unique */
|
2009-04-14 18:15:49 +04:00
|
|
|
opal_argv_append_unique_nosize(&node->alias, node_alias, false);
|
2009-01-15 21:11:50 +03:00
|
|
|
free(node_alias);
|
|
|
|
}
|
2008-08-19 19:16:27 +04:00
|
|
|
} else if (ORTE_HOSTFILE_RELATIVE == token) {
|
|
|
|
/* store this for later processing */
|
|
|
|
node = OBJ_NEW(orte_node_t);
|
|
|
|
node->name = strdup(orte_util_hostfile_value.sval);
|
2010-03-11 18:24:18 +03:00
|
|
|
if (NULL != username) {
|
|
|
|
node->username = strdup(username);
|
|
|
|
}
|
2009-08-13 20:08:43 +04:00
|
|
|
} else if (ORTE_HOSTFILE_RANK == token) {
|
|
|
|
/* we can ignore the rank, but we need to extract the node name. we
|
|
|
|
* first need to shift over to the other side of the equal sign as
|
|
|
|
* this is where the node name will be
|
|
|
|
*/
|
|
|
|
while (!orte_util_hostfile_done &&
|
|
|
|
ORTE_HOSTFILE_EQUAL != token) {
|
|
|
|
token = orte_util_hostfile_lex();
|
|
|
|
}
|
|
|
|
if (orte_util_hostfile_done) {
|
|
|
|
/* bad syntax somewhere */
|
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
|
|
|
/* next position should be the node name */
|
|
|
|
token = orte_util_hostfile_lex();
|
|
|
|
if(ORTE_HOSTFILE_INT == token) {
|
|
|
|
snprintf(buff, 64, "%d", orte_util_hostfile_value.ival);
|
|
|
|
value = buff;
|
|
|
|
} else {
|
|
|
|
value = orte_util_hostfile_value.sval;
|
|
|
|
}
|
|
|
|
|
|
|
|
argv = opal_argv_split (value, '@');
|
|
|
|
|
|
|
|
cnt = opal_argv_count (argv);
|
|
|
|
if (1 == cnt) {
|
|
|
|
node_name = strdup(argv[0]);
|
|
|
|
} else if (2 == cnt) {
|
|
|
|
username = strdup(argv[0]);
|
|
|
|
node_name = strdup(argv[1]);
|
|
|
|
} else {
|
|
|
|
opal_output(0, "WARNING: Unhandled user@host-combination\n"); /* XXX */
|
|
|
|
}
|
|
|
|
opal_argv_free (argv);
|
|
|
|
/* Do we need to make a new node object? First check to see
|
|
|
|
* if we are keeping everything or if it's already in the updates
|
|
|
|
* list. Because we check keep_all first, if that is set we will
|
|
|
|
* not do the hostfile_lookup call, and thus won't remove the
|
|
|
|
* pre-existing node from the updates list
|
|
|
|
*/
|
|
|
|
if (keep_all || NULL == (node = hostfile_lookup(updates, node_name))) {
|
|
|
|
node = OBJ_NEW(orte_node_t);
|
|
|
|
node->name = node_name;
|
2010-03-11 18:24:18 +03:00
|
|
|
if (NULL != username) {
|
|
|
|
node->username = strdup(username);
|
|
|
|
}
|
2009-08-13 20:08:43 +04:00
|
|
|
}
|
|
|
|
/* add a slot */
|
|
|
|
node->slots++;
|
|
|
|
/* do we need to record an alias for this node? */
|
|
|
|
if (NULL != node_alias) {
|
|
|
|
/* add to list of aliases for this node - only add if unique */
|
|
|
|
opal_argv_append_unique_nosize(&node->alias, node_alias, false);
|
|
|
|
free(node_alias);
|
|
|
|
}
|
|
|
|
/* skip to end of line */
|
|
|
|
while (!orte_util_hostfile_done &&
|
|
|
|
ORTE_HOSTFILE_NEWLINE != token) {
|
|
|
|
token = orte_util_hostfile_lex();
|
|
|
|
}
|
|
|
|
opal_list_append(updates, &node->super);
|
|
|
|
return ORTE_SUCCESS;
|
2008-02-28 04:57:57 +03:00
|
|
|
} else {
|
|
|
|
hostfile_parse_error(token);
|
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
2009-08-13 20:08:43 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
got_count = false;
|
|
|
|
while (!orte_util_hostfile_done) {
|
|
|
|
token = orte_util_hostfile_lex();
|
2009-08-13 20:08:43 +04:00
|
|
|
|
|
|
|
switch (token) {
|
2008-02-28 04:57:57 +03:00
|
|
|
case ORTE_HOSTFILE_DONE:
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
case ORTE_HOSTFILE_NEWLINE:
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
case ORTE_HOSTFILE_USERNAME:
|
|
|
|
node->username = hostfile_parse_string();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ORTE_HOSTFILE_COUNT:
|
|
|
|
case ORTE_HOSTFILE_CPU:
|
|
|
|
case ORTE_HOSTFILE_SLOTS:
|
|
|
|
rc = hostfile_parse_int();
|
|
|
|
if (rc < 0) {
|
This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-14 00:00:55 +04:00
|
|
|
orte_show_help("help-hostfile.txt", "slots",
|
2008-02-28 04:57:57 +03:00
|
|
|
true,
|
|
|
|
cur_hostfile_name, rc);
|
|
|
|
OBJ_RELEASE(node);
|
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
|
|
|
node->slots += rc;
|
|
|
|
got_count = true;
|
|
|
|
|
|
|
|
/* Ensure that slots_max >= slots */
|
|
|
|
if (node->slots_max != 0 && node->slots_max < node->slots) {
|
|
|
|
node->slots_max = node->slots;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ORTE_HOSTFILE_SLOTS_MAX:
|
|
|
|
rc = hostfile_parse_int();
|
|
|
|
if (rc < 0) {
|
This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-14 00:00:55 +04:00
|
|
|
orte_show_help("help-hostfile.txt", "max_slots",
|
2008-02-28 04:57:57 +03:00
|
|
|
true,
|
|
|
|
cur_hostfile_name, ((size_t) rc));
|
|
|
|
OBJ_RELEASE(node);
|
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
|
|
|
/* Only take this update if it puts us >= node_slots */
|
|
|
|
if (rc >= node->slots) {
|
|
|
|
if (node->slots_max != rc) {
|
|
|
|
node->slots_max = rc;
|
|
|
|
got_max = true;
|
|
|
|
}
|
|
|
|
} else {
|
This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-14 00:00:55 +04:00
|
|
|
orte_show_help("help-hostfile.txt", "max_slots_lt",
|
2008-02-28 04:57:57 +03:00
|
|
|
true,
|
|
|
|
cur_hostfile_name, node->slots, rc);
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
|
|
|
OBJ_RELEASE(node);
|
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
hostfile_parse_error(token);
|
|
|
|
OBJ_RELEASE(node);
|
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
|
|
|
if (number_of_slots > node->slots) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
|
|
|
OBJ_RELEASE(node);
|
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
2008-04-17 17:50:59 +04:00
|
|
|
if (!got_count) {
|
|
|
|
if (got_max) {
|
|
|
|
node->slots = node->slots_max;
|
|
|
|
} else {
|
|
|
|
++node->slots;
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
|
|
|
}
|
2008-04-17 17:50:59 +04:00
|
|
|
opal_list_append(updates, &node->super);
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse the specified file into a node list.
|
|
|
|
*/
|
|
|
|
|
2008-04-17 17:50:59 +04:00
|
|
|
static int hostfile_parse(const char *hostfile, opal_list_t* updates, opal_list_t* exclude, bool keep_all)
|
2008-02-28 04:57:57 +03:00
|
|
|
{
|
|
|
|
int token;
|
|
|
|
int rc = ORTE_SUCCESS;
|
|
|
|
|
2008-03-05 07:54:57 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
cur_hostfile_name = hostfile;
|
|
|
|
|
|
|
|
orte_util_hostfile_done = false;
|
|
|
|
orte_util_hostfile_in = fopen(hostfile, "r");
|
|
|
|
if (NULL == orte_util_hostfile_in) {
|
2012-02-15 08:16:05 +04:00
|
|
|
if (NULL == orte_default_hostfile ||
|
|
|
|
0 != strcmp(orte_default_hostfile, hostfile)) {
|
|
|
|
/* not the default hostfile, so not finding it
|
|
|
|
* is an error
|
|
|
|
*/
|
|
|
|
orte_show_help("help-hostfile.txt", "no-hostfile", true, hostfile);
|
|
|
|
rc = ORTE_ERR_SILENT;
|
|
|
|
goto unlock;
|
|
|
|
}
|
|
|
|
/* if this is the default hostfile and it was given,
|
|
|
|
* then it's an error
|
|
|
|
*/
|
|
|
|
if (orte_default_hostfile_given) {
|
|
|
|
orte_show_help("help-hostfile.txt", "no-hostfile", true, hostfile);
|
|
|
|
rc = ORTE_ERR_NOT_FOUND;
|
|
|
|
goto unlock;
|
|
|
|
}
|
|
|
|
/* otherwise, not finding it is okay */
|
|
|
|
rc = ORTE_SUCCESS;
|
2008-02-28 04:57:57 +03:00
|
|
|
goto unlock;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (!orte_util_hostfile_done) {
|
|
|
|
token = orte_util_hostfile_lex();
|
|
|
|
|
|
|
|
switch (token) {
|
|
|
|
case ORTE_HOSTFILE_DONE:
|
|
|
|
orte_util_hostfile_done = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ORTE_HOSTFILE_NEWLINE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This looks odd, since we have several forms of host-definitions:
|
|
|
|
* hostname just plain as it is, being a ORTE_HOSTFILE_STRING
|
|
|
|
* IP4s and user@IPv4s
|
|
|
|
* hostname.domain and user@hostname.domain
|
|
|
|
*/
|
|
|
|
case ORTE_HOSTFILE_STRING:
|
|
|
|
case ORTE_HOSTFILE_INT:
|
|
|
|
case ORTE_HOSTFILE_HOSTNAME:
|
|
|
|
case ORTE_HOSTFILE_IPV4:
|
|
|
|
case ORTE_HOSTFILE_IPV6:
|
2008-08-19 19:16:27 +04:00
|
|
|
case ORTE_HOSTFILE_RELATIVE:
|
2009-08-13 20:08:43 +04:00
|
|
|
case ORTE_HOSTFILE_RANK:
|
2008-08-19 19:16:27 +04:00
|
|
|
rc = hostfile_parse_line(token, updates, exclude, keep_all);
|
|
|
|
if (ORTE_SUCCESS != rc) {
|
|
|
|
goto unlock;
|
|
|
|
}
|
|
|
|
break;
|
2009-08-13 20:08:43 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
default:
|
|
|
|
hostfile_parse_error(token);
|
|
|
|
goto unlock;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(orte_util_hostfile_in);
|
|
|
|
orte_util_hostfile_in = NULL;
|
|
|
|
|
|
|
|
unlock:
|
|
|
|
cur_hostfile_name = NULL;
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse the provided hostfile and add the nodes to the list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int orte_util_add_hostfile_nodes(opal_list_t *nodes,
|
|
|
|
char *hostfile)
|
|
|
|
{
|
2008-03-05 07:54:57 +03:00
|
|
|
opal_list_t exclude;
|
|
|
|
opal_list_item_t *item, *itm;
|
2008-02-28 04:57:57 +03:00
|
|
|
int rc;
|
|
|
|
|
2008-03-05 07:54:57 +03:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
2008-03-05 07:54:57 +03:00
|
|
|
"%s hostfile: checking hostfile %s for nodes",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), hostfile));
|
2008-03-05 07:54:57 +03:00
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&exclude, opal_list_t);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
/* parse the hostfile and add the contents to the list */
|
2008-04-17 17:50:59 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = hostfile_parse(hostfile, nodes, &exclude, false))) {
|
2008-02-28 04:57:57 +03:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2008-08-19 19:16:27 +04:00
|
|
|
/* parse the nodes to check for any relative node directives */
|
|
|
|
for (item = opal_list_get_first(nodes);
|
|
|
|
item != opal_list_get_end(nodes);
|
|
|
|
item = opal_list_get_next(item)) {
|
|
|
|
orte_node_t *node=(orte_node_t*)item;
|
|
|
|
|
|
|
|
if ('+' == node->name[0]) {
|
|
|
|
orte_show_help("help-hostfile.txt", "hostfile:relative-syntax",
|
|
|
|
true, node->name);
|
|
|
|
rc = ORTE_ERR_SILENT;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-05 07:54:57 +03:00
|
|
|
/* remove from the list of nodes those that are in the exclude list */
|
|
|
|
while(NULL != (item = opal_list_remove_first(&exclude))) {
|
|
|
|
orte_node_t *exnode = (orte_node_t*)item;
|
|
|
|
/* check for matches on nodes */
|
|
|
|
for (itm = opal_list_get_first(nodes);
|
|
|
|
itm != opal_list_get_end(nodes);
|
|
|
|
itm = opal_list_get_next(itm)) {
|
|
|
|
orte_node_t *node=(orte_node_t*)itm;
|
|
|
|
if (0 == strcmp(exnode->name, node->name)) {
|
|
|
|
/* match - remove it */
|
|
|
|
opal_list_remove_item(nodes, itm);
|
|
|
|
OBJ_RELEASE(itm);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OBJ_RELEASE(item);
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
cleanup:
|
2008-03-05 07:54:57 +03:00
|
|
|
OBJ_DESTRUCT(&exclude);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Parse the provided hostfile and filter the nodes that are
|
|
|
|
* on the input list, removing those that
|
|
|
|
* are not found in the hostfile
|
|
|
|
*/
|
|
|
|
int orte_util_filter_hostfile_nodes(opal_list_t *nodes,
|
2011-12-15 00:01:15 +04:00
|
|
|
char *hostfile,
|
|
|
|
bool remove)
|
2008-02-28 04:57:57 +03:00
|
|
|
{
|
2008-03-05 07:54:57 +03:00
|
|
|
opal_list_t newnodes, exclude;
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
opal_list_item_t *item1, *item2, *next, *item3;
|
2009-06-25 18:08:36 +04:00
|
|
|
orte_node_t *node_from_list, *node_from_file, *node_from_pool, *node3;
|
2008-08-19 19:16:27 +04:00
|
|
|
int rc = ORTE_SUCCESS;
|
|
|
|
char *cptr;
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
int num_empty, nodeidx;
|
2008-08-19 19:16:27 +04:00
|
|
|
bool want_all_empty = false;
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
opal_list_t keep;
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
2008-03-05 07:54:57 +03:00
|
|
|
"%s hostfile: filtering nodes through hostfile %s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), hostfile));
|
2008-03-05 07:54:57 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* parse the hostfile and create local list of findings */
|
|
|
|
OBJ_CONSTRUCT(&newnodes, opal_list_t);
|
2008-03-05 07:54:57 +03:00
|
|
|
OBJ_CONSTRUCT(&exclude, opal_list_t);
|
2008-04-17 17:50:59 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = hostfile_parse(hostfile, &newnodes, &exclude, false))) {
|
2008-02-28 04:57:57 +03:00
|
|
|
OBJ_DESTRUCT(&newnodes);
|
2012-02-01 21:40:44 +04:00
|
|
|
OBJ_DESTRUCT(&exclude);
|
2008-02-28 04:57:57 +03:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2012-02-01 21:40:44 +04:00
|
|
|
/* if the hostfile was empty, then treat it as a no-op filter */
|
|
|
|
if (0 == opal_list_get_size(&newnodes)) {
|
|
|
|
OBJ_DESTRUCT(&newnodes);
|
|
|
|
OBJ_DESTRUCT(&exclude);
|
2012-02-15 07:33:49 +04:00
|
|
|
/* indicate that the hostfile was empty */
|
|
|
|
return ORTE_ERR_TAKE_NEXT_OPTION;
|
2012-02-01 21:40:44 +04:00
|
|
|
}
|
|
|
|
|
2008-08-19 19:16:27 +04:00
|
|
|
/* remove from the list of newnodes those that are in the exclude list
|
|
|
|
* since we could have added duplicate names above due to the */
|
|
|
|
while (NULL != (item1 = opal_list_remove_first(&exclude))) {
|
2008-03-05 07:54:57 +03:00
|
|
|
node_from_file = (orte_node_t*)item1;
|
|
|
|
/* check for matches on nodes */
|
|
|
|
for (item2 = opal_list_get_first(&newnodes);
|
|
|
|
item2 != opal_list_get_end(&newnodes);
|
|
|
|
item2 = opal_list_get_next(item2)) {
|
2008-08-19 19:16:27 +04:00
|
|
|
orte_node_t *node = (orte_node_t*)item2;
|
2008-03-05 07:54:57 +03:00
|
|
|
if (0 == strcmp(node_from_file->name, node->name)) {
|
|
|
|
/* match - remove it */
|
|
|
|
opal_list_remove_item(&newnodes, item2);
|
|
|
|
OBJ_RELEASE(item2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OBJ_RELEASE(item1);
|
|
|
|
}
|
|
|
|
|
2011-12-15 00:01:15 +04:00
|
|
|
/* now check our nodes and keep or mark those that match. We can
|
2008-02-28 04:57:57 +03:00
|
|
|
* destruct our hostfile list as we go since this won't be needed
|
|
|
|
*/
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
OBJ_CONSTRUCT(&keep, opal_list_t);
|
|
|
|
while (NULL != (item2 = opal_list_remove_first(&newnodes))) {
|
|
|
|
node_from_file = (orte_node_t*)item2;
|
|
|
|
|
|
|
|
next = opal_list_get_next(item2);
|
|
|
|
|
|
|
|
/* see if this is a relative node syntax */
|
|
|
|
if ('+' == node_from_file->name[0]) {
|
|
|
|
/* see if we specified empty nodes */
|
|
|
|
if ('e' == node_from_file->name[1] ||
|
|
|
|
'E' == node_from_file->name[1]) {
|
|
|
|
/* request for empty nodes - do they want
|
|
|
|
* all of them?
|
|
|
|
*/
|
|
|
|
if (NULL != (cptr = strchr(node_from_file->name, ':'))) {
|
|
|
|
/* the colon indicates a specific # are requested */
|
|
|
|
cptr++; /* step past : */
|
|
|
|
num_empty = strtol(cptr, NULL, 10);
|
|
|
|
} else {
|
|
|
|
/* want them all - set num_empty to max */
|
|
|
|
num_empty = INT_MAX;
|
|
|
|
want_all_empty = true;
|
|
|
|
}
|
|
|
|
/* search the list of nodes provided to us and find those
|
|
|
|
* that are empty
|
|
|
|
*/
|
|
|
|
item1 = opal_list_get_first(nodes);
|
|
|
|
while (0 < num_empty && item1 != opal_list_get_end(nodes)) {
|
|
|
|
node_from_list = (orte_node_t*)item1;
|
|
|
|
next = opal_list_get_next(item1); /* keep our place */
|
|
|
|
if (0 == node_from_list->slots_inuse) {
|
|
|
|
/* check to see if this node is explicitly called
|
|
|
|
* out later - if so, don't use it here
|
|
|
|
*/
|
|
|
|
for (item3 = opal_list_get_first(&newnodes);
|
|
|
|
item3 != opal_list_get_end(&newnodes);
|
|
|
|
item3 = opal_list_get_next(item3)) {
|
|
|
|
node3 = (orte_node_t*)item3;
|
|
|
|
if (0 == strcmp(node3->name, node_from_list->name)) {
|
|
|
|
/* match - don't use it */
|
|
|
|
goto skipnode;
|
|
|
|
}
|
|
|
|
}
|
2011-12-15 00:01:15 +04:00
|
|
|
if (remove) {
|
|
|
|
/* remove item from list */
|
|
|
|
opal_list_remove_item(nodes, item1);
|
|
|
|
/* xfer to keep list */
|
|
|
|
opal_list_append(&keep, item1);
|
|
|
|
} else {
|
|
|
|
/* mark as included */
|
|
|
|
node_from_list->mapped = true;
|
|
|
|
}
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
--num_empty;
|
|
|
|
}
|
|
|
|
skipnode:
|
|
|
|
item1 = next;
|
|
|
|
}
|
|
|
|
/* did they get everything they wanted? */
|
|
|
|
if (!want_all_empty && 0 < num_empty) {
|
|
|
|
orte_show_help("help-hostfile.txt", "hostfile:not-enough-empty",
|
|
|
|
true, num_empty);
|
|
|
|
rc = ORTE_ERR_SILENT;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
} else if ('n' == node_from_file->name[1] ||
|
|
|
|
'N' == node_from_file->name[1]) {
|
|
|
|
/* they want a specific relative node #, so
|
|
|
|
* look it up on global pool
|
|
|
|
*/
|
|
|
|
nodeidx = strtol(&node_from_file->name[2], NULL, 10);
|
2009-06-25 18:08:36 +04:00
|
|
|
if (NULL == (node_from_pool = (orte_node_t*)opal_pointer_array_get_item(orte_node_pool, nodeidx))) {
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
/* this is an error */
|
|
|
|
orte_show_help("help-hostfile.txt", "hostfile:relative-node-not-found",
|
|
|
|
true, nodeidx, node_from_file->name);
|
|
|
|
rc = ORTE_ERR_SILENT;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
/* search the list of nodes provided to us and find it */
|
|
|
|
for (item1 = opal_list_get_first(nodes);
|
|
|
|
item1 != opal_list_get_end(nodes);
|
|
|
|
item1 = opal_list_get_next(nodes)) {
|
|
|
|
node_from_list = (orte_node_t*)item1;
|
2009-06-25 18:08:36 +04:00
|
|
|
if (0 == strcmp(node_from_list->name, node_from_pool->name)) {
|
2011-12-15 00:01:15 +04:00
|
|
|
if (remove) {
|
|
|
|
/* match - remove item from list */
|
|
|
|
opal_list_remove_item(nodes, item1);
|
|
|
|
/* xfer to keep list */
|
|
|
|
opal_list_append(&keep, item1);
|
|
|
|
} else {
|
|
|
|
/* mark as included */
|
|
|
|
node_from_list->mapped = true;
|
|
|
|
}
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* invalid relative node syntax */
|
|
|
|
orte_show_help("help-hostfile.txt", "hostfile:invalid-relative-node-syntax",
|
|
|
|
true, node_from_file->name);
|
|
|
|
rc = ORTE_ERR_SILENT;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* we are looking for a specific node on the list
|
|
|
|
* search the provided list of nodes to see if this
|
|
|
|
* one is found
|
2008-02-28 04:57:57 +03:00
|
|
|
*/
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
for (item1 = opal_list_get_first(nodes);
|
|
|
|
item1 != opal_list_get_end(nodes);
|
|
|
|
item1 = opal_list_get_next(item1)) {
|
|
|
|
node_from_list = (orte_node_t*)item1;
|
|
|
|
/* since the name in the hostfile might not match
|
|
|
|
* our local name, and yet still be intended to match,
|
|
|
|
* we have to check for local interfaces
|
2008-07-28 19:10:40 +04:00
|
|
|
*/
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
if (0 == strcmp(node_from_file->name, node_from_list->name) ||
|
|
|
|
(opal_ifislocal(node_from_list->name) &&
|
|
|
|
opal_ifislocal(node_from_file->name))) {
|
|
|
|
/* if the slot count here is less than the
|
|
|
|
* total slots avail on this node, set it
|
|
|
|
* to the specified count - this allows people
|
|
|
|
* to subdivide an allocation
|
|
|
|
*/
|
|
|
|
if (node_from_file->slots < node_from_list->slots) {
|
|
|
|
node_from_list->slots_alloc = node_from_file->slots;
|
|
|
|
}
|
2011-12-15 00:01:15 +04:00
|
|
|
if (remove) {
|
|
|
|
/* remove the node from the list */
|
|
|
|
opal_list_remove_item(nodes, item1);
|
|
|
|
/* xfer it to keep list */
|
|
|
|
opal_list_append(&keep, item1);
|
|
|
|
} else {
|
|
|
|
/* mark as included */
|
|
|
|
node_from_list->mapped = true;
|
|
|
|
}
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
break;
|
2008-07-28 19:10:40 +04:00
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
|
|
|
}
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
/* cleanup the newnode list */
|
|
|
|
OBJ_RELEASE(item2);
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* if we still have entries on our hostfile list, then
|
|
|
|
* there were requested hosts that were not in our allocation.
|
|
|
|
* This is an error - report it to the user and return an error
|
|
|
|
*/
|
|
|
|
if (0 != opal_list_get_size(&newnodes)) {
|
This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-14 00:00:55 +04:00
|
|
|
orte_show_help("help-hostfile.txt", "not-all-mapped-alloc",
|
2008-02-28 04:57:57 +03:00
|
|
|
true, hostfile);
|
|
|
|
while (NULL != (item1 = opal_list_remove_first(&newnodes))) {
|
|
|
|
OBJ_RELEASE(item1);
|
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&newnodes);
|
|
|
|
return ORTE_ERR_SILENT;
|
|
|
|
}
|
|
|
|
|
2011-12-15 00:01:15 +04:00
|
|
|
if (!remove) {
|
|
|
|
/* all done */
|
|
|
|
OBJ_DESTRUCT(&newnodes);
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
Per request from Terry, make -host and -hostfile respect order when used as filters. In other words, if you specify -host host1,host3,host2, then we should use the hosts in that order. Previously, we used them in whatever order they were found in the allocation - all the -host did was tell us which nodes to use, not what order to use them in.
Relative node syntax remains supported. Also, if you specify empty nodes, but have a specific empty node called out later, we will not include that node in the empties we add. I'll provide examples in the manpage.
This commit was SVN r19402.
2008-08-26 06:56:10 +04:00
|
|
|
/* clear the rest of the nodes list */
|
|
|
|
while (NULL != (item1 = opal_list_remove_first(nodes))) {
|
|
|
|
OBJ_RELEASE(item1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the nodes list has been cleared - rebuild it in order */
|
|
|
|
while (NULL != (item1 = opal_list_remove_first(&keep))) {
|
|
|
|
opal_list_append(nodes, item1);
|
|
|
|
}
|
|
|
|
|
2008-08-19 19:16:27 +04:00
|
|
|
cleanup:
|
2008-02-28 04:57:57 +03:00
|
|
|
OBJ_DESTRUCT(&newnodes);
|
|
|
|
|
2008-08-19 19:16:27 +04:00
|
|
|
return rc;
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
2008-04-02 00:03:49 +04:00
|
|
|
|
|
|
|
int orte_util_get_ordered_host_list(opal_list_t *nodes,
|
|
|
|
char *hostfile)
|
|
|
|
{
|
|
|
|
opal_list_t exclude;
|
2008-08-19 19:16:27 +04:00
|
|
|
opal_list_item_t *item, *itm, *item2, *item1;
|
|
|
|
char *cptr;
|
|
|
|
int num_empty, i, nodeidx, startempty=0;
|
2008-08-26 17:38:11 +04:00
|
|
|
bool want_all_empty=false;
|
2009-06-25 18:08:36 +04:00
|
|
|
orte_node_t *node_from_pool, *newnode;
|
2008-04-02 00:03:49 +04:00
|
|
|
int rc;
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
2008-04-02 00:03:49 +04:00
|
|
|
"%s hostfile: creating ordered list of hosts from hostfile %s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), hostfile));
|
2008-04-02 00:03:49 +04:00
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&exclude, opal_list_t);
|
|
|
|
|
2008-04-17 17:50:59 +04:00
|
|
|
/* parse the hostfile and add the contents to the list, keeping duplicates */
|
|
|
|
if (ORTE_SUCCESS != (rc = hostfile_parse(hostfile, nodes, &exclude, true))) {
|
2008-04-02 00:03:49 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2008-08-19 19:16:27 +04:00
|
|
|
/* parse the nodes to process any relative node directives */
|
|
|
|
item2 = opal_list_get_first(nodes);
|
|
|
|
while (item2 != opal_list_get_end(nodes)) {
|
|
|
|
orte_node_t *node=(orte_node_t*)item2;
|
|
|
|
|
|
|
|
/* save the next location in case this one gets removed */
|
|
|
|
item1 = opal_list_get_next(item2);
|
|
|
|
|
|
|
|
if ('+' != node->name[0]) {
|
|
|
|
item2 = item1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* see if we specified empty nodes */
|
|
|
|
if ('e' == node->name[1] ||
|
|
|
|
'E' == node->name[1]) {
|
|
|
|
/* request for empty nodes - do they want
|
|
|
|
* all of them?
|
|
|
|
*/
|
|
|
|
if (NULL != (cptr = strchr(node->name, ':'))) {
|
|
|
|
/* the colon indicates a specific # are requested */
|
|
|
|
cptr++; /* step past : */
|
|
|
|
num_empty = strtol(cptr, NULL, 10);
|
|
|
|
} else {
|
|
|
|
/* want them all - set num_empty to max */
|
|
|
|
num_empty = INT_MAX;
|
|
|
|
want_all_empty = true;
|
|
|
|
}
|
|
|
|
/* insert empty nodes into newnodes list in place of the current item.
|
|
|
|
* since item1 is the next item, we insert in front of it
|
|
|
|
*/
|
|
|
|
if (!orte_hnp_is_allocated && 0 == startempty) {
|
|
|
|
startempty = 1;
|
|
|
|
}
|
2009-06-25 18:08:36 +04:00
|
|
|
for (i=startempty; 0 < num_empty && i < orte_node_pool->size; i++) {
|
|
|
|
if (NULL == (node_from_pool = (orte_node_t*)opal_pointer_array_get_item(orte_node_pool, i))) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (0 == node_from_pool->slots_inuse) {
|
2008-08-19 19:16:27 +04:00
|
|
|
newnode = OBJ_NEW(orte_node_t);
|
2009-06-25 18:08:36 +04:00
|
|
|
newnode->name = strdup(node_from_pool->name);
|
2008-08-19 19:16:27 +04:00
|
|
|
/* if the slot count here is less than the
|
|
|
|
* total slots avail on this node, set it
|
|
|
|
* to the specified count - this allows people
|
|
|
|
* to subdivide an allocation
|
|
|
|
*/
|
2009-06-25 18:08:36 +04:00
|
|
|
if (node->slots < node_from_pool->slots) {
|
2008-08-19 19:16:27 +04:00
|
|
|
newnode->slots_alloc = node->slots;
|
|
|
|
} else {
|
2009-06-25 18:08:36 +04:00
|
|
|
newnode->slots_alloc = node_from_pool->slots;
|
2008-08-19 19:16:27 +04:00
|
|
|
}
|
|
|
|
opal_list_insert_pos(nodes, item1, &newnode->super);
|
|
|
|
/* track number added */
|
|
|
|
--num_empty;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* bookmark where we stopped in case they ask for more */
|
|
|
|
startempty = i;
|
|
|
|
/* did they get everything they wanted? */
|
|
|
|
if (!want_all_empty && 0 < num_empty) {
|
|
|
|
orte_show_help("help-hostfile.txt", "hostfile:not-enough-empty",
|
|
|
|
true, num_empty);
|
|
|
|
rc = ORTE_ERR_SILENT;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
/* since we have expanded the provided node, remove
|
|
|
|
* it from list
|
|
|
|
*/
|
|
|
|
opal_list_remove_item(nodes, item2);
|
|
|
|
OBJ_RELEASE(item2);
|
|
|
|
} else if ('n' == node->name[1] ||
|
|
|
|
'N' == node->name[1]) {
|
|
|
|
/* they want a specific relative node #, so
|
|
|
|
* look it up on global pool
|
|
|
|
*/
|
|
|
|
nodeidx = strtol(&node->name[2], NULL, 10);
|
|
|
|
/* if the HNP is not allocated, then we need to
|
|
|
|
* adjust the index as the node pool is offset
|
|
|
|
* by one
|
|
|
|
*/
|
|
|
|
if (!orte_hnp_is_allocated) {
|
|
|
|
nodeidx++;
|
|
|
|
}
|
|
|
|
/* see if that location is filled */
|
2009-06-25 18:08:36 +04:00
|
|
|
if (NULL == (node_from_pool = (orte_node_t*)opal_pointer_array_get_item(orte_node_pool, nodeidx))) {
|
2008-08-19 19:16:27 +04:00
|
|
|
/* this is an error */
|
|
|
|
orte_show_help("help-hostfile.txt", "hostfile:relative-node-not-found",
|
|
|
|
true, nodeidx, node->name);
|
|
|
|
rc = ORTE_ERR_SILENT;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
/* create the node object */
|
|
|
|
newnode = OBJ_NEW(orte_node_t);
|
2009-06-25 18:08:36 +04:00
|
|
|
newnode->name = strdup(node_from_pool->name);
|
2008-08-19 19:16:27 +04:00
|
|
|
/* if the slot count here is less than the
|
|
|
|
* total slots avail on this node, set it
|
|
|
|
* to the specified count - this allows people
|
|
|
|
* to subdivide an allocation
|
|
|
|
*/
|
2009-06-25 18:08:36 +04:00
|
|
|
if (node->slots < node_from_pool->slots) {
|
2008-08-19 19:16:27 +04:00
|
|
|
newnode->slots_alloc = node->slots;
|
|
|
|
} else {
|
2009-06-25 18:08:36 +04:00
|
|
|
newnode->slots_alloc = node_from_pool->slots;
|
2008-08-19 19:16:27 +04:00
|
|
|
}
|
|
|
|
/* insert it before item1 */
|
|
|
|
opal_list_insert_pos(nodes, item1, &newnode->super);
|
|
|
|
/* since we have expanded the provided node, remove
|
|
|
|
* it from list
|
|
|
|
*/
|
|
|
|
opal_list_remove_item(nodes, item2);
|
|
|
|
OBJ_RELEASE(item2);
|
|
|
|
} else {
|
|
|
|
/* invalid relative node syntax */
|
|
|
|
orte_show_help("help-hostfile.txt", "hostfile:invalid-relative-node-syntax",
|
|
|
|
true, node->name);
|
|
|
|
rc = ORTE_ERR_SILENT;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* move to next */
|
|
|
|
item2 = item1;
|
|
|
|
}
|
|
|
|
|
2008-04-02 00:03:49 +04:00
|
|
|
/* remove from the list of nodes those that are in the exclude list */
|
|
|
|
while(NULL != (item = opal_list_remove_first(&exclude))) {
|
|
|
|
orte_node_t *exnode = (orte_node_t*)item;
|
|
|
|
/* check for matches on nodes */
|
|
|
|
for (itm = opal_list_get_first(nodes);
|
|
|
|
itm != opal_list_get_end(nodes);
|
|
|
|
itm = opal_list_get_next(itm)) {
|
|
|
|
orte_node_t *node=(orte_node_t*)itm;
|
|
|
|
if (0 == strcmp(exnode->name, node->name)) {
|
|
|
|
/* match - remove it */
|
|
|
|
opal_list_remove_item(nodes, itm);
|
|
|
|
OBJ_RELEASE(itm);
|
2008-04-17 17:50:59 +04:00
|
|
|
/* have to cycle through the entire list as we could
|
|
|
|
* have duplicates
|
|
|
|
*/
|
2008-04-02 00:03:49 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
OBJ_RELEASE(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
OBJ_DESTRUCT(&exclude);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|