This source file includes following definitions.
- notification_fn
- errhandler_reg_callbk
- main
1
2
3
4
5
6
7 #include "orte_config.h"
8
9 #include <stdio.h>
10 #include <unistd.h>
11
12 #include "opal/mca/pmix/pmix.h"
13 #include "orte/runtime/runtime.h"
14 #include "orte/util/proc_info.h"
15 #include "orte/util/name_fns.h"
16 #include "orte/runtime/orte_globals.h"
17 #include "orte/mca/errmgr/errmgr.h"
18
19 static pid_t pid;
20 static char hostname[OPAL_MAXHOSTNAMELEN];
21
22 static void notification_fn(int status,
23 const opal_process_name_t *source,
24 opal_list_t *info, opal_list_t *results,
25 opal_pmix_notification_complete_fn_t cbfunc,
26 void *cbdata)
27 {
28 int peer_rank;
29
30 fprintf(stderr, "orte_notify: Name %s Host: %s Pid %ld status %d source %s\n",
31 ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
32 hostname, (long)pid, status, ORTE_NAME_PRINT(source));
33
34
35 if (cbfunc) {
36 cbfunc(OPAL_ERR_HANDLERS_COMPLETE, NULL, NULL, NULL, cbdata);
37 }
38
39 }
40
41 static void errhandler_reg_callbk(int status,
42 size_t evhdlr_ref,
43 void *cbdata)
44 {
45 return;
46 }
47
48 int main(int argc, char* argv[])
49 {
50 int rc;
51 opal_value_t *kv;
52 opal_list_t info;
53
54 if (0 > (rc = orte_init(&argc, &argv, ORTE_PROC_NON_MPI))) {
55 fprintf(stderr, "orte_abort: couldn't init orte - error code %d\n", rc);
56 return rc;
57 }
58 pid = getpid();
59 gethostname(hostname, sizeof(hostname));
60
61 printf("orte_notify: Name %s Host: %s Pid %ld\n",
62 ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
63 hostname, (long)pid);
64 fflush(stdout);
65
66
67 OBJ_CONSTRUCT(&info, opal_list_t);
68 kv = OBJ_NEW(opal_value_t);
69 kv->key = strdup(OPAL_PMIX_EVENT_ORDER_PREPEND);
70 kv->type = OPAL_BOOL;
71 kv->data.flag = true;
72 opal_list_append(&info, &kv->super);
73
74 opal_pmix.register_evhandler(NULL, &info,
75 notification_fn,
76 NULL, NULL);
77
78 while (1) {
79 usleep(100);
80 }
81
82 return 0;
83 }