Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit 980766e

Browse files
committed
Merge pull request #963 from rhc54/cmr2.x/pmix
Update the PMIx support to the PMIx 1.1.2 release.
2 parents aaf15d9 + e923c4f commit 980766e

30 files changed

+853
-507
lines changed

ompi/dpm/dpm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ static int construct_peers(ompi_group_t *group, opal_list_t *peers)
536536
} else {
537537
proc_name = proct->super.proc_name;
538538
}
539-
539+
540540
/* add to the list of peers */
541541
nm = OBJ_NEW(opal_namelist_t);
542542
nm->name = proc_name;
@@ -1203,7 +1203,7 @@ static bool ompi_dpm_group_is_dyn (ompi_group_t *group, ompi_jobid_t thisjobid)
12031203
{
12041204
int size = group ? ompi_group_size (group) : 0;
12051205

1206-
for (int i = 1 ; i < size ; ++i) {
1206+
for (int i = 0 ; i < size ; ++i) {
12071207
opal_process_name_t name = ompi_group_get_proc_name (group, i);
12081208

12091209
if (thisjobid != ((ompi_process_name_t *) &name)->jobid) {

opal/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ nobase_opal_HEADERS = $(headers)
7575
endif
7676

7777
include class/Makefile.am
78+
include errhandler/Makefile.am
7879
include memoryhooks/Makefile.am
7980
include runtime/Makefile.am
8081
include threads/Makefile.am

opal/errhandler/Makefile.am

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- makefile -*-
2+
#
3+
# Copyright (c) 2015 Intel, Inc. All rights reserved.
4+
# $COPYRIGHT$
5+
#
6+
# Additional copyrights may follow
7+
#
8+
# $HEADER$
9+
#
10+
11+
# This makefile.am does not stand on its own - it is included from opal/Makefile.am
12+
13+
headers += \
14+
errhandler/opal_errhandler.h
15+
16+
lib@OPAL_LIB_PREFIX@open_pal_la_SOURCES += \
17+
errhandler/opal_errhandler.c

opal/errhandler/opal_errhandler.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2015 Intel, Inc. All rights reserved.
3+
* $COPYRIGHT$
4+
*
5+
* Additional copyrights may follow
6+
*
7+
* $HEADER$
8+
*/
9+
10+
#include "opal_config.h"
11+
12+
#include "opal/errhandler/opal_errhandler.h"
13+
14+
opal_errhandler_fn_t errhandler = NULL;
15+
void *cbdata = NULL;
16+
17+
void opal_register_errhandler(opal_errhandler_fn_t newerr, void *cbd)
18+
{
19+
errhandler = newerr;
20+
cbdata = cbd;
21+
}
22+
23+
void opal_deregister_errhandler(void)
24+
{
25+
errhandler = NULL;
26+
cbdata = NULL;
27+
}
28+
29+
void opal_invoke_errhandler(int status, opal_proc_t *proc)
30+
{
31+
if (NULL != errhandler) {
32+
errhandler(status, proc, cbdata);
33+
}
34+
}

opal/errhandler/opal_errhandler.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) 2015 Intel, Inc. All rights reserved.
3+
* $COPYRIGHT$
4+
*
5+
* Additional copyrights may follow
6+
*
7+
* $HEADER$
8+
*/
9+
10+
#ifndef OPAL_ERRHANDLER_H
11+
#define OPAL_ERRHANDLER_H
12+
13+
#include "opal_config.h"
14+
15+
#include "opal/util/proc.h"
16+
17+
typedef void (*opal_errhandler_fn_t)(int status, opal_proc_t *proc, void *cbdata);
18+
19+
OPAL_DECLSPEC void opal_register_errhandler(opal_errhandler_fn_t errhandler, void *cbdata);
20+
21+
OPAL_DECLSPEC void opal_deregister_errhandler(void);
22+
23+
OPAL_DECLSPEC void opal_invoke_errhandler(int status, opal_proc_t *proc);
24+
25+
#endif

opal/mca/pmix/base/base.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@ OPAL_DECLSPEC int opal_pmix_base_select(void);
3232

3333
OPAL_DECLSPEC extern bool opal_pmix_base_allow_delayed_server;
3434

35-
OPAL_DECLSPEC void opal_pmix_base_register_handler(opal_pmix_errhandler_fn_t err);
36-
OPAL_DECLSPEC void opal_pmix_base_deregister_handler(void);
35+
OPAL_DECLSPEC void opal_pmix_base_register_handler(opal_list_t *info,
36+
opal_pmix_notification_fn_t errhandler,
37+
opal_pmix_errhandler_reg_cbfunc_t cbfunc,
38+
void *cbdata);
39+
OPAL_DECLSPEC void opal_pmix_base_deregister_handler(int errhandler,
40+
opal_pmix_op_cbfunc_t cbfunc,
41+
void *cbdata);
3742
OPAL_DECLSPEC void opal_pmix_base_errhandler(int status,
3843
opal_list_t *procs,
39-
opal_list_t *info);
44+
opal_list_t *info,
45+
opal_pmix_release_cbfunc_t cbfunc, void *cbdata);
4046
OPAL_DECLSPEC int opal_pmix_base_exchange(opal_value_t *info,
4147
opal_pmix_pdata_t *pdat,
4248
int timeout);

opal/mca/pmix/base/pmix_base_fns.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,40 @@
3838

3939
#define OPAL_PMI_PAD 10
4040

41-
/******** ERRHANDLER SUPPORT ********/
42-
static opal_pmix_errhandler_fn_t errhandler = NULL;
43-
44-
void opal_pmix_base_register_handler(opal_pmix_errhandler_fn_t err)
41+
/******** ERRHANDLER SUPPORT FOR COMPONENTS THAT
42+
******** DO NOT NATIVELY SUPPORT IT
43+
********/
44+
static opal_pmix_notification_fn_t errhandler = NULL;
45+
46+
void opal_pmix_base_register_handler(opal_list_t *info,
47+
opal_pmix_notification_fn_t err,
48+
opal_pmix_errhandler_reg_cbfunc_t cbfunc,
49+
void *cbdata)
4550
{
4651
errhandler = err;
52+
if (NULL != cbfunc) {
53+
cbfunc(OPAL_SUCCESS, 0, cbdata);
54+
}
4755
}
4856

4957
void opal_pmix_base_errhandler(int status,
5058
opal_list_t *procs,
51-
opal_list_t *info)
59+
opal_list_t *info,
60+
opal_pmix_release_cbfunc_t cbfunc, void *cbdata)
5261
{
5362
if (NULL != errhandler) {
54-
errhandler(status);
63+
errhandler(status, procs, info, cbfunc, cbdata);
5564
}
5665
}
5766

58-
void opal_pmix_base_deregister_handler(void)
67+
void opal_pmix_base_deregister_handler(int errid,
68+
opal_pmix_op_cbfunc_t cbfunc,
69+
void *cbdata)
5970
{
6071
errhandler = NULL;
72+
if (NULL != cbfunc) {
73+
cbfunc(OPAL_SUCCESS, cbdata);
74+
}
6175
}
6276

6377
struct lookup_caddy_t {

opal/mca/pmix/external/Makefile.am

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,5 @@ noinst_LTLIBRARIES = $(component_noinst)
4444
libmca_pmix_external_la_SOURCES =$(sources)
4545
libmca_pmix_external_la_CFLAGS =
4646
libmca_pmix_external_la_CPPFLAGS = $(opal_pmix_ext_CPPFLAGS)
47-
libmca_pmix_external_la_LDFLAGS = -module -avoid-version -L$(opal_pmix_ext_LDFLAGS)
48-
libmca_pmix_external_la_LIBADD = $(opal_pmix_ext_LIBS) \
49-
$(OPAL_TOP_BUILDDIR)/opal/mca/event/lib@OPAL_LIB_PREFIX@mca_event.la \
50-
$(OPAL_TOP_BUILDDIR)/opal/mca/hwloc/lib@OPAL_LIB_PREFIX@mca_hwloc.la
47+
libmca_pmix_external_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext_LDFLAGS)
48+
libmca_pmix_external_la_LIBADD = $(opal_pmix_ext_LIBS)

opal/mca/pmix/external/pmix_ext_client.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ static pmix_proc_t my_proc;
3636
static char *dbgvalue=NULL;
3737
static int errhdler_ref = 0;
3838

39+
static void completion_handler (void * cbdata) {
40+
int * cond = (int *)cbdata;
41+
*cond = 0;
42+
}
43+
44+
#define PMIX_WAIT_FOR_COMPLETION(a) \
45+
do { \
46+
while ((a)) { \
47+
usleep(10); \
48+
} \
49+
} while (0);
50+
3951
static void myerr(pmix_status_t status,
4052
pmix_proc_t procs[], size_t nprocs,
4153
pmix_info_t info[], size_t ninfo)
@@ -45,6 +57,7 @@ static void myerr(pmix_status_t status,
4557
opal_namelist_t *nm;
4658
opal_value_t *iptr;
4759
size_t n;
60+
volatile int cond = 1;
4861

4962
/* convert the incoming status */
5063
rc = pmix1_convert_rc(status);
@@ -64,11 +77,13 @@ static void myerr(pmix_status_t status,
6477
iptr = OBJ_NEW(opal_value_t);
6578
iptr->key = strdup(info[n].key);
6679
pmix1_value_unload(iptr, &info[n].value);
67-
opal_list_append(&plist, &nm->super);
80+
opal_list_append(&plist, &iptr->super);
6881
}
6982

7083
/* call the base errhandler */
71-
opal_pmix_base_errhandler(rc, &plist, &ilist);
84+
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
85+
PMIX_WAIT_FOR_COMPLETION(cond);
86+
7287
OPAL_LIST_DESTRUCT(&plist);
7388
OPAL_LIST_DESTRUCT(&ilist);
7489
}

opal/mca/pmix/external/pmix_ext_server_south.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ extern opal_pmix_server_module_t *host_module;
5050
static char *dbgvalue=NULL;
5151
static int errhdler_ref = 0;
5252

53+
static void completion_handler (void * cbdata) {
54+
int * cond = (int *)cbdata;
55+
*cond = 0;
56+
}
57+
58+
#define PMIX_WAIT_FOR_COMPLETION(a) \
59+
do { \
60+
while ((a)) { \
61+
usleep(10); \
62+
} \
63+
} while (0);
64+
5365
static void myerr(pmix_status_t status,
5466
pmix_proc_t procs[], size_t nprocs,
5567
pmix_info_t info[], size_t ninfo)
@@ -58,6 +70,7 @@ static void myerr(pmix_status_t status,
5870
opal_list_t plist, ilist;
5971
opal_namelist_t *nm;
6072
opal_value_t *iptr;
73+
volatile int cond = 1;
6174
size_t n;
6275

6376
/* convert the incoming status */
@@ -78,11 +91,13 @@ static void myerr(pmix_status_t status,
7891
iptr = OBJ_NEW(opal_value_t);
7992
iptr->key = strdup(info[n].key);
8093
pmix1_value_unload(iptr, &info[n].value);
81-
opal_list_append(&plist, &nm->super);
94+
opal_list_append(&plist, &iptr->super);
8295
}
8396

8497
/* call the base errhandler */
85-
opal_pmix_base_errhandler(rc, &plist, &ilist);
98+
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
99+
PMIX_WAIT_FOR_COMPLETION(cond);
100+
86101
OPAL_LIST_DESTRUCT(&plist);
87102
OPAL_LIST_DESTRUCT(&ilist);
88103
}

0 commit comments

Comments
 (0)