Skip to content

Commit 0380c00

Browse files
committed
pmix/pmix4x: refresh to the latest PMIx
refresh to openpmix/openpmix@dc53a84 and add commits from openpmix/openpmix#1031 and openpmix/openpmix#1034 !!! NOT FROM THE OFFICIAL PMIx repository !!! Refs. #6242 Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent c1bc92f commit 0380c00

28 files changed

+1309
-603
lines changed

opal/mca/pmix/pmix4x/pmix/VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ release=0
2323
# The only requirement is that it must be entirely printable ASCII
2424
# characters and have no white space.
2525

26-
greek=
26+
greek=a1
2727

2828
# If repo_rev is empty, then the repository version number will be
2929
# obtained during "make dist" via the "git describe --tags --always"
3030
# command, or with the date (if "git describe" fails) in the form of
3131
# "date<date>".
3232

33-
repo_rev=gitfae0ee7d
33+
repo_rev=git0be66492
3434

3535
# If tarball_version is not empty, it is used as the version string in
3636
# the tarball filename, regardless of all other versions listed in
@@ -44,7 +44,7 @@ tarball_version=
4444

4545
# The date when this release was created
4646

47-
date="Dec 28, 2018"
47+
date="Jan 07, 2019"
4848

4949
# The shared library version of each of PMIx's public libraries.
5050
# These versions are maintained in accordance with the "Library

opal/mca/pmix/pmix4x/pmix/contrib/pmix.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192

193193
Summary: An extended/exascale implementation of PMI
194194
Name: %{?_name:%{_name}}%{!?_name:pmix}
195-
Version: 4.0.0
195+
Version: 4.0.0a1
196196
Release: 1%{?dist}
197197
License: BSD
198198
Group: Development/Libraries

opal/mca/pmix/pmix4x/pmix/examples/Makefile.am

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
# All rights reserved.
1212
# Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
1313
# Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
14-
# Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
14+
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
1515
# $COPYRIGHT$
1616
#
1717
# Additional copyrights may follow
1818
#
1919
# $HEADER$
2020
#
21+
headers = examples.h
2122

2223
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/include -I$(top_builddir)/include/pmix
2324

@@ -28,64 +29,64 @@ if !WANT_HIDDEN
2829
noinst_PROGRAMS += server
2930
endif
3031

31-
client_SOURCES = client.c
32+
client_SOURCES = client.c examples.h
3233
client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
3334
client_LDADD = $(top_builddir)/src/libpmix.la
3435

35-
client2_SOURCES = client2.c
36+
client2_SOURCES = client2.c examples.h
3637
client2_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
3738
client2_LDADD = $(top_builddir)/src/libpmix.la
3839

39-
debugger_SOURCES = debugger.c
40+
debugger_SOURCES = debugger.c examples.h
4041
debugger_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
4142
debugger_LDADD = $(top_builddir)/src/libpmix.la
4243

43-
debuggerd_SOURCES = debuggerd.c
44+
debuggerd_SOURCES = debuggerd.c examples.h
4445
debuggerd_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
4546
debuggerd_LDADD = $(top_builddir)/src/libpmix.la
4647

47-
alloc_SOURCES = alloc.c
48+
alloc_SOURCES = alloc.c examples.h
4849
alloc_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
4950
alloc_LDADD = $(top_builddir)/src/libpmix.la
5051

51-
jctrl_SOURCES = jctrl.c
52+
jctrl_SOURCES = jctrl.c examples.h
5253
jctrl_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
5354
jctrl_LDADD = $(top_builddir)/src/libpmix.la
5455

55-
dmodex_SOURCES = dmodex.c
56+
dmodex_SOURCES = dmodex.c examples.h
5657
dmodex_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
5758
dmodex_LDADD = $(top_builddir)/src/libpmix.la
5859

