Cleanup the orte/test/system directory
Этот коммит содержится в:
родитель
d5775bf9de
Коммит
2a83d2613a
@ -1,4 +1,4 @@
|
|||||||
PROGS = no_op sigusr_trap spin orte_nodename orte_spawn orte_loop_spawn orte_loop_child orte_abort get_limits orte_ring spawn_child orte_tool orte_no_op binom oob_stress iof_stress iof_delay radix orte_barrier opal_interface orte_spin segfault orte_exit orte_db test-time event-threads psm_keygen regex orte_errors evpri-test opal-evpri-test evpri-test2 mapper reducer opal_hotel orte_dfs orte_allocate pmi_abort opal_db
|
PROGS = no_op sigusr_trap spin orte_nodename orte_spawn orte_loop_spawn orte_loop_child orte_abort get_limits orte_tool orte_no_op binom oob_stress iof_stress iof_delay radix opal_interface orte_spin segfault orte_exit test-time event-threads psm_keygen regex orte_errors evpri-test opal-evpri-test evpri-test2 mapper reducer opal_hotel orte_dfs
|
||||||
|
|
||||||
all: $(PROGS)
|
all: $(PROGS)
|
||||||
|
|
||||||
@ -8,8 +8,8 @@ CXX = ortec++
|
|||||||
CXXFLAGS = -g
|
CXXFLAGS = -g
|
||||||
FFLAGS = -g
|
FFLAGS = -g
|
||||||
|
|
||||||
pmi_abort:
|
|
||||||
gcc -I$(SLURMHOME)/include/slurm -L$(SLURMHOME)/lib -lpmi -o pmi_abort pmi_abort.c
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(PROGS) *~
|
rm -f $(PROGS) *~
|
||||||
|
|
||||||
|
oob_stress:
|
||||||
|
ortecc -o oob_stress oob_stress.c -lm
|
||||||
|
@ -34,15 +34,12 @@ EXTRA_DIST += \
|
|||||||
test/system/iof_stress.c \
|
test/system/iof_stress.c \
|
||||||
test/system/oob_stress.c \
|
test/system/oob_stress.c \
|
||||||
test/system/orte_abort.c \
|
test/system/orte_abort.c \
|
||||||
test/system/orte_barrier.c \
|
|
||||||
test/system/orte_loop_child.c \
|
test/system/orte_loop_child.c \
|
||||||
test/system/orte_loop_spawn.c \
|
test/system/orte_loop_spawn.c \
|
||||||
test/system/orte_nodename.c \
|
test/system/orte_nodename.c \
|
||||||
test/system/orte_no_op.c \
|
test/system/orte_no_op.c \
|
||||||
test/system/orte_ring.c \
|
|
||||||
test/system/orte_spawn.c \
|
test/system/orte_spawn.c \
|
||||||
test/system/sigusr_trap.c \
|
test/system/sigusr_trap.c \
|
||||||
test/system/spawn_child.c \
|
|
||||||
test/system/spin.c \
|
test/system/spin.c \
|
||||||
test/system/mapper.c \
|
test/system/mapper.c \
|
||||||
test/system/mapr.py \
|
test/system/mapr.py \
|
||||||
|
@ -1,188 +0,0 @@
|
|||||||
/* -*- C -*-
|
|
||||||
*
|
|
||||||
* $HEADER$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "opal/mca/base/base.h"
|
|
||||||
#include "opal/util/cmd_line.h"
|
|
||||||
#include "opal/util/opal_environ.h"
|
|
||||||
|
|
||||||
#include "orte/constants.h"
|
|
||||||
|
|
||||||
#include "opal/mca/db/base/base.h"
|
|
||||||
#include "opal/runtime/opal.h"
|
|
||||||
|
|
||||||
static bool help;
|
|
||||||
#define NKV 1024
|
|
||||||
|
|
||||||
static opal_cmd_line_init_t cmd_line_init[] = {
|
|
||||||
{ NULL, 'h', NULL, "help", 0,
|
|
||||||
&help, OPAL_CMD_LINE_TYPE_BOOL,
|
|
||||||
"This help message" },
|
|
||||||
|
|
||||||
/* End of list */
|
|
||||||
{ NULL, '\0', NULL, NULL, 0,
|
|
||||||
NULL, OPAL_CMD_LINE_TYPE_NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
int rc, i;
|
|
||||||
opal_cmd_line_t cmd_line;
|
|
||||||
opal_process_name_t uid;
|
|
||||||
opal_value_t kvs;
|
|
||||||
char *key;
|
|
||||||
opal_process_name_t data, *dptr;
|
|
||||||
float *fval;
|
|
||||||
opal_list_t kvlist;
|
|
||||||
|
|
||||||
opal_cmd_line_create(&cmd_line, cmd_line_init);
|
|
||||||
mca_base_cmd_line_setup(&cmd_line);
|
|
||||||
if (OPAL_SUCCESS != (rc = opal_cmd_line_parse(&cmd_line, true,
|
|
||||||
argc, argv)) ) {
|
|
||||||
if (OPAL_ERR_SILENT != rc) {
|
|
||||||
fprintf(stderr, "%s: command line error (%d)\n", argv[0], rc);
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Since this process can now handle MCA/GMCA parameters, make sure to
|
|
||||||
* process them.
|
|
||||||
*/
|
|
||||||
mca_base_cmd_line_process_args(&cmd_line, &environ, &environ);
|
|
||||||
|
|
||||||
/* init the OPAL framework, but only the test-required level */
|
|
||||||
if (0 > (rc = opal_init_test())) {
|
|
||||||
fprintf(stderr, "opal_db: couldn't init opal test - error code %d\n", rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open and select the database framework */
|
|
||||||
if (ORTE_SUCCESS != (rc = mca_base_framework_open(&opal_db_base_framework, 0))) {
|
|
||||||
fprintf(stderr, "%s: db_framework_open failed (%d)\n", argv[0], rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
/* let the system pick any db plugin to test - will
|
|
||||||
* be set by whatever param we were given on the cmd
|
|
||||||
* line or environment
|
|
||||||
*/
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_db_base_select(false))) {
|
|
||||||
fprintf(stderr, "%s: db_framework_select failed (%d)\n", argv[0], rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
/* set our id */
|
|
||||||
uid.jobid = 12345;
|
|
||||||
uid.vpid = 67890;
|
|
||||||
opal_db.set_id(&uid);
|
|
||||||
|
|
||||||
/* create and store some arbitrary key-value pairs */
|
|
||||||
for (i=0; i < NKV; i++) {
|
|
||||||
asprintf(&key, "foo.%d", i);
|
|
||||||
data.jobid = i;
|
|
||||||
data.vpid = i;
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_db.store(&uid, OPAL_SCOPE_GLOBAL,
|
|
||||||
key, &data, OPAL_NAME))) {
|
|
||||||
fprintf(stderr, "%s: db_store failed (%d)\n", argv[0], rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
free(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create another one */
|
|
||||||
OBJ_CONSTRUCT(&kvs, opal_value_t);
|
|
||||||
kvs.scope = OPAL_SCOPE_INTERNAL;
|
|
||||||
kvs.key = strdup("pointer-value");
|
|
||||||
kvs.type = OPAL_FLOAT;
|
|
||||||
kvs.data.fval = 1.2334;
|
|
||||||
|
|
||||||
/* store a pointer to it */
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_db.store_pointer((opal_identifier_t*)&uid, &kvs))) {
|
|
||||||
fprintf(stderr, "%s: db_store_pointer failed (%d)\n", argv[0], rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* commit the data - only has an effect if an external
|
|
||||||
* database plugin was selected
|
|
||||||
*/
|
|
||||||
opal_db.commit((opal_identifier_t*)&uid);
|
|
||||||
|
|
||||||
/* fetch data and compare it to what was stored */
|
|
||||||
dptr = &data;
|
|
||||||
for (i=0; i < NKV; i++) {
|
|
||||||
asprintf(&key, "foo.%d", i);
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_db.fetch(&uid, key, (void**)&dptr, OPAL_NAME))) {
|
|
||||||
fprintf(stderr, "%s: db_fetch failed (%d)\n", argv[0], rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
if (data.jobid != i || data.vpid != i) {
|
|
||||||
fprintf(stderr, "%s: db_fetch return incorrect data: %s vs %d\n", argv[0],
|
|
||||||
OPAL_NAME_PRINT(data), i);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
free(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fetch a pointer to data and ensure the
|
|
||||||
* pointer and its value is correct
|
|
||||||
*/
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_db.fetch_pointer((opal_identifier_t*)&uid, "pointer-value", (void**)&fval, OPAL_FLOAT))) {
|
|
||||||
fprintf(stderr, "%s: db_fetch_pointer failed (%d)\n", argv[0], rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
if (kvs.data.fval != (*fval)) {
|
|
||||||
fprintf(stderr, "%s: db_fetch_pointer return incorrect data: %f vs %f\n", argv[0], *fval, kvs.data.fval);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove one key */
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_db.remove((opal_identifier_t*)&uid, "foo.0"))) {
|
|
||||||
fprintf(stderr, "%s: db_remove failed (%d)\n", argv[0], rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* verify that it no longer is in the store */
|
|
||||||
if (ORTE_SUCCESS == (rc = opal_db.fetch(&uid, "foo.0", (void**)&dptr, OPAL_NAME))) {
|
|
||||||
fprintf(stderr, "%s: db_fetch succeeded when it should have failed\n", argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove the pointer key */
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_db.remove((opal_identifier_t*)&uid, "pointer-value"))) {
|
|
||||||
fprintf(stderr, "%s: db_remove failed (%d)\n", argv[0], rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* verify that it no longer is in the store */
|
|
||||||
if (ORTE_SUCCESS == (rc = opal_db.fetch_pointer((opal_identifier_t*)&uid, "pointer-value", (void**)&fval, OPAL_FLOAT))) {
|
|
||||||
fprintf(stderr, "%s: db_fetch_pointer succeeded when it should have failed\n", argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove all keys */
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_db.remove((opal_identifier_t*)&uid, NULL))) {
|
|
||||||
fprintf(stderr, "%s: db_remove failed (%d)\n", argv[0], rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* verify that nothing is in the store */
|
|
||||||
OBJ_CONSTRUCT(&kvlist, opal_list_t);
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_db.fetch_multiple((opal_identifier_t*)&uid, OPAL_SCOPE_ALL,
|
|
||||||
NULL, &kvlist))) {
|
|
||||||
fprintf(stderr, "%s: db_fetch_multiple failed\n", argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (0 < opal_list_get_size(&kvlist)) {
|
|
||||||
fprintf(stderr, "%s: db_fetch_multiple returned values when the db should have been empty\n", argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
mca_base_framework_close(&opal_db_base_framework);
|
|
||||||
|
|
||||||
fprintf(stderr, "%s: SUCCESS\n", argv[0]);
|
|
||||||
opal_finalize_test();
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,258 +0,0 @@
|
|||||||
/* -*- C -*-
|
|
||||||
*
|
|
||||||
* $HEADER$
|
|
||||||
*
|
|
||||||
* Take cmd-line arguments and execute a dynamic allocation
|
|
||||||
*
|
|
||||||
* NOTE: this program is executed as a standalone program since
|
|
||||||
* it emulates mpirun!
|
|
||||||
*
|
|
||||||
* Usage: orte_allocate -np 3 -N 1 -host foo,bar : -np 1 -host bee -mandatory
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "opal/mca/if/if.h"
|
|
||||||
#include "opal/util/argv.h"
|
|
||||||
#include "opal/util/cmd_line.h"
|
|
||||||
#include "opal/util/opal_environ.h"
|
|
||||||
#include "opal/util/show_help.h"
|
|
||||||
#include "opal/runtime/opal.h"
|
|
||||||
|
|
||||||
#include "orte/util/proc_info.h"
|
|
||||||
#include "orte/mca/plm/plm.h"
|
|
||||||
#include "orte/runtime/runtime.h"
|
|
||||||
#include "orte/mca/ras/ras.h"
|
|
||||||
|
|
||||||
struct my_globals_t {
|
|
||||||
bool help;
|
|
||||||
int num_procs;
|
|
||||||
int min_num_nodes;
|
|
||||||
bool mandatory;
|
|
||||||
};
|
|
||||||
struct my_globals_t my_globals;
|
|
||||||
|
|
||||||
static opal_cmd_line_init_t cmd_line_init[] = {
|
|
||||||
/* Various "obvious" options */
|
|
||||||
{ NULL, 'h', NULL, "help", 0,
|
|
||||||
&my_globals.help, OPAL_CMD_LINE_TYPE_BOOL,
|
|
||||||
"This help message" },
|
|
||||||
|
|
||||||
/* Number of processes; -c, -n, --n, -np, and --np are all
|
|
||||||
synonyms */
|
|
||||||
{ NULL, 'c', "np", "np", 1,
|
|
||||||
&my_globals.num_procs, OPAL_CMD_LINE_TYPE_INT,
|
|
||||||
"Number of processes to run" },
|
|
||||||
{ NULL, '\0', "n", "n", 1,
|
|
||||||
&my_globals.num_procs, OPAL_CMD_LINE_TYPE_INT,
|
|
||||||
"Number of processes to run" },
|
|
||||||
|
|
||||||
/* Minimum number of nodes */
|
|
||||||
{ NULL, '\0', "N", "N", 1,
|
|
||||||
&my_globals.min_num_nodes, OPAL_CMD_LINE_TYPE_INT,
|
|
||||||
"Minimum number of nodes for this app" },
|
|
||||||
|
|
||||||
/* the hosts to use for this app */
|
|
||||||
{ NULL, 'H', "host", "host", 1,
|
|
||||||
NULL, OPAL_CMD_LINE_TYPE_STRING,
|
|
||||||
"List of hosts to invoke processes on" },
|
|
||||||
|
|
||||||
/* These hosts are mandatory */
|
|
||||||
{ NULL, '\0', NULL, "mandatory", 0,
|
|
||||||
&my_globals.mandatory, OPAL_CMD_LINE_TYPE_BOOL,
|
|
||||||
"The hosts are mandatory (default: optional)" },
|
|
||||||
|
|
||||||
/* End of list */
|
|
||||||
{ NULL, '\0', NULL, NULL, 0,
|
|
||||||
NULL, OPAL_CMD_LINE_TYPE_NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static void init_globals(void)
|
|
||||||
{
|
|
||||||
my_globals.help = false;
|
|
||||||
my_globals.num_procs = 0;
|
|
||||||
my_globals.min_num_nodes = -1;
|
|
||||||
my_globals.mandatory = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
opal_cmd_line_t cmd_line;
|
|
||||||
orte_job_t *jdata;
|
|
||||||
orte_app_context_t *app;
|
|
||||||
int temp_argc;
|
|
||||||
char **temp_argv, *value;
|
|
||||||
opal_cmd_line_t tmp_cmd_line;
|
|
||||||
int i, j, k, app_num;
|
|
||||||
|
|
||||||
/* bozo check - we don't allow recursive calls of orterun */
|
|
||||||
if (NULL != getenv("OMPI_UNIVERSE_SIZE")) {
|
|
||||||
fprintf(stderr, "\n\n**********************************************************\n\n");
|
|
||||||
fprintf(stderr, "This program is a standalone program and cannot be run via mpirun\n");
|
|
||||||
fprintf(stderr, "\n**********************************************************\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup and parse the command line */
|
|
||||||
init_globals();
|
|
||||||
opal_cmd_line_create(&cmd_line, cmd_line_init);
|
|
||||||
mca_base_cmd_line_setup(&cmd_line);
|
|
||||||
if (OPAL_SUCCESS != (rc = opal_cmd_line_parse(&cmd_line, true,
|
|
||||||
argc, argv)) ) {
|
|
||||||
if (OPAL_ERR_SILENT != rc) {
|
|
||||||
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
|
|
||||||
opal_strerror(rc));
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Need to initialize OPAL so that install_dirs are filled in */
|
|
||||||
if (OPAL_SUCCESS != opal_init_util(&argc, &argv)) {
|
|
||||||
fprintf(stderr, "Error in opal_init_util\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (my_globals.help) {
|
|
||||||
char *str, *args = NULL;
|
|
||||||
args = opal_cmd_line_get_usage_msg(&cmd_line);
|
|
||||||
str = opal_show_help_string("help-orterun.txt", "orterun:usage", false,
|
|
||||||
"orte_allocate", "orte_allocate", "ignore",
|
|
||||||
"orte_allocate", args, "ignore");
|
|
||||||
if (NULL != str) {
|
|
||||||
printf("%s", str);
|
|
||||||
free(str);
|
|
||||||
}
|
|
||||||
free(args);
|
|
||||||
/* If someone asks for help, that should be all we do */
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
mca_base_cmd_line_process_args(&cmd_line, &environ, &environ);
|
|
||||||
|
|
||||||
/* create the job object */
|
|
||||||
jdata = OBJ_NEW(orte_job_t);
|
|
||||||
|
|
||||||
/* collect the apps */
|
|
||||||
temp_argc = 0;
|
|
||||||
temp_argv = NULL;
|
|
||||||
for (app_num = 0, i = 1; i < argc; ++i) {
|
|
||||||
if (0 == strcmp(argv[i], ":")) {
|
|
||||||
fprintf(stderr, "Creating app\n");
|
|
||||||
/* Make an app with this argv */
|
|
||||||
app = OBJ_NEW(orte_app_context_t);
|
|
||||||
opal_cmd_line_create(&tmp_cmd_line, cmd_line_init);
|
|
||||||
mca_base_cmd_line_setup(&tmp_cmd_line);
|
|
||||||
rc = opal_cmd_line_parse(&tmp_cmd_line, true, argc, argv);
|
|
||||||
if (ORTE_SUCCESS != rc) {
|
|
||||||
fprintf(stderr, "Error processing app\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
mca_base_cmd_line_process_args(&tmp_cmd_line, &app->env, &environ);
|
|
||||||
opal_pointer_array_add(jdata->apps, app);
|
|
||||||
app->idx = jdata->num_apps;
|
|
||||||
++jdata->num_apps;
|
|
||||||
/* fake an app executable - we don't care */
|
|
||||||
app->app = strdup("fakeapp");
|
|
||||||
opal_argv_append_nosize(&app->argv, "fakeapp");
|
|
||||||
/* set the num_procs */
|
|
||||||
app->num_procs = my_globals.num_procs;
|
|
||||||
/* Did the user specify any hosts? */
|
|
||||||
if (0 < (j = opal_cmd_line_get_ninsts(&tmp_cmd_line, "host"))) {
|
|
||||||
for (k = 0; k < j; ++k) {
|
|
||||||
value = opal_cmd_line_get_param(&tmp_cmd_line, "host", k, 0);
|
|
||||||
opal_argv_append_nosize(&app->dash_host, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* set the minimum number of nodes */
|
|
||||||
app->min_number_of_nodes = my_globals.min_num_nodes;
|
|
||||||
/* set the mandatory flag */
|
|
||||||
app->mandatory = my_globals.mandatory;
|
|
||||||
opal_dss.dump(0, app, ORTE_APP_CONTEXT);
|
|
||||||
}
|
|
||||||
opal_argv_append(&temp_argc, &temp_argv, argv[i]);
|
|
||||||
}
|
|
||||||
if (opal_argv_count(temp_argv) > 1) {
|
|
||||||
fprintf(stderr, "Creating app\n");
|
|
||||||
/* Make an app with this argv */
|
|
||||||
app = OBJ_NEW(orte_app_context_t);
|
|
||||||
opal_cmd_line_create(&tmp_cmd_line, cmd_line_init);
|
|
||||||
mca_base_cmd_line_setup(&tmp_cmd_line);
|
|
||||||
rc = opal_cmd_line_parse(&tmp_cmd_line, true, argc, argv);
|
|
||||||
if (ORTE_SUCCESS != rc) {
|
|
||||||
fprintf(stderr, "Error processing app\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
mca_base_cmd_line_process_args(&tmp_cmd_line, &app->env, &environ);
|
|
||||||
opal_pointer_array_add(jdata->apps, app);
|
|
||||||
app->idx = jdata->num_apps;
|
|
||||||
++jdata->num_apps;
|
|
||||||
/* fake an app executable - we don't care */
|
|
||||||
app->app = strdup("fakeapp");
|
|
||||||
opal_argv_append_nosize(&app->argv, "fakeapp");
|
|
||||||
/* set the num_procs */
|
|
||||||
app->num_procs = my_globals.num_procs;
|
|
||||||
/* Did the user specify any hosts? */
|
|
||||||
if (0 < (j = opal_cmd_line_get_ninsts(&tmp_cmd_line, "host"))) {
|
|
||||||
for (k = 0; k < j; ++k) {
|
|
||||||
value = opal_cmd_line_get_param(&tmp_cmd_line, "host", k, 0);
|
|
||||||
opal_argv_append_nosize(&app->dash_host, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* set the minimum number of nodes */
|
|
||||||
app->min_number_of_nodes = my_globals.min_num_nodes;
|
|
||||||
/* set the mandatory flag */
|
|
||||||
app->mandatory = my_globals.mandatory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* flag that I am the HNP - needs to be done prior to
|
|
||||||
* registering params
|
|
||||||
*/
|
|
||||||
orte_process_info.proc_type = ORTE_PROC_HNP;
|
|
||||||
|
|
||||||
/* Setup MCA params */
|
|
||||||
orte_register_params();
|
|
||||||
|
|
||||||
/* flag that we do NOT want to launch anything - we just
|
|
||||||
* want to test the allocator
|
|
||||||
*/
|
|
||||||
orte_do_not_launch = true;
|
|
||||||
/* do not resolve the hosts */
|
|
||||||
opal_if_do_not_resolve = true;
|
|
||||||
|
|
||||||
if (ORTE_SUCCESS != orte_init(&argc, &argv, ORTE_PROC_HNP)) {
|
|
||||||
fprintf(stderr, "Failed orte_init\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
/* finalize the OPAL utils. As they are opened again from orte_init->opal_init
|
|
||||||
* we continue to have a reference count on them. So we have to finalize them twice...
|
|
||||||
*/
|
|
||||||
opal_finalize_util();
|
|
||||||
|
|
||||||
opal_dss.dump(0, jdata, ORTE_JOB);
|
|
||||||
|
|
||||||
/* spawn the job and its daemons */
|
|
||||||
rc = orte_plm.spawn(jdata);
|
|
||||||
|
|
||||||
/* loop the event lib until an exit event is detected */
|
|
||||||
#if ORTE_ENABLE_PROGRESS_THREADS
|
|
||||||
while (orte_event_base_active) {
|
|
||||||
/* provide a very short quiet period so we
|
|
||||||
* don't hammer the cpu while
|
|
||||||
*/
|
|
||||||
struct timespec tp = {0, 100};
|
|
||||||
nanosleep(&tp, NULL);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
while (orte_event_base_active) {
|
|
||||||
opal_event_loop(orte_event_base, OPAL_EVLOOP_ONCE);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ORTE_SUCCESS != orte_finalize()) {
|
|
||||||
fprintf(stderr, "Failed orte_finalize\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
/* -*- C -*-
|
|
||||||
*
|
|
||||||
* $HEADER$
|
|
||||||
*
|
|
||||||
* The most basic of applications
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "orte/runtime/runtime.h"
|
|
||||||
#include "orte/mca/grpcomm/grpcomm.h"
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
orte_grpcomm_collective_t *coll;
|
|
||||||
|
|
||||||
if (ORTE_SUCCESS != orte_init(&argc, &argv, ORTE_PROC_NON_MPI)) {
|
|
||||||
fprintf(stderr, "Failed orte_init\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
coll = OBJ_NEW(orte_grpcomm_collective_t);
|
|
||||||
coll->id = orte_process_info.peer_modex;
|
|
||||||
orte_grpcomm.barrier(coll);
|
|
||||||
|
|
||||||
coll->id = orte_process_info.peer_fini_barrier;
|
|
||||||
orte_grpcomm.barrier(coll);
|
|
||||||
OBJ_RELEASE(coll);
|
|
||||||
|
|
||||||
if (ORTE_SUCCESS != orte_finalize()) {
|
|
||||||
fprintf(stderr, "Failed orte_finalize\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
/* -*- C -*-
|
|
||||||
*
|
|
||||||
* $HEADER$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "opal/dss/dss.h"
|
|
||||||
#include "opal/mca/event/event.h"
|
|
||||||
#include "opal/util/output.h"
|
|
||||||
|
|
||||||
#include "orte/util/proc_info.h"
|
|
||||||
#include "orte/util/name_fns.h"
|
|
||||||
#include "orte/runtime/orte_globals.h"
|
|
||||||
#include "orte/runtime/runtime.h"
|
|
||||||
#include "orte/runtime/orte_wait.h"
|
|
||||||
#include "orte/mca/errmgr/errmgr.h"
|
|
||||||
#include "orte/mca/grpcomm/grpcomm.h"
|
|
||||||
#include "orte/mca/db/db.h"
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
char hostname[512];
|
|
||||||
pid_t pid;
|
|
||||||
orte_proc_t *proc;
|
|
||||||
|
|
||||||
if (0 > (rc = orte_init(&argc, &argv, ORTE_PROC_NON_MPI))) {
|
|
||||||
fprintf(stderr, "orte_db: couldn't init orte - error code %d\n", rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
gethostname(hostname, 512);
|
|
||||||
pid = getpid();
|
|
||||||
|
|
||||||
proc = OBJ_NEW(orte_proc_t);
|
|
||||||
if (ORTE_SUCCESS != (rc = orte_db.store(ORTE_PROC_MY_NAME, "test-insert", proc, ORTE_PROC))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
}
|
|
||||||
if (ORTE_SUCCESS != (rc = orte_db.fetch(ORTE_PROC_MY_NAME, "test-insert", (void**)&proc, ORTE_PROC))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
}
|
|
||||||
if (ORTE_SUCCESS != (rc = orte_db.store(ORTE_PROC_MY_NAME, "test-insert2", proc, ORTE_PROC))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
}
|
|
||||||
if (ORTE_SUCCESS != (rc = orte_db.fetch(ORTE_PROC_MY_NAME, "test-insert2", (void**)&proc, ORTE_PROC))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
}
|
|
||||||
OBJ_RELEASE(proc);
|
|
||||||
|
|
||||||
orte_finalize();
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -27,7 +27,7 @@ int main(int argc, char* argv[])
|
|||||||
for (iter = 0; iter < 1000; ++iter) {
|
for (iter = 0; iter < 1000; ++iter) {
|
||||||
/* setup the job object */
|
/* setup the job object */
|
||||||
jdata = OBJ_NEW(orte_job_t);
|
jdata = OBJ_NEW(orte_job_t);
|
||||||
jdata->controls |= ORTE_JOB_CONTROL_NON_ORTE_JOB;
|
orte_set_attribute(&jdata->attributes, ORTE_JOB_NON_ORTE_JOB, ORTE_ATTR_GLOBAL, NULL, OPAL_BOOL);
|
||||||
|
|
||||||
/* create an app_context that defines the app to be run */
|
/* create an app_context that defines the app to be run */
|
||||||
app = OBJ_NEW(orte_app_context_t);
|
app = OBJ_NEW(orte_app_context_t);
|
||||||
@ -37,7 +37,6 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
getcwd(cwd, sizeof(cwd));
|
getcwd(cwd, sizeof(cwd));
|
||||||
app->cwd = strdup(cwd);
|
app->cwd = strdup(cwd);
|
||||||
app->user_specified_cwd = false;
|
|
||||||
|
|
||||||
/* add the app to the job data */
|
/* add the app to the job data */
|
||||||
opal_pointer_array_add(jdata->apps, app);
|
opal_pointer_array_add(jdata->apps, app);
|
||||||
|
@ -1,134 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "orte/util/proc_info.h"
|
|
||||||
#include "orte/util/name_fns.h"
|
|
||||||
#include "orte/runtime/orte_globals.h"
|
|
||||||
#include "orte/mca/rml/rml.h"
|
|
||||||
|
|
||||||
#include "orte/runtime/runtime.h"
|
|
||||||
|
|
||||||
#define MY_TAG 12345
|
|
||||||
#define MAX_COUNT 3
|
|
||||||
|
|
||||||
# define false 0
|
|
||||||
# define true 1
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char *argv[]){
|
|
||||||
int counter = 0;
|
|
||||||
char * my_name = NULL;
|
|
||||||
char * my_right_peer = NULL;
|
|
||||||
char * my_left_peer = NULL;
|
|
||||||
orte_process_name_t right_peer_orte_name;
|
|
||||||
orte_process_name_t left_peer_orte_name;
|
|
||||||
int num_peers = 0;
|
|
||||||
struct iovec msg;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Init
|
|
||||||
*/
|
|
||||||
orte_init(&argc, &argv, ORTE_PROC_NON_MPI);
|
|
||||||
|
|
||||||
num_peers = orte_process_info.num_procs;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Construct Peer name in a ring
|
|
||||||
*/
|
|
||||||
right_peer_orte_name.jobid = ORTE_PROC_MY_NAME->jobid;
|
|
||||||
right_peer_orte_name.vpid = ORTE_PROC_MY_NAME->vpid + 1;
|
|
||||||
if( right_peer_orte_name.vpid >= num_peers ) {
|
|
||||||
right_peer_orte_name.vpid = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
left_peer_orte_name.jobid = ORTE_PROC_MY_NAME->jobid;
|
|
||||||
left_peer_orte_name.vpid = ORTE_PROC_MY_NAME->vpid - 1;
|
|
||||||
if( ORTE_PROC_MY_NAME->vpid == 0 ) {
|
|
||||||
left_peer_orte_name.vpid = num_peers - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("My name is: %s -- PID %d\tMy Left Peer is %s\tMy Right Peer is %s\n",
|
|
||||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), getpid(),
|
|
||||||
ORTE_NAME_PRINT(&left_peer_orte_name),
|
|
||||||
ORTE_NAME_PRINT(&right_peer_orte_name));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Rank 0 starts the ring...
|
|
||||||
*/
|
|
||||||
if( ORTE_PROC_MY_NAME->vpid == 0) {
|
|
||||||
/* update value */
|
|
||||||
counter = 1;
|
|
||||||
|
|
||||||
/* Send to right */
|
|
||||||
msg.iov_base = (void *) &counter;
|
|
||||||
msg.iov_len = sizeof(counter);
|
|
||||||
|
|
||||||
printf("%s Send Counter (%d) to peer %s\n",
|
|
||||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
||||||
counter, ORTE_NAME_PRINT(&right_peer_orte_name));
|
|
||||||
|
|
||||||
if( 0 > orte_rml.send(&right_peer_orte_name,
|
|
||||||
&msg,
|
|
||||||
1,
|
|
||||||
MY_TAG,
|
|
||||||
0) ) {
|
|
||||||
printf("error... %d\n", __LINE__);;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
while (counter <= MAX_COUNT ) {
|
|
||||||
int *cnt;
|
|
||||||
|
|
||||||
/* Receive from left */
|
|
||||||
printf("%s Waiting to Recv Counter from peer %s\n",
|
|
||||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&left_peer_orte_name));
|
|
||||||
|
|
||||||
msg.iov_base = NULL;
|
|
||||||
msg.iov_len = 0;
|
|
||||||
|
|
||||||
if( 0 > orte_rml.recv(&left_peer_orte_name,
|
|
||||||
&msg,
|
|
||||||
1,
|
|
||||||
MY_TAG,
|
|
||||||
ORTE_RML_ALLOC) ) {
|
|
||||||
printf("error A... %d\n", __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
cnt = (int *) msg.iov_base;
|
|
||||||
counter = *cnt;
|
|
||||||
|
|
||||||
/* Update */
|
|
||||||
printf("%s Recv %d ... Send %d\n", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), counter, counter + 1);
|
|
||||||
if( ORTE_PROC_MY_NAME->vpid == 0 ) {
|
|
||||||
sleep(2);
|
|
||||||
}
|
|
||||||
if(ORTE_PROC_MY_NAME->vpid == 0) {
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(counter > MAX_COUNT && right_peer_orte_name.vpid == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send to right */
|
|
||||||
msg.iov_base = (void *) &counter;
|
|
||||||
msg.iov_len = sizeof(counter);
|
|
||||||
|
|
||||||
printf("%s Send Counter (%d) to peer (%s)\n", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), counter,
|
|
||||||
ORTE_NAME_PRINT(&right_peer_orte_name));
|
|
||||||
|
|
||||||
if( 0 > orte_rml.send(&right_peer_orte_name,
|
|
||||||
&msg,
|
|
||||||
1,
|
|
||||||
MY_TAG,
|
|
||||||
0) ) {
|
|
||||||
printf("error B... %d\n", __LINE__);;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
orte_finalize();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -37,7 +37,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
/* setup the job object */
|
/* setup the job object */
|
||||||
jdata = OBJ_NEW(orte_job_t);
|
jdata = OBJ_NEW(orte_job_t);
|
||||||
jdata->controls |= ORTE_JOB_CONTROL_NON_ORTE_JOB;
|
orte_set_attribute(&jdata->attributes, ORTE_JOB_NON_ORTE_JOB, ORTE_ATTR_GLOBAL, NULL, OPAL_BOOL);
|
||||||
|
|
||||||
/* create an app_context that defines the app to be run */
|
/* create an app_context that defines the app to be run */
|
||||||
app = OBJ_NEW(orte_app_context_t);
|
app = OBJ_NEW(orte_app_context_t);
|
||||||
@ -47,12 +47,10 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
getcwd(cwd, sizeof(cwd));
|
getcwd(cwd, sizeof(cwd));
|
||||||
app->cwd = strdup(cwd);
|
app->cwd = strdup(cwd);
|
||||||
app->user_specified_cwd = false;
|
|
||||||
/*===================================*/
|
/*===================================*/
|
||||||
char *host_list[] = {"vm2", "vm3", "vm4", NULL};
|
char *host_list = "vm,vm3,vm4";
|
||||||
app->dash_host = host_list;
|
orte_set_attribute(&app->attributes, ORTE_APP_DASH_HOST, ORTE_ATTR_GLOBAL, host_list, OPAL_STRING);
|
||||||
jdata->dyn_alloc_enabled = 1;
|
/*==================================*/
|
||||||
/*==================================*/
|
|
||||||
|
|
||||||
/* add the app to the job data */
|
/* add the app to the job data */
|
||||||
opal_pointer_array_add(jdata->apps, app);
|
opal_pointer_array_add(jdata->apps, app);
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 Intel, Inc. All rights reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "pmi.h"
|
|
||||||
|
|
||||||
/* NOTES
|
|
||||||
*
|
|
||||||
* useful debug environment variables:
|
|
||||||
* PMI_DEBUG
|
|
||||||
*/
|
|
||||||
|
|
||||||
int main(int argc, char **argv, char **envp)
|
|
||||||
{
|
|
||||||
int pmi_rank = -1;
|
|
||||||
int pmi_process_group_size = -1;
|
|
||||||
int rc = EXIT_SUCCESS;
|
|
||||||
char *err = NULL;
|
|
||||||
PMI_BOOL pmi_initialized = PMI_FALSE;
|
|
||||||
int i;
|
|
||||||
double pi;
|
|
||||||
int spawned;
|
|
||||||
|
|
||||||
if (1 < argc) {
|
|
||||||
rc = strtol(argv[1], NULL, 10);
|
|
||||||
} else {
|
|
||||||
rc = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* sanity */
|
|
||||||
if (PMI_SUCCESS != PMI_Initialized(&pmi_initialized) ||
|
|
||||||
PMI_TRUE == pmi_initialized) {
|
|
||||||
fprintf(stderr, "=== ERROR: PMI sanity failure\n");
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
if (PMI_SUCCESS != PMI_Init(&spawned)) {
|
|
||||||
err = "PMI_Init failure!";
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if (PMI_SUCCESS != PMI_Get_size(&pmi_process_group_size)) {
|
|
||||||
err = "PMI_Get_size failure!";
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if (PMI_SUCCESS != PMI_Get_rank(&pmi_rank)) {
|
|
||||||
err = "PMI_Get_rank failure!";
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (1) {
|
|
||||||
i++;
|
|
||||||
pi = i / 3.14159256;
|
|
||||||
if (i > 10000) i = 0;
|
|
||||||
if ((pmi_rank == 3 ||
|
|
||||||
(pmi_process_group_size <= 3 && pmi_rank == 0))
|
|
||||||
&& i == 9995) {
|
|
||||||
asprintf(&err, "RANK%d CALLED ABORT", pmi_rank);
|
|
||||||
fprintf(stderr, "%s\n", err);
|
|
||||||
fflush(stderr);
|
|
||||||
PMI_Abort(rc, err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
done:
|
|
||||||
if (NULL != err) {
|
|
||||||
fprintf(stderr, "=== ERROR [rank:%d] %s\n", pmi_rank, err);
|
|
||||||
rc = EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
/* -*- C -*-
|
|
||||||
*
|
|
||||||
* $HEADER$
|
|
||||||
*
|
|
||||||
* The most basic of MPI applications
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "orte/runtime/runtime.h"
|
|
||||||
#include "orte/mca/rml/rml.h"
|
|
||||||
#include "orte/util/name_fns.h"
|
|
||||||
#include "orte/runtime/orte_globals.h"
|
|
||||||
|
|
||||||
#define MY_TAG 12345
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
char hostname[512];
|
|
||||||
pid_t pid;
|
|
||||||
struct iovec msg;
|
|
||||||
|
|
||||||
gethostname(hostname, 512);
|
|
||||||
pid = getpid();
|
|
||||||
|
|
||||||
printf("CHILD starting: Node %s Pid %ld\n", hostname, (long)pid);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("CHILD %s waiting for message\n", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
|
||||||
|
|
||||||
/* wait for message from our parent */
|
|
||||||
if (0 > orte_rml.recv(ORTE_NAME_WILDCARD, &msg, 1, MY_TAG, ORTE_RML_ALLOC)) {
|
|
||||||
printf("error at line %d\n", __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("CHILD %s got message and is exiting\n", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
|
||||||
|
|
||||||
orte_finalize();
|
|
||||||
return 0;
|
|
||||||
}
|
|
Загрузка…
x
Ссылка в новой задаче
Block a user