Skip to content

Commit 5b1484a

Browse files
author
Ralph Castain
committed
Implement the backend support for process-generated event notification
1 parent 315a622 commit 5b1484a

File tree

6 files changed

+135
-4
lines changed

6 files changed

+135
-4
lines changed

contrib/update-my-copyright.pl

100644100755
File mode changed.

opal/mca/pmix/pmix3x/pmix3x_server_north.c

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,51 @@ static pmix_status_t server_notify_event(pmix_status_t code,
765765
pmix_info_t info[], size_t ninfo,
766766
pmix_op_cbfunc_t cbfunc, void *cbdata)
767767
{
768-
return PMIX_ERR_NOT_SUPPORTED;
768+
pmix3x_opalcaddy_t *opalcaddy;
769+
opal_process_name_t src;
770+
size_t n;
771+
opal_value_t *oinfo;
772+
int rc, status;
773+
774+
if (NULL == host_module || NULL == host_module->notify_event) {
775+
return PMIX_ERR_NOT_SUPPORTED;
776+
}
777+
778+
/* setup the caddy */
779+
opalcaddy = OBJ_NEW(pmix3x_opalcaddy_t);
780+
opalcaddy->opcbfunc = cbfunc;
781+
opalcaddy->cbdata = cbdata;
782+
783+
/* convert the code */
784+
status = pmix3x_convert_rc(code);
785+
786+
/* convert the source */
787+
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&src.jobid, source->nspace))) {
788+
opal_output(0, "FILE: %s LINE %d", __FILE__, __LINE__);
789+
OBJ_RELEASE(opalcaddy);
790+
return pmix3x_convert_opalrc(rc);
791+
}
792+
src.vpid = pmix3x_convert_rank(source->rank);
793+
794+
/* ignore the range for now */
795+
796+
/* convert the info */
797+
for (n=0; n < ninfo; n++) {
798+
oinfo = OBJ_NEW(opal_value_t);
799+
opal_list_append(&opalcaddy->info, &oinfo->super);
800+
oinfo->key = strdup(info[n].key);
801+
if (OPAL_SUCCESS != (rc = pmix3x_value_unload(oinfo, &info[n].value))) {
802+
OBJ_RELEASE(opalcaddy);
803+
return pmix3x_convert_opalrc(rc);
804+
}
805+
}
806+
807+
/* send it upstairs */
808+
if (OPAL_SUCCESS != (rc = host_module->notify_event(status, &src, &opalcaddy->info,
809+
opal_opcbfunc, opalcaddy))) {
810+
OBJ_RELEASE(opalcaddy);
811+
}
812+
return pmix3x_convert_opalrc(rc);
769813
}
770814

771815
static void _info_rel(void *cbdata)