59-
dynamic_SOURCES = dynamic.c
60+
dynamic_SOURCES = dynamic.c examples.h
6061
dynamic_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
6162
dynamic_LDADD = $(top_builddir)/src/libpmix.la
6263

63-
fault_SOURCES = fault.c
64+
fault_SOURCES = fault.c examples.h
6465
fault_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
6566
fault_LDADD = $(top_builddir)/src/libpmix.la
6667

67-
pub_SOURCES = pub.c
68+
pub_SOURCES = pub.c examples.h
6869
pub_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
6970
pub_LDADD = $(top_builddir)/src/libpmix.la
7071

71-
pubi_SOURCES = pubi.c
72+
pubi_SOURCES = pubi.c examples.h
7273
pubi_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
7374
pubi_LDADD = $(top_builddir)/src/libpmix.la
7475

75-
tool_SOURCES = tool.c
76+
tool_SOURCES = tool.c examples.h
7677
tool_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
7778
tool_LDADD = $(top_builddir)/src/libpmix.la
7879

79-
group_SOURCES = group.c
80+
group_SOURCES = group.c examples.h
8081
group_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
8182
group_LDADD = $(top_builddir)/src/libpmix.la
8283

83-
asyncgroup_SOURCES = asyncgroup.c
84+
asyncgroup_SOURCES = asyncgroup.c examples.h
8485
asyncgroup_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
8586
asyncgroup_LDADD = $(top_builddir)/src/libpmix.la
8687

8788
if !WANT_HIDDEN
88-
server_SOURCES = server.c
89+
server_SOURCES = server.c examples.h
8990
server_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
9091
server_LDADD = $(top_builddir)/src/libpmix.la
9192
endif

opal/mca/pmix/pmix4x/pmix/examples/alloc.c

Lines changed: 78 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* All rights reserved.
1414
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
16-
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
16+
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
1717
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
1818
* $COPYRIGHT$
1919
*
@@ -30,16 +30,7 @@
3030
#include <time.h>
3131

3232
#include <pmix.h>
33-
34-
/* define a structure for collecting returned
35-
* info from an allocation request */
36-
typedef struct {
37-
volatile bool active;
38-
pmix_info_t *info;
39-
size_t ninfo;
40-
} mydata_t;
41-
42-
static volatile bool waiting_for_allocation = true;
33+
#include "examples.h"
4334

4435
/* this is a callback function for the PMIx_Query and
4536
* PMIx_Allocate APIs. The query will callback with a status indicating
@@ -59,7 +50,7 @@ static void infocbfunc(pmix_status_t status,
5950
pmix_release_cbfunc_t release_fn,
6051
void *release_cbdata)
6152
{
62-
mydata_t *mq = (mydata_t*)cbdata;
53+
myquery_data_t *mq = (myquery_data_t*)cbdata;
6354
size_t n;
6455

6556
fprintf(stderr, "Allocation request returned %s", PMIx_Error_string(status));
@@ -75,6 +66,9 @@ static void infocbfunc(pmix_status_t status,
7566
PMIX_INFO_XFER(&mq->info[n], &info[n]);
7667
}
7768
}
69+
/* the status returned here indicates whether the requested
70+
* information was found or not - preserve it */
71+
mq->lock.status = status;
7872

7973
/* let the library release the data and cleanup from
8074
* the operation */
@@ -83,7 +77,7 @@ static void infocbfunc(pmix_status_t status,
8377
}
8478

8579
/* release the block */
86-
mq->active = false;
80+
DEBUG_WAKEUP_THREAD(&mq->lock);
8781
}
8882

