pmix/pmix4x: refresh to the latest PMIx master
refresh to pmix/pmix@f67efc835c Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
родитель
6433da7ba8
Коммит
5679a88867
@ -30,7 +30,7 @@ greek=a1
|
|||||||
# command, or with the date (if "git describe" fails) in the form of
|
# command, or with the date (if "git describe" fails) in the form of
|
||||||
# "date<date>".
|
# "date<date>".
|
||||||
|
|
||||||
repo_rev=git186dca19
|
repo_rev=gitf67efc83
|
||||||
|
|
||||||
# If tarball_version is not empty, it is used as the version string in
|
# If tarball_version is not empty, it is used as the version string in
|
||||||
# the tarball filename, regardless of all other versions listed in
|
# the tarball filename, regardless of all other versions listed in
|
||||||
@ -44,7 +44,7 @@ tarball_version=
|
|||||||
|
|
||||||
# The date when this release was created
|
# The date when this release was created
|
||||||
|
|
||||||
date="Jun 10, 2019"
|
date="Jun 24, 2019"
|
||||||
|
|
||||||
# The shared library version of each of PMIx's public libraries.
|
# The shared library version of each of PMIx's public libraries.
|
||||||
# These versions are maintained in accordance with the "Library
|
# These versions are maintained in accordance with the "Library
|
||||||
|
137
opal/mca/pmix/pmix4x/pmix/bindings/python/sched.py.in
Исполняемый файл
137
opal/mca/pmix/pmix4x/pmix/bindings/python/sched.py.in
Исполняемый файл
@ -0,0 +1,137 @@
|
|||||||
|
@PMIX_PYTHON_PATH@
|
||||||
|
|
||||||
|
from pmix import *
|
||||||
|
import signal, time
|
||||||
|
import os
|
||||||
|
import select
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
global killer
|
||||||
|
|
||||||
|
class GracefulKiller:
|
||||||
|
kill_now = False
|
||||||
|
def __init__(self):
|
||||||
|
signal.signal(signal.SIGINT, self.exit_gracefully)
|
||||||
|
signal.signal(signal.SIGTERM, self.exit_gracefully)
|
||||||
|
|
||||||
|
def exit_gracefully(self,signum, frame):
|
||||||
|
self.kill_now = True
|
||||||
|
|
||||||
|
def clientconnected(proc:tuple is not None):
|
||||||
|
print("CLIENT CONNECTED", proc)
|
||||||
|
return PMIX_SUCCESS
|
||||||
|
|
||||||
|
def clientfinalized(proc:tuple is not None):
|
||||||
|
print("CLIENT FINALIZED", proc)
|
||||||
|
return PMIX_SUCCESS
|
||||||
|
|
||||||
|
def clientfence(args:dict is not None):
|
||||||
|
print("SERVER FENCE", args)
|
||||||
|
return PMIX_SUCCESS
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
foo = PMIxServer()
|
||||||
|
except:
|
||||||
|
print("FAILED TO CREATE SERVER")
|
||||||
|
exit(1)
|
||||||
|
print("Testing server version ", foo.get_version())
|
||||||
|
args = {PMIX_SERVER_SCHEDULER: ('T', PMIX_BOOL)}
|
||||||
|
map = {'clientconnected': clientconnected,
|
||||||
|
'clientfinalized': clientfinalized,
|
||||||
|
'fencenb': clientfence}
|
||||||
|
my_result = foo.init(args, map)
|
||||||
|
print("Testing PMIx_Initialized")
|
||||||
|
rc = foo.initialized()
|
||||||
|
print("Initialized: ", rc)
|
||||||
|
vers = foo.get_version()
|
||||||
|
print("Version: ", vers)
|
||||||
|
|
||||||
|
# Register a fabric
|
||||||
|
rc = foo.register_fabric(None)
|
||||||
|
print("Fabric registered: ", rc)
|
||||||
|
|
||||||
|
# Get the number of vertices in this fabric
|
||||||
|
nverts = foo.get_num_vertices()
|
||||||
|
print("Nverts in fabric: ", nverts)
|
||||||
|
|
||||||
|
# setup the application
|
||||||
|
(rc, regex) = foo.generate_regex("test000,test001,test002")
|
||||||
|
print("Node regex: ", regex)
|
||||||
|
(rc, ppn) = foo.generate_ppn("0,1,2;3,4,5;6,7")
|
||||||
|
print("PPN: ", ppn)
|
||||||
|
darray = (PMIX_INFO, [{PMIX_ALLOC_NETWORK_ID: ("SIMPSCHED.net", PMIX_STRING)},
|
||||||
|
{PMIX_ALLOC_NETWORK_SEC_KEY: ('T', PMIX_BOOL)},
|
||||||
|
{PMIX_SETUP_APP_ENVARS: ('T', PMIX_BOOL)}])
|
||||||
|
kyvals = {PMIX_NODE_MAP: (regex, PMIX_STRING), PMIX_PROC_MAP: (ppn, PMIX_STRING), PMIX_ALLOC_NETWORK: (darray, PMIX_DATA_ARRAY)}
|
||||||
|
|
||||||
|
appinfo = []
|
||||||
|
rc, appinfo = foo.setup_application("SIMPSCHED", kyvals)
|
||||||
|
print("SETUPAPP: ", appinfo)
|
||||||
|
|
||||||
|
rc = foo.setup_local_support("SIMPSCHED", appinfo)
|
||||||
|
print("SETUPLOCAL: ", rc)
|
||||||
|
|
||||||
|
# get our environment as a base
|
||||||
|
env = os.environ.copy()
|
||||||
|
|
||||||
|
# register an nspace for the client app
|
||||||
|
kvals = {PMIX_NODE_MAP: (regex, PMIX_STRING), PMIX_PROC_MAP: (ppn, PMIX_STRING), PMIX_UNIV_SIZE: (1, PMIX_UINT32), PMIX_JOB_SIZE: (1, PMIX_UINT32)}
|
||||||
|
print("REGISTERING NSPACE")
|
||||||
|
rc = foo.register_nspace("testnspace", 1, kvals)
|
||||||
|
print("RegNspace ", rc)
|
||||||
|
|
||||||
|
# register a client
|
||||||
|
uid = os.getuid()
|
||||||
|
gid = os.getgid()
|
||||||
|
print("REGISTERING CLIENT")
|
||||||
|
rc = foo.register_client(("testnspace", 0), uid, gid)
|
||||||
|
print("RegClient ", rc)
|
||||||
|
|
||||||
|
# setup the fork
|
||||||
|
rc = foo.setup_fork(("testnspace", 0), env)
|
||||||
|
print("SetupFrk", rc)
|
||||||
|
|
||||||
|
# setup the client argv
|
||||||
|
args = ["./client.py"]
|
||||||
|
# open a subprocess with stdout and stderr
|
||||||
|
# as distinct pipes so we can capture their
|
||||||
|
# output as the process runs
|
||||||
|
p = subprocess.Popen(args, env=env,
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
# define storage to catch the output
|
||||||
|
stdout = []
|
||||||
|
stderr = []
|
||||||
|
# loop until the pipes close
|
||||||
|
while True:
|
||||||
|
reads = [p.stdout.fileno(), p.stderr.fileno()]
|
||||||
|
ret = select.select(reads, [], [])
|
||||||
|
|
||||||
|
stdout_done = True
|
||||||
|
stderr_done = True
|
||||||
|
|
||||||
|
for fd in ret[0]:
|
||||||
|
# if the data
|
||||||
|
if fd == p.stdout.fileno():
|
||||||
|
read = p.stdout.readline()
|
||||||
|
if read:
|
||||||
|
read = read.decode('utf-8').rstrip()
|
||||||
|
print('stdout: ' + read)
|
||||||
|
stdout_done = False
|
||||||
|
elif fd == p.stderr.fileno():
|
||||||
|
read = p.stderr.readline()
|
||||||
|
if read:
|
||||||
|
read = read.decode('utf-8').rstrip()
|
||||||
|
print('stderr: ' + read)
|
||||||
|
stderr_done = False
|
||||||
|
|
||||||
|
if stdout_done and stderr_done:
|
||||||
|
break
|
||||||
|
|
||||||
|
print("FINALIZING")
|
||||||
|
foo.finalize()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
global killer
|
||||||
|
killer = GracefulKiller()
|
||||||
|
main()
|
@ -913,6 +913,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[
|
|||||||
if test "$WANT_PYTHON_BINDINGS" = "1"; then
|
if test "$WANT_PYTHON_BINDINGS" = "1"; then
|
||||||
AC_CONFIG_FILES(pmix_config_prefix[bindings/python/server.py], [chmod +x bindings/python/server.py])
|
AC_CONFIG_FILES(pmix_config_prefix[bindings/python/server.py], [chmod +x bindings/python/server.py])
|
||||||
AC_CONFIG_FILES(pmix_config_prefix[bindings/python/client.py], [chmod +x bindings/python/client.py])
|
AC_CONFIG_FILES(pmix_config_prefix[bindings/python/client.py], [chmod +x bindings/python/client.py])
|
||||||
|
AC_CONFIG_FILES(pmix_config_prefix[bindings/python/sched.py], [chmod +x bindings/python/sched.py])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# publish any embedded flags so external wrappers can use them
|
# publish any embedded flags so external wrappers can use them
|
||||||
|
@ -1093,6 +1093,23 @@ typedef uint8_t pmix_coord_system_t;
|
|||||||
#define PMIX_COORD_CYLINDRICAL 0x02
|
#define PMIX_COORD_CYLINDRICAL 0x02
|
||||||
|
|
||||||
|
|
||||||
|
/* define some "hooks" external libraries can use to
|
||||||
|
* intercept memory allocation/release operations */
|
||||||
|
static inline void* pmix_malloc(size_t n)
|
||||||
|
{
|
||||||
|
return malloc(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void pmix_free(void *m)
|
||||||
|
{
|
||||||
|
free(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void* pmix_calloc(size_t n, size_t m)
|
||||||
|
{
|
||||||
|
return calloc(n, m);
|
||||||
|
}
|
||||||
|
|
||||||
/* declare a convenience macro for checking keys */
|
/* declare a convenience macro for checking keys */
|
||||||
#define PMIX_CHECK_KEY(a, b) \
|
#define PMIX_CHECK_KEY(a, b) \
|
||||||
(0 == strncmp((a)->key, (b), PMIX_MAX_KEYLEN))
|
(0 == strncmp((a)->key, (b), PMIX_MAX_KEYLEN))
|
||||||
@ -1134,7 +1151,7 @@ typedef struct pmix_byte_object {
|
|||||||
|
|
||||||
#define PMIX_BYTE_OBJECT_CREATE(m, n) \
|
#define PMIX_BYTE_OBJECT_CREATE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
(m) = (pmix_byte_object_t*)malloc((n) * sizeof(pmix_byte_object_t)); \
|
(m) = (pmix_byte_object_t*)pmix_malloc((n) * sizeof(pmix_byte_object_t)); \
|
||||||
if (NULL != (m)) { \
|
if (NULL != (m)) { \
|
||||||
memset((m), 0, (n)*sizeof(pmix_byte_object_t)); \
|
memset((m), 0, (n)*sizeof(pmix_byte_object_t)); \
|
||||||
} \
|
} \
|
||||||
@ -1149,7 +1166,7 @@ typedef struct pmix_byte_object {
|
|||||||
#define PMIX_BYTE_OBJECT_DESTRUCT(m) \
|
#define PMIX_BYTE_OBJECT_DESTRUCT(m) \
|
||||||
do { \
|
do { \
|
||||||
if (NULL != (m)->bytes) { \
|
if (NULL != (m)->bytes) { \
|
||||||
free((m)->bytes); \
|
pmix_free((m)->bytes); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
@ -1159,10 +1176,10 @@ typedef struct pmix_byte_object {
|
|||||||
if (NULL != (m)) { \
|
if (NULL != (m)) { \
|
||||||
for (_bon=0; _bon < n; _bon++) { \
|
for (_bon=0; _bon < n; _bon++) { \
|
||||||
if (NULL != (m)[_bon].bytes) { \
|
if (NULL != (m)[_bon].bytes) { \
|
||||||
free((m)[_bon].bytes); \
|
pmix_free((m)[_bon].bytes); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
@ -1193,7 +1210,7 @@ typedef struct {
|
|||||||
|
|
||||||
#define PMIX_ENVAR_CREATE(m, n) \
|
#define PMIX_ENVAR_CREATE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
(m) = (pmix_envar_t*)calloc((n) , sizeof(pmix_envar_t)); \
|
(m) = (pmix_envar_t*)pmix_calloc((n) , sizeof(pmix_envar_t)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define PMIX_ENVAR_FREE(m, n) \
|
#define PMIX_ENVAR_FREE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
@ -1202,7 +1219,7 @@ typedef struct {
|
|||||||
for (_ek=0; _ek < (n); _ek++) { \
|
for (_ek=0; _ek < (n); _ek++) { \
|
||||||
PMIX_ENVAR_DESTRUCT(&(m)[_ek]); \
|
PMIX_ENVAR_DESTRUCT(&(m)[_ek]); \
|
||||||
} \
|
} \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define PMIX_ENVAR_CONSTRUCT(m) \
|
#define PMIX_ENVAR_CONSTRUCT(m) \
|
||||||
@ -1214,11 +1231,11 @@ typedef struct {
|
|||||||
#define PMIX_ENVAR_DESTRUCT(m) \
|
#define PMIX_ENVAR_DESTRUCT(m) \
|
||||||
do { \
|
do { \
|
||||||
if (NULL != (m)->envar) { \
|
if (NULL != (m)->envar) { \
|
||||||
free((m)->envar); \
|
pmix_free((m)->envar); \
|
||||||
(m)->envar = NULL; \
|
(m)->envar = NULL; \
|
||||||
} \
|
} \
|
||||||
if (NULL != (m)->value) { \
|
if (NULL != (m)->value) { \
|
||||||
free((m)->value); \
|
pmix_free((m)->value); \
|
||||||
(m)->value = NULL; \
|
(m)->value = NULL; \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
@ -1252,14 +1269,14 @@ typedef struct pmix_data_buffer {
|
|||||||
} pmix_data_buffer_t;
|
} pmix_data_buffer_t;
|
||||||
#define PMIX_DATA_BUFFER_CREATE(m) \
|
#define PMIX_DATA_BUFFER_CREATE(m) \
|
||||||
do { \
|
do { \
|
||||||
(m) = (pmix_data_buffer_t*)calloc(1, sizeof(pmix_data_buffer_t)); \
|
(m) = (pmix_data_buffer_t*)pmix_calloc(1, sizeof(pmix_data_buffer_t)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define PMIX_DATA_BUFFER_RELEASE(m) \
|
#define PMIX_DATA_BUFFER_RELEASE(m) \
|
||||||
do { \
|
do { \
|
||||||
if (NULL != (m)->base_ptr) { \
|
if (NULL != (m)->base_ptr) { \
|
||||||
free((m)->base_ptr); \
|
pmix_free((m)->base_ptr); \
|
||||||
} \
|
} \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define PMIX_DATA_BUFFER_CONSTRUCT(m) \
|
#define PMIX_DATA_BUFFER_CONSTRUCT(m) \
|
||||||
@ -1267,7 +1284,7 @@ typedef struct pmix_data_buffer {
|
|||||||
#define PMIX_DATA_BUFFER_DESTRUCT(m) \
|
#define PMIX_DATA_BUFFER_DESTRUCT(m) \
|
||||||
do { \
|
do { \
|
||||||
if (NULL != (m)->base_ptr) { \
|
if (NULL != (m)->base_ptr) { \
|
||||||
free((m)->base_ptr); \
|
pmix_free((m)->base_ptr); \
|
||||||
(m)->base_ptr = NULL; \
|
(m)->base_ptr = NULL; \
|
||||||
} \
|
} \
|
||||||
(m)->pack_ptr = NULL; \
|
(m)->pack_ptr = NULL; \
|
||||||
@ -1298,12 +1315,12 @@ typedef struct pmix_proc {
|
|||||||
} pmix_proc_t;
|
} pmix_proc_t;
|
||||||
#define PMIX_PROC_CREATE(m, n) \
|
#define PMIX_PROC_CREATE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
(m) = (pmix_proc_t*)calloc((n) , sizeof(pmix_proc_t)); \
|
(m) = (pmix_proc_t*)pmix_calloc((n) , sizeof(pmix_proc_t)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define PMIX_PROC_RELEASE(m) \
|
#define PMIX_PROC_RELEASE(m) \
|
||||||
do { \
|
do { \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -1317,7 +1334,7 @@ typedef struct pmix_proc {
|
|||||||
#define PMIX_PROC_FREE(m, n) \
|
#define PMIX_PROC_FREE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
if (NULL != (m)) { \
|
if (NULL != (m)) { \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -1367,7 +1384,7 @@ typedef struct pmix_proc_info {
|
|||||||
} pmix_proc_info_t;
|
} pmix_proc_info_t;
|
||||||
#define PMIX_PROC_INFO_CREATE(m, n) \
|
#define PMIX_PROC_INFO_CREATE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
(m) = (pmix_proc_info_t*)calloc((n) , sizeof(pmix_proc_info_t)); \
|
(m) = (pmix_proc_info_t*)pmix_calloc((n) , sizeof(pmix_proc_info_t)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define PMIX_PROC_INFO_RELEASE(m) \
|
#define PMIX_PROC_INFO_RELEASE(m) \
|
||||||
@ -1383,11 +1400,11 @@ typedef struct pmix_proc_info {
|
|||||||
#define PMIX_PROC_INFO_DESTRUCT(m) \
|
#define PMIX_PROC_INFO_DESTRUCT(m) \
|
||||||
do { \
|
do { \
|
||||||
if (NULL != (m)->hostname) { \
|
if (NULL != (m)->hostname) { \
|
||||||
free((m)->hostname); \
|
pmix_free((m)->hostname); \
|
||||||
(m)->hostname = NULL; \
|
(m)->hostname = NULL; \
|
||||||
} \
|
} \
|
||||||
if (NULL != (m)->executable_name) { \
|
if (NULL != (m)->executable_name) { \
|
||||||
free((m)->executable_name); \
|
pmix_free((m)->executable_name); \
|
||||||
(m)->executable_name = NULL; \
|
(m)->executable_name = NULL; \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
@ -1399,7 +1416,7 @@ typedef struct pmix_proc_info {
|
|||||||
for (_k=0; _k < (n); _k++) { \
|
for (_k=0; _k < (n); _k++) { \
|
||||||
PMIX_PROC_INFO_DESTRUCT(&(m)[_k]); \
|
PMIX_PROC_INFO_DESTRUCT(&(m)[_k]); \
|
||||||
} \
|
} \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -1472,7 +1489,7 @@ typedef struct pmix_value {
|
|||||||
do { \
|
do { \
|
||||||
int _ii; \
|
int _ii; \
|
||||||
pmix_value_t *_v; \
|
pmix_value_t *_v; \
|
||||||
(m) = (pmix_value_t*)calloc((n), sizeof(pmix_value_t)); \
|
(m) = (pmix_value_t*)pmix_calloc((n), sizeof(pmix_value_t)); \
|
||||||
_v = (pmix_value_t*)(m); \
|
_v = (pmix_value_t*)(m); \
|
||||||
if (NULL != (m)) { \
|
if (NULL != (m)) { \
|
||||||
for (_ii=0; _ii < (int)(n); _ii++) { \
|
for (_ii=0; _ii < (int)(n); _ii++) { \
|
||||||
@ -1485,7 +1502,7 @@ typedef struct pmix_value {
|
|||||||
#define PMIX_VALUE_RELEASE(m) \
|
#define PMIX_VALUE_RELEASE(m) \
|
||||||
do { \
|
do { \
|
||||||
PMIX_VALUE_DESTRUCT((m)); \
|
PMIX_VALUE_DESTRUCT((m)); \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -1506,7 +1523,7 @@ typedef struct pmix_value {
|
|||||||
for (_vv=0; _vv < (n); _vv++) { \
|
for (_vv=0; _vv < (n); _vv++) { \
|
||||||
PMIX_VALUE_DESTRUCT(&((m)[_vv])); \
|
PMIX_VALUE_DESTRUCT(&((m)[_vv])); \
|
||||||
} \
|
} \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -1520,7 +1537,7 @@ typedef struct pmix_value {
|
|||||||
#define PMIX_VALUE_XFER(r, v, s) \
|
#define PMIX_VALUE_XFER(r, v, s) \
|
||||||
do { \
|
do { \
|
||||||
if (NULL == (v)) { \
|
if (NULL == (v)) { \
|
||||||
(v) = (pmix_value_t*)malloc(sizeof(pmix_value_t)); \
|
(v) = (pmix_value_t*)pmix_malloc(sizeof(pmix_value_t)); \
|
||||||
if (NULL == (v)) { \
|
if (NULL == (v)) { \
|
||||||
(r) = PMIX_ERR_NOMEM; \
|
(r) = PMIX_ERR_NOMEM; \
|
||||||
} else { \
|
} else { \
|
||||||
@ -1578,7 +1595,7 @@ typedef struct pmix_info {
|
|||||||
#define PMIX_INFO_CREATE(m, n) \
|
#define PMIX_INFO_CREATE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
pmix_info_t *_i; \
|
pmix_info_t *_i; \
|
||||||
(m) = (pmix_info_t*)calloc((n), sizeof(pmix_info_t)); \
|
(m) = (pmix_info_t*)pmix_calloc((n), sizeof(pmix_info_t)); \
|
||||||
if (NULL != (m)) { \
|
if (NULL != (m)) { \
|
||||||
_i = (pmix_info_t*)(m); \
|
_i = (pmix_info_t*)(m); \
|
||||||
_i[(n)-1].flags = PMIX_INFO_ARRAY_END; \
|
_i[(n)-1].flags = PMIX_INFO_ARRAY_END; \
|
||||||
@ -1603,7 +1620,7 @@ typedef struct pmix_info {
|
|||||||
for (_is=0; _is < (n); _is++) { \
|
for (_is=0; _is < (n); _is++) { \
|
||||||
PMIX_INFO_DESTRUCT(&((m)[_is])); \
|
PMIX_INFO_DESTRUCT(&((m)[_is])); \
|
||||||
} \
|
} \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -1662,13 +1679,13 @@ typedef struct pmix_pdata {
|
|||||||
/* utility macros for working with pmix_pdata_t structs */
|
/* utility macros for working with pmix_pdata_t structs */
|
||||||
#define PMIX_PDATA_CREATE(m, n) \
|
#define PMIX_PDATA_CREATE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
(m) = (pmix_pdata_t*)calloc((n), sizeof(pmix_pdata_t)); \
|
(m) = (pmix_pdata_t*)pmix_calloc((n), sizeof(pmix_pdata_t)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define PMIX_PDATA_RELEASE(m) \
|
#define PMIX_PDATA_RELEASE(m) \
|
||||||
do { \
|
do { \
|
||||||
PMIX_VALUE_DESTRUCT(&(m)->value); \
|
PMIX_VALUE_DESTRUCT(&(m)->value); \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -1691,7 +1708,7 @@ typedef struct pmix_pdata {
|
|||||||
for (_ps=0; _ps < (n); _ps++) { \
|
for (_ps=0; _ps < (n); _ps++) { \
|
||||||
PMIX_PDATA_DESTRUCT(&(_pdf[_ps])); \
|
PMIX_PDATA_DESTRUCT(&(_pdf[_ps])); \
|
||||||
} \
|
} \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -1732,7 +1749,7 @@ typedef struct pmix_app {
|
|||||||
/* utility macros for working with pmix_app_t structs */
|
/* utility macros for working with pmix_app_t structs */
|
||||||
#define PMIX_APP_CREATE(m, n) \
|
#define PMIX_APP_CREATE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
(m) = (pmix_app_t*)calloc((n), sizeof(pmix_app_t)); \
|
(m) = (pmix_app_t*)pmix_calloc((n), sizeof(pmix_app_t)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define PMIX_APP_INFO_CREATE(m, n) \
|
#define PMIX_APP_INFO_CREATE(m, n) \
|
||||||
@ -1744,7 +1761,7 @@ typedef struct pmix_app {
|
|||||||
#define PMIX_APP_RELEASE(m) \
|
#define PMIX_APP_RELEASE(m) \
|
||||||
do { \
|
do { \
|
||||||
PMIX_APP_DESTRUCT((m)); \
|
PMIX_APP_DESTRUCT((m)); \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -1757,25 +1774,25 @@ typedef struct pmix_app {
|
|||||||
do { \
|
do { \
|
||||||
size_t _aii; \
|
size_t _aii; \
|
||||||
if (NULL != (m)->cmd) { \
|
if (NULL != (m)->cmd) { \
|
||||||
free((m)->cmd); \
|
pmix_free((m)->cmd); \
|
||||||
(m)->cmd = NULL; \
|
(m)->cmd = NULL; \
|
||||||
} \
|
} \
|
||||||
if (NULL != (m)->argv) { \
|
if (NULL != (m)->argv) { \
|
||||||
for (_aii=0; NULL != (m)->argv[_aii]; _aii++) { \
|
for (_aii=0; NULL != (m)->argv[_aii]; _aii++) { \
|
||||||
free((m)->argv[_aii]); \
|
pmix_free((m)->argv[_aii]); \
|
||||||
} \
|
} \
|
||||||
free((m)->argv); \
|
pmix_free((m)->argv); \
|
||||||
(m)->argv = NULL; \
|
(m)->argv = NULL; \
|
||||||
} \
|
} \
|
||||||
if (NULL != (m)->env) { \
|
if (NULL != (m)->env) { \
|
||||||
for (_aii=0; NULL != (m)->env[_aii]; _aii++) { \
|
for (_aii=0; NULL != (m)->env[_aii]; _aii++) { \
|
||||||
free((m)->env[_aii]); \
|
pmix_free((m)->env[_aii]); \
|
||||||
} \
|
} \
|
||||||
free((m)->env); \
|
pmix_free((m)->env); \
|
||||||
(m)->env = NULL; \
|
(m)->env = NULL; \
|
||||||
} \
|
} \
|
||||||
if (NULL != (m)->cwd) { \
|
if (NULL != (m)->cwd) { \
|
||||||
free((m)->cwd); \
|
pmix_free((m)->cwd); \
|
||||||
(m)->cwd = NULL; \
|
(m)->cwd = NULL; \
|
||||||
} \
|
} \
|
||||||
if (NULL != (m)->info) { \
|
if (NULL != (m)->info) { \
|
||||||
@ -1792,7 +1809,7 @@ typedef struct pmix_app {
|
|||||||
for (_as=0; _as < (n); _as++) { \
|
for (_as=0; _as < (n); _as++) { \
|
||||||
PMIX_APP_DESTRUCT(&((m)[_as])); \
|
PMIX_APP_DESTRUCT(&((m)[_as])); \
|
||||||
} \
|
} \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -1807,7 +1824,7 @@ typedef struct pmix_query {
|
|||||||
/* utility macros for working with pmix_query_t structs */
|
/* utility macros for working with pmix_query_t structs */
|
||||||
#define PMIX_QUERY_CREATE(m, n) \
|
#define PMIX_QUERY_CREATE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
(m) = (pmix_query_t*)calloc((n) , sizeof(pmix_query_t)); \
|
(m) = (pmix_query_t*)pmix_calloc((n) , sizeof(pmix_query_t)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define PMIX_QUERY_QUALIFIERS_CREATE(m, n) \
|
#define PMIX_QUERY_QUALIFIERS_CREATE(m, n) \
|
||||||
@ -1819,7 +1836,7 @@ typedef struct pmix_query {
|
|||||||
#define PMIX_QUERY_RELEASE(m) \
|
#define PMIX_QUERY_RELEASE(m) \
|
||||||
do { \
|
do { \
|
||||||
PMIX_QUERY_DESTRUCT((m)); \
|
PMIX_QUERY_DESTRUCT((m)); \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -1833,9 +1850,9 @@ typedef struct pmix_query {
|
|||||||
size_t _qi; \
|
size_t _qi; \
|
||||||
if (NULL != (m)->keys) { \
|
if (NULL != (m)->keys) { \
|
||||||
for (_qi=0; NULL != (m)->keys[_qi]; _qi++) { \
|
for (_qi=0; NULL != (m)->keys[_qi]; _qi++) { \
|
||||||
free((m)->keys[_qi]); \
|
pmix_free((m)->keys[_qi]); \
|
||||||
} \
|
} \
|
||||||
free((m)->keys); \
|
pmix_free((m)->keys); \
|
||||||
(m)->keys = NULL; \
|
(m)->keys = NULL; \
|
||||||
} \
|
} \
|
||||||
if (NULL != (m)->qualifiers) { \
|
if (NULL != (m)->qualifiers) { \
|
||||||
@ -1852,7 +1869,7 @@ typedef struct pmix_query {
|
|||||||
for (_qs=0; _qs < (n); _qs++) { \
|
for (_qs=0; _qs < (n); _qs++) { \
|
||||||
PMIX_QUERY_DESTRUCT(&((m)[_qs])); \
|
PMIX_QUERY_DESTRUCT(&((m)[_qs])); \
|
||||||
} \
|
} \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -1902,7 +1919,7 @@ typedef struct pmix_regattr_t {
|
|||||||
do { \
|
do { \
|
||||||
if (NULL != (a)) { \
|
if (NULL != (a)) { \
|
||||||
if (NULL != (a)->name) { \
|
if (NULL != (a)->name) { \
|
||||||
free((a)->name); \
|
pmix_free((a)->name); \
|
||||||
} \
|
} \
|
||||||
if (NULL != (a)->description) { \
|
if (NULL != (a)->description) { \
|
||||||
PMIX_ARGV_FREE((a)->description); \
|
PMIX_ARGV_FREE((a)->description); \
|
||||||
@ -1912,7 +1929,7 @@ typedef struct pmix_regattr_t {
|
|||||||
|
|
||||||
#define PMIX_REGATTR_CREATE(m, n) \
|
#define PMIX_REGATTR_CREATE(m, n) \
|
||||||
do { \
|
do { \
|
||||||
(m) = (pmix_regattr_t*)calloc((n) , sizeof(pmix_regattr_t)); \
|
(m) = (pmix_regattr_t*)pmix_calloc((n) , sizeof(pmix_regattr_t)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define PMIX_REGATTR_FREE(m, n) \
|
#define PMIX_REGATTR_FREE(m, n) \
|
||||||
@ -1922,7 +1939,7 @@ typedef struct pmix_regattr_t {
|
|||||||
for (_ra=0; _ra < (n); _ra++) { \
|
for (_ra=0; _ra < (n); _ra++) { \
|
||||||
PMIX_REGATTR_DESTRUCT(&((m)[_ra])); \
|
PMIX_REGATTR_DESTRUCT(&((m)[_ra])); \
|
||||||
} \
|
} \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -2616,7 +2633,7 @@ PMIX_EXPORT pmix_status_t PMIx_Data_pack(const pmix_proc_t *target,
|
|||||||
* status_code = PMIx_Data_unpack(buffer, (void*)&dest, &num_values, PMIX_INT32);
|
* status_code = PMIx_Data_unpack(buffer, (void*)&dest, &num_values, PMIX_INT32);
|
||||||
*
|
*
|
||||||
* num_values = 5;
|
* num_values = 5;
|
||||||
* string_array = malloc(num_values*sizeof(char *));
|
* string_array = pmix_malloc(num_values*sizeof(char *));
|
||||||
* status_code = PMIx_Data_unpack(buffer, (void*)(string_array), &num_values, PMIX_STRING);
|
* status_code = PMIx_Data_unpack(buffer, (void*)(string_array), &num_values, PMIX_STRING);
|
||||||
*
|
*
|
||||||
* @endcode
|
* @endcode
|
||||||
@ -2686,20 +2703,20 @@ static inline void pmix_value_destruct(pmix_value_t * m)
|
|||||||
{
|
{
|
||||||
if (PMIX_STRING == (m)->type) {
|
if (PMIX_STRING == (m)->type) {
|
||||||
if (NULL != (m)->data.string) {
|
if (NULL != (m)->data.string) {
|
||||||
free((m)->data.string);
|
pmix_free((m)->data.string);
|
||||||
(m)->data.string = NULL;
|
(m)->data.string = NULL;
|
||||||
}
|
}
|
||||||
} else if ((PMIX_BYTE_OBJECT == (m)->type) ||
|
} else if ((PMIX_BYTE_OBJECT == (m)->type) ||
|
||||||
(PMIX_COMPRESSED_STRING == (m)->type)) {
|
(PMIX_COMPRESSED_STRING == (m)->type)) {
|
||||||
if (NULL != (m)->data.bo.bytes) {
|
if (NULL != (m)->data.bo.bytes) {
|
||||||
free((m)->data.bo.bytes);
|
pmix_free((m)->data.bo.bytes);
|
||||||
(m)->data.bo.bytes = NULL;
|
(m)->data.bo.bytes = NULL;
|
||||||
(m)->data.bo.size = 0;
|
(m)->data.bo.size = 0;
|
||||||
}
|
}
|
||||||
} else if (PMIX_DATA_ARRAY == (m)->type) {
|
} else if (PMIX_DATA_ARRAY == (m)->type) {
|
||||||
if (NULL != (m)->data.darray) {
|
if (NULL != (m)->data.darray) {
|
||||||
pmix_darray_destruct((m)->data.darray);
|
pmix_darray_destruct((m)->data.darray);
|
||||||
free((m)->data.darray);
|
pmix_free((m)->data.darray);
|
||||||
(m)->data.darray = NULL;
|
(m)->data.darray = NULL;
|
||||||
}
|
}
|
||||||
} else if (PMIX_ENVAR == (m)->type) {
|
} else if (PMIX_ENVAR == (m)->type) {
|
||||||
@ -2744,12 +2761,12 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m)
|
|||||||
char **_s = (char**)m->array;
|
char **_s = (char**)m->array;
|
||||||
size_t _si;
|
size_t _si;
|
||||||
for (_si=0; _si < m->size; _si++) {
|
for (_si=0; _si < m->size; _si++) {
|
||||||
free(_s[_si]);
|
pmix_free(_s[_si]);
|
||||||
}
|
}
|
||||||
free(m->array);
|
pmix_free(m->array);
|
||||||
m->array = NULL;
|
m->array = NULL;
|
||||||
} else {
|
} else {
|
||||||
free(m->array);
|
pmix_free(m->array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2787,44 +2804,44 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m)
|
|||||||
PMIX_INT8 == (t) || \
|
PMIX_INT8 == (t) || \
|
||||||
PMIX_UINT8 == (t) || \
|
PMIX_UINT8 == (t) || \
|
||||||
PMIX_POINTER == (t)) { \
|
PMIX_POINTER == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(int8_t)); \
|
(m)->array = pmix_calloc((n), sizeof(int8_t)); \
|
||||||
} else if (PMIX_STRING == (t)) { \
|
} else if (PMIX_STRING == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(char*)); \
|
(m)->array = pmix_calloc((n), sizeof(char*)); \
|
||||||
} else if (PMIX_SIZE == (t)) { \
|
} else if (PMIX_SIZE == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(size_t)); \
|
(m)->array = pmix_calloc((n), sizeof(size_t)); \
|
||||||
} else if (PMIX_PID == (t)) { \
|
} else if (PMIX_PID == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(pid_t)); \
|
(m)->array = pmix_calloc((n), sizeof(pid_t)); \
|
||||||
} else if (PMIX_INT == (t) || \
|
} else if (PMIX_INT == (t) || \
|
||||||
PMIX_UINT == (t) || \
|
PMIX_UINT == (t) || \
|
||||||
PMIX_STATUS == (t)) { \
|
PMIX_STATUS == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(int)); \
|
(m)->array = pmix_calloc((n), sizeof(int)); \
|
||||||
} else if (PMIX_IOF_CHANNEL == (t) || \
|
} else if (PMIX_IOF_CHANNEL == (t) || \
|
||||||
PMIX_DATA_TYPE == (t) || \
|
PMIX_DATA_TYPE == (t) || \
|
||||||
PMIX_INT16 == (t) || \
|
PMIX_INT16 == (t) || \
|
||||||
PMIX_UINT16 == (t)) { \
|
PMIX_UINT16 == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(int16_t)); \
|
(m)->array = pmix_calloc((n), sizeof(int16_t)); \
|
||||||
} else if (PMIX_PROC_RANK == (t) || \
|
} else if (PMIX_PROC_RANK == (t) || \
|
||||||
PMIX_INFO_DIRECTIVES == (t) || \
|
PMIX_INFO_DIRECTIVES == (t) || \
|
||||||
PMIX_INT32 == (t) || \
|
PMIX_INT32 == (t) || \
|
||||||
PMIX_UINT32 == (t)) { \
|
PMIX_UINT32 == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(int32_t)); \
|
(m)->array = pmix_calloc((n), sizeof(int32_t)); \
|
||||||
} else if (PMIX_INT64 == (t) || \
|
} else if (PMIX_INT64 == (t) || \
|
||||||
PMIX_UINT64 == (t)) { \
|
PMIX_UINT64 == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(int64_t)); \
|
(m)->array = pmix_calloc((n), sizeof(int64_t)); \
|
||||||
} else if (PMIX_FLOAT == (t)) { \
|
} else if (PMIX_FLOAT == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(float)); \
|
(m)->array = pmix_calloc((n), sizeof(float)); \
|
||||||
} else if (PMIX_DOUBLE == (t)) { \
|
} else if (PMIX_DOUBLE == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(double)); \
|
(m)->array = pmix_calloc((n), sizeof(double)); \
|
||||||
} else if (PMIX_TIMEVAL == (t)) { \
|
} else if (PMIX_TIMEVAL == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(struct timeval)); \
|
(m)->array = pmix_calloc((n), sizeof(struct timeval)); \
|
||||||
} else if (PMIX_TIME == (t)) { \
|
} else if (PMIX_TIME == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(time_t)); \
|
(m)->array = pmix_calloc((n), sizeof(time_t)); \
|
||||||
} else if (PMIX_REGATTR == (t)) { \
|
} else if (PMIX_REGATTR == (t)) { \
|
||||||
PMIX_REGATTR_CREATE((m)->array, (n)); \
|
PMIX_REGATTR_CREATE((m)->array, (n)); \
|
||||||
} else if (PMIX_BOOL == (t)) { \
|
} else if (PMIX_BOOL == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(bool)); \
|
(m)->array = pmix_calloc((n), sizeof(bool)); \
|
||||||
} else if (PMIX_COORD == (t)) { \
|
} else if (PMIX_COORD == (t)) { \
|
||||||
(m)->array = calloc((n), sizeof(pmix_coord_t)); \
|
(m)->array = pmix_calloc((n), sizeof(pmix_coord_t)); \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
(m)->array = NULL; \
|
(m)->array = NULL; \
|
||||||
@ -2832,7 +2849,7 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m)
|
|||||||
} while(0)
|
} while(0)
|
||||||
#define PMIX_DATA_ARRAY_CREATE(m, n, t) \
|
#define PMIX_DATA_ARRAY_CREATE(m, n, t) \
|
||||||
do { \
|
do { \
|
||||||
(m) = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t)); \
|
(m) = (pmix_data_array_t*)pmix_calloc(1, sizeof(pmix_data_array_t)); \
|
||||||
PMIX_DATA_ARRAY_CONSTRUCT((m), (n), (t)); \
|
PMIX_DATA_ARRAY_CONSTRUCT((m), (n), (t)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
@ -2842,7 +2859,7 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m)
|
|||||||
do { \
|
do { \
|
||||||
if (NULL != (m)) { \
|
if (NULL != (m)) { \
|
||||||
PMIX_DATA_ARRAY_DESTRUCT(m); \
|
PMIX_DATA_ARRAY_DESTRUCT(m); \
|
||||||
free((m)); \
|
pmix_free((m)); \
|
||||||
(m) = NULL; \
|
(m) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
@ -253,7 +253,6 @@ typedef struct event pmix_event_t;
|
|||||||
|
|
||||||
#define pmix_event_base_free(b) event_base_free(b)
|
#define pmix_event_base_free(b) event_base_free(b)
|
||||||
|
|
||||||
#define pmix_event_base_loopexit(b) event_base_loopexit(b, NULL)
|
|
||||||
|
|
||||||
#if PMIX_HAVE_LIBEV
|
#if PMIX_HAVE_LIBEV
|
||||||
#define pmix_event_use_threads()
|
#define pmix_event_use_threads()
|
||||||
@ -279,12 +278,12 @@ PMIX_EXPORT int pmix_event_assign(struct event *ev, pmix_event_base_t *evbase,
|
|||||||
PMIX_EXPORT int pmix_event_add(struct event *ev, struct timeval *tv);
|
PMIX_EXPORT int pmix_event_add(struct event *ev, struct timeval *tv);
|
||||||
PMIX_EXPORT int pmix_event_del(struct event *ev);
|
PMIX_EXPORT int pmix_event_del(struct event *ev);
|
||||||
PMIX_EXPORT void pmix_event_active (struct event *ev, int res, short ncalls);
|
PMIX_EXPORT void pmix_event_active (struct event *ev, int res, short ncalls);
|
||||||
PMIX_EXPORT void pmix_event_base_loopbreak (pmix_event_base_t *b);
|
PMIX_EXPORT void pmix_event_base_loopexit (pmix_event_base_t *b);
|
||||||
#else
|
#else
|
||||||
#define pmix_event_add(ev, tv) event_add((ev), (tv))
|
#define pmix_event_add(ev, tv) event_add((ev), (tv))
|
||||||
#define pmix_event_del(ev) event_del((ev))
|
#define pmix_event_del(ev) event_del((ev))
|
||||||
#define pmix_event_active(x, y, z) event_active((x), (y), (z))
|
#define pmix_event_active(x, y, z) event_active((x), (y), (z))
|
||||||
#define pmix_event_base_loopbreak(b) event_base_loopbreak(b)
|
#define pmix_event_base_loopexit(b) event_base_loopexit(b, NULL)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PMIX_EXPORT pmix_event_t* pmix_event_new(pmix_event_base_t *b, int fd,
|
PMIX_EXPORT pmix_event_t* pmix_event_new(pmix_event_base_t *b, int fd,
|
||||||
|
@ -768,7 +768,14 @@ pmix_status_t pmix_bfrops_base_pack_app(pmix_pointer_array_t *regtypes,
|
|||||||
}
|
}
|
||||||
/* argv */
|
/* argv */
|
||||||
nvals = pmix_argv_count(app[i].argv);
|
nvals = pmix_argv_count(app[i].argv);
|
||||||
PMIX_BFROPS_PACK_TYPE(ret, buffer, &nvals, 1, PMIX_INT32, regtypes);
|
/* although nvals is technically an int32, we have to pack it
|
||||||
|
* as a generic int due to a typo in earlier release series. This
|
||||||
|
* preserves the ordering of bytes in the packed buffer as it
|
||||||
|
* includes a tag indicating the actual size of the value. No
|
||||||
|
* harm is done as generic int is equivalent to int32 on all
|
||||||
|
* current systems - just something to watch out for in the
|
||||||
|
* future should someone someday change the size of "int" */
|
||||||
|
PMIX_BFROPS_PACK_TYPE(ret, buffer, &nvals, 1, PMIX_INT, regtypes);
|
||||||
if (PMIX_SUCCESS != ret) {
|
if (PMIX_SUCCESS != ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -944,7 +944,14 @@ pmix_status_t pmix_bfrops_base_unpack_app(pmix_pointer_array_t *regtypes,
|
|||||||
}
|
}
|
||||||
/* unpack argc */
|
/* unpack argc */
|
||||||
m=1;
|
m=1;
|
||||||
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nval, &m, PMIX_INT32, regtypes);
|
/* although nval is technically an int32, we have to unpack it
|
||||||
|
* as a generic int due to a typo in earlier release series. This
|
||||||
|
* preserves the ordering of bytes in the packed buffer as it
|
||||||
|
* includes a tag indicating the actual size of the value. No
|
||||||
|
* harm is done as generic int is equivalent to int32 on all
|
||||||
|
* current systems - just something to watch out for in the
|
||||||
|
* future should someone someday change the size of "int" */
|
||||||
|
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nval, &m, PMIX_INT, regtypes);
|
||||||
if (PMIX_SUCCESS != ret) {
|
if (PMIX_SUCCESS != ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1143,6 +1143,7 @@ static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo,
|
|||||||
&bkt, &pbo, &cnt, PMIX_BYTE_OBJECT);
|
&bkt, &pbo, &cnt, PMIX_BYTE_OBJECT);
|
||||||
while (PMIX_SUCCESS == rc) {
|
while (PMIX_SUCCESS == rc) {
|
||||||
/* load the byte object for unpacking */
|
/* load the byte object for unpacking */
|
||||||
|
PMIX_CONSTRUCT(&pbkt, pmix_buffer_t);
|
||||||
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, pbo.bytes, pbo.size);
|
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, pbo.bytes, pbo.size);
|
||||||
/* unpack the name of the device */
|
/* unpack the name of the device */
|
||||||
cnt = 1;
|
cnt = 1;
|
||||||
@ -1150,7 +1151,7 @@ static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo,
|
|||||||
&pbkt, &device, &cnt, PMIX_STRING);
|
&pbkt, &device, &cnt, PMIX_STRING);
|
||||||
if (PMIX_SUCCESS != rc) {
|
if (PMIX_SUCCESS != rc) {
|
||||||
PMIX_ERROR_LOG(rc);
|
PMIX_ERROR_LOG(rc);
|
||||||
PMIX_DATA_BUFFER_DESTRUCT(&pbkt);
|
PMIX_DESTRUCT(&pbkt);
|
||||||
/* must _not_ destruct bkt as we don't
|
/* must _not_ destruct bkt as we don't
|
||||||
* own the bytes! */
|
* own the bytes! */
|
||||||
return rc;
|
return rc;
|
||||||
@ -1161,7 +1162,7 @@ static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo,
|
|||||||
&pbkt, &address, &cnt, PMIX_STRING);
|
&pbkt, &address, &cnt, PMIX_STRING);
|
||||||
if (PMIX_SUCCESS != rc) {
|
if (PMIX_SUCCESS != rc) {
|
||||||
PMIX_ERROR_LOG(rc);
|
PMIX_ERROR_LOG(rc);
|
||||||
PMIX_DATA_BUFFER_DESTRUCT(&pbkt);
|
PMIX_DESTRUCT(&pbkt);
|
||||||
/* must _not_ destruct bkt as we don't
|
/* must _not_ destruct bkt as we don't
|
||||||
* own the bytes! */
|
* own the bytes! */
|
||||||
return rc;
|
return rc;
|
||||||
@ -1171,12 +1172,11 @@ static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo,
|
|||||||
res->device = device;
|
res->device = device;
|
||||||
res->address = address;
|
res->address = address;
|
||||||
pmix_list_append(&prts->devices, &res->super);
|
pmix_list_append(&prts->devices, &res->super);
|
||||||
PMIX_DATA_BUFFER_DESTRUCT(&pbkt);
|
PMIX_DESTRUCT(&pbkt);
|
||||||
cnt = 1;
|
cnt = 1;
|
||||||
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer,
|
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer,
|
||||||
&bkt, &pbo, &cnt, PMIX_BYTE_OBJECT);
|
&bkt, &pbo, &cnt, PMIX_BYTE_OBJECT);
|
||||||
}
|
}
|
||||||
PMIX_DATA_BUFFER_DESTRUCT(&bkt);
|
|
||||||
if (5 < pmix_output_get_verbosity(pmix_pnet_base_framework.framework_output)) {
|
if (5 < pmix_output_get_verbosity(pmix_pnet_base_framework.framework_output)) {
|
||||||
/* dump the resulting node resources */
|
/* dump the resulting node resources */
|
||||||
pmix_output(0, "TCP resources for node: %s", nd->name);
|
pmix_output(0, "TCP resources for node: %s", nd->name);
|
||||||
|
@ -240,11 +240,12 @@ static pmix_status_t test_init(void)
|
|||||||
{
|
{
|
||||||
int n, m, r, ns, nplane, nnodes, nports;
|
int n, m, r, ns, nplane, nnodes, nports;
|
||||||
uint64_t n64, m64;
|
uint64_t n64, m64;
|
||||||
char **system, **ptr;
|
char **system=NULL, **ptr;
|
||||||
pnet_plane_t *p;
|
pnet_plane_t *p;
|
||||||
pnet_switch_t *s, *s2;
|
pnet_switch_t *s, *s2;
|
||||||
pnet_nic_t *nic, *nic2;
|
pnet_nic_t *nic, *nic2;
|
||||||
pnet_node_t *node;
|
pnet_node_t *node;
|
||||||
|
pmix_status_t rc;
|
||||||
|
|
||||||
pmix_output_verbose(2, pmix_pnet_base_framework.framework_output,
|
pmix_output_verbose(2, pmix_pnet_base_framework.framework_output,
|
||||||
"pnet: test init");
|
"pnet: test init");
|
||||||
@ -288,7 +289,9 @@ static pmix_status_t test_init(void)
|
|||||||
for (n=0; n < nnodes; n++) {
|
for (n=0; n < nnodes; n++) {
|
||||||
node = PMIX_NEW(pnet_node_t);
|
node = PMIX_NEW(pnet_node_t);
|
||||||
if (0 > asprintf(&node->name, "test%03d", n)) {
|
if (0 > asprintf(&node->name, "test%03d", n)) {
|
||||||
return PMIX_ERR_NOMEM;
|
rc = PMIX_ERR_NOMEM;
|
||||||
|
PMIX_RELEASE(node);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
pmix_list_append(&mynodes, &node->super);
|
pmix_list_append(&mynodes, &node->super);
|
||||||
}
|
}
|
||||||
@ -313,8 +316,8 @@ static pmix_status_t test_init(void)
|
|||||||
pmix_list_append(&myplanes, &p->super);
|
pmix_list_append(&myplanes, &p->super);
|
||||||
} else {
|
} else {
|
||||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||||
pmix_argv_free(system);
|
rc = PMIX_ERR_BAD_PARAM;
|
||||||
return PMIX_ERR_BAD_PARAM;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* setup the ports in each switch for each plane */
|
/* setup the ports in each switch for each plane */
|
||||||
@ -322,7 +325,8 @@ static pmix_status_t test_init(void)
|
|||||||
PMIX_LIST_FOREACH(p, &myplanes, pnet_plane_t) {
|
PMIX_LIST_FOREACH(p, &myplanes, pnet_plane_t) {
|
||||||
/* assign a name to the plane */
|
/* assign a name to the plane */
|
||||||
if (0 > asprintf(&p->name, "plane%03d", nplane)) {
|
if (0 > asprintf(&p->name, "plane%03d", nplane)) {
|
||||||
return PMIX_ERR_NOMEM;
|
rc = PMIX_ERR_NOMEM;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
/* setup the ports on the switches */
|
/* setup the ports on the switches */
|
||||||
nports = nnodes / p->nswitches;
|
nports = nnodes / p->nswitches;
|
||||||
@ -334,20 +338,24 @@ static pmix_status_t test_init(void)
|
|||||||
for (n=0; n < p->nswitches; n++) {
|
for (n=0; n < p->nswitches; n++) {
|
||||||
s = PMIX_NEW(pnet_switch_t);
|
s = PMIX_NEW(pnet_switch_t);
|
||||||
if (0 > asprintf(&s->name, "%s:switch%03d", p->name, n)) {
|
if (0 > asprintf(&s->name, "%s:switch%03d", p->name, n)) {
|
||||||
return PMIX_ERR_NOMEM;
|
rc = PMIX_ERR_NOMEM;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
s->index = n;
|
s->index = n;
|
||||||
pmix_list_append(&p->switches, &s->super);
|
pmix_list_append(&p->switches, &s->super);
|
||||||
if (0 > asprintf(&s->leftport.name, "%s:port000", s->name)) {
|
if (0 > asprintf(&s->leftport.name, "%s:port000", s->name)) {
|
||||||
return PMIX_ERR_NOMEM;
|
rc = PMIX_ERR_NOMEM;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (0 > asprintf(&s->rightport.name, "%s:port%03d", s->name, nports+1)) {
|
if (0 > asprintf(&s->rightport.name, "%s:port%03d", s->name, nports+1)) {
|
||||||
return PMIX_ERR_NOMEM;
|
rc = PMIX_ERR_NOMEM;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
for (m=0; m < nports; m++) {
|
for (m=0; m < nports; m++) {
|
||||||
nic = PMIX_NEW(pnet_nic_t);
|
nic = PMIX_NEW(pnet_nic_t);
|
||||||
if (0 > asprintf(&nic->name, "%s:port%03d", s->name, m+1)) {
|
if (0 > asprintf(&nic->name, "%s:port%03d", s->name, m+1)) {
|
||||||
return PMIX_ERR_NOMEM;
|
rc = PMIX_ERR_NOMEM;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
nic->s = s;
|
nic->s = s;
|
||||||
nic->plane = p;
|
nic->plane = p;
|
||||||
@ -409,7 +417,8 @@ static pmix_status_t test_init(void)
|
|||||||
PMIX_LIST_FOREACH(node, &mynodes, pnet_node_t) {
|
PMIX_LIST_FOREACH(node, &mynodes, pnet_node_t) {
|
||||||
nic2 = PMIX_NEW(pnet_nic_t);
|
nic2 = PMIX_NEW(pnet_nic_t);
|
||||||
if (0 > asprintf(&nic2->name, "%s:nic%03d", node->name, n)) {
|
if (0 > asprintf(&nic2->name, "%s:nic%03d", node->name, n)) {
|
||||||
return PMIX_ERR_NOMEM;
|
rc = PMIX_ERR_NOMEM;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
++n;
|
++n;
|
||||||
--ns;
|
--ns;
|
||||||
@ -471,9 +480,16 @@ static pmix_status_t test_init(void)
|
|||||||
++nplane;
|
++nplane;
|
||||||
}
|
}
|
||||||
pmix_argv_free(system);
|
pmix_argv_free(system);
|
||||||
|
system = NULL;
|
||||||
|
}
|
||||||
|
rc = PMIX_SUCCESS;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (NULL != system) {
|
||||||
|
pmix_argv_free(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PMIX_SUCCESS;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_finalize(void)
|
static void test_finalize(void)
|
||||||
@ -513,7 +529,7 @@ static pmix_status_t allocate(pmix_namespace_t *nptr,
|
|||||||
pmix_list_t mylist;
|
pmix_list_t mylist;
|
||||||
size_t n, m, p, q, nreqs=0;
|
size_t n, m, p, q, nreqs=0;
|
||||||
pmix_info_t *requests = NULL, *iptr, *ip2;
|
pmix_info_t *requests = NULL, *iptr, *ip2;
|
||||||
char *idkey = NULL, **locals;
|
char *idkey = NULL, **locals = NULL;
|
||||||
uint64_t unique_key = 12345;
|
uint64_t unique_key = 12345;
|
||||||
pmix_buffer_t buf;
|
pmix_buffer_t buf;
|
||||||
pmix_status_t rc;
|
pmix_status_t rc;
|
||||||
@ -617,7 +633,8 @@ static pmix_status_t allocate(pmix_namespace_t *nptr,
|
|||||||
if (PMIX_STRING != requests[n].value.type ||
|
if (PMIX_STRING != requests[n].value.type ||
|
||||||
NULL == requests[n].value.data.string) {
|
NULL == requests[n].value.data.string) {
|
||||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||||
return PMIX_ERR_BAD_PARAM;
|
rc = PMIX_ERR_BAD_PARAM;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
idkey = requests[n].value.data.string;
|
idkey = requests[n].value.data.string;
|
||||||
} else if (PMIX_CHECK_KEY(&requests[n], PMIX_ALLOC_NETWORK_SEC_KEY)) {
|
} else if (PMIX_CHECK_KEY(&requests[n], PMIX_ALLOC_NETWORK_SEC_KEY)) {
|
||||||
@ -693,12 +710,10 @@ static pmix_status_t allocate(pmix_namespace_t *nptr,
|
|||||||
* for each proc on the node - we assume the same
|
* for each proc on the node - we assume the same
|
||||||
* list of static endpoints on each node */
|
* list of static endpoints on each node */
|
||||||
for (n=0; NULL != nodes[n]; n++) {
|
for (n=0; NULL != nodes[n]; n++) {
|
||||||
pmix_output(0, "WORKING NODE %s", nodes[n]);
|
|
||||||
/* split the procs for this node */
|
/* split the procs for this node */
|
||||||
locals = pmix_argv_split(procs[n], ',');
|
locals = pmix_argv_split(procs[n], ',');
|
||||||
if (NULL == locals) {
|
if (NULL == locals) {
|
||||||
/* aren't any on this node */
|
/* aren't any on this node */
|
||||||
pmix_output(0, "NO PROCS ON THIS NODE");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* find this node in our list */
|
/* find this node in our list */
|
||||||
@ -711,7 +726,6 @@ static pmix_status_t allocate(pmix_namespace_t *nptr,
|
|||||||
}
|
}
|
||||||
if (NULL == nd) {
|
if (NULL == nd) {
|
||||||
/* we don't have this node in our list */
|
/* we don't have this node in our list */
|
||||||
pmix_output(0, "DO NOT KNOW THIS NODE");
|
|
||||||
rc = PMIX_ERR_NOT_FOUND;
|
rc = PMIX_ERR_NOT_FOUND;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -762,6 +776,7 @@ static pmix_status_t allocate(pmix_namespace_t *nptr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pmix_argv_free(locals);
|
pmix_argv_free(locals);
|
||||||
|
locals = NULL;
|
||||||
pmix_list_append(&mylist, &kv->super);
|
pmix_list_append(&mylist, &kv->super);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -802,6 +817,9 @@ static pmix_status_t allocate(pmix_namespace_t *nptr,
|
|||||||
if (NULL != procs) {
|
if (NULL != procs) {
|
||||||
pmix_argv_free(procs);
|
pmix_argv_free(procs);
|
||||||
}
|
}
|
||||||
|
if (NULL != locals) {
|
||||||
|
pmix_argv_free(locals);
|
||||||
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,6 +843,8 @@ static pmix_status_t setup_local_network(pmix_namespace_t *nptr,
|
|||||||
for (n=0; n < ninfo; n++) {
|
for (n=0; n < ninfo; n++) {
|
||||||
/* look for my key */
|
/* look for my key */
|
||||||
if (PMIX_CHECK_KEY(&info[n], "pmix-pnet-test-blob")) {
|
if (PMIX_CHECK_KEY(&info[n], "pmix-pnet-test-blob")) {
|
||||||
|
pmix_output_verbose(2, pmix_pnet_base_framework.framework_output,
|
||||||
|
"pnet:test:setup_local_network found my blob");
|
||||||
/* this macro NULLs and zero's the incoming bo */
|
/* this macro NULLs and zero's the incoming bo */
|
||||||
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &bkt,
|
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &bkt,
|
||||||
info[n].value.data.bo.bytes,
|
info[n].value.data.bo.bytes,
|
||||||
@ -839,6 +859,11 @@ static pmix_status_t setup_local_network(pmix_namespace_t *nptr,
|
|||||||
"recvd KEY %s %s", kv->key, PMIx_Data_type_string(kv->value->type));
|
"recvd KEY %s %s", kv->key, PMIx_Data_type_string(kv->value->type));
|
||||||
/* check for the network ID */
|
/* check for the network ID */
|
||||||
if (PMIX_CHECK_KEY(kv, PMIX_ALLOC_NETWORK_ID)) {
|
if (PMIX_CHECK_KEY(kv, PMIX_ALLOC_NETWORK_ID)) {
|
||||||
|
if (NULL != idkey) {
|
||||||
|
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||||
|
free(idkey);
|
||||||
|
return PMIX_ERR_BAD_PARAM;
|
||||||
|
}
|
||||||
idkey = strdup(kv->value->data.string);
|
idkey = strdup(kv->value->data.string);
|
||||||
pmix_output_verbose(2, pmix_pnet_base_framework.framework_output,
|
pmix_output_verbose(2, pmix_pnet_base_framework.framework_output,
|
||||||
"pnet:test:setup_local_network idkey %s", idkey);
|
"pnet:test:setup_local_network idkey %s", idkey);
|
||||||
@ -861,6 +886,9 @@ static pmix_status_t setup_local_network(pmix_namespace_t *nptr,
|
|||||||
PMIX_GDS_CACHE_JOB_INFO(rc, pmix_globals.mypeer, nptr, iptr, nvals);
|
PMIX_GDS_CACHE_JOB_INFO(rc, pmix_globals.mypeer, nptr, iptr, nvals);
|
||||||
if (PMIX_SUCCESS != rc) {
|
if (PMIX_SUCCESS != rc) {
|
||||||
PMIX_RELEASE(kv);
|
PMIX_RELEASE(kv);
|
||||||
|
if (NULL != idkey) {
|
||||||
|
free(idkey);
|
||||||
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -880,6 +908,9 @@ static pmix_status_t setup_local_network(pmix_namespace_t *nptr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NULL != idkey) {
|
||||||
|
free(idkey);
|
||||||
|
}
|
||||||
return PMIX_SUCCESS;
|
return PMIX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ void pmix_event_active (struct event *ev, int res, short ncalls) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pmix_event_base_loopbreak (pmix_event_base_t *ev_base) {
|
void pmix_event_base_loopexit (pmix_event_base_t *ev_base) {
|
||||||
pmix_progress_tracker_t *trk = pmix_progress_tracker_get_by_base(ev_base);
|
pmix_progress_tracker_t *trk = pmix_progress_tracker_get_by_base(ev_base);
|
||||||
assert(NULL != trk);
|
assert(NULL != trk);
|
||||||
ev_async_send ((struct ev_loop *)trk->ev_base, &trk->async);
|
ev_async_send ((struct ev_loop *)trk->ev_base, &trk->async);
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user