This source file includes following definitions.
- main
1
2 #include <stdio.h>
3 #include <unistd.h>
4
5 #include "orte/constants.h"
6
7 #include "opal/util/argv.h"
8
9 #include "orte/mca/plm/plm.h"
10 #include "orte/mca/errmgr/errmgr.h"
11 #include "orte/runtime/runtime.h"
12 #include "orte/runtime/orte_globals.h"
13
14 int main(int argc, char* argv[])
15 {
16 int rc;
17 orte_job_t *jdata;
18 orte_app_context_t *app;
19 char cwd[1024];
20 int iter;
21
22 if (0 > (rc = orte_init(&argc, &argv, ORTE_PROC_NON_MPI))) {
23 fprintf(stderr, "couldn't init orte - error code %d\n", rc);
24 return rc;
25 }
26
27 for (iter = 0; iter < 1000; ++iter) {
28
29 jdata = OBJ_NEW(orte_job_t);
30 orte_set_attribute(&jdata->attributes, ORTE_JOB_NON_ORTE_JOB, ORTE_ATTR_GLOBAL, NULL, OPAL_BOOL);
31
32
33 app = OBJ_NEW(orte_app_context_t);
34 app->app = strdup("hostname");
35 opal_argv_append_nosize(&app->argv, "hostname");
36 app->num_procs = 1;
37
38 getcwd(cwd, sizeof(cwd));
39 app->cwd = strdup(cwd);
40
41
42 opal_pointer_array_add(jdata->apps, app);
43 jdata->num_apps = 1;
44
45 fprintf(stderr, "Parent: spawning child %d\n", iter);
46 if (ORTE_SUCCESS != (rc = orte_plm.spawn(jdata))) {
47 ORTE_ERROR_LOG(rc);
48 exit(1);
49 }
50 }
51
52
53 orte_finalize();
54 return 0;
55 }