8983
/* this is an event notification function that we explicitly request
@@ -100,12 +94,37 @@ static void release_fn(size_t evhdlr_registration_id,
10094
pmix_event_notification_cbfunc_fn_t cbfunc,
10195
void *cbdata)
10296
{
97+
myrel_t *lock;
98+
size_t n;
99+
100+
/* find the return object */
101+
lock = NULL;
102+
for (n=0; n < ninfo; n++) {
103+
if (0 == strncmp(info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) {
104+
lock = (myrel_t*)info[n].value.data.ptr;
105+
break;
106+
}
107+
}
108+
/* if the object wasn't returned, then that is an error */
109+
if (NULL == lock) {
110+
fprintf(stderr, "LOCK WASN'T RETURNED IN RELEASE CALLBACK\n");
111+
/* let the event handler progress */
112+
if (NULL != cbfunc) {
113+
cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata);
114+
}
115+
return;
116+
}
117+
103118
/* tell the event handler state machine that we are the last step */
104119
if (NULL != cbfunc) {
105120
cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata);
106121
}
107-
/* flag that the allocation is complete so we can exit */
108-
waiting_for_allocation = false;
122+
/* the status will be PMIX_ERR_ALLOC_COMPLETE since that is the code
123+
* we registered to receive. The result of the allocation request is
124+
* in the info array - for now, just assume success */
125+
lock->lock.status = PMIX_SUCCESS;
126+
/* release the lock */
127+
DEBUG_WAKEUP_THREAD(&lock->lock);
109128
}
110129

111130
/* event handler registration is done asynchronously because it
@@ -114,18 +133,20 @@ static void release_fn(size_t evhdlr_registration_id,
114133
* the status of the request (success or an error), plus a numerical index
115134
* to the registered event. The index is used later on to deregister
116135
* an event handler - if we don't explicitly deregister it, then the
117-
* PMIx server will do so when it see us exit */
136+
* PMIx server will do so when it sees us exit */
118137
static void evhandler_reg_callbk(pmix_status_t status,
119138
size_t evhandler_ref,
120139
void *cbdata)
121140
{
122-
volatile int *active = (volatile int*)cbdata;
141+
mylock_t *lock = (mylock_t*)cbdata;
123142

124143
if (PMIX_SUCCESS != status) {
125144
fprintf(stderr, "EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n",
126145
status, (unsigned long)evhandler_ref);
127146
}
128-
*active = status;
147+
lock->status = status;
148+
lock->evhandler_ref = evhandler_ref;
149+
DEBUG_WAKEUP_THREAD(lock);
129150
}
130151

131152
int main(int argc, char **argv)
@@ -138,11 +159,12 @@ int main(int argc, char **argv)
138159
uint32_t nprocs;
139160
pmix_info_t *info;
140161
uint64_t nnodes = 12;
141-
mydata_t mydata;
162+
myquery_data_t mydata;
142163
pmix_query_t *query;
143164
char *myallocation = "MYALLOCATION";
144-
volatile int active;
145-
pmix_status_t code = PMIX_NOTIFY_ALLOC_COMPLETE;
165+
mylock_t mylock;
166+
pmix_status_t code;
167+
myrel_t myrel;
146168

147169
/* init us */
148170
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
@@ -163,63 +185,64 @@ int main(int argc, char **argv)
163185
PMIX_VALUE_RELEASE(val);
164186
fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs);
165187

166-
/* initialize the return info struct */
167-
mydata.info = NULL;
168-
mydata.ninfo = 0;
169-
170188
if (0 == myproc.rank) {
171189
/* try to get an allocation */
172-
mydata.active = true;
190+
DEBUG_CONSTRUCT_MYQUERY(&mydata);
173191
PMIX_INFO_CREATE(info, 2);
174192
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_NUM_NODES, &nnodes, PMIX_UINT64);
175193
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
176-
if (PMIX_SUCCESS != (rc = PMIx_Allocation_request_nb(PMIX_ALLOC_NEW, info, 2, infocbfunc, NULL))) {
194+
if (PMIX_SUCCESS != (rc = PMIx_Allocation_request_nb(PMIX_ALLOC_NEW, info, 2, infocbfunc, &mydata))) {
177195
fprintf(stderr, "Client ns %s rank %d: PMIx_Allocation_request_nb failed: %d\n", myproc.nspace, myproc.rank, rc);
178196
goto done;
179197
}
180-
while (mydata.active) {
181-
usleep(10);
182-
}
198+
DEBUG_WAIT_THREAD(&mydata.lock);
183199
PMIX_INFO_FREE(info, 2);
184-
if (NULL != mydata.info) {
185-
PMIX_INFO_FREE(mydata.info, mydata.ninfo);
186-
}
200+
fprintf(stderr, "Client ns %s rank %d: Allocation returned status: %s\n",
201+
myproc.nspace, myproc.rank, PMIx_Error_string(mydata.lock.status));
202+
DEBUG_DESTRUCT_MYQUERY(&mydata);
203+
187204
} else if (1 == myproc.rank) {
188-
/* register a handler specifically for when the allocation
189-
* operation completes */
190-
PMIX_INFO_CREATE(info, 1);
205+
/* demonstrate a notification based approach - register a handler
206+
* specifically for when the allocation operation completes */
207+
DEBUG_CONSTRUCT_MYREL(&myrel);
208+
PMIX_INFO_CREATE(info, 2);
191209
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
192-
active = -1;
193-
PMIx_Register_event_handler(&code, 1, info, 1,
194-
release_fn, evhandler_reg_callbk, (void*)&active);
195-
while (-1 == active) {
196-
usleep(10);
197-
}
198-
if (0 != active) {
199-
exit(active);
200-
}
201-
PMIX_INFO_FREE(info, 1);
210+
PMIX_INFO_LOAD(&info[1], PMIX_EVENT_RETURN_OBJECT, &myrel, PMIX_POINTER);
211+
DEBUG_CONSTRUCT_LOCK(&mylock);
212+
code = PMIX_NOTIFY_ALLOC_COMPLETE;
213+
PMIx_Register_event_handler(&code, 1, info, 2,
214+
release_fn, evhandler_reg_callbk, (void*)&mylock);
215+
DEBUG_WAIT_THREAD(&mylock);
216+
PMIX_INFO_FREE(info, 2);
217+
rc = mylock.status;
218+
DEBUG_DESTRUCT_LOCK(&mylock);
219+
202220
/* now wait to hear that the request is complete */
203-
while (waiting_for_allocation) {
204-
usleep(10);
205-
}
221+
DEBUG_WAIT_THREAD(&myrel.lock);
222+
fprintf(stderr, "[%s:%d] Allocation returned status: %s\n",
223+
myproc.nspace, myproc.rank, PMIx_Error_string(myrel.lock.status));
224+
DEBUG_DESTRUCT_MYREL(&myrel);
225+
206226
} else {
207-
/* I am not the root rank, so let me wait a little while and then
208-
* query the status of the allocation request */
227+
/* demonstrate a query-based approach - wait a little while and ask to
228+
* see if it was done */
209229
usleep(10);
230+
DEBUG_CONSTRUCT_MYQUERY(&mydata);
231+
210232
PMIX_QUERY_CREATE(query, 1);
211233
PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_QUERY_ALLOC_STATUS);
212234
PMIX_INFO_CREATE(query[0].qualifiers, 1);
213235
PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
214-
mydata.active = true;
236+
215237
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, 1, infocbfunc, (void*)&mydata))) {
216238
fprintf(stderr, "PMIx_Query_info failed: %d\n", rc);
217239
goto done;
218240
}
219-
while (mydata.active) {
220-
usleep(10);
221-
}
241+
DEBUG_WAIT_THREAD(&mydata.lock);
222242
PMIX_QUERY_FREE(query, 1);
243+
fprintf(stderr, "[%s:%d] Allocation returned status: %s\n",
244+
myproc.nspace, myproc.rank, PMIx_Error_string(mydata.lock.status));
245+
DEBUG_DESTRUCT_MYQUERY(&mydata);
223246
}
224247

225248
done:

0 commit comments

Comments
 (0)