This source file includes following definitions.
- main
1
2
3
4
5
6
7
8 #include <stdio.h>
9
10 #include "opal/util/argv.h"
11
12 #include "orte/util/proc_info.h"
13 #include "orte/mca/plm/plm.h"
14 #include "orte/mca/rml/rml.h"
15 #include "orte/mca/errmgr/errmgr.h"
16 #include "orte/runtime/runtime.h"
17 #include "orte/runtime/orte_globals.h"
18 #include "orte/util/name_fns.h"
19
20 #define MY_TAG 12345
21
22 int main(int argc, char* argv[])
23 {
24 int rc;
25 orte_job_t *jdata;
26 orte_app_context_t *app;
27 char cwd[1024];
28 orte_process_name_t name;
29 struct iovec msg;
30 orte_vpid_t i;
31
32
33 if (0 > (rc = orte_init(&argc, &argv, ORTE_PROC_NON_MPI))) {
34 fprintf(stderr, "couldn't init orte - error code %d\n", rc);
35 return rc;
36 }
37
38
39 jdata = OBJ_NEW(orte_job_t);
40 orte_set_attribute(&jdata->attributes, ORTE_JOB_NON_ORTE_JOB, ORTE_ATTR_GLOBAL, NULL, OPAL_BOOL);
41
42
43 app = OBJ_NEW(orte_app_context_t);
44 app->app = strdup("hostname");
45 opal_argv_append_nosize(&app->argv, "hostname");
46 app->num_procs = 3;
47
48 getcwd(cwd, sizeof(cwd));
49 app->cwd = strdup(cwd);
50
51 char *host_list = "vm,vm3,vm4";
52 orte_set_attribute(&app->attributes, ORTE_APP_DASH_HOST, ORTE_ATTR_GLOBAL, host_list, OPAL_STRING);
53
54
55
56 opal_pointer_array_add(jdata->apps, app);
57 jdata->num_apps = 1;
58 #if 0
59
60 jdata->map = OBJ_NEW(orte_job_map_t);
61 jdata->map->display_map = true;
62 #endif
63
64 fprintf(stderr, "Parent: spawning children!\n");
65 if (ORTE_SUCCESS != (rc = orte_plm.spawn(jdata))) {
66 ORTE_ERROR_LOG(rc);
67 orte_finalize();
68 return 1;
69 }
70 fprintf(stderr, "Parent: children spawned!\n");
71
72 #if 0
73
74 name.jobid = jdata->jobid;
75 i = 1;
76 msg.iov_base = (void *) &i;
77 msg.iov_len = sizeof(i);
78 for (i=0; i < app->num_procs; i++) {
79 name.vpid = i;
80
81 fprintf(stderr, "Parent: sending message to child %s\n", ORTE_NAME_PRINT(&name));
82 if (0 > (rc = orte_rml.send(&name, &msg, 1, MY_TAG, 0))) {
83 ORTE_ERROR_LOG(rc);
84 }
85 }
86 #endif
87
88
89 orte_finalize();
90 return 0;
91 }