Update some of the orte tests to sync with openrte repository
This commit was SVN r13155.
Этот коммит содержится в:
родитель
6f7adfe231
Коммит
da82359446
@ -1,4 +1,4 @@
|
||||
PROGS = no_op sigusr_trap spin orte_nodename orte_spawn
|
||||
PROGS = no_op sigusr_trap spin orte_nodename orte_proc_subscribe orte_stage_gate orte_spawn
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
|
@ -13,6 +13,7 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
int rc;
|
||||
char hostname[512];
|
||||
pid_t pid;
|
||||
|
||||
if (0 > (rc = orte_init())) {
|
||||
fprintf(stderr, "orte_nodename: couldn't init orte - error code %d\n", rc);
|
||||
@ -20,7 +21,9 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
gethostname(hostname, 512);
|
||||
printf("orte_nodename: Node %s Name [%lu,%lu,%lu]\n", hostname, ORTE_NAME_ARGS(orte_process_info.my_name));
|
||||
pid = getpid();
|
||||
|
||||
printf("orte_nodename: Node %s Name [%lu,%lu,%lu] Pid %ld\n", hostname, ORTE_NAME_ARGS(orte_process_info.my_name), (long)pid);
|
||||
|
||||
orte_finalize();
|
||||
return 0;
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/mca/rmgr/rmgr.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/ras/ras_types.h"
|
||||
#include "orte/mca/rmaps/rmaps_types.h"
|
||||
|
||||
bool waitexit;
|
||||
opal_mutex_t lock;
|
||||
@ -27,22 +29,27 @@ int main(int argc, char* argv[])
|
||||
orte_jobid_t job;
|
||||
opal_list_t attributes;
|
||||
opal_list_item_t *item;
|
||||
char cwd[1024];
|
||||
bool spawned;
|
||||
|
||||
OBJ_CONSTRUCT(&lock, opal_mutex_t);
|
||||
OBJ_CONSTRUCT(&cond, opal_condition_t);
|
||||
waitexit = false;
|
||||
|
||||
if (0 > (rc = orte_init())) {
|
||||
if (0 > (rc = orte_init(false))) {
|
||||
fprintf(stderr, "couldn't init orte - error code %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* create an app_context that defines the app to be run */
|
||||
app = OBJ_NEW(orte_app_context_t);
|
||||
app->app = strdup("hostname");
|
||||
opal_argv_append_nosize(&app->argv, "hostname");
|
||||
app->app = strdup("orte_nodename");
|
||||
opal_argv_append_nosize(&app->argv, "orte_nodename");
|
||||
app->num_procs = 3;
|
||||
app->cwd = strdup("/tmp");
|
||||
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
app->cwd = strdup(cwd);
|
||||
app->user_specified_cwd = false;
|
||||
|
||||
/* construct an empty attributes list - we don't need this, but it will
|
||||
* allow the various steps in the launch procedure add things if they
|
||||
@ -50,11 +57,44 @@ int main(int argc, char* argv[])
|
||||
*/
|
||||
OBJ_CONSTRUCT(&attributes, opal_list_t);
|
||||
|
||||
/* tell the RTE that we want to be a child of this process' job */
|
||||
if (ORTE_SUCCESS != (rc = orte_rmgr.add_attribute(&attributes, ORTE_NS_USE_PARENT,
|
||||
ORTE_JOBID, &(orte_process_info.my_name->jobid),
|
||||
ORTE_RMGR_ATTR_OVERRIDE))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* tell the RTE that we want to the children to run inside of our allocation -
|
||||
* don't go get one just for them
|
||||
*/
|
||||
if (ORTE_SUCCESS != (rc = orte_rmgr.add_attribute(&attributes, ORTE_RAS_USE_PARENT_ALLOCATION,
|
||||
ORTE_JOBID, &(orte_process_info.my_name->jobid),
|
||||
ORTE_RMGR_ATTR_OVERRIDE))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* tell the RTE that we want the children mapped the same way as their parent */
|
||||
if (ORTE_SUCCESS != (rc = orte_rmgr.add_attribute(&attributes, ORTE_RMAPS_USE_PARENT_PLAN,
|
||||
ORTE_JOBID, &(orte_process_info.my_name->jobid),
|
||||
ORTE_RMGR_ATTR_OVERRIDE))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* launch the job, specifing a callback function so we get notified
|
||||
* when it completes
|
||||
*/
|
||||
|
||||
fprintf(stderr, "Parent: spawning children!\n");
|
||||
cb_states = ORTE_PROC_STATE_TERMINATED;
|
||||
rc = orte_rmgr.spawn_job(&app, 1, &job, 0, NULL, job_state_callback, cb_states, &attributes);
|
||||
spawned = true;
|
||||
if (ORTE_SUCCESS != (rc = orte_rmgr.spawn_job(&app, 1, &job, 0, NULL, job_state_callback, cb_states, &attributes))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
spawned = false;
|
||||
}
|
||||
if (spawned) fprintf(stderr, "Parent: children spawned!\n");
|
||||
|
||||
/* cleanup the attribute list, just in case someone added something to it */
|
||||
while (NULL != (item = opal_list_remove_first(&attributes))) OBJ_RELEASE(item);
|
||||
@ -64,10 +104,12 @@ int main(int argc, char* argv[])
|
||||
OBJ_RELEASE(app);
|
||||
|
||||
/* Wait for the app to complete */
|
||||
if (spawned) {
|
||||
OPAL_THREAD_LOCK(&lock);
|
||||
while (!waitexit) {
|
||||
opal_condition_wait(&cond, &lock);
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
orte_finalize();
|
||||
|
138
orte/test/system/orte_stage_gate.c
Обычный файл
138
orte/test/system/orte_stage_gate.c
Обычный файл
@ -0,0 +1,138 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* The most basic of MPI applications
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif /* HAVE_SYS_TIME_H */
|
||||
|
||||
#include "opal/runtime/opal.h"
|
||||
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/runtime/runtime.h"
|
||||
#include "orte/mca/gpr/gpr.h"
|
||||
#include "orte/mca/smr/smr.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int rc;
|
||||
char hostname[512];
|
||||
char *error = NULL;
|
||||
bool timing = false;
|
||||
int param, value;
|
||||
struct timeval ortestart, ortestop;
|
||||
|
||||
/* setup the OPAL environment */
|
||||
if (ORTE_SUCCESS != (rc = opal_init())) {
|
||||
error = "opal_init failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* check to see if we want timing information */
|
||||
param = mca_base_param_reg_int_name("orte", "timing",
|
||||
"Request that critical timing loops be measured",
|
||||
false, false, 0, &value);
|
||||
if (value != 0) {
|
||||
timing = true;
|
||||
gettimeofday(&ortestart, NULL);
|
||||
}
|
||||
|
||||
/* Setup ORTE stage 1, note that we are not infrastructre */
|
||||
if (ORTE_SUCCESS != (rc = orte_init_stage1(false))) {
|
||||
error = "orte_init_stage1 failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* setup a compound command to capture info to be rcurned in the xcast */
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.begin_compound_cmd())) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
error = "orte_gpr.begin_compound_cmd failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Now do the things that hit the registry */
|
||||
if (ORTE_SUCCESS != (rc = orte_init_stage2())) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
error = "orte_init_stage2 failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* check for timing request - get stop time and report elapsed time if so */
|
||||
if (timing) {
|
||||
gettimeofday(&ortestop, NULL);
|
||||
opal_output(0, "[%ld]: time from start to completion of orte_init %ld usec",
|
||||
(long)ORTE_PROC_MY_NAME->vpid,
|
||||
(long int)((ortestop.tv_sec - ortestart.tv_sec)*1000000 +
|
||||
(ortestop.tv_usec - ortestart.tv_usec)));
|
||||
gettimeofday(&ortestart, NULL);
|
||||
}
|
||||
|
||||
/* Let system know we are at STG1 Barrier */
|
||||
if (ORTE_SUCCESS != (rc = orte_smr.set_proc_state(orte_process_info.my_name,
|
||||
ORTE_PROC_STATE_AT_STG1, 0))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
error = "set process state failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* check for timing request - get stop time and report elapsed time if so */
|
||||
if (timing) {
|
||||
gettimeofday(&ortestop, NULL);
|
||||
opal_output(0, "[%ld]: time from completion of orte_init to exec_compound_cmd %ld usec",
|
||||
(long)ORTE_PROC_MY_NAME->vpid,
|
||||
(long int)((ortestop.tv_sec - ortestart.tv_sec)*1000000 +
|
||||
(ortestop.tv_usec - ortestart.tv_usec)));
|
||||
gettimeofday(&ortestart, NULL);
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.exec_compound_cmd())) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
error = "orte_gpr.exec_compound_cmd failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* check for timing request - get stop time and report elapsed time if so */
|
||||
if (timing) {
|
||||
gettimeofday(&ortestop, NULL);
|
||||
opal_output(0, "[%ld]: time to execute compound command %ld usec",
|
||||
(long)ORTE_PROC_MY_NAME->vpid,
|
||||
(long int)((ortestop.tv_sec - ortestart.tv_sec)*1000000 +
|
||||
(ortestop.tv_usec - ortestart.tv_usec)));
|
||||
gettimeofday(&ortestart, NULL);
|
||||
}
|
||||
|
||||
/* FIRST BARRIER - WAIT FOR MSG FROM RMGR_PROC_STAGE_GATE_MGR TO ARRIVE */
|
||||
if (ORTE_SUCCESS != (rc = orte_rml.xcast(ORTE_PROC_MY_NAME->jobid,
|
||||
NULL, orte_gpr.deliver_notify_msg))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
error = "failed to see all procs register\n";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* check for timing request - get start time */
|
||||
if (timing) {
|
||||
gettimeofday(&ortestop, NULL);
|
||||
opal_output(0, "[%ld]: time to execute xcast %ld usec",
|
||||
(long)ORTE_PROC_MY_NAME->vpid,
|
||||
(long int)((ortestop.tv_sec - ortestart.tv_sec)*1000000 +
|
||||
(ortestop.tv_usec - ortestart.tv_usec)));
|
||||
gettimeofday(&ortestart, NULL);
|
||||
}
|
||||
|
||||
gethostname(hostname, 512);
|
||||
printf("orte_nodename: Node %s Name [%lu,%lu,%lu]\n", hostname, ORTE_NAME_ARGS(orte_process_info.my_name));
|
||||
|
||||
orte_finalize();
|
||||
return 0;
|
||||
|
||||
error:
|
||||
opal_output(0, "[%lu,%lu,%lu]: %s", ORTE_NAME_ARGS(orte_process_info.my_name), error);
|
||||
return rc;
|
||||
}
|
@ -8,11 +8,22 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "orte/util/proc_info.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
int i;
|
||||
int i, rc;
|
||||
double pi;
|
||||
pid_t pid;
|
||||
|
||||
if (0 > (rc = orte_init())) {
|
||||
fprintf(stderr, "spin: couldn't init orte - error code %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
pid = getpid();
|
||||
|
||||
printf("spin: Name [%lu,%lu,%lu] Pid %ld\n", ORTE_NAME_ARGS(orte_process_info.my_name), (long)pid);
|
||||
|
||||
i = 0;
|
||||
while (1) {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user