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.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
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
|
|
|
* Copyright (c) 2008 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 /* HAVE_UNISTD_H */
|
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif /* HAVE_STRING_H */
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#include "opal/util/opal_environ.h"
|
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
|
|
|
#include "opal/util/argv.h"
|
2008-04-30 23:49:53 +04:00
|
|
|
#include "opal/class/opal_pointer_array.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
#include "orte/util/proc_info.h"
|
2008-06-09 18:53:58 +04:00
|
|
|
#include "orte/util/show_help.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/util/name_fns.h"
|
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
|
|
|
|
#include "orte/mca/ess/ess.h"
|
|
|
|
#include "orte/mca/ess/base/base.h"
|
|
|
|
#include "orte/mca/ess/slurm/ess_slurm.h"
|
|
|
|
|
|
|
|
static char *get_slurm_nodename(int nodeid);
|
|
|
|
static int slurm_set_name(void);
|
|
|
|
|
|
|
|
static int rte_init(char flags);
|
|
|
|
static int rte_finalize(void);
|
2008-04-30 23:49:53 +04:00
|
|
|
static bool proc_is_local(orte_process_name_t *proc);
|
|
|
|
static char* proc_get_hostname(orte_process_name_t *proc);
|
|
|
|
static uint32_t proc_get_arch(orte_process_name_t *proc);
|
|
|
|
static uint8_t proc_get_local_rank(orte_process_name_t *proc);
|
|
|
|
static uint8_t proc_get_node_rank(orte_process_name_t *proc);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
|
|
|
|
orte_ess_base_module_t orte_ess_slurm_module = {
|
|
|
|
rte_init,
|
|
|
|
rte_finalize,
|
2008-03-05 07:57:23 +03:00
|
|
|
orte_ess_base_app_abort,
|
2008-04-30 23:49:53 +04:00
|
|
|
proc_is_local,
|
|
|
|
proc_get_hostname,
|
|
|
|
proc_get_arch,
|
|
|
|
proc_get_local_rank,
|
|
|
|
proc_get_node_rank,
|
2008-03-05 07:57:23 +03:00
|
|
|
NULL /* ft_event */
|
2008-02-28 04:57:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-04-30 23:49:53 +04:00
|
|
|
static opal_pointer_array_t nidmap;
|
|
|
|
static orte_pmap_t *pmap;
|
|
|
|
static orte_vpid_t nprocs;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
static int rte_init(char flags)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
char *error = NULL;
|
|
|
|
|
2008-06-18 07:15:56 +04:00
|
|
|
/* run the prolog */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) {
|
|
|
|
error = "orte_ess_base_std_prolog";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* Start by getting a unique name */
|
|
|
|
slurm_set_name();
|
|
|
|
|
|
|
|
/* if I am a daemon, complete my setup using the
|
|
|
|
* default procedure
|
|
|
|
*/
|
|
|
|
if (orte_process_info.daemon) {
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_orted_setup())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_ess_base_orted_setup";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
} else if (orte_process_info.tool) {
|
|
|
|
/* otherwise, if I am a tool proc, use that procedure */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_ess_base_tool_setup";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
} else {
|
2008-04-30 23:49:53 +04:00
|
|
|
/* otherwise, I must be an application process - use
|
|
|
|
* the default procedure to finish my setup
|
2008-02-28 04:57:57 +03:00
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_app_setup())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_ess_base_app_setup";
|
|
|
|
goto error;
|
|
|
|
}
|
2008-04-30 23:49:53 +04:00
|
|
|
|
|
|
|
/* setup the nidmap arrays */
|
|
|
|
OBJ_CONSTRUCT(&nidmap, opal_pointer_array_t);
|
|
|
|
opal_pointer_array_init(&nidmap, 8, INT32_MAX, 8);
|
|
|
|
|
|
|
|
/* if one was provided, build my nidmap */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_build_nidmap(orte_process_info.sync_buf,
|
|
|
|
&nidmap, &pmap, &nprocs))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_ess_base_build_nidmap";
|
|
|
|
goto error;
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
|
|
|
|
error:
|
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-orte-runtime.txt",
|
2008-02-28 04:57:57 +03:00
|
|
|
"orte_init:startup:internal-failure",
|
|
|
|
true, error, ORTE_ERROR_NAME(ret), ret);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rte_finalize(void)
|
|
|
|
{
|
|
|
|
int ret;
|
2008-04-30 23:49:53 +04:00
|
|
|
orte_nid_t **nids;
|
|
|
|
int32_t i;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* if I am a daemon, finalize using the default procedure */
|
|
|
|
if (orte_process_info.daemon) {
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_orted_finalize())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
}
|
|
|
|
} else if (orte_process_info.tool) {
|
|
|
|
/* otherwise, if I am a tool proc, use that procedure */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_tool_finalize())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
}
|
|
|
|
} else {
|
2008-04-30 23:49:53 +04:00
|
|
|
/* otherwise, I must be an application process - deconstruct
|
|
|
|
* my nidmap arrays
|
2008-02-28 04:57:57 +03:00
|
|
|
*/
|
2008-04-30 23:49:53 +04:00
|
|
|
nids = (orte_nid_t**)nidmap.addr;
|
|
|
|
for (i=0; i < nidmap.size; i++) {
|
|
|
|
if (NULL == nids[i]) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (NULL != nids[i]->name) {
|
|
|
|
free(nids[i]->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&nidmap);
|
|
|
|
free(pmap);
|
|
|
|
|
|
|
|
/* use the default procedure to finish */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-04-30 23:49:53 +04:00
|
|
|
static bool proc_is_local(orte_process_name_t *proc)
|
|
|
|
{
|
|
|
|
if (pmap[proc->vpid].node == (int32_t)ORTE_PROC_MY_DAEMON->vpid) {
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
2008-04-30 23:49:53 +04:00
|
|
|
"%s ess:slurm: proc %s is LOCAL",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(proc)));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
2008-04-30 23:49:53 +04:00
|
|
|
"%s ess:slurm: proc %s is REMOTE",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(proc)));
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static char* proc_get_hostname(orte_process_name_t *proc)
|
|
|
|
{
|
|
|
|
int32_t node;
|
|
|
|
orte_nid_t **nids;
|
|
|
|
|
|
|
|
node = pmap[proc->vpid].node;
|
|
|
|
nids = (orte_nid_t**)nidmap.addr;
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
2008-04-30 23:49:53 +04:00
|
|
|
"%s ess:slurm: proc %s is on host %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(proc),
|
|
|
|
nids[node]->name));
|
|
|
|
|
|
|
|
return nids[node]->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t proc_get_arch(orte_process_name_t *proc)
|
|
|
|
{
|
|
|
|
int32_t node;
|
|
|
|
orte_nid_t **nids;
|
|
|
|
|
|
|
|
node = pmap[proc->vpid].node;
|
|
|
|
nids = (orte_nid_t**)nidmap.addr;
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
2008-04-30 23:49:53 +04:00
|
|
|
"%s ess:slurm: proc %s has arch %d",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(proc),
|
|
|
|
nids[node]->arch));
|
|
|
|
|
|
|
|
return nids[node]->arch;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t proc_get_local_rank(orte_process_name_t *proc)
|
|
|
|
{
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
2008-04-30 23:49:53 +04:00
|
|
|
"%s ess:slurm: proc %s has local rank %d",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(proc),
|
|
|
|
(int)pmap[proc->vpid].local_rank));
|
|
|
|
|
|
|
|
return pmap[proc->vpid].local_rank;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t proc_get_node_rank(orte_process_name_t *proc)
|
|
|
|
{
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
2008-04-30 23:49:53 +04:00
|
|
|
"%s ess:slurm: proc %s has node rank %d",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(proc),
|
|
|
|
(int)pmap[proc->vpid].node_rank));
|
|
|
|
|
|
|
|
return pmap[proc->vpid].node_rank;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
static int slurm_set_name(void)
|
|
|
|
{
|
|
|
|
int slurm_nodeid;
|
|
|
|
int rc;
|
|
|
|
int id;
|
|
|
|
orte_jobid_t jobid;
|
|
|
|
orte_vpid_t vpid;
|
|
|
|
char* jobid_string;
|
|
|
|
char* vpid_string;
|
|
|
|
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_ess_base_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"ess:slurm setting name"));
|
|
|
|
|
|
|
|
id = mca_base_param_register_string("orte", "ess", "jobid", NULL, NULL);
|
|
|
|
mca_base_param_lookup_string(id, &jobid_string);
|
|
|
|
if (NULL == jobid_string) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
|
|
|
return ORTE_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_jobid(&jobid, jobid_string))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
id = mca_base_param_register_string("orte", "ess", "vpid", NULL, NULL);
|
|
|
|
mca_base_param_lookup_string(id, &vpid_string);
|
|
|
|
if (NULL == vpid_string) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
|
|
|
return ORTE_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_vpid(&vpid, vpid_string))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
ORTE_PROC_MY_NAME->jobid = jobid;
|
|
|
|
|
|
|
|
/* fix up the vpid and make it the "real" vpid */
|
|
|
|
slurm_nodeid = atoi(getenv("SLURM_NODEID"));
|
|
|
|
ORTE_PROC_MY_NAME->vpid = vpid + slurm_nodeid;
|
|
|
|
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_ess_base_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"ess:slurm set name to %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
|
|
|
|
|
|
/* fix up the system info nodename to match exactly what slurm returned */
|
2008-03-24 02:10:15 +03:00
|
|
|
if (NULL != orte_process_info.nodename) {
|
|
|
|
free(orte_process_info.nodename);
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
2008-03-24 02:10:15 +03:00
|
|
|
orte_process_info.nodename = get_slurm_nodename(slurm_nodeid);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_ess_base_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"ess:slurm set nodename to %s",
|
2008-03-24 02:10:15 +03:00
|
|
|
orte_process_info.nodename));
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
/* get the non-name common environmental variables */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_ess_env_get())) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
get_slurm_nodename(int nodeid)
|
|
|
|
{
|
|
|
|
char **names = NULL;
|
|
|
|
char *slurm_nodelist;
|
|
|
|
char *ret;
|
|
|
|
|
|
|
|
slurm_nodelist = getenv("OMPI_MCA_orte_slurm_nodelist");
|
|
|
|
|
|
|
|
if (NULL == slurm_nodelist) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* split the node list into an argv array */
|
|
|
|
names = opal_argv_split(slurm_nodelist, ',');
|
|
|
|
if (NULL == names) { /* got an error */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check to see if there are enough entries */
|
|
|
|
if (nodeid > opal_argv_count(names)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = strdup(names[nodeid]);
|
|
|
|
|
|
|
|
opal_argv_free(names);
|
|
|
|
|
|
|
|
/* All done */
|
|
|
|
return ret;
|
|
|
|
}
|