opal/mca/pmix/pmix_server.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
2+
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
33
* $COPYRIGHT$
44
*
55
* Additional copyrights may follow
@@ -180,7 +180,8 @@ typedef int (*opal_pmix_server_disconnect_fn_t)(opal_list_t *procs, opal_list_t
180180
* the PMIx server itself, or by one of its local clients. The RTE
181181
* is requested to pass the notification to each PMIx server that
182182
* hosts one or more of the specified processes */
183-
typedef int (*opal_pmix_server_notify_fn_t)(int code, opal_list_t *procs, opal_list_t *info,
183+
typedef int (*opal_pmix_server_notify_fn_t)(int code, opal_process_name_t *source,
184+
opal_list_t *info,
184185
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
185186

186187
/* Query the RTE for information - the list is composed of opal_pmix_query_t items */

orte/orted/pmix/pmix_server.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ static opal_pmix_server_module_t pmix_server = {
9999
.disconnect = pmix_server_disconnect_fn,
100100
.register_events = pmix_server_register_events_fn,
101101
.deregister_events = pmix_server_deregister_events_fn,
102+
.notify_event = pmix_server_notify_event,
102103
.query = pmix_server_query_fn,
103104
.tool_connected = pmix_tool_connected_fn,
104105
.log = pmix_server_log_fn

orte/orted/pmix/pmix_server_gen.c

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,88 @@ void pmix_server_notify(int status, orte_process_name_t* sender,
342342
}
343343
}
344344

345+
int pmix_server_notify_event(int code, opal_process_name_t *source,
346+
opal_list_t *info,
347+
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
348+
{
349+
opal_buffer_t *buf;
350+
int rc, ninfo;
351+
opal_value_t *val;
352+
orte_grpcomm_signature_t *sig;
353+
354+
/* a local process has generated an event - we need to xcast it
355+
* to all the daemons so it can be passed down to their local
356+
* procs */
357+
buf = OBJ_NEW(opal_buffer_t);
358+
if (NULL == buf) {
359+
return ORTE_ERR_OUT_OF_RESOURCE;
360+
}
361+
/* pack the status code */
362+
if (OPAL_SUCCESS != (rc = opal_dss.pack(buf, &code, 1, OPAL_INT))) {
363+
ORTE_ERROR_LOG(rc);
364+
OBJ_RELEASE(buf);
365+
return rc;
366+
}
367+
/* pack the source */
368+
if (OPAL_SUCCESS != (rc = opal_dss.pack(buf, source, 1, ORTE_NAME))) {
369+
ORTE_ERROR_LOG(rc);
370+
OBJ_RELEASE(buf);
371+
return rc;
372+
}
373+
374+
/* pack the number of infos */
375+
if (NULL == info) {
376+
ninfo = 0;
377+
} else {
378+
ninfo = opal_list_get_size(info);
379+
}
380+
if (OPAL_SUCCESS != (rc = opal_dss.pack(buf, &ninfo, 1, OPAL_INT))) {
381+
ORTE_ERROR_LOG(rc);
382+
OBJ_RELEASE(buf);
383+
return rc;
384+
}
385+
if (0 < ninfo) {
386+
OPAL_LIST_FOREACH(val, info, opal_value_t) {
387+
if (OPAL_SUCCESS != (rc = opal_dss.pack(buf, val, 1, OPAL_VALUE))) {
388+
ORTE_ERROR_LOG(rc);
389+
OBJ_RELEASE(buf);
390+
return rc;
391+
}
392+
}
393+
}
394+
395+
/* goes to all daemons */
396+
sig = OBJ_NEW(orte_grpcomm_signature_t);
397+
if (NULL == sig) {
398+
OBJ_RELEASE(buf);
399+
return ORTE_ERR_OUT_OF_RESOURCE;
400+
}
401+
sig->signature = (orte_process_name_t*)malloc(sizeof(orte_process_name_t));
402+
if (NULL == sig->signature) {
403+
OBJ_RELEASE(buf);
404+
OBJ_RELEASE(sig);
405+
return ORTE_ERR_OUT_OF_RESOURCE;
406+
}
407+
sig->signature[0].jobid = ORTE_PROC_MY_NAME->jobid;
408+
sig->signature[0].vpid = ORTE_VPID_WILDCARD;
409+
sig->sz = 1;
410+
if (ORTE_SUCCESS != (rc = orte_grpcomm.xcast(sig, ORTE_RML_TAG_NOTIFICATION, buf))) {
411+
ORTE_ERROR_LOG(rc);
412+
OBJ_RELEASE(buf);
413+
OBJ_RELEASE(sig);
414+
return rc;
415+
}
416+
OBJ_RELEASE(buf);
417+
/* maintain accounting */
418+
OBJ_RELEASE(sig);
419+
420+
/* execute the callback */
421+
if (NULL != cbfunc) {
422+
cbfunc(ORTE_SUCCESS, cbdata);
423+
}
424+
return ORTE_SUCCESS;
425+
}
426+
345427
static void qrel(void *cbdata)
346428
{
347429
opal_list_t *l = (opal_list_t*)cbdata;

orte/orted/pmix/pmix_server_internal.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
1313
* All rights reserved.
1414
* Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved.
15-
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
15+
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
1616
* Copyright (c) 2014 Mellanox Technologies, Inc.
1717
* All rights reserved.
1818
* Copyright (c) 2014 Research Organization for Information Science
@@ -189,6 +189,9 @@ extern int pmix_server_register_events_fn(opal_list_t *info,
189189
extern int pmix_server_deregister_events_fn(opal_list_t *info,
190190
opal_pmix_op_cbfunc_t cbfunc,
191191
void *cbdata);
192+
extern int pmix_server_notify_event(int code, opal_process_name_t *source,
193+
opal_list_t *info,
194+
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
192195
extern int pmix_server_query_fn(opal_process_name_t *requestor,
193196
opal_list_t *queries,
194197
opal_pmix_info_cbfunc_t cbfunc, void *cbdata);

0 commit comments

Comments
 (0)