Skip to content

pmix/pmix4x: refresh to the latest PMIx #6246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions opal/mca/pmix/pmix4x/pmix/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ release=0
# The only requirement is that it must be entirely printable ASCII
# characters and have no white space.

greek=
greek=a1

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

repo_rev=gitfae0ee7d
repo_rev=git0be66492

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

# The date when this release was created

date="Dec 28, 2018"
date="Jan 07, 2019"

# The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library
Expand Down
2 changes: 1 addition & 1 deletion opal/mca/pmix/pmix4x/pmix/contrib/pmix.spec
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@

Summary: An extended/exascale implementation of PMI
Name: %{?_name:%{_name}}%{!?_name:pmix}
Version: 4.0.0
Version: 4.0.0a1
Release: 1%{?dist}
License: BSD
Group: Development/Libraries
Expand Down
33 changes: 17 additions & 16 deletions opal/mca/pmix/pmix4x/pmix/examples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
# All rights reserved.
# Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
# Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
headers = examples.h

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

Expand All @@ -28,64 +29,64 @@ if !WANT_HIDDEN
noinst_PROGRAMS += server
endif

client_SOURCES = client.c
client_SOURCES = client.c examples.h
client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
client_LDADD = $(top_builddir)/src/libpmix.la

client2_SOURCES = client2.c
client2_SOURCES = client2.c examples.h
client2_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
client2_LDADD = $(top_builddir)/src/libpmix.la

debugger_SOURCES = debugger.c
debugger_SOURCES = debugger.c examples.h
debugger_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
debugger_LDADD = $(top_builddir)/src/libpmix.la

debuggerd_SOURCES = debuggerd.c
debuggerd_SOURCES = debuggerd.c examples.h
debuggerd_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
debuggerd_LDADD = $(top_builddir)/src/libpmix.la

alloc_SOURCES = alloc.c
alloc_SOURCES = alloc.c examples.h
alloc_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
alloc_LDADD = $(top_builddir)/src/libpmix.la

jctrl_SOURCES = jctrl.c
jctrl_SOURCES = jctrl.c examples.h
jctrl_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
jctrl_LDADD = $(top_builddir)/src/libpmix.la

dmodex_SOURCES = dmodex.c
dmodex_SOURCES = dmodex.c examples.h
dmodex_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
dmodex_LDADD = $(top_builddir)/src/libpmix.la

dynamic_SOURCES = dynamic.c
dynamic_SOURCES = dynamic.c examples.h
dynamic_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
dynamic_LDADD = $(top_builddir)/src/libpmix.la

fault_SOURCES = fault.c
fault_SOURCES = fault.c examples.h
fault_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
fault_LDADD = $(top_builddir)/src/libpmix.la

pub_SOURCES = pub.c
pub_SOURCES = pub.c examples.h
pub_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
pub_LDADD = $(top_builddir)/src/libpmix.la

pubi_SOURCES = pubi.c
pubi_SOURCES = pubi.c examples.h
pubi_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
pubi_LDADD = $(top_builddir)/src/libpmix.la

tool_SOURCES = tool.c
tool_SOURCES = tool.c examples.h
tool_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
tool_LDADD = $(top_builddir)/src/libpmix.la

group_SOURCES = group.c
group_SOURCES = group.c examples.h
group_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
group_LDADD = $(top_builddir)/src/libpmix.la

asyncgroup_SOURCES = asyncgroup.c
asyncgroup_SOURCES = asyncgroup.c examples.h
asyncgroup_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
asyncgroup_LDADD = $(top_builddir)/src/libpmix.la

if !WANT_HIDDEN
server_SOURCES = server.c
server_SOURCES = server.c examples.h
server_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
server_LDADD = $(top_builddir)/src/libpmix.la
endif
Expand Down
133 changes: 78 additions & 55 deletions opal/mca/pmix/pmix4x/pmix/examples/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
Expand All @@ -30,16 +30,7 @@
#include <time.h>

#include <pmix.h>

/* define a structure for collecting returned
* info from an allocation request */
typedef struct {
volatile bool active;
pmix_info_t *info;
size_t ninfo;
} mydata_t;

static volatile bool waiting_for_allocation = true;
#include "examples.h"

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

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

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

/* release the block */
mq->active = false;
DEBUG_WAKEUP_THREAD(&mq->lock);
}

/* this is an event notification function that we explicitly request
Expand All @@ -100,12 +94,37 @@ static void release_fn(size_t evhdlr_registration_id,
pmix_event_notification_cbfunc_fn_t cbfunc,
void *cbdata)
{
myrel_t *lock;
size_t n;

/* find the return object */
lock = NULL;
for (n=0; n < ninfo; n++) {
if (0 == strncmp(info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) {
lock = (myrel_t*)info[n].value.data.ptr;
break;
}
}
/* if the object wasn't returned, then that is an error */
if (NULL == lock) {
fprintf(stderr, "LOCK WASN'T RETURNED IN RELEASE CALLBACK\n");
/* let the event handler progress */
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata);
}
return;
}

/* tell the event handler state machine that we are the last step */
if (NULL != cbfunc) {
cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata);
}
/* flag that the allocation is complete so we can exit */
waiting_for_allocation = false;
/* the status will be PMIX_ERR_ALLOC_COMPLETE since that is the code
* we registered to receive. The result of the allocation request is
* in the info array - for now, just assume success */
lock->lock.status = PMIX_SUCCESS;
/* release the lock */
DEBUG_WAKEUP_THREAD(&lock->lock);
}

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

if (PMIX_SUCCESS != status) {
fprintf(stderr, "EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n",
status, (unsigned long)evhandler_ref);
}
*active = status;
lock->status = status;
lock->evhandler_ref = evhandler_ref;
DEBUG_WAKEUP_THREAD(lock);
}

int main(int argc, char **argv)
Expand All @@ -138,11 +159,12 @@ int main(int argc, char **argv)
uint32_t nprocs;
pmix_info_t *info;
uint64_t nnodes = 12;
mydata_t mydata;
myquery_data_t mydata;
pmix_query_t *query;
char *myallocation = "MYALLOCATION";
volatile int active;
pmix_status_t code = PMIX_NOTIFY_ALLOC_COMPLETE;
mylock_t mylock;
pmix_status_t code;
myrel_t myrel;

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

/* initialize the return info struct */
mydata.info = NULL;
mydata.ninfo = 0;

if (0 == myproc.rank) {
/* try to get an allocation */
mydata.active = true;
DEBUG_CONSTRUCT_MYQUERY(&mydata);
PMIX_INFO_CREATE(info, 2);
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_NUM_NODES, &nnodes, PMIX_UINT64);
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
if (PMIX_SUCCESS != (rc = PMIx_Allocation_request_nb(PMIX_ALLOC_NEW, info, 2, infocbfunc, NULL))) {
if (PMIX_SUCCESS != (rc = PMIx_Allocation_request_nb(PMIX_ALLOC_NEW, info, 2, infocbfunc, &mydata))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Allocation_request_nb failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
while (mydata.active) {
usleep(10);
}
DEBUG_WAIT_THREAD(&mydata.lock);
PMIX_INFO_FREE(info, 2);
if (NULL != mydata.info) {
PMIX_INFO_FREE(mydata.info, mydata.ninfo);
}
fprintf(stderr, "Client ns %s rank %d: Allocation returned status: %s\n",
myproc.nspace, myproc.rank, PMIx_Error_string(mydata.lock.status));
DEBUG_DESTRUCT_MYQUERY(&mydata);

} else if (1 == myproc.rank) {
/* register a handler specifically for when the allocation
* operation completes */
PMIX_INFO_CREATE(info, 1);
/* demonstrate a notification based approach - register a handler
* specifically for when the allocation operation completes */
DEBUG_CONSTRUCT_MYREL(&myrel);
PMIX_INFO_CREATE(info, 2);
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
active = -1;
PMIx_Register_event_handler(&code, 1, info, 1,
release_fn, evhandler_reg_callbk, (void*)&active);
while (-1 == active) {
usleep(10);
}
if (0 != active) {
exit(active);
}
PMIX_INFO_FREE(info, 1);
PMIX_INFO_LOAD(&info[1], PMIX_EVENT_RETURN_OBJECT, &myrel, PMIX_POINTER);
DEBUG_CONSTRUCT_LOCK(&mylock);
code = PMIX_NOTIFY_ALLOC_COMPLETE;
PMIx_Register_event_handler(&code, 1, info, 2,
release_fn, evhandler_reg_callbk, (void*)&mylock);
DEBUG_WAIT_THREAD(&mylock);
PMIX_INFO_FREE(info, 2);
rc = mylock.status;
DEBUG_DESTRUCT_LOCK(&mylock);

/* now wait to hear that the request is complete */
while (waiting_for_allocation) {
usleep(10);
}
DEBUG_WAIT_THREAD(&myrel.lock);
fprintf(stderr, "[%s:%d] Allocation returned status: %s\n",
myproc.nspace, myproc.rank, PMIx_Error_string(myrel.lock.status));
DEBUG_DESTRUCT_MYREL(&myrel);

} else {
/* I am not the root rank, so let me wait a little while and then
* query the status of the allocation request */
/* demonstrate a query-based approach - wait a little while and ask to
* see if it was done */
usleep(10);
DEBUG_CONSTRUCT_MYQUERY(&mydata);

PMIX_QUERY_CREATE(query, 1);
PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_QUERY_ALLOC_STATUS);
PMIX_INFO_CREATE(query[0].qualifiers, 1);
PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
mydata.active = true;

if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, 1, infocbfunc, (void*)&mydata))) {
fprintf(stderr, "PMIx_Query_info failed: %d\n", rc);
goto done;
}
while (mydata.active) {
usleep(10);
}
DEBUG_WAIT_THREAD(&mydata.lock);
PMIX_QUERY_FREE(query, 1);
fprintf(stderr, "[%s:%d] Allocation returned status: %s\n",
myproc.nspace, myproc.rank, PMIx_Error_string(mydata.lock.status));
DEBUG_DESTRUCT_MYQUERY(&mydata);
}

done:
Expand Down
Loading