1
1
openmpi/orte/test/system/orte_nodename.c

50 строки
1.1 KiB
C
Исходник Обычный вид История

/* -*- C -*-
*
* $HEADER$
*
* The most basic of MPI applications
*/
#include <stdio.h>
#include <unistd.h>
#include "opal/class/opal_list.h"
#include "opal/util/opal_environ.h"
#include "orte/util/proc_info.h"
#include "orte/util/name_fns.h"
#include "orte/runtime/orte_globals.h"
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start. The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system. Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed. Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief. With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn. Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put". This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
#include "orte/runtime/runtime.h"
#include "orte/mca/ess/ess.h"
int main(int argc, char* argv[])
{
int rc, i, restart=-1;
char hostname[512], *rstrt;
pid_t pid;
2015-06-24 06:59:57 +03:00
if (0 > (rc = orte_init(&argc, &argv, ORTE_PROC_NON_MPI))) {
fprintf(stderr, "orte_nodename: couldn't init orte - error code %d\n", rc);
return rc;
}
if (NULL != (rstrt = getenv("OMPI_MCA_orte_num_restarts"))) {
restart = strtol(rstrt, NULL, 10);
}
gethostname(hostname, 512);
pid = getpid();
printf("orte_nodename: Node %s Name %s Pid %ld Restarts: %d\n",
hostname, ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (long)pid, restart);
for (i=0; NULL != environ[i]; i++) {
if (0 == strncmp(environ[i], "OMPI_MCA", strlen("OMPI_MCA"))) {
printf("\t%s\n", environ[i]);
}
}
orte_finalize();
return 0;
}