1
1

Merge pull request #2649 from rhc54/topic/foot2

Update to latest PMIx master
Этот коммит содержится в:
rhc54 2016-12-30 15:36:03 -08:00 коммит произвёл GitHub
родитель a16162832b 08c76a42bb
Коммит 56b1e10ac0
50 изменённых файлов: 766 добавлений и 683 удалений

Просмотреть файл

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -31,7 +32,7 @@ int opal_hwloc_base_set_process_membind_policy(void)
/* Make sure opal_hwloc_topology has been set by the time we've /* Make sure opal_hwloc_topology has been set by the time we've
been called */ been called */
if (NULL == opal_hwloc_topology) { if (OPAL_SUCCESS != opal_hwloc_base_get_topology()) {
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_BAD_PARAM;
} }
@ -82,7 +83,7 @@ int opal_hwloc_base_memory_set(opal_hwloc_base_memory_segment_t *segments,
hwloc_cpuset_t cpuset = NULL; hwloc_cpuset_t cpuset = NULL;
/* bozo check */ /* bozo check */
if (NULL == opal_hwloc_topology) { if (OPAL_SUCCESS != opal_hwloc_base_get_topology()) {
msg = "hwloc_set_area_membind() failure - topology not available"; msg = "hwloc_set_area_membind() failure - topology not available";
return opal_hwloc_base_report_bind_failure(__FILE__, __LINE__, return opal_hwloc_base_report_bind_failure(__FILE__, __LINE__,
msg, rc); msg, rc);
@ -137,7 +138,7 @@ int opal_hwloc_base_membind(opal_hwloc_base_memory_segment_t *segs,
hwloc_cpuset_t cpuset = NULL; hwloc_cpuset_t cpuset = NULL;
/* bozo check */ /* bozo check */
if (NULL == opal_hwloc_topology) { if (OPAL_SUCCESS != opal_hwloc_base_get_topology()) {
msg = "hwloc_set_area_membind() failure - topology not available"; msg = "hwloc_set_area_membind() failure - topology not available";
return opal_hwloc_base_report_bind_failure(__FILE__, __LINE__, return opal_hwloc_base_report_bind_failure(__FILE__, __LINE__,
msg, rc); msg, rc);

Просмотреть файл

@ -23,14 +23,14 @@ release=0
# The only requirement is that it must be entirely printable ASCII # The only requirement is that it must be entirely printable ASCII
# characters and have no white space. # characters and have no white space.
greek= greek=a1
# If repo_rev is empty, then the repository version number will be # If repo_rev is empty, then the repository version number will be
# obtained during "make dist" via the "git describe --tags --always" # obtained during "make dist" via the "git describe --tags --always"
# 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=gitb9778a7 repo_rev=git8ed98a0
# 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="Dec 19, 2016" date="Dec 30, 2016"
# 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

Просмотреть файл

@ -12,7 +12,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2010 Oracle and/or its affiliates. All rights # Copyright (c) 2010 Oracle and/or its affiliates. All rights
# reserved. # reserved.
# Copyright (c) 2016 Intel, Inc. All rights reserved. # Copyright (c) 2016 Intel, Inc. All rights reserved.
@ -41,7 +41,7 @@ EXTRA_DIST = \
pmix.m4 \ pmix.m4 \
pmix_search_libs.m4 \ pmix_search_libs.m4 \
pmix_setup_cc.m4 \ pmix_setup_cc.m4 \
pmix_setup_hwloc.m4 \ pmix_setup_zlib.m4 \
pmix_setup_libevent.m4 \ pmix_setup_libevent.m4 \
pmix_mca_priority_sort.pl pmix_mca_priority_sort.pl

Просмотреть файл

@ -358,7 +358,6 @@ AC_DEFUN([PMIX_SETUP_CORE],[
#endif #endif
]) ])
# Note that sometimes we have <stdbool.h>, but it doesn't work (e.g., # Note that sometimes we have <stdbool.h>, but it doesn't work (e.g.,
# have both Portland and GNU installed; using pgcc will find GNU's # have both Portland and GNU installed; using pgcc will find GNU's
# <stdbool.h>, which all it does -- by standard -- is define "bool" to # <stdbool.h>, which all it does -- by standard -- is define "bool" to
@ -641,11 +640,11 @@ AC_DEFUN([PMIX_SETUP_CORE],[
PMIX_LIBEVENT_CONFIG PMIX_LIBEVENT_CONFIG
################################## ##################################
# HWLOC # ZLIB COMPRESSION
################################## ##################################
pmix_show_title "HWLOC" pmix_show_title "ZLIB"
PMIX_HWLOC_CONFIG PMIX_ZLIB_CONFIG
################################## ##################################
# MCA # MCA

Просмотреть файл

@ -1,123 +0,0 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_hwloc_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([PMIX_HWLOC_CONFIG],[
AC_ARG_WITH([hwloc-header],
[AC_HELP_STRING([--with-hwloc-header=HEADER],
[The value that should be included in C files to include hwloc.h])])
AC_ARG_ENABLE([embedded-hwloc],
[AC_HELP_STRING([--enable-embedded-hwloc],
[Enable use of locally embedded hwloc])])
pmix_hwloc_support=0
AS_IF([test "$enable_embedded_hwloc" = "yes"],
[_PMIX_HWLOC_EMBEDDED_MODE],
[_PMIX_HWLOC_EXTERNAL])
AC_DEFINE_UNQUOTED(PMIX_HAVE_HWLOC, [$pmix_hwloc_support],
[Whether we have hwloc support or not])
AC_MSG_CHECKING([hwloc header])
AC_DEFINE_UNQUOTED([PMIX_HWLOC_HEADER], [$PMIX_HWLOC_HEADER],
[Location of hwloc.h])
AC_MSG_RESULT([$PMIX_HWLOC_HEADER])
CPPFLAGS="$CPPFLAGS $PMIX_HWLOC_CPPFLAGS"
LDFLAGS="$LDFLAGS $PMIX_HWLOC_LDFLAGS"
LIBS="$LIBS $PMIX_HWLOC_LIBS"
])
AC_DEFUN([_PMIX_HWLOC_EMBEDDED_MODE],[
AC_MSG_CHECKING([for hwloc])
AC_MSG_RESULT([assumed available (embedded mode)])
PMIX_HWLOC_HEADER="$with_hwloc_header"
PMIX_HWLOC_CPPFLAGS=
PMIX_HWLOC_LIB=
PMIX_HWLOC_LDFLAGS=
pmix_hwloc_support=1
])
AC_DEFUN([_PMIX_HWLOC_EXTERNAL],[
PMIX_VAR_SCOPE_PUSH([pmix_hwloc_dir pmix_hwloc_libdir])
AC_ARG_WITH([hwloc],
[AC_HELP_STRING([--with-hwloc=DIR],
[Search for hwloc headers and libraries in DIR ])])
AC_ARG_WITH([hwloc-libdir],
[AC_HELP_STRING([--with-hwloc-libdir=DIR],
[Search for hwloc libraries in DIR ])])
pmix_hwloc_support=0
if test "$with_hwloc" != "no"; then
AC_MSG_CHECKING([for hwloc in])
if test ! -z "$with_hwloc" && test "$with_hwloc" != "yes"; then
pmix_hwloc_dir=$with_hwloc
if test -d $with_hwloc/lib; then
pmix_hwloc_libdir=$with_hwloc/lib
elif test -d $with_hwloc/lib64; then
pmix_hwloc_libdir=$with_hwloc/lib64
else
AC_MSG_RESULT([Could not find $with_hwloc/lib or $with_hwloc/lib64])
AC_MSG_ERROR([Can not continue])
fi
AC_MSG_RESULT([$pmix_hwloc_dir and $pmix_hwloc_libdir])
else
AC_MSG_RESULT([(default search paths)])
fi
AS_IF([test ! -z "$with_hwloc_libdir" && test "$with_hwloc_libdir" != "yes"],
[pmix_hwloc_libdir="$with_hwloc_libdir"])
PMIX_CHECK_PACKAGE([pmix_hwloc],
[hwloc.h],
[hwloc],
[hwloc_topology_dup],
[-lhwloc],
[$pmix_hwloc_dir],
[$pmix_hwloc_libdir],
[pmix_hwloc_support=1],
[pmix_hwloc_support=0])
if test $pmix_hwloc_support == "1"; then
CPPFLAGS="$pmix_hwloc_CPPFLAGS $CPPFLAGS"
LIBS="$LIBS -lhwloc"
LDFLAGS="$pmix_hwloc_LDFLAGS $LDFLAGS"
fi
fi
if test ! -z "$with_hwloc" && test "$with_hwloc" != "no" && test "$pmix_hwloc_support" != "1"; then
AC_MSG_WARN([HWLOC SUPPORT REQUESTED AND NOT FOUND. PMIX HWLOC])
AC_MSG_WARN([SUPPORT REQUIRES A MINIMUM OF VERSION 1.9.1])
AC_MSG_ERROR([CANNOT CONTINUE])
fi
# Set output variables
PMIX_HWLOC_HEADER="<hwloc.h>"
PMIX_HWLOC_LIB=-lhwloc
AS_IF([test "$pmix_hwloc_dir" != ""],
[PMIX_HWLOC_CPPFLAGS="-I$pmix_hwloc_dir/include"])
AS_IF([test "$pmix_hwloc_libdir" != ""],
[PMIX_HWLOC_LDFLAGS="-L$pmix_hwloc_libdir"])
AC_MSG_CHECKING([will hwloc support be built])
if test "$pmix_hwloc_support" != "1"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
PMIX_VAR_SCOPE_POP
])dnl

Просмотреть файл

@ -0,0 +1,85 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_zlib_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([PMIX_ZLIB_CONFIG],[
PMIX_VAR_SCOPE_PUSH([pmix_zlib_dir pmix_zlib_libdir])
AC_ARG_WITH([zlib],
[AC_HELP_STRING([--with-zlib=DIR],
[Search for zlib headers and libraries in DIR ])])
AC_ARG_WITH([zlib-libdir],
[AC_HELP_STRING([--with-zlib-libdir=DIR],
[Search for zlib libraries in DIR ])])
pmix_zlib_support=0
if test "$with_zlib" != "no"; then
AC_MSG_CHECKING([for zlib in])
if test ! -z "$with_zlib" && test "$with_zlib" != "yes"; then
pmix_zlib_dir=$with_zlib
pmix_zlib_standard_header_location=no
if test -d $with_zlib/lib; then
pmix_zlib_libdir=$with_zlib/lib
elif test -d $with_zlib/lib64; then
pmix_zlib_libdir=$with_zlib/lib64
else
AC_MSG_RESULT([Could not find $with_zlib/lib or $with_zlib/lib64])
AC_MSG_ERROR([Can not continue])
fi
AC_MSG_RESULT([$pmix_zlib_dir and $pmix_zlib_libdir])
else
AC_MSG_RESULT([(default search paths)])
pmix_zlib_standard_header_location=yes
fi
AS_IF([test ! -z "$with_zlib_libdir" && test "$with_zlib_libdir" != "yes"],
[pmix_zlib_libdir="$with_zlib_libdir"
pmix_zlib_standard_lib_location=no],
[pmix_zlib_standard_lib_location=yes])
PMIX_CHECK_PACKAGE([pmix_zlib],
[zlib.h],
[z],
[deflate],
[-lz],
[$pmix_zlib_dir],
[$pmix_zlib_libdir],
[pmix_zlib_support=1],
[pmix_zlib_support=0])
if test $pmix_zlib_support == "1"; then
LIBS="$LIBS -lz"
if test "$pmix_zlib_standard_header_location" != "yes"; then
CPPFLAGS="$CPPFLAGS $pmix_zlib_CPPFLAGS"
fi
if test "$pmix_zlib_standard_lib_location" != "yes"; then
LDFLAGS="$LDFLAGS $pmix_zlib_LDFLAGS"
fi
fi
fi
if test ! -z "$with_zlib" && test "$with_zlib" != "no" && test "$pmix_zlib_support" != "1"; then
AC_MSG_WARN([ZLIB SUPPORT REQUESTED AND NOT FOUND])
AC_MSG_ERROR([CANNOT CONTINUE])
fi
AC_MSG_CHECKING([will zlib support be built])
if test "$pmix_zlib_support" != "1"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
AC_DEFINE_UNQUOTED([PMIX_HAVE_ZLIB], [$pmix_zlib_support],
[Whether or not we have zlib support])
PMIX_VAR_SCOPE_POP
])dnl

0
opal/mca/pmix/pmix2x/pmix/contrib/make_dist_tarball Обычный файл → Исполняемый файл
Просмотреть файл

Просмотреть файл

@ -24,4 +24,12 @@ make sure that both MPI and PMIx libraries are visible for the loader.
For PMIx testing "convenience" there is a `run.sh` script that can be used to For PMIx testing "convenience" there is a `run.sh` script that can be used to
ensure that environment is set properly (not a production grade so may not work ensure that environment is set properly (not a production grade so may not work
for all environments) for all environments). To use it open it and fix:
- OMPI_BASE to point to your MPI installation
- PMIX_LIB to point to your PMIx installation
If you are running inside the supported batch system you shoud be fine to
just run fixed `run.sh` with the first argument defining how many processes
needs to be launched and all other parameters will be passed to the performance
tool. For example:
$ ./run.sh 10 -d

Просмотреть файл

@ -493,7 +493,7 @@ int main(int argc, char **argv)
fprintf(stderr,"get: max loc %lf rem %lf (loc: %d, rem: %d)\n", fprintf(stderr,"get: max loc %lf rem %lf (loc: %d, rem: %d)\n",
max_get_loc_time, max_get_rem_time, max_get_loc_idx, max_get_rem_idx); max_get_loc_time, max_get_rem_time, max_get_loc_idx, max_get_rem_idx);
fprintf(stderr,"total: max %lf min %lf\n", max_total_time, min_total_time); fprintf(stderr,"total: max %lf min %lf\n", max_total_time, min_total_time);
fprintf(stderr,"mem: loc %0.2lf rem %0.2lf min %0.2lf max %0.2lf total %0.2lf Kb\n", fprintf(stderr,"mem: loc %0.2lf avg %0.2lf min %0.2lf max %0.2lf total %0.2lf Kb\n",
mem_pss, cum_mem_pss / nproc, min_mem_pss, max_mem_pss, cum_mem_pss); mem_pss, cum_mem_pss / nproc, min_mem_pss, max_mem_pss, cum_mem_pss);

Просмотреть файл

@ -17,6 +17,7 @@ pmix_proc_t this_proc;
void pmi_init(int *rank, int *size) void pmi_init(int *rank, int *size)
{ {
pmix_value_t value, *val = &value; pmix_value_t value, *val = &value;
pmix_proc_t job_proc;
int rc; int rc;
/* init us */ /* init us */
@ -30,8 +31,12 @@ void pmi_init(int *rank, int *size)
abort(); abort();
} }
job_proc = this_proc;
#if (PMIX_VERSION_MAJOR > 1 )
job_proc.rank = PMIX_RANK_WILDCARD;
#endif
/* get our job size */ /* get our job size */
if (PMIX_SUCCESS != (rc = PMIx_Get(&this_proc, PMIX_JOB_SIZE, NULL, 0, &val))) { if (PMIX_SUCCESS != (rc = PMIx_Get(&job_proc, PMIX_JOB_SIZE, NULL, 0, &val))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get job size failed: %d", this_proc.nspace, this_proc.rank, rc); fprintf(stderr, "Client ns %s rank %d: PMIx_Get job size failed: %d", this_proc.nspace, this_proc.rank, rc);
abort(); abort();
} }
@ -45,9 +50,13 @@ void pmi_get_local_ranks(int **local_ranks, int *local_cnt)
pmix_value_t value, *val = &value; pmix_value_t value, *val = &value;
char *ptr; char *ptr;
int i, rc; int i, rc;
pmix_proc_t job_proc = this_proc;
#if (PMIX_VERSION_MAJOR > 1 )
job_proc.rank = PMIX_RANK_WILDCARD;
#endif
/* get our job size */ /* get our job size */
if (PMIX_SUCCESS != (rc = PMIx_Get(&this_proc, PMIX_LOCAL_SIZE, NULL, 0, &val))) { if (PMIX_SUCCESS != (rc = PMIx_Get(&job_proc, PMIX_LOCAL_SIZE, NULL, 0, &val))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get PMIX_LOCAL_SIZE failed: %d", this_proc.nspace, this_proc.rank, rc); fprintf(stderr, "Client ns %s rank %d: PMIx_Get PMIX_LOCAL_SIZE failed: %d", this_proc.nspace, this_proc.rank, rc);
abort(); abort();
} }
@ -56,7 +65,7 @@ void pmi_get_local_ranks(int **local_ranks, int *local_cnt)
*local_ranks = calloc(*local_cnt, sizeof(int)); *local_ranks = calloc(*local_cnt, sizeof(int));
/* get our job size */ /* get our job size */
if (PMIX_SUCCESS != (rc = PMIx_Get(&this_proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) { if (PMIX_SUCCESS != (rc = PMIx_Get(&job_proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get PMIX_LOCAL_PEERS failed: %d", this_proc.nspace, this_proc.rank, rc); fprintf(stderr, "Client ns %s rank %d: PMIx_Get PMIX_LOCAL_PEERS failed: %d", this_proc.nspace, this_proc.rank, rc);
abort(); abort();
} }

Двоичный файл не отображается.

0
opal/mca/pmix/pmix2x/pmix/contrib/whitespace-purge.sh Обычный файл → Исполняемый файл
Просмотреть файл

Просмотреть файл

@ -3,6 +3,9 @@
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved * Copyright (c) 2013-2016 Intel, Inc. All rights reserved
* Copyright (c) 2016 Research Organization for Information Science * Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -43,8 +46,6 @@
* *
* Additional copyrights may follow * Additional copyrights may follow
* *
* Copyright (c) 2016 IBM Corporation. All rights reserved.
*
* $HEADER$ * $HEADER$
*/ */
@ -121,6 +122,7 @@ typedef uint32_t pmix_rank_t;
#define PMIX_CONNECT_TO_SYSTEM "pmix.cnct.sys" // (bool) The requestor requires that a connection be made only to #define PMIX_CONNECT_TO_SYSTEM "pmix.cnct.sys" // (bool) The requestor requires that a connection be made only to
// a local system-level PMIx server // a local system-level PMIx server
#define PMIX_CONNECT_SYSTEM_FIRST "pmix.cnct.sys.first" // (bool) Preferentially look for a system-level PMIx server first #define PMIX_CONNECT_SYSTEM_FIRST "pmix.cnct.sys.first" // (bool) Preferentially look for a system-level PMIx server first
#define PMIX_REGISTER_NODATA "pmix.reg.nodata" // (bool) Registration is for nspace only, do not copy job data
/* identification attributes */ /* identification attributes */
#define PMIX_USERID "pmix.euid" // (uint32_t) effective user id #define PMIX_USERID "pmix.euid" // (uint32_t) effective user id
@ -435,28 +437,28 @@ typedef uint16_t pmix_data_type_t;
#define PMIX_STATUS 20 // needs to be tracked separately from integer for those times #define PMIX_STATUS 20 // needs to be tracked separately from integer for those times
// when we are embedded and it needs to be converted to the // when we are embedded and it needs to be converted to the
// host error definitions // host error definitions
#define PMIX_HWLOC_TOPO 21 #define PMIX_VALUE 21
#define PMIX_VALUE 22 #define PMIX_PROC 22
#define PMIX_PROC 23 #define PMIX_APP 23
#define PMIX_APP 24 #define PMIX_INFO 24
#define PMIX_INFO 25 #define PMIX_PDATA 25
#define PMIX_PDATA 26 #define PMIX_BUFFER 26
#define PMIX_BUFFER 27 #define PMIX_BYTE_OBJECT 27
#define PMIX_BYTE_OBJECT 28 #define PMIX_KVAL 28
#define PMIX_KVAL 29 #define PMIX_MODEX 29
#define PMIX_MODEX 30 #define PMIX_PERSIST 30
#define PMIX_PERSIST 31 #define PMIX_POINTER 31
#define PMIX_POINTER 32 #define PMIX_SCOPE 32
#define PMIX_SCOPE 33 #define PMIX_DATA_RANGE 33
#define PMIX_DATA_RANGE 34 #define PMIX_COMMAND 34
#define PMIX_COMMAND 35 #define PMIX_INFO_DIRECTIVES 35
#define PMIX_INFO_DIRECTIVES 36 #define PMIX_DATA_TYPE 36
#define PMIX_DATA_TYPE 37 #define PMIX_PROC_STATE 37
#define PMIX_PROC_STATE 38 #define PMIX_PROC_INFO 38
#define PMIX_PROC_INFO 39 #define PMIX_DATA_ARRAY 39
#define PMIX_DATA_ARRAY 40 #define PMIX_PROC_RANK 40
#define PMIX_PROC_RANK 41 #define PMIX_QUERY 41
#define PMIX_QUERY 42 #define PMIX_COMPRESSED_STRING 42 // string compressed with zlib
/**** DEPRECATED ****/ /**** DEPRECATED ****/
#define PMIX_INFO_ARRAY 43 #define PMIX_INFO_ARRAY 43
/********************/ /********************/
@ -681,7 +683,8 @@ typedef struct pmix_value {
if (NULL != (m)->data.string) { \ if (NULL != (m)->data.string) { \
free((m)->data.string); \ free((m)->data.string); \
} \ } \
} else if (PMIX_BYTE_OBJECT == (m)->type) { \ } else if ((PMIX_BYTE_OBJECT == (m)->type) || \
(PMIX_COMPRESSED_STRING == (m)->type)) { \
if (NULL != (m)->data.bo.bytes) { \ if (NULL != (m)->data.bo.bytes) { \
free((m)->data.bo.bytes); \ free((m)->data.bo.bytes); \
} \ } \
@ -765,7 +768,7 @@ typedef struct pmix_value {
* includes internal functions - we don't * includes internal functions - we don't
* want to expose the entire header here * want to expose the entire header here
*/ */
void pmix_value_load(pmix_value_t *v, void *data, pmix_data_type_t type); void pmix_value_load(pmix_value_t *v, const void *data, pmix_data_type_t type);
pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src); pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src);
pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg); pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg);
pmix_status_t pmix_setenv(const char *name, const char *value, pmix_status_t pmix_setenv(const char *name, const char *value,
@ -1364,6 +1367,9 @@ pmix_status_t PMIx_Store_internal(const pmix_proc_t *proc,
#define PMIX_VAL_CMP_byte PMIX_VAL_cmp_val #define PMIX_VAL_CMP_byte PMIX_VAL_cmp_val
#define PMIX_VAL_CMP_flag PMIX_VAL_cmp_val #define PMIX_VAL_CMP_flag PMIX_VAL_cmp_val
#define PMIX_VAL_ASSIGN(_v, _field, _val) \
PMIX_VAL_set_assign(_v, _field, _val)
#define PMIX_VAL_CMP(_field, _val1, _val2) \ #define PMIX_VAL_CMP(_field, _val1, _val2) \
PMIX_VAL_CMP_ ## _field(_val1, _val2) PMIX_VAL_CMP_ ## _field(_val1, _val2)

Просмотреть файл

@ -45,7 +45,7 @@ BEGIN_C_DECLS
* another pmix_value_t structure * another pmix_value_t structure
*/ */
pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src); pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src);
void pmix_value_load(pmix_value_t *v, void *data, void pmix_value_load(pmix_value_t *v, const void *data,
pmix_data_type_t type); pmix_data_type_t type);
pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data, pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data,
size_t *sz, pmix_data_type_t type); size_t *sz, pmix_data_type_t type);

Просмотреть файл

@ -259,6 +259,12 @@ bool pmix_value_cmp(pmix_value_t *p, pmix_value_t *p1)
case PMIX_STRING: case PMIX_STRING:
rc = strcmp(p->data.string, p1->data.string); rc = strcmp(p->data.string, p1->data.string);
break; break;
case PMIX_COMPRESSED_STRING:
if (p->data.bo.size != p1->data.bo.size) {
return false;
} else {
return true;
}
case PMIX_STATUS: case PMIX_STATUS:
rc = (p->data.status == p1->data.status); rc = (p->data.status == p1->data.status);
break; break;
@ -370,6 +376,7 @@ PMIX_EXPORT pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
memcpy(&p->data.proc, &src->data.rank, sizeof(pmix_rank_t)); memcpy(&p->data.proc, &src->data.rank, sizeof(pmix_rank_t));
break; break;
case PMIX_BYTE_OBJECT: case PMIX_BYTE_OBJECT:
case PMIX_COMPRESSED_STRING:
memset(&p->data.bo, 0, sizeof(pmix_byte_object_t)); memset(&p->data.bo, 0, sizeof(pmix_byte_object_t));
if (NULL != src->data.bo.bytes && 0 < src->data.bo.size) { if (NULL != src->data.bo.bytes && 0 < src->data.bo.size) {
p->data.bo.bytes = malloc(src->data.bo.size); p->data.bo.bytes = malloc(src->data.bo.size);
@ -612,6 +619,7 @@ PMIX_EXPORT pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
} }
break; break;
case PMIX_BYTE_OBJECT: case PMIX_BYTE_OBJECT:
case PMIX_COMPRESSED_STRING:
p->data.darray->array = (pmix_byte_object_t*)malloc(src->data.darray->size * sizeof(pmix_byte_object_t)); p->data.darray->array = (pmix_byte_object_t*)malloc(src->data.darray->size * sizeof(pmix_byte_object_t));
if (NULL == p->data.darray->array) { if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM; return PMIX_ERR_NOMEM;
@ -891,16 +899,6 @@ pmix_status_t pmix_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
return PMIX_SUCCESS; return PMIX_SUCCESS;
} }
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_copy_topo(hwloc_topology_t *dest,
hwloc_topology_t src,
pmix_data_type_t type)
{
/* use the hwloc dup function */
return hwloc_topology_dup(dest, src);
}
#endif
pmix_status_t pmix_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src, pmix_status_t pmix_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src,
pmix_data_type_t type) pmix_data_type_t type)
{ {
@ -1240,6 +1238,7 @@ pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest,
} }
break; break;
case PMIX_BYTE_OBJECT: case PMIX_BYTE_OBJECT:
case PMIX_COMPRESSED_STRING:
p->array = (pmix_byte_object_t*)malloc(src->size * sizeof(pmix_byte_object_t)); p->array = (pmix_byte_object_t*)malloc(src->size * sizeof(pmix_byte_object_t));
if (NULL == p->array) { if (NULL == p->array) {
free(p); free(p);

Просмотреть файл

@ -38,9 +38,6 @@
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif
#if PMIX_HAVE_HWLOC
#include PMIX_HWLOC_HEADER
#endif #endif
BEGIN_C_DECLS BEGIN_C_DECLS
@ -279,11 +276,6 @@ pmix_status_t pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type); int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_status(pmix_buffer_t *buffer, const void *src, pmix_status_t pmix_bfrop_pack_status(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type); int32_t num_vals, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_pack_topo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
#endif
pmix_status_t pmix_bfrop_pack_value(pmix_buffer_t *buffer, const void *src, pmix_status_t pmix_bfrop_pack_value(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type); int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src, pmix_status_t pmix_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src,
@ -364,11 +356,6 @@ pmix_status_t pmix_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
int32_t *num_vals, pmix_data_type_t type); int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type); int32_t *num_vals, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_unpack_topo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
#endif
pmix_status_t pmix_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest, pmix_status_t pmix_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type); int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, pmix_status_t pmix_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest,
@ -418,15 +405,8 @@ pmix_status_t pmix_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest,
* Internal copy functions * Internal copy functions
*/ */
pmix_status_t pmix_bfrop_std_copy(void **dest, void *src, pmix_data_type_t type); pmix_status_t pmix_bfrop_std_copy(void **dest, void *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_string(char **dest, char *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_string(char **dest, char *src, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_copy_topo(hwloc_topology_t *dest,
hwloc_topology_t src,
pmix_data_type_t type);
#endif
pmix_status_t pmix_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src, pmix_status_t pmix_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src,
pmix_data_type_t type); pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src, pmix_status_t pmix_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
@ -487,11 +467,6 @@ pmix_status_t pmix_bfrop_print_double(char **output, char *prefix, double *src,
pmix_status_t pmix_bfrop_print_timeval(char **output, char *prefix, struct timeval *src, pmix_data_type_t type); pmix_status_t pmix_bfrop_print_timeval(char **output, char *prefix, struct timeval *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_time(char **output, char *prefix, time_t *src, pmix_data_type_t type); pmix_status_t pmix_bfrop_print_time(char **output, char *prefix, time_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_status(char **output, char *prefix, pmix_status_t *src, pmix_data_type_t type); pmix_status_t pmix_bfrop_print_status(char **output, char *prefix, pmix_status_t *src, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_print_topo(char **output, char *prefix,
hwloc_topology_t src, pmix_data_type_t type);
#endif
pmix_status_t pmix_bfrop_print_value(char **output, char *prefix, pmix_value_t *src, pmix_data_type_t type); pmix_status_t pmix_bfrop_print_value(char **output, char *prefix, pmix_value_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_proc(char **output, char *prefix, pmix_status_t pmix_bfrop_print_proc(char **output, char *prefix,
pmix_proc_t *src, pmix_data_type_t type); pmix_proc_t *src, pmix_data_type_t type);

Просмотреть файл

@ -297,14 +297,6 @@ pmix_status_t pmix_bfrop_open(void)
pmix_bfrop_std_copy, pmix_bfrop_std_copy,
pmix_bfrop_print_status); pmix_bfrop_print_status);
#if PMIX_HAVE_HWLOC
PMIX_REGISTER_TYPE("PMIX_HWLOC_TOPO", PMIX_HWLOC_TOPO,
pmix_bfrop_pack_topo,
pmix_bfrop_unpack_topo,
pmix_bfrop_copy_topo,
pmix_bfrop_print_topo);
#endif
PMIX_REGISTER_TYPE("PMIX_VALUE", PMIX_VALUE, PMIX_REGISTER_TYPE("PMIX_VALUE", PMIX_VALUE,
pmix_bfrop_pack_value, pmix_bfrop_pack_value,
pmix_bfrop_unpack_value, pmix_bfrop_unpack_value,
@ -425,6 +417,13 @@ pmix_status_t pmix_bfrop_open(void)
pmix_bfrop_copy_query, pmix_bfrop_copy_query,
pmix_bfrop_print_query); pmix_bfrop_print_query);
PMIX_REGISTER_TYPE("PMIX_COMPRESSED_STRING",
PMIX_COMPRESSED_STRING,
pmix_bfrop_pack_bo,
pmix_bfrop_unpack_bo,
pmix_bfrop_copy_bo,
pmix_bfrop_print_bo);
/**** DEPRECATED ****/ /**** DEPRECATED ****/
PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY, PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY,
pmix_bfrop_pack_array, pmix_bfrop_pack_array,
@ -462,7 +461,8 @@ pmix_status_t pmix_bfrop_close(void)
} }
/**** UTILITY SUPPORT ****/ /**** UTILITY SUPPORT ****/
PMIX_EXPORT void pmix_value_load(pmix_value_t *v, void *data, PMIX_EXPORT void pmix_value_load(pmix_value_t *v,
const void *data,
pmix_data_type_t type) pmix_data_type_t type)
{ {
pmix_byte_object_t *bo; pmix_byte_object_t *bo;

Просмотреть файл

@ -550,6 +550,7 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer,
} }
break; break;
case PMIX_BYTE_OBJECT: case PMIX_BYTE_OBJECT:
case PMIX_COMPRESSED_STRING:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) { if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) {
return ret; return ret;
} }
@ -819,65 +820,6 @@ pmix_status_t pmix_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src,
return PMIX_SUCCESS; return PMIX_SUCCESS;
} }
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_pack_topo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
/* NOTE: hwloc defines topology_t as a pointer to a struct! */
hwloc_topology_t t, *tarray = (hwloc_topology_t*)src;
pmix_status_t rc;
int i;
char *xmlbuffer=NULL;
int len;
struct hwloc_topology_support *support;
for (i=0; i < num_vals; i++) {
t = tarray[i];
/* extract an xml-buffer representation of the tree */
if (0 != hwloc_topology_export_xmlbuffer(t, &xmlbuffer, &len)) {
return PMIX_ERROR;
}
/* add to buffer */
if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_string(buffer, &xmlbuffer, 1, PMIX_STRING))) {
free(xmlbuffer);
return rc;
}
/* cleanup */
if (NULL != xmlbuffer) {
free(xmlbuffer);
}
/* get the available support - hwloc unfortunately does
* not include this info in its xml export!
*/
support = (struct hwloc_topology_support*)hwloc_topology_get_support(t);
/* pack the discovery support */
if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_byte(buffer, support->discovery,
sizeof(struct hwloc_topology_discovery_support),
PMIX_BYTE))) {
return rc;
}
/* pack the cpubind support */
if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_byte(buffer, support->cpubind,
sizeof(struct hwloc_topology_cpubind_support),
PMIX_BYTE))) {
return rc;
}
/* pack the membind support */
if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_byte(buffer, support->membind,
sizeof(struct hwloc_topology_membind_support),
PMIX_BYTE))) {
return rc;
}
}
return PMIX_SUCCESS;
}
#endif
pmix_status_t pmix_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, pmix_status_t pmix_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type) int32_t num_vals, pmix_data_type_t type)
{ {

Просмотреть файл

@ -1021,130 +1021,6 @@ pmix_status_t pmix_bfrop_print_kval(char **output, char *prefix,
return PMIX_SUCCESS; return PMIX_SUCCESS;
} }
#if PMIX_HAVE_HWLOC
#define PMIX_HWLOC_MAX_STRING 2048
static void print_hwloc_obj(char **output, char *prefix,
hwloc_topology_t topo, hwloc_obj_t obj)
{
hwloc_obj_t obj2;
char string[1024], *tmp, *tmp2, *pfx;
unsigned i;
struct hwloc_topology_support *support;
/* print the object type */
hwloc_obj_type_snprintf(string, 1024, obj, 1);
if (0 > asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix)) {
return;
}
if (0 > asprintf(&tmp, "%sType: %s Number of child objects: %u%sName=%s",
(NULL == prefix) ? "" : prefix, string, obj->arity,
pfx, (NULL == obj->name) ? "NULL" : obj->name)) {
free(pfx);
return;
}
if (0 < hwloc_obj_attr_snprintf(string, 1024, obj, pfx, 1)) {
/* print the attributes */
if (0 > asprintf(&tmp2, "%s%s%s", tmp, pfx, string)) {
free(tmp);
free(pfx);
return;
}
free(tmp);
tmp = tmp2;
}
/* print the cpusets - apparently, some new HWLOC types don't
* have cpusets, so protect ourselves here
*/
if (NULL != obj->cpuset) {
hwloc_bitmap_snprintf(string, PMIX_HWLOC_MAX_STRING, obj->cpuset);
if (0 > asprintf(&tmp2, "%s%sCpuset: %s", tmp, pfx, string)) {
free(tmp);
free(pfx);
return;
}
free(tmp);
tmp = tmp2;
}
if (NULL != obj->online_cpuset) {
hwloc_bitmap_snprintf(string, PMIX_HWLOC_MAX_STRING, obj->online_cpuset);
if (0 > asprintf(&tmp2, "%s%sOnline: %s", tmp, pfx, string)) {
free(tmp);
free(pfx);
return;
}
free(tmp);
tmp = tmp2;
}
if (NULL != obj->allowed_cpuset) {
hwloc_bitmap_snprintf(string, PMIX_HWLOC_MAX_STRING, obj->allowed_cpuset);
if (0 > asprintf(&tmp2, "%s%sAllowed: %s", tmp, pfx, string)) {
free(tmp);
free(pfx);
return;
}
free(tmp);
tmp = tmp2;
}
if (HWLOC_OBJ_MACHINE == obj->type) {
/* root level object - add support values */
support = (struct hwloc_topology_support*)hwloc_topology_get_support(topo);
if (0 > asprintf(&tmp2, "%s%sBind CPU proc: %s%sBind CPU thread: %s", tmp, pfx,
(support->cpubind->set_thisproc_cpubind) ? "TRUE" : "FALSE", pfx,
(support->cpubind->set_thisthread_cpubind) ? "TRUE" : "FALSE")) {
free(tmp);
free(pfx);
return;
}
free(tmp);
tmp = tmp2;
if (0 > asprintf(&tmp2, "%s%sBind MEM proc: %s%sBind MEM thread: %s", tmp, pfx,
(support->membind->set_thisproc_membind) ? "TRUE" : "FALSE", pfx,
(support->membind->set_thisthread_membind) ? "TRUE" : "FALSE")) {
free(tmp);
free(pfx);
return;
}
free(tmp);
tmp = tmp2;
}
if (0 > asprintf(&tmp2, "%s%s\n", (NULL == *output) ? "" : *output, tmp)) {
free(tmp);
return;
}
free(tmp);
free(pfx);
if (0 > asprintf(&pfx, "%s\t", (NULL == prefix) ? "" : prefix)) {
return;
}
for (i=0; i < obj->arity; i++) {
obj2 = obj->children[i];
/* print the object */
print_hwloc_obj(&tmp2, pfx, topo, obj2);
}
free(pfx);
if (NULL != *output) {
free(*output);
}
*output = tmp2;
}
pmix_status_t pmix_bfrop_print_topo(char **output, char *prefix,
hwloc_topology_t src, pmix_data_type_t type)
{
hwloc_obj_t obj;
char *tmp=NULL;
/* get root object */
obj = hwloc_get_root_obj(src);
/* print it */
print_hwloc_obj(&tmp, prefix, src, obj);
*output = tmp;
return PMIX_SUCCESS;
}
#endif
pmix_status_t pmix_bfrop_print_modex(char **output, char *prefix, pmix_status_t pmix_bfrop_print_modex(char **output, char *prefix,
pmix_modex_data_t *src, pmix_data_type_t type) pmix_modex_data_t *src, pmix_data_type_t type)
{ {

Просмотреть файл

@ -646,6 +646,7 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
} }
break; break;
case PMIX_BYTE_OBJECT: case PMIX_BYTE_OBJECT:
case PMIX_COMPRESSED_STRING:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.bo, &m, PMIX_BYTE_OBJECT))) { if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.bo, &m, PMIX_BYTE_OBJECT))) {
return ret; return ret;
} }
@ -1031,89 +1032,6 @@ pmix_status_t pmix_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest,
return PMIX_SUCCESS; return PMIX_SUCCESS;
} }
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_unpack_topo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals,
pmix_data_type_t type)
{
/* NOTE: hwloc defines topology_t as a pointer to a struct! */
hwloc_topology_t t, *tarray = (hwloc_topology_t*)dest;
pmix_status_t rc=PMIX_SUCCESS;
int32_t cnt, i, j;
char *xmlbuffer;
struct hwloc_topology_support *support;
for (i=0, j=0; i < *num_vals; i++) {
/* unpack the xml string */
cnt=1;
xmlbuffer = NULL;
if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_string(buffer, &xmlbuffer, &cnt, PMIX_STRING))) {
goto cleanup;
}
if (NULL == xmlbuffer) {
goto cleanup;
}
/* convert the xml */
if (0 != hwloc_topology_init(&t)) {
rc = PMIX_ERROR;
goto cleanup;
}
if (0 != hwloc_topology_set_xmlbuffer(t, xmlbuffer, strlen(xmlbuffer))) {
rc = PMIX_ERROR;
free(xmlbuffer);
hwloc_topology_destroy(t);
goto cleanup;
}
/* since we are loading this from an external source, we have to
* explicitly set a flag so hwloc sets things up correctly
*/
if (0 != hwloc_topology_set_flags(t, HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM | HWLOC_TOPOLOGY_FLAG_IO_DEVICES)) {
free(xmlbuffer);
rc = PMIX_ERROR;
hwloc_topology_destroy(t);
goto cleanup;
}
/* now load the topology */
if (0 != hwloc_topology_load(t)) {
free(xmlbuffer);
rc = PMIX_ERROR;
hwloc_topology_destroy(t);
goto cleanup;
}
if (NULL != xmlbuffer) {
free(xmlbuffer);
}
/* get the available support - hwloc unfortunately does
* not include this info in its xml import!
*/
support = (struct hwloc_topology_support*)hwloc_topology_get_support(t);
cnt = sizeof(struct hwloc_topology_discovery_support);
if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_byte(buffer, support->discovery, &cnt, PMIX_BYTE))) {
goto cleanup;
}
cnt = sizeof(struct hwloc_topology_cpubind_support);
if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_byte(buffer, support->cpubind, &cnt, PMIX_BYTE))) {
goto cleanup;
}
cnt = sizeof(struct hwloc_topology_membind_support);
if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_byte(buffer, support->membind, &cnt, PMIX_BYTE))) {
goto cleanup;
}
/* pass it back */
tarray[i] = t;
/* track the number added */
j++;
}
cleanup:
*num_vals = j;
return rc;
}
#endif
pmix_status_t pmix_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, pmix_status_t pmix_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type) int32_t *num_vals, pmix_data_type_t type)
{ {
@ -1145,7 +1063,6 @@ pmix_status_t pmix_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest,
return PMIX_SUCCESS; return PMIX_SUCCESS;
} }
pmix_status_t pmix_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest, pmix_status_t pmix_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type) int32_t *num_vals, pmix_data_type_t type)
{ {
@ -1354,6 +1271,7 @@ pmix_status_t pmix_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest,
nbytes = sizeof(pmix_proc_t); nbytes = sizeof(pmix_proc_t);
break; break;
case PMIX_BYTE_OBJECT: case PMIX_BYTE_OBJECT:
case PMIX_COMPRESSED_STRING:
nbytes = sizeof(pmix_byte_object_t); nbytes = sizeof(pmix_byte_object_t);
break; break;
case PMIX_PERSIST: case PMIX_PERSIST:

Просмотреть файл

@ -75,10 +75,10 @@ typedef struct pmix_hash_table_t pmix_hash_table_t;
* *
*/ */
int pmix_hash_table_init(pmix_hash_table_t* ht, size_t table_size); PMIX_EXPORT int pmix_hash_table_init(pmix_hash_table_t* ht, size_t table_size);
/* this could be the new init if people wanted a more general API */ /* this could be the new init if people wanted a more general API */
int pmix_hash_table_init2(pmix_hash_table_t* ht, size_t estimated_max_size, PMIX_EXPORT int pmix_hash_table_init2(pmix_hash_table_t* ht, size_t estimated_max_size,
int density_numer, int density_denom, int density_numer, int density_denom,
int growth_numer, int growth_denom); int growth_numer, int growth_denom);
@ -103,7 +103,7 @@ static inline size_t pmix_hash_table_get_size(pmix_hash_table_t *ht)
* *
*/ */
int pmix_hash_table_remove_all(pmix_hash_table_t *ht); PMIX_EXPORT int pmix_hash_table_remove_all(pmix_hash_table_t *ht);
/** /**
* Retrieve value via uint32_t key. * Retrieve value via uint32_t key.
@ -118,7 +118,7 @@ int pmix_hash_table_remove_all(pmix_hash_table_t *ht);
* *
*/ */
int pmix_hash_table_get_value_uint32(pmix_hash_table_t* table, uint32_t key, PMIX_EXPORT int pmix_hash_table_get_value_uint32(pmix_hash_table_t* table, uint32_t key,
void** ptr); void** ptr);
/** /**
@ -131,7 +131,7 @@ int pmix_hash_table_get_value_uint32(pmix_hash_table_t* table, uint32_t key,
* *
*/ */
int pmix_hash_table_set_value_uint32(pmix_hash_table_t* table, uint32_t key, void* value); PMIX_EXPORT int pmix_hash_table_set_value_uint32(pmix_hash_table_t* table, uint32_t key, void* value);
/** /**
* Remove value based on uint32_t key. * Remove value based on uint32_t key.
@ -142,7 +142,7 @@ int pmix_hash_table_set_value_uint32(pmix_hash_table_t* table, uint32_t key, voi
* *
*/ */
int pmix_hash_table_remove_value_uint32(pmix_hash_table_t* table, uint32_t key); PMIX_EXPORT int pmix_hash_table_remove_value_uint32(pmix_hash_table_t* table, uint32_t key);
/** /**
* Retrieve value via uint64_t key. * Retrieve value via uint64_t key.
@ -157,7 +157,7 @@ int pmix_hash_table_remove_value_uint32(pmix_hash_table_t* table, uint32_t key);
* *
*/ */
int pmix_hash_table_get_value_uint64(pmix_hash_table_t *table, uint64_t key, PMIX_EXPORT int pmix_hash_table_get_value_uint64(pmix_hash_table_t *table, uint64_t key,
void **ptr); void **ptr);
/** /**
@ -170,7 +170,7 @@ int pmix_hash_table_get_value_uint64(pmix_hash_table_t *table, uint64_t key,
* *
*/ */
int pmix_hash_table_set_value_uint64(pmix_hash_table_t *table, uint64_t key, void* value); PMIX_EXPORT int pmix_hash_table_set_value_uint64(pmix_hash_table_t *table, uint64_t key, void* value);
/** /**
* Remove value based on uint64_t key. * Remove value based on uint64_t key.
@ -181,7 +181,7 @@ int pmix_hash_table_set_value_uint64(pmix_hash_table_t *table, uint64_t key, voi
* *
*/ */
int pmix_hash_table_remove_value_uint64(pmix_hash_table_t *table, uint64_t key); PMIX_EXPORT int pmix_hash_table_remove_value_uint64(pmix_hash_table_t *table, uint64_t key);
/** /**
* Retrieve value via arbitrary length binary key. * Retrieve value via arbitrary length binary key.
@ -196,7 +196,7 @@ int pmix_hash_table_remove_value_uint64(pmix_hash_table_t *table, uint64_t key);
* *
*/ */
int pmix_hash_table_get_value_ptr(pmix_hash_table_t *table, const void* key, PMIX_EXPORT int pmix_hash_table_get_value_ptr(pmix_hash_table_t *table, const void* key,
size_t keylen, void **ptr); size_t keylen, void **ptr);
/** /**
@ -209,7 +209,7 @@ int pmix_hash_table_get_value_ptr(pmix_hash_table_t *table, const void* key,
* *
*/ */
int pmix_hash_table_set_value_ptr(pmix_hash_table_t *table, const void* key, size_t keylen, void* value); PMIX_EXPORT int pmix_hash_table_set_value_ptr(pmix_hash_table_t *table, const void* key, size_t keylen, void* value);
/** /**
* Remove value based on arbitrary length binary key. * Remove value based on arbitrary length binary key.
@ -220,7 +220,7 @@ int pmix_hash_table_set_value_ptr(pmix_hash_table_t *table, const void* key, siz
* *
*/ */
int pmix_hash_table_remove_value_ptr(pmix_hash_table_t *table, const void* key, size_t keylen); PMIX_EXPORT int pmix_hash_table_remove_value_ptr(pmix_hash_table_t *table, const void* key, size_t keylen);
/** The following functions are only for allowing iterating through /** The following functions are only for allowing iterating through
@ -245,7 +245,7 @@ int pmix_hash_table_remove_value_ptr(pmix_hash_table_t *table, const void* key,
* *
*/ */
int pmix_hash_table_get_first_key_uint32(pmix_hash_table_t *table, uint32_t *key, PMIX_EXPORT int pmix_hash_table_get_first_key_uint32(pmix_hash_table_t *table, uint32_t *key,
void **value, void **node); void **value, void **node);
@ -263,7 +263,7 @@ int pmix_hash_table_get_first_key_uint32(pmix_hash_table_t *table, uint32_t *key
* *
*/ */
int pmix_hash_table_get_next_key_uint32(pmix_hash_table_t *table, uint32_t *key, PMIX_EXPORT int pmix_hash_table_get_next_key_uint32(pmix_hash_table_t *table, uint32_t *key,
void **value, void *in_node, void **value, void *in_node,
void **out_node); void **out_node);
@ -281,7 +281,7 @@ int pmix_hash_table_get_next_key_uint32(pmix_hash_table_t *table, uint32_t *key,
* *
*/ */
int pmix_hash_table_get_first_key_uint64(pmix_hash_table_t *table, uint64_t *key, PMIX_EXPORT int pmix_hash_table_get_first_key_uint64(pmix_hash_table_t *table, uint64_t *key,
void **value, void **node); void **value, void **node);
@ -299,7 +299,7 @@ int pmix_hash_table_get_first_key_uint64(pmix_hash_table_t *table, uint64_t *key
* *
*/ */
int pmix_hash_table_get_next_key_uint64(pmix_hash_table_t *table, uint64_t *key, PMIX_EXPORT int pmix_hash_table_get_next_key_uint64(pmix_hash_table_t *table, uint64_t *key,
void **value, void *in_node, void **value, void *in_node,
void **out_node); void **out_node);
@ -318,7 +318,7 @@ int pmix_hash_table_get_next_key_uint64(pmix_hash_table_t *table, uint64_t *key,
* *
*/ */
int pmix_hash_table_get_first_key_ptr(pmix_hash_table_t *table, void* *key, PMIX_EXPORT int pmix_hash_table_get_first_key_ptr(pmix_hash_table_t *table, void* *key,
size_t *key_size, void **value, void **node); size_t *key_size, void **value, void **node);
@ -337,7 +337,7 @@ int pmix_hash_table_get_first_key_ptr(pmix_hash_table_t *table, void* *key,
* *
*/ */
int pmix_hash_table_get_next_key_ptr(pmix_hash_table_t *table, void* *key, PMIX_EXPORT int pmix_hash_table_get_next_key_ptr(pmix_hash_table_t *table, void* *key,
size_t *key_size, void **value, size_t *key_size, void **value,
void *in_node, void **out_node); void *in_node, void **out_node);

Просмотреть файл

@ -157,7 +157,7 @@ PMIX_CLASS_DECLARATION(pmix_hotel_t);
* @return PMIX_SUCCESS if all initializations were succesful. Otherwise, * @return PMIX_SUCCESS if all initializations were succesful. Otherwise,
* the error indicate what went wrong in the function. * the error indicate what went wrong in the function.
*/ */
int pmix_hotel_init(pmix_hotel_t *hotel, int num_rooms, PMIX_EXPORT int pmix_hotel_init(pmix_hotel_t *hotel, int num_rooms,
pmix_event_base_t *evbase, pmix_event_base_t *evbase,
uint32_t eviction_timeout, uint32_t eviction_timeout,
int eviction_event_priority, int eviction_event_priority,

Просмотреть файл

@ -165,7 +165,7 @@ struct pmix_class_t {
size_t cls_sizeof; /**< size of an object instance */ size_t cls_sizeof; /**< size of an object instance */
}; };
extern int pmix_class_init_epoch; PMIX_EXPORT extern int pmix_class_init_epoch;
/** /**
* For static initializations of OBJects. * For static initializations of OBJects.
@ -394,7 +394,7 @@ PMIX_CLASS_DECLARATION(pmix_object_t);
* *
* @param class Pointer to class descriptor * @param class Pointer to class descriptor
*/ */
void pmix_class_initialize(pmix_class_t *); PMIX_EXPORT void pmix_class_initialize(pmix_class_t *);
/** /**
* Shut down the class system and release all memory * Shut down the class system and release all memory
@ -405,7 +405,7 @@ void pmix_class_initialize(pmix_class_t *);
* tools like valgrind and purify don't report still-reachable memory * tools like valgrind and purify don't report still-reachable memory
* upon process termination. * upon process termination.
*/ */
int pmix_class_finalize(void); PMIX_EXPORT int pmix_class_finalize(void);
/** /**
* Run the hierarchy of class constructors for this object, in a * Run the hierarchy of class constructors for this object, in a

Просмотреть файл

@ -79,7 +79,7 @@ PMIX_CLASS_DECLARATION(pmix_pointer_array_t);
* @return PMIX_SUCCESS if all initializations were succesfull. Otherwise, * @return PMIX_SUCCESS if all initializations were succesfull. Otherwise,
* the error indicate what went wrong in the function. * the error indicate what went wrong in the function.
*/ */
pmix_status_t pmix_pointer_array_init(pmix_pointer_array_t* array, PMIX_EXPORT pmix_status_t pmix_pointer_array_init(pmix_pointer_array_t* array,
int initial_allocation, int initial_allocation,
int max_size, int block_size ); int max_size, int block_size );
@ -92,7 +92,7 @@ pmix_status_t pmix_pointer_array_init(pmix_pointer_array_t* array,
* @return Index of inserted array element. Return value of * @return Index of inserted array element. Return value of
* (-1) indicates an error. * (-1) indicates an error.
*/ */
int pmix_pointer_array_add(pmix_pointer_array_t *array, void *ptr); PMIX_EXPORT int pmix_pointer_array_add(pmix_pointer_array_t *array, void *ptr);
/** /**
* Set the value of an element in array * Set the value of an element in array
@ -104,7 +104,7 @@ int pmix_pointer_array_add(pmix_pointer_array_t *array, void *ptr);
* @return PMIX_SUCCESS if item was inserted. Otherwise, * @return PMIX_SUCCESS if item was inserted. Otherwise,
* the error indicate what went wrong in the function. * the error indicate what went wrong in the function.
*/ */
pmix_status_t pmix_pointer_array_set_item(pmix_pointer_array_t *array, PMIX_EXPORT pmix_status_t pmix_pointer_array_set_item(pmix_pointer_array_t *array,
int index, void *value); int index, void *value);
/** /**
@ -157,7 +157,7 @@ static inline int pmix_pointer_array_get_size(pmix_pointer_array_t *array)
* Simple function to set the size of the array in order to * Simple function to set the size of the array in order to
* hide the member field from external users. * hide the member field from external users.
*/ */
pmix_status_t pmix_pointer_array_set_size(pmix_pointer_array_t *array, int size); PMIX_EXPORT pmix_status_t pmix_pointer_array_set_size(pmix_pointer_array_t *array, int size);
/** /**
* Test whether a certain element is already in use. If not yet * Test whether a certain element is already in use. If not yet
@ -173,7 +173,7 @@ pmix_status_t pmix_pointer_array_set_size(pmix_pointer_array_t *array, int size)
* In contrary to array_set, this function does not allow to overwrite * In contrary to array_set, this function does not allow to overwrite
* a value, unless the previous value is NULL ( equiv. to free ). * a value, unless the previous value is NULL ( equiv. to free ).
*/ */
bool pmix_pointer_array_test_and_set_item (pmix_pointer_array_t *table, PMIX_EXPORT bool pmix_pointer_array_test_and_set_item (pmix_pointer_array_t *table,
int index, int index,
void *value); void *value);

Просмотреть файл

@ -64,7 +64,7 @@ PMIX_CLASS_DECLARATION(pmix_ring_buffer_t);
* @return PMIX_SUCCESS if all initializations were succesful. Otherwise, * @return PMIX_SUCCESS if all initializations were succesful. Otherwise,
* the error indicate what went wrong in the function. * the error indicate what went wrong in the function.
*/ */
int pmix_ring_buffer_init(pmix_ring_buffer_t* ring, int size); PMIX_EXPORT int pmix_ring_buffer_init(pmix_ring_buffer_t* ring, int size);
/** /**
* Push an item onto the ring buffer, displacing the oldest * Push an item onto the ring buffer, displacing the oldest
@ -76,7 +76,7 @@ int pmix_ring_buffer_init(pmix_ring_buffer_t* ring, int size);
* @return Pointer to displaced item, NULL if ring * @return Pointer to displaced item, NULL if ring
* is not yet full * is not yet full
*/ */
void* pmix_ring_buffer_push(pmix_ring_buffer_t *ring, void *ptr); PMIX_EXPORT void* pmix_ring_buffer_push(pmix_ring_buffer_t *ring, void *ptr);
/** /**
@ -88,14 +88,14 @@ void* pmix_ring_buffer_push(pmix_ring_buffer_t *ring, void *ptr);
* @return Error code. NULL indicates an error. * @return Error code. NULL indicates an error.
*/ */
void* pmix_ring_buffer_pop(pmix_ring_buffer_t *ring); PMIX_EXPORT void* pmix_ring_buffer_pop(pmix_ring_buffer_t *ring);
/* /*
* Access an element of the ring, without removing it, indexed * Access an element of the ring, without removing it, indexed
* starting at the tail - a value of -1 will return the element * starting at the tail - a value of -1 will return the element
* at the head of the ring * at the head of the ring
*/ */
void* pmix_ring_buffer_poke(pmix_ring_buffer_t *ring, int i); PMIX_EXPORT void* pmix_ring_buffer_poke(pmix_ring_buffer_t *ring, int i);
END_C_DECLS END_C_DECLS

Просмотреть файл

@ -126,7 +126,7 @@ static inline size_t pmix_value_array_get_size(pmix_value_array_t* array)
* return the new size. * return the new size.
*/ */
int pmix_value_array_set_size(pmix_value_array_t* array, size_t size); PMIX_EXPORT int pmix_value_array_set_size(pmix_value_array_t* array, size_t size);
/** /**

Просмотреть файл

@ -45,6 +45,10 @@
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#if PMIX_HAVE_ZLIB
#include <zlib.h>
#endif
#include PMIX_EVENT_HEADER #include PMIX_EVENT_HEADER
#include PMIX_EVENT2_THREAD_HEADER #include PMIX_EVENT2_THREAD_HEADER
@ -60,6 +64,7 @@
#include "src/buffer_ops/buffer_ops.h" #include "src/buffer_ops/buffer_ops.h"
#include "src/event/pmix_event.h" #include "src/event/pmix_event.h"
#include "src/util/argv.h" #include "src/util/argv.h"
#include "src/util/compress.h"
#include "src/util/error.h" #include "src/util/error.h"
#include "src/util/hash.h" #include "src/util/hash.h"
#include "src/util/output.h" #include "src/util/output.h"
@ -70,6 +75,9 @@
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) #if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
#include "src/dstore/pmix_dstore.h" #include "src/dstore/pmix_dstore.h"
#endif /* PMIX_ENABLE_DSTORE */ #endif /* PMIX_ENABLE_DSTORE */
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
#include "pmix_client_ops.h" #include "pmix_client_ops.h"
#include "src/include/pmix_jobdata.h" #include "src/include/pmix_jobdata.h"
@ -547,12 +555,30 @@ static void _putfn(int sd, short args, void *cbdata)
pmix_status_t rc; pmix_status_t rc;
pmix_kval_t *kv; pmix_kval_t *kv;
pmix_nspace_t *ns; pmix_nspace_t *ns;
uint8_t *tmp;
size_t len;
/* setup to xfer the data */ /* setup to xfer the data */
kv = PMIX_NEW(pmix_kval_t); kv = PMIX_NEW(pmix_kval_t);
kv->key = strdup(cb->key); // need to copy as the input belongs to the user kv->key = strdup(cb->key); // need to copy as the input belongs to the user
kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t));
rc = pmix_value_xfer(kv->value, cb->value); if (PMIX_STRING_SIZE_CHECK(cb->value)) {
/* compress large strings */
if (pmix_util_compress_string(cb->value->data.string, &tmp, &len)) {
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
}
kv->value->type = PMIX_COMPRESSED_STRING;
kv->value->data.bo.bytes = (char*)tmp;
kv->value->data.bo.size = len;
rc = PMIX_SUCCESS;
} else {
rc = pmix_value_xfer(kv->value, cb->value);
}
} else {
rc = pmix_value_xfer(kv->value, cb->value);
}
if (PMIX_SUCCESS != rc) { if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc); PMIX_ERROR_LOG(rc);
goto done; goto done;
@ -595,7 +621,7 @@ static void _putfn(int sd, short args, void *cbdata)
} }
} }
done: done:
PMIX_RELEASE(kv); // maintain accounting PMIX_RELEASE(kv); // maintain accounting
cb->pstatus = rc; cb->pstatus = rc;
cb->active = false; cb->active = false;

Просмотреть файл

@ -45,11 +45,16 @@
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#if PMIX_HAVE_ZLIB
#include <zlib.h>
#endif
#include PMIX_EVENT_HEADER #include PMIX_EVENT_HEADER
#include "src/class/pmix_list.h" #include "src/class/pmix_list.h"
#include "src/buffer_ops/buffer_ops.h" #include "src/buffer_ops/buffer_ops.h"
#include "src/util/argv.h" #include "src/util/argv.h"
#include "src/util/compress.h"
#include "src/util/error.h" #include "src/util/error.h"
#include "src/util/hash.h" #include "src/util/hash.h"
#include "src/util/output.h" #include "src/util/output.h"
@ -73,6 +78,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr,
static void _value_cbfunc(pmix_status_t status, pmix_value_t *kv, void *cbdata); static void _value_cbfunc(pmix_status_t status, pmix_value_t *kv, void *cbdata);
PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[], PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
const pmix_info_t info[], size_t ninfo, const pmix_info_t info[], size_t ninfo,
pmix_value_t **val) pmix_value_t **val)
@ -249,6 +255,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr,
#if (PMIX_ENABLE_DSTORE != 1) #if (PMIX_ENABLE_DSTORE != 1)
pmix_rank_t cur_rank; pmix_rank_t cur_rank;
#endif #endif
char *tmp;
pmix_output_verbose(2, pmix_globals.debug_output, pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: get_nb callback recvd"); "pmix: get_nb callback recvd");
@ -370,6 +377,20 @@ done:
if (NULL != cb && NULL != cb->value_cbfunc) { if (NULL != cb && NULL != cb->value_cbfunc) {
if (NULL == val) { if (NULL == val) {
rc = PMIX_ERR_NOT_FOUND; rc = PMIX_ERR_NOT_FOUND;
} else {
/* if this is a compressed string, then uncompress it */
if (PMIX_COMPRESSED_STRING == val->type) {
pmix_util_uncompress_string(&tmp, (uint8_t*)val->data.bo.bytes, val->data.bo.size);
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
PMIX_VALUE_RELEASE(val);
val = NULL;
} else {
PMIX_VALUE_DESTRUCT(val);
PMIX_VAL_ASSIGN(val, string, tmp);
}
}
} }
cb->value_cbfunc(rc, val, cb->cbdata); cb->value_cbfunc(rc, val, cb->cbdata);
} }
@ -462,6 +483,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
pmix_status_t rc; pmix_status_t rc;
pmix_nspace_t *ns, *nptr; pmix_nspace_t *ns, *nptr;
size_t n, nvals; size_t n, nvals;
char *tmp;
pmix_output_verbose(2, pmix_globals.debug_output, pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: getnbfn value for proc %s:%d key %s", "pmix: getnbfn value for proc %s:%d key %s",
@ -550,7 +572,18 @@ static void _getnbfn(int fd, short flags, void *cbdata)
for (n=0; n < (size_t)results.size && n < nvals; n++) { for (n=0; n < (size_t)results.size && n < nvals; n++) {
if (NULL != (info = (pmix_info_t*)pmix_pointer_array_get_item(&results, n))) { if (NULL != (info = (pmix_info_t*)pmix_pointer_array_get_item(&results, n))) {
(void)strncpy(iptr[n].key, info->key, PMIX_MAX_KEYLEN); (void)strncpy(iptr[n].key, info->key, PMIX_MAX_KEYLEN);
pmix_value_xfer(&iptr[n].value, &info->value); /* if this is a compressed string, then uncompress it */
if (PMIX_COMPRESSED_STRING == info->value.type) {
iptr[n].value.type = PMIX_STRING;
pmix_util_uncompress_string(&iptr[n].value.data.string,
(uint8_t*)info->value.data.bo.bytes,
info->value.data.bo.size);
if (NULL == iptr[n].value.data.string) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
}
} else {
pmix_value_xfer(&iptr[n].value, &info->value);
}
PMIX_INFO_FREE(info, 1); PMIX_INFO_FREE(info, 1);
} }
} }
@ -565,6 +598,19 @@ static void _getnbfn(int fd, short flags, void *cbdata)
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) #if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, cb->rank, cb->key, &val))) { if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, cb->rank, cb->key, &val))) {
/* if this is a compressed string, then uncompress it */
if (PMIX_COMPRESSED_STRING == val->type) {
pmix_util_uncompress_string(&tmp, (uint8_t*)val->data.bo.bytes, val->data.bo.size);
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
PMIX_VALUE_RELEASE(val);
val = NULL;
} else {
PMIX_VALUE_DESTRUCT(val);
PMIX_VAL_ASSIGN(val, string, tmp);
}
}
/* found it - we are in an event, so we can /* found it - we are in an event, so we can
* just execute the callback */ * just execute the callback */
cb->value_cbfunc(rc, val, cb->cbdata); cb->value_cbfunc(rc, val, cb->cbdata);
@ -586,6 +632,19 @@ static void _getnbfn(int fd, short flags, void *cbdata)
#else #else
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, cb->rank, cb->key, &val))) { if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, cb->rank, cb->key, &val))) {
#endif #endif
/* if this is a compressed string, then uncompress it */
if (PMIX_COMPRESSED_STRING == val->type) {
pmix_util_uncompress_string(&tmp, (uint8_t*)val->data.bo.bytes, val->data.bo.size);
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
PMIX_VALUE_RELEASE(val);
val = NULL;
} else {
PMIX_VALUE_DESTRUCT(val);
PMIX_VAL_ASSIGN(val, string, tmp);
}
}
/* found it - we are in an event, so we can /* found it - we are in an event, so we can
* just execute the callback */ * just execute the callback */
cb->value_cbfunc(rc, val, cb->cbdata); cb->value_cbfunc(rc, val, cb->cbdata);
@ -635,6 +694,19 @@ static void _getnbfn(int fd, short flags, void *cbdata)
if ( PMIX_SUCCESS == rc ) { if ( PMIX_SUCCESS == rc ) {
pmix_output_verbose(2, pmix_globals.debug_output, pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_get[%d]: value retrieved from dstore", __LINE__); "pmix_get[%d]: value retrieved from dstore", __LINE__);
/* if this is a compressed string, then uncompress it */
if (PMIX_COMPRESSED_STRING == val->type) {
pmix_util_uncompress_string(&tmp, (uint8_t*)val->data.bo.bytes, val->data.bo.size);
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
PMIX_VALUE_RELEASE(val);
val = NULL;
} else {
PMIX_VALUE_DESTRUCT(val);
PMIX_VAL_ASSIGN(val, string, tmp);
}
}
/* found it - we are in an event, so we can /* found it - we are in an event, so we can
* just execute the callback */ * just execute the callback */
cb->value_cbfunc(rc, val, cb->cbdata); cb->value_cbfunc(rc, val, cb->cbdata);

Просмотреть файл

@ -23,7 +23,7 @@ typedef struct {
pmix_list_t pending_requests; // list of pmix_cb_t pending data requests pmix_list_t pending_requests; // list of pmix_cb_t pending data requests
} pmix_client_globals_t; } pmix_client_globals_t;
extern pmix_client_globals_t pmix_client_globals; PMIX_EXPORT extern pmix_client_globals_t pmix_client_globals;
END_C_DECLS END_C_DECLS

Просмотреть файл

@ -18,6 +18,7 @@
#include "src/util/error.h" #include "src/util/error.h"
#include "src/buffer_ops/internal.h" #include "src/buffer_ops/internal.h"
#include "src/util/argv.h" #include "src/util/argv.h"
#include "src/util/compress.h"
#include "src/util/hash.h" #include "src/util/hash.h"
#include "src/include/pmix_jobdata.h" #include "src/include/pmix_jobdata.h"
@ -28,6 +29,7 @@
static inline int _add_key_for_rank(pmix_rank_t rank, pmix_kval_t *kv, void *cbdata); static inline int _add_key_for_rank(pmix_rank_t rank, pmix_kval_t *kv, void *cbdata);
static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata); static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata);
static inline int _add_key_for_rank(pmix_rank_t rank, pmix_kval_t *kv, void *cbdata) static inline int _add_key_for_rank(pmix_rank_t rank, pmix_kval_t *kv, void *cbdata)
{ {
pmix_job_data_caddy_t *cb = (pmix_job_data_caddy_t*)(cbdata); pmix_job_data_caddy_t *cb = (pmix_job_data_caddy_t*)(cbdata);
@ -135,13 +137,14 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
pmix_nspace_t *nsptr = NULL, *nsptr2 = NULL; pmix_nspace_t *nsptr = NULL, *nsptr2 = NULL;
pmix_kval_t *kptr, *kp2, kv; pmix_kval_t *kptr, *kp2, kv;
int32_t cnt; int32_t cnt;
size_t nnodes; size_t nnodes, len;
uint32_t i; uint32_t i;
#if !(defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)) #if !(defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1))
uint32_t j; uint32_t j;
#endif #endif
pmix_nrec_t *nrec, *nr2; pmix_nrec_t *nrec, *nr2;
char **procs = NULL; char **procs = NULL;
uint8_t *tmp;
pmix_byte_object_t *bo; pmix_byte_object_t *bo;
pmix_buffer_t buf2; pmix_buffer_t buf2;
int rank; int rank;
@ -149,7 +152,9 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
"server" : "client"; "server" : "client";
pmix_output_verbose(10, pmix_globals.debug_output, pmix_output_verbose(10, pmix_globals.debug_output,
"pmix:%s pmix_jobdata_store %s", proc_type_str, nspace); "[%s:%d] pmix:%s pmix_jobdata_store %s",
pmix_globals.myid.nspace, pmix_globals.myid.rank,
proc_type_str, nspace);
/* check buf data */ /* check buf data */
if ((NULL == job_data) && (0 != job_data->bytes_used)) { if ((NULL == job_data) && (0 != job_data->bytes_used)) {
@ -213,6 +218,21 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
cnt = 1; cnt = 1;
kp2 = PMIX_NEW(pmix_kval_t); kp2 = PMIX_NEW(pmix_kval_t);
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(&buf2, kp2, &cnt, PMIX_KVAL))) { while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(&buf2, kp2, &cnt, PMIX_KVAL))) {
/* if the value contains a string that is longer than the
* limit, then compress it */
if (PMIX_STRING_SIZE_CHECK(kp2->value)) {
if (pmix_util_compress_string(kp2->value->data.string, &tmp, &len)) {
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
goto exit;
}
kp2->value->type = PMIX_COMPRESSED_STRING;
free(kp2->value->data.string);
kp2->value->data.bo.bytes = (char*)tmp;
kp2->value->data.bo.size = len;
}
}
/* this is data provided by a job-level exchange, so store it /* this is data provided by a job-level exchange, so store it
* in the job-level data hash_table */ * in the job-level data hash_table */
if (PMIX_SUCCESS != (rc = _add_key_for_rank(rank, kp2, cb))) { if (PMIX_SUCCESS != (rc = _add_key_for_rank(rank, kp2, cb))) {
@ -249,6 +269,21 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
PMIX_DESTRUCT(&kv); PMIX_DESTRUCT(&kv);
goto exit; goto exit;
} }
/* if the value contains a string that is longer than the
* limit, then compress it */
if (PMIX_STRING_SIZE_CHECK(kv.value)) {
if (pmix_util_compress_string(kv.value->data.string, &tmp, &len)) {
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
goto exit;
}
kv.value->type = PMIX_COMPRESSED_STRING;
free(kv.value->data.string);
kv.value->data.bo.bytes = (char*)tmp;
kv.value->data.bo.size = len;
}
}
/* the name of the node is in the key, and the value is /* the name of the node is in the key, and the value is
* a comma-delimited list of procs on that node. See if we already * a comma-delimited list of procs on that node. See if we already
* have this node */ * have this node */
@ -310,6 +345,21 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
/* cleanup */ /* cleanup */
PMIX_DESTRUCT(&buf2); PMIX_DESTRUCT(&buf2);
} else { } else {
/* if the value contains a string that is longer than the
* limit, then compress it */
if (PMIX_STRING_SIZE_CHECK(kptr->value)) {
if (pmix_util_compress_string(kptr->value->data.string, &tmp, &len)) {
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
goto exit;
}
kptr->value->type = PMIX_COMPRESSED_STRING;
free(kptr->value->data.string);
kptr->value->data.bo.bytes = (char*)tmp;
kptr->value->data.bo.size = len;
}
}
if (PMIX_SUCCESS != (rc = _add_key_for_rank(PMIX_RANK_WILDCARD, kptr, cb))) { if (PMIX_SUCCESS != (rc = _add_key_for_rank(PMIX_RANK_WILDCARD, kptr, cb))) {
PMIX_ERROR_LOG(rc); PMIX_ERROR_LOG(rc);
PMIX_RELEASE(kptr); PMIX_RELEASE(kptr);

Просмотреть файл

@ -63,8 +63,64 @@ pmix_dstore_base_module_t pmix_dstore_esh_module = {
#define ESH_ENV_NS_DATA_SEG_SIZE "NS_DATA_SEG_SIZE" #define ESH_ENV_NS_DATA_SEG_SIZE "NS_DATA_SEG_SIZE"
#define ESH_ENV_LINEAR "SM_USE_LINEAR_SEARCH" #define ESH_ENV_LINEAR "SM_USE_LINEAR_SEARCH"
#define ESH_MIN_KEY_LEN (sizeof(ESH_REGION_INVALIDATED) + 1)
#define EXT_SLOT_SIZE(key) (strlen(key) + 1 + 2*sizeof(size_t)) /* in ext slot new offset will be stored in case if new data were added for the same process during next commit */ #define EXT_SLOT_SIZE(key) (strlen(key) + 1 + 2*sizeof(size_t)) /* in ext slot new offset will be stored in case if new data were added for the same process during next commit */
#define KVAL_SIZE(key, size) (strlen(key) + 1 + sizeof(size_t) + size)
#define ESH_KEY_SIZE(key, size) \
__extension__ ({ \
size_t len = sizeof(size_t) + size; \
size_t kname_len = strlen(key) + 1; \
len += (kname_len < ESH_MIN_KEY_LEN) ? \
ESH_MIN_KEY_LEN : kname_len; \
len; \
})
#define ESH_KV_SIZE(addr) \
__extension__ ({ \
size_t sz; \
memcpy(&sz, addr, sizeof(size_t)); \
sz; \
})
#define ESH_KNAME_PTR(addr) \
__extension__ ({ \
char *name_ptr = (char *)addr + sizeof(size_t); \
name_ptr; \
})
#define ESH_KNAME_LEN(key) \
__extension__ ({ \
size_t kname_len = strlen(key) + 1; \
size_t len = (kname_len < ESH_MIN_KEY_LEN) ? \
ESH_MIN_KEY_LEN : kname_len; \
len; \
})
#define ESH_DATA_PTR(addr) \
__extension__ ({ \
size_t kname_len = ESH_KNAME_LEN(ESH_KNAME_PTR(addr)); \
uint8_t *data_ptr = addr + sizeof(size_t) + kname_len; \
data_ptr; \
})
#define ESH_DATA_SIZE(addr, data_ptr) \
__extension__ ({ \
size_t sz = ESH_KV_SIZE(addr); \
size_t data_size = sz - (data_ptr - addr); \
data_size; \
})
#define ESH_PUT_KEY(addr, key, buffer, size) \
__extension__ ({ \
size_t sz = ESH_KEY_SIZE(key, size); \
memcpy(addr, &sz, sizeof(size_t)); \
memset(addr + sizeof(size_t), 0, ESH_KNAME_LEN(key)); \
strncpy((char *)addr + sizeof(size_t), \
key, ESH_KNAME_LEN(key)); \
memcpy(addr + sizeof(size_t) + ESH_KNAME_LEN(key), \
buffer, size); \
})
#define _ESH_LOCK(lockfd, operation) \ #define _ESH_LOCK(lockfd, operation) \
__extension__ ({ \ __extension__ ({ \
@ -1045,8 +1101,8 @@ int _esh_fetch(const char *nspace, pmix_rank_t rank, const char *key, pmix_value
while (0 < kval_cnt) { while (0 < kval_cnt) {
/* data is stored in the following format: /* data is stored in the following format:
* key_val_pair { * key_val_pair {
* char key[PMIX_MAX_KEYLEN+1];
* size_t size; * size_t size;
* char key[KNAME_LEN(addr)];
* byte_t byte[size]; // should be loaded to pmix_buffer_t and unpacked. * byte_t byte[size]; // should be loaded to pmix_buffer_t and unpacked.
* }; * };
* segment_format { * segment_format {
@ -1056,18 +1112,16 @@ int _esh_fetch(const char *nspace, pmix_rank_t rank, const char *key, pmix_value
* EXTENSION slot which has key = EXTENSION_SLOT and a size_t value for offset * EXTENSION slot which has key = EXTENSION_SLOT and a size_t value for offset
* to next data address for this process. * to next data address for this process.
*/ */
if (0 == strncmp((const char *)addr, ESH_REGION_INVALIDATED, strlen(ESH_REGION_INVALIDATED)+1)) { if (0 == strncmp(ESH_KNAME_PTR(addr), ESH_REGION_INVALIDATED, ESH_KNAME_LEN(ESH_REGION_INVALIDATED))) {
PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output,
"%s:%d:%s: for rank %s:%u, skip %s region", "%s:%d:%s: for rank %s:%u, skip %s region",
__FILE__, __LINE__, __func__, nspace, cur_rank, ESH_REGION_INVALIDATED)); __FILE__, __LINE__, __func__, nspace, cur_rank, ESH_REGION_INVALIDATED));
/*skip it */ /* skip it
size_t size; * go to next item, updating address */
memcpy(&size, addr + strlen(ESH_REGION_INVALIDATED) + 1, sizeof(size_t)); addr += ESH_KV_SIZE(addr);
/* go to next item, updating address */ } else if (0 == strncmp(ESH_KNAME_PTR(addr), ESH_REGION_EXTENSION, ESH_KNAME_LEN(ESH_REGION_EXTENSION))) {
addr += KVAL_SIZE(ESH_REGION_INVALIDATED, size);
} else if (0 == strncmp((const char *)addr, ESH_REGION_EXTENSION, strlen(ESH_REGION_EXTENSION)+1)) {
size_t offset; size_t offset;
memcpy(&offset, addr + strlen(ESH_REGION_EXTENSION) + 1 + sizeof(size_t), sizeof(size_t)); memcpy(&offset, ESH_DATA_PTR(addr), sizeof(size_t));
PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output,
"%s:%d:%s: for rank %s:%u, reached %s with %lu value", "%s:%d:%s: for rank %s:%u, reached %s with %lu value",
__FILE__, __LINE__, __func__, nspace, cur_rank, ESH_REGION_EXTENSION, offset)); __FILE__, __LINE__, __func__, nspace, cur_rank, ESH_REGION_EXTENSION, offset));
@ -1087,16 +1141,15 @@ int _esh_fetch(const char *nspace, pmix_rank_t rank, const char *key, pmix_value
__FILE__, __LINE__, __func__, cur_rank, key)); __FILE__, __LINE__, __func__, cur_rank, key));
break; break;
} }
} else if (0 == strncmp((const char *)addr, key, strlen(key)+1)) { } else if (0 == strncmp(ESH_KNAME_PTR(addr), key, ESH_KNAME_LEN(key))) {
PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output,
"%s:%d:%s: for rank %s:%u, found target key %s", "%s:%d:%s: for rank %s:%u, found target key %s",
__FILE__, __LINE__, __func__, nspace, cur_rank, key)); __FILE__, __LINE__, __func__, nspace, cur_rank, key));
/* target key is found, get value */ /* target key is found, get value */
size_t size; uint8_t *data_ptr = ESH_DATA_PTR(addr);
memcpy(&size, addr + strlen(key) + 1, sizeof(size_t)); size_t data_size = ESH_DATA_SIZE(addr, data_ptr);
addr += strlen(key) + 1 + sizeof(size_t);
PMIX_CONSTRUCT(&buffer, pmix_buffer_t); PMIX_CONSTRUCT(&buffer, pmix_buffer_t);
PMIX_LOAD_BUFFER(&buffer, addr, size); PMIX_LOAD_BUFFER(&buffer, data_ptr, data_size);
int cnt = 1; int cnt = 1;
/* unpack value for this key from the buffer. */ /* unpack value for this key from the buffer. */
PMIX_VALUE_CONSTRUCT(&val); PMIX_VALUE_CONSTRUCT(&val);
@ -1115,14 +1168,11 @@ int _esh_fetch(const char *nspace, pmix_rank_t rank, const char *key, pmix_value
key_found = true; key_found = true;
goto done; goto done;
} else { } else {
char ckey[PMIX_MAX_KEYLEN+1] = {0};
size_t size;
strncpy(ckey, (const char *)addr, strlen((const char *)addr)+1);
memcpy(&size, addr + strlen(ckey) + 1, sizeof(size_t));
PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output,
"%s:%d:%s: for rank %s:%u, skip key %s look for key %s", __FILE__, __LINE__, __func__, nspace, cur_rank, ckey, key)); "%s:%d:%s: for rank %s:%u, skip key %s look for key %s",
__FILE__, __LINE__, __func__, nspace, cur_rank, ESH_KNAME_PTR(addr), key));
/* go to next item, updating address */ /* go to next item, updating address */
addr += KVAL_SIZE(ckey, size); addr += ESH_KV_SIZE(addr);
kval_cnt--; kval_cnt--;
} }
} }
@ -1893,7 +1943,7 @@ static size_t get_free_offset(seg_desc_t *data_seg)
static int put_empty_ext_slot(seg_desc_t *dataseg) static int put_empty_ext_slot(seg_desc_t *dataseg)
{ {
size_t global_offset, rel_offset, data_ended, sz, val; size_t global_offset, rel_offset, data_ended, val = 0;
uint8_t *addr; uint8_t *addr;
global_offset = get_free_offset(dataseg); global_offset = get_free_offset(dataseg);
rel_offset = global_offset % _data_segment_size; rel_offset = global_offset % _data_segment_size;
@ -1902,11 +1952,7 @@ static int put_empty_ext_slot(seg_desc_t *dataseg)
return PMIX_ERROR; return PMIX_ERROR;
} }
addr = _get_data_region_by_offset(dataseg, global_offset); addr = _get_data_region_by_offset(dataseg, global_offset);
strncpy((char *)addr, ESH_REGION_EXTENSION, strlen(ESH_REGION_EXTENSION)+1); ESH_PUT_KEY(addr, ESH_REGION_EXTENSION, (void*)&val, sizeof(size_t));
val = 0;
sz = sizeof(size_t);
memcpy(addr + strlen(ESH_REGION_EXTENSION) + 1, &sz, sz);
memcpy(addr + strlen(ESH_REGION_EXTENSION) + 1 + sizeof(size_t), &val, sz);
/* update offset at the beginning of current segment */ /* update offset at the beginning of current segment */
data_ended = rel_offset + EXT_SLOT_SIZE(ESH_REGION_EXTENSION); data_ended = rel_offset + EXT_SLOT_SIZE(ESH_REGION_EXTENSION);
@ -1922,7 +1968,6 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg,
int id = 0; int id = 0;
size_t global_offset, data_ended; size_t global_offset, data_ended;
uint8_t *addr; uint8_t *addr;
size_t sz;
PMIX_OUTPUT_VERBOSE((2, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((2, pmix_globals.debug_output,
"%s:%d:%s: key %s", "%s:%d:%s: key %s",
@ -1937,7 +1982,7 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg,
offset = global_offset % _data_segment_size; offset = global_offset % _data_segment_size;
/* We should provide additional space at the end of segment to place EXTENSION_SLOT to have an ability to enlarge data for this rank.*/ /* We should provide additional space at the end of segment to place EXTENSION_SLOT to have an ability to enlarge data for this rank.*/
if (sizeof(size_t) + KVAL_SIZE(key, size) + EXT_SLOT_SIZE(key) > _data_segment_size) { if (sizeof(size_t) + ESH_KEY_SIZE(key, size) + EXT_SLOT_SIZE(key) > _data_segment_size) {
/* this is an error case: segment is so small that cannot place evem a single key-value pair. /* this is an error case: segment is so small that cannot place evem a single key-value pair.
* warn a user about it and fail. */ * warn a user about it and fail. */
offset = 0; /* offset cannot be 0 in normal case, so we use this value to indicate a problem. */ offset = 0; /* offset cannot be 0 in normal case, so we use this value to indicate a problem. */
@ -1945,7 +1990,7 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg,
sizeof(size_t) + strlen(key) + 1 + sizeof(size_t) + size + EXT_SLOT_SIZE(key)); sizeof(size_t) + strlen(key) + 1 + sizeof(size_t) + size + EXT_SLOT_SIZE(key));
return offset; return offset;
} }
if (offset + KVAL_SIZE(key, size) + EXT_SLOT_SIZE(key) > _data_segment_size) { if (offset + ESH_KEY_SIZE(key, size) + EXT_SLOT_SIZE(key) > _data_segment_size) {
id++; id++;
/* create a new data segment. */ /* create a new data segment. */
tmp = extend_segment(tmp, &ns_info->ns_map); tmp = extend_segment(tmp, &ns_info->ns_map);
@ -1967,16 +2012,13 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg,
} }
global_offset = offset + id * _data_segment_size; global_offset = offset + id * _data_segment_size;
addr = (uint8_t*)(tmp->seg_info.seg_base_addr)+offset; addr = (uint8_t*)(tmp->seg_info.seg_base_addr)+offset;
strncpy((char *)addr, key, strlen(key)+1); ESH_PUT_KEY(addr, key, buffer, size);
sz = size;
memcpy(addr + strlen(key) + 1, &sz, sizeof(size_t));
memcpy(addr + strlen(key) + 1 + sizeof(size_t), buffer, size);
/* update offset at the beginning of current segment */ /* update offset at the beginning of current segment */
data_ended = offset + KVAL_SIZE(key, size); data_ended = offset + ESH_KEY_SIZE(key, size);
addr = (uint8_t*)(tmp->seg_info.seg_base_addr); addr = (uint8_t*)(tmp->seg_info.seg_base_addr);
memcpy(addr, &data_ended, sizeof(size_t)); memcpy(addr, &data_ended, sizeof(size_t));
PMIX_OUTPUT_VERBOSE((2, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((1, pmix_globals.debug_output,
"%s:%d:%s: key %s, rel start offset %lu, rel end offset %lu, abs shift %lu size %lu", "%s:%d:%s: key %s, rel start offset %lu, rel end offset %lu, abs shift %lu size %lu",
__FILE__, __LINE__, __func__, key, offset, data_ended, id * _data_segment_size, size)); __FILE__, __LINE__, __func__, key, offset, data_ended, id * _data_segment_size, size));
return global_offset; return global_offset;
@ -2025,11 +2067,8 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t
* It should be equal in the normal case. It it's not true, then it means that * It should be equal in the normal case. It it's not true, then it means that
* segment was extended, and we put data to the next segment, so we now need to * segment was extended, and we put data to the next segment, so we now need to
* put extension slot at the end of previous segment with a "reference" to a new_offset */ * put extension slot at the end of previous segment with a "reference" to a new_offset */
size_t sz = sizeof(size_t);
addr = _get_data_region_by_offset(datadesc, free_offset); addr = _get_data_region_by_offset(datadesc, free_offset);
strncpy((char *)addr, ESH_REGION_EXTENSION, strlen(ESH_REGION_EXTENSION)+1); ESH_PUT_KEY(addr, ESH_REGION_EXTENSION, (void*)&offset, sizeof(size_t));
memcpy(addr + strlen(ESH_REGION_EXTENSION) + 1, &sz, sizeof(size_t));
memcpy(addr + strlen(ESH_REGION_EXTENSION) + 1 + sizeof(size_t), &offset, sizeof(size_t));
} }
if (NULL == *rinfo) { if (NULL == *rinfo) {
*rinfo = (rank_meta_info*)malloc(sizeof(rank_meta_info)); *rinfo = (rank_meta_info*)malloc(sizeof(rank_meta_info));
@ -2055,15 +2094,15 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t
int add_to_the_end = 1; int add_to_the_end = 1;
while (0 < kval_cnt) { while (0 < kval_cnt) {
/* data is stored in the following format: /* data is stored in the following format:
* key[PMIX_MAX_KEYLEN+1]
* size_t size * size_t size
* key[ESH_KNAME_LEN(addr)]
* byte buffer containing pmix_value, should be loaded to pmix_buffer_t and unpacked. * byte buffer containing pmix_value, should be loaded to pmix_buffer_t and unpacked.
* next kval pair * next kval pair
* ..... * .....
* extension slot which has key = EXTENSION_SLOT and a size_t value for offset to next data address for this process. * extension slot which has key = EXTENSION_SLOT and a size_t value for offset to next data address for this process.
*/ */
if (0 == strncmp((const char *)addr, ESH_REGION_EXTENSION, strlen(ESH_REGION_EXTENSION)+1)) { if (0 == strncmp(ESH_KNAME_PTR(addr), ESH_REGION_EXTENSION, ESH_KNAME_LEN(ESH_REGION_EXTENSION))) {
memcpy(&offset, addr + strlen(ESH_REGION_EXTENSION) + 1 + sizeof(size_t), sizeof(size_t)); memcpy(&offset, ESH_DATA_PTR(addr), sizeof(size_t));
if (0 < offset) { if (0 < offset) {
PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output,
"%s:%d:%s: for rank %u, replace flag %d %s is filled with %lu value", "%s:%d:%s: for rank %u, replace flag %d %s is filled with %lu value",
@ -2078,22 +2117,20 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t
} else { } else {
/* should not be, we should be out of cycle when this happens */ /* should not be, we should be out of cycle when this happens */
} }
} else if (0 == strncmp((const char *)addr, kval->key, strlen(kval->key)+1)) { } else if (0 == strncmp(ESH_KNAME_PTR(addr), kval->key, ESH_KNAME_LEN(kval->key))) {
PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output,
"%s:%d:%s: for rank %u, replace flag %d found target key %s", "%s:%d:%s: for rank %u, replace flag %d found target key %s",
__FILE__, __LINE__, __func__, rank, data_exist, kval->key)); __FILE__, __LINE__, __func__, rank, data_exist, kval->key));
/* target key is found, compare value sizes */ /* target key is found, compare value sizes */
size_t cur_size; if (ESH_DATA_SIZE(addr, ESH_DATA_PTR(addr)) != size) {
memcpy(&cur_size, addr + strlen(kval->key) + 1, sizeof(size_t));
if (cur_size != size) {
//if (1) { /* if we want to test replacing values for existing keys. */ //if (1) { /* if we want to test replacing values for existing keys. */
/* invalidate current value and store another one at the end of data region. */ /* invalidate current value and store another one at the end of data region. */
strncpy((char *)addr, ESH_REGION_INVALIDATED, strlen(ESH_REGION_INVALIDATED)+1); strncpy(ESH_KNAME_PTR(addr), ESH_REGION_INVALIDATED, ESH_KNAME_LEN(ESH_REGION_INVALIDATED));
/* decrementing count, it will be incremented back when we add a new value for this key at the end of region. */ /* decrementing count, it will be incremented back when we add a new value for this key at the end of region. */
(*rinfo)->count--; (*rinfo)->count--;
kval_cnt--; kval_cnt--;
/* go to next item, updating address */ /* go to next item, updating address */
addr += KVAL_SIZE(ESH_REGION_INVALIDATED, cur_size); addr += ESH_KV_SIZE(addr);
PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output,
"%s:%d:%s: for rank %u, replace flag %d mark key %s regions as invalidated. put new data at the end.", "%s:%d:%s: for rank %u, replace flag %d mark key %s regions as invalidated. put new data at the end.",
__FILE__, __LINE__, __func__, rank, data_exist, kval->key)); __FILE__, __LINE__, __func__, rank, data_exist, kval->key));
@ -2102,38 +2139,31 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t
"%s:%d:%s: for rank %u, replace flag %d replace data for key %s type %d in place", "%s:%d:%s: for rank %u, replace flag %d replace data for key %s type %d in place",
__FILE__, __LINE__, __func__, rank, data_exist, kval->key, kval->value->type)); __FILE__, __LINE__, __func__, rank, data_exist, kval->key, kval->value->type));
/* replace old data with new one. */ /* replace old data with new one. */
addr += strlen(kval->key) + 1; memset(ESH_DATA_PTR(addr), 0, ESH_DATA_SIZE(addr, ESH_DATA_PTR(addr)));
memcpy(addr, &size, sizeof(size_t)); memcpy(ESH_DATA_PTR(addr), buffer->base_ptr, size);
addr += sizeof(size_t); addr += ESH_KV_SIZE(addr);
memset(addr, 0, cur_size);
memcpy(addr, buffer->base_ptr, size);
addr += cur_size;
add_to_the_end = 0; add_to_the_end = 0;
break; break;
} }
} else { } else {
char ckey[PMIX_MAX_KEYLEN+1] = {0};
strncpy(ckey, (const char *)addr, strlen((char*)addr)+1);
PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output,
"%s:%d:%s: for rank %u, replace flag %d skip %s key, look for %s key", "%s:%d:%s: for rank %u, replace flag %d skip %s key, look for %s key",
__FILE__, __LINE__, __func__, rank, data_exist, ckey, kval->key)); __FILE__, __LINE__, __func__, rank, data_exist, ESH_KNAME_PTR(addr), kval->key));
/* Skip it: key is "INVALIDATED" or key is valid but different from target one. */ /* Skip it: key is "INVALIDATED" or key is valid but different from target one. */
if (0 != strncmp(ESH_REGION_INVALIDATED, ckey, strlen(ckey)+1)) { if (0 != strncmp(ESH_REGION_INVALIDATED, ESH_KNAME_PTR(addr), ESH_KNAME_LEN(ESH_KNAME_PTR(addr)))) {
/* count only valid items */ /* count only valid items */
kval_cnt--; kval_cnt--;
} }
size_t size;
memcpy(&size, addr + strlen(ckey) + 1, sizeof(size_t));
/* go to next item, updating address */ /* go to next item, updating address */
addr += KVAL_SIZE(ckey, size); addr += ESH_KV_SIZE(addr);
} }
} }
if (1 == add_to_the_end) { if (1 == add_to_the_end) {
/* if we get here, it means that we want to add a new item for the target rank, or /* if we get here, it means that we want to add a new item for the target rank, or
* we mark existing item with the same key as "invalidated" and want to add new item * we mark existing item with the same key as "invalidated" and want to add new item
* for the same key. */ * for the same key. */
(*rinfo)->count++;
size_t free_offset; size_t free_offset;
(*rinfo)->count++;
free_offset = get_free_offset(datadesc); free_offset = get_free_offset(datadesc);
/* add to the end */ /* add to the end */
offset = put_data_to_the_end(ns_info, datadesc, kval->key, buffer->base_ptr, size); offset = put_data_to_the_end(ns_info, datadesc, kval->key, buffer->base_ptr, size);
@ -2147,11 +2177,11 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t
* data for different ranks, and that's why next element is EXTENSION_SLOT. * data for different ranks, and that's why next element is EXTENSION_SLOT.
* We put new data to the end of data region and just update EXTENSION_SLOT value by new offset. * We put new data to the end of data region and just update EXTENSION_SLOT value by new offset.
*/ */
if (0 == strncmp((const char *)addr, ESH_REGION_EXTENSION, strlen(ESH_REGION_EXTENSION)+1)) { if (0 == strncmp(ESH_KNAME_PTR(addr), ESH_REGION_EXTENSION, ESH_KNAME_LEN(ESH_REGION_EXTENSION))) {
PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output,
"%s:%d:%s: for rank %u, replace flag %d %s should be filled with offset %lu value", "%s:%d:%s: for rank %u, replace flag %d %s should be filled with offset %lu value",
__FILE__, __LINE__, __func__, rank, data_exist, ESH_REGION_EXTENSION, offset)); __FILE__, __LINE__, __func__, rank, data_exist, ESH_REGION_EXTENSION, offset));
memcpy(addr + strlen(ESH_REGION_EXTENSION) + 1 + sizeof(size_t), &offset, sizeof(size_t)); memcpy(ESH_DATA_PTR(addr), &offset, sizeof(size_t));
} else { } else {
/* (2) - we point to the first free offset, no more data is stored further in this segment. /* (2) - we point to the first free offset, no more data is stored further in this segment.
* There is no EXTENSION_SLOT by this addr since we continue pushing data for the same rank, * There is no EXTENSION_SLOT by this addr since we continue pushing data for the same rank,
@ -2161,11 +2191,7 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t
* forcibly and store new offset in its value. */ * forcibly and store new offset in its value. */
if (free_offset != offset) { if (free_offset != offset) {
/* segment was extended, need to put extension slot by free_offset indicating new_offset */ /* segment was extended, need to put extension slot by free_offset indicating new_offset */
size_t sz = sizeof(size_t); ESH_PUT_KEY(addr, ESH_REGION_EXTENSION, (void*)&offset, sizeof(size_t));
size_t length = strlen(ESH_REGION_EXTENSION);
strncpy((char *)addr, ESH_REGION_EXTENSION, length + 1);
memcpy(addr + length + 1, &sz, sz);
memcpy(addr + length + 1 + sizeof(size_t), &offset, sz);
} }
} }
PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output, PMIX_OUTPUT_VERBOSE((10, pmix_globals.debug_output,

Просмотреть файл

@ -64,9 +64,9 @@ static void cbdes(pmix_cb_t *p)
{ {
PMIX_DESTRUCT(&p->data); PMIX_DESTRUCT(&p->data);
} }
PMIX_CLASS_INSTANCE(pmix_cb_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_cb_t,
pmix_list_item_t, pmix_list_item_t,
cbcon, cbdes); cbcon, cbdes);
static void pcon(pmix_peer_t *p) static void pcon(pmix_peer_t *p)
{ {
@ -106,9 +106,9 @@ static void pdes(pmix_peer_t *p)
PMIX_RELEASE(p->recv_msg); PMIX_RELEASE(p->recv_msg);
} }
} }
PMIX_CLASS_INSTANCE(pmix_peer_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_peer_t,
pmix_object_t, pmix_object_t,
pcon, pdes); pcon, pdes);
static void nscon(pmix_nspace_t *p) static void nscon(pmix_nspace_t *p)
{ {
@ -142,9 +142,9 @@ static void nsdes(pmix_nspace_t *p)
PMIX_RELEASE(p->server); PMIX_RELEASE(p->server);
} }
} }
PMIX_CLASS_INSTANCE(pmix_nspace_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_nspace_t,
pmix_list_item_t, pmix_list_item_t,
nscon, nsdes); nscon, nsdes);
static void ncon(pmix_nrec_t *p) static void ncon(pmix_nrec_t *p)
{ {
@ -160,9 +160,9 @@ static void ndes(pmix_nrec_t *p)
free(p->procs); free(p->procs);
} }
} }
PMIX_CLASS_INSTANCE(pmix_nrec_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_nrec_t,
pmix_list_item_t, pmix_list_item_t,
ncon, ndes); ncon, ndes);
static void sncon(pmix_server_nspace_t *p) static void sncon(pmix_server_nspace_t *p)
{ {
@ -185,9 +185,9 @@ static void sndes(pmix_server_nspace_t *p)
PMIX_DESTRUCT(&p->myremote); PMIX_DESTRUCT(&p->myremote);
PMIX_DESTRUCT(&p->remote); PMIX_DESTRUCT(&p->remote);
} }
PMIX_CLASS_INSTANCE(pmix_server_nspace_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_server_nspace_t,
pmix_object_t, pmix_object_t,
sncon, sndes); sncon, sndes);
static void info_con(pmix_rank_info_t *info) static void info_con(pmix_rank_info_t *info)
{ {
@ -204,9 +204,9 @@ static void info_des(pmix_rank_info_t *info)
PMIX_RELEASE(info->nptr); PMIX_RELEASE(info->nptr);
} }
} }
PMIX_CLASS_INSTANCE(pmix_rank_info_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_rank_info_t,
pmix_list_item_t, pmix_list_item_t,
info_con, info_des); info_con, info_des);
static void scon(pmix_shift_caddy_t *p) static void scon(pmix_shift_caddy_t *p)
{ {
@ -236,9 +236,9 @@ static void scdes(pmix_shift_caddy_t *p)
PMIX_RELEASE(p->kv); PMIX_RELEASE(p->kv);
} }
} }
PMIX_CLASS_INSTANCE(pmix_shift_caddy_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_shift_caddy_t,
pmix_object_t, pmix_object_t,
scon, scdes); scon, scdes);
PMIX_CLASS_INSTANCE(pmix_info_caddy_t, PMIX_CLASS_INSTANCE(pmix_info_caddy_t,
pmix_list_item_t, pmix_list_item_t,

Просмотреть файл

@ -400,7 +400,7 @@ int pmix_mca_base_var_init(void);
* the caller may free the original string after this function returns * the caller may free the original string after this function returns
* successfully. * successfully.
*/ */
int pmix_mca_base_var_register (const char *project_name, const char *framework_name, PMIX_EXPORT int pmix_mca_base_var_register (const char *project_name, const char *framework_name,
const char *component_name, const char *variable_name, const char *component_name, const char *variable_name,
const char *description, pmix_mca_base_var_type_t type, const char *description, pmix_mca_base_var_type_t type,
pmix_mca_base_var_enum_t *enumerator, int bind, pmix_mca_base_var_flag_t flags, pmix_mca_base_var_enum_t *enumerator, int bind, pmix_mca_base_var_flag_t flags,
@ -416,7 +416,7 @@ int pmix_mca_base_var_register (const char *project_name, const char *framework_
* be unregistered / made unavailable when that component is closed by * be unregistered / made unavailable when that component is closed by
* its framework. * its framework.
*/ */
int pmix_mca_base_component_var_register (const pmix_mca_base_component_t *component, PMIX_EXPORT int pmix_mca_base_component_var_register (const pmix_mca_base_component_t *component,
const char *variable_name, const char *description, const char *variable_name, const char *description,
pmix_mca_base_var_type_t type, pmix_mca_base_var_enum_t *enumerator, pmix_mca_base_var_type_t type, pmix_mca_base_var_enum_t *enumerator,
int bind, pmix_mca_base_var_flag_t flags, int bind, pmix_mca_base_var_flag_t flags,
@ -428,7 +428,7 @@ int pmix_mca_base_component_var_register (const pmix_mca_base_component_t *compo
* function is equivalent to pmix_mca_base_var_register with component_name = "base" and * function is equivalent to pmix_mca_base_var_register with component_name = "base" and
* with the MCA_BASE_VAR_FLAG_DWG set. See pmix_mca_base_var_register(). * with the MCA_BASE_VAR_FLAG_DWG set. See pmix_mca_base_var_register().
*/ */
int pmix_mca_base_framework_var_register (const pmix_mca_base_framework_t *framework, PMIX_EXPORT int pmix_mca_base_framework_var_register (const pmix_mca_base_framework_t *framework,
const char *variable_name, const char *variable_name,
const char *help_msg, pmix_mca_base_var_type_t type, const char *help_msg, pmix_mca_base_var_type_t type,
pmix_mca_base_var_enum_t *enumerator, int bind, pmix_mca_base_var_enum_t *enumerator, int bind,
@ -471,7 +471,7 @@ int pmix_mca_base_framework_var_register (const pmix_mca_base_framework_t *frame
* variable names "B" and "C" (and does *not* set a value for * variable names "B" and "C" (and does *not* set a value for
* "A"), it is undefined as to which value will be used. * "A"), it is undefined as to which value will be used.
*/ */
int pmix_mca_base_var_register_synonym (int synonym_for, const char *project_name, PMIX_EXPORT int pmix_mca_base_var_register_synonym (int synonym_for, const char *project_name,
const char *framework_name, const char *framework_name,
const char *component_name, const char *component_name,
const char *synonym_name, const char *synonym_name,

Просмотреть файл

@ -33,9 +33,6 @@
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#if PMIX_HAVE_HWLOC
#include PMIX_HWLOC_HEADER
#endif
#include "src/class/pmix_pointer_array.h" #include "src/class/pmix_pointer_array.h"
#include "src/mca/mca.h" #include "src/mca/mca.h"

Просмотреть файл

@ -33,9 +33,6 @@
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#if PMIX_HAVE_HWLOC
#include PMIX_HWLOC_HEADER
#endif
#include "src/class/pmix_pointer_array.h" #include "src/class/pmix_pointer_array.h"
#include "src/mca/mca.h" #include "src/mca/mca.h"
@ -49,7 +46,7 @@
/* /*
* MCA Framework * MCA Framework
*/ */
extern pmix_mca_base_framework_t pmix_ptl_base_framework; PMIX_EXPORT extern pmix_mca_base_framework_t pmix_ptl_base_framework;
/** /**
* PTL select function * PTL select function
* *
@ -82,7 +79,7 @@ struct pmix_ptl_globals_t {
}; };
typedef struct pmix_ptl_globals_t pmix_ptl_globals_t; typedef struct pmix_ptl_globals_t pmix_ptl_globals_t;
extern pmix_ptl_globals_t pmix_ptl_globals; PMIX_EXPORT extern pmix_ptl_globals_t pmix_ptl_globals;
/* API stubs */ /* API stubs */
PMIX_EXPORT pmix_status_t pmix_ptl_stub_set_notification_cbfunc(pmix_ptl_cbfunc_t cbfunc); PMIX_EXPORT pmix_status_t pmix_ptl_stub_set_notification_cbfunc(pmix_ptl_cbfunc_t cbfunc);

Просмотреть файл

@ -157,9 +157,9 @@ static void srcon(pmix_ptl_sr_t *p)
p->cbfunc = NULL; p->cbfunc = NULL;
p->cbdata = NULL; p->cbdata = NULL;
} }
PMIX_CLASS_INSTANCE(pmix_ptl_sr_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_ptl_sr_t,
pmix_object_t, pmix_object_t,
srcon, NULL); srcon, NULL);
static void pccon(pmix_pending_connection_t *p) static void pccon(pmix_pending_connection_t *p)
{ {
@ -186,9 +186,9 @@ static void pcdes(pmix_pending_connection_t *p)
free(p->cred); free(p->cred);
} }
} }
PMIX_CLASS_INSTANCE(pmix_pending_connection_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_pending_connection_t,
pmix_object_t, pmix_object_t,
pccon, pcdes); pccon, pcdes);
static void lcon(pmix_listener_t *p) static void lcon(pmix_listener_t *p)
{ {
@ -211,10 +211,10 @@ static void ldes(pmix_listener_t *p)
free(p->uri); free(p->uri);
} }
} }
PMIX_CLASS_INSTANCE(pmix_listener_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_listener_t,
pmix_list_item_t, pmix_list_item_t,
lcon, ldes); lcon, ldes);
PMIX_CLASS_INSTANCE(pmix_ptl_queue_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_ptl_queue_t,
pmix_object_t, pmix_object_t,
NULL, NULL); NULL, NULL);

Просмотреть файл

@ -73,7 +73,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
* Instantiate the public struct with all of our public information * Instantiate the public struct with all of our public information
* and pointers to our public functions in it * and pointers to our public functions in it
*/ */
pmix_ptl_tcp_component_t mca_ptl_tcp_component = { PMIX_EXPORT pmix_ptl_tcp_component_t mca_ptl_tcp_component = {
.super = { .super = {
.base = { .base = {
PMIX_PTL_BASE_VERSION_1_0_0, PMIX_PTL_BASE_VERSION_1_0_0,

Просмотреть файл

@ -73,7 +73,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
* Instantiate the public struct with all of our public information * Instantiate the public struct with all of our public information
* and pointers to our public functions in it * and pointers to our public functions in it
*/ */
pmix_ptl_usock_component_t mca_ptl_usock_component = { PMIX_EXPORT pmix_ptl_usock_component_t mca_ptl_usock_component = {
.super = { .super = {
.base = { .base = {
PMIX_PTL_BASE_VERSION_1_0_0, PMIX_PTL_BASE_VERSION_1_0_0,

Просмотреть файл

@ -286,6 +286,7 @@ static void _register_nspace(int sd, short args, void *cbdata)
pmix_info_t *iptr; pmix_info_t *iptr;
pmix_value_t val; pmix_value_t val;
char *msg; char *msg;
bool nodata = false;
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) #if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
pmix_buffer_t *jobdata = PMIX_NEW(pmix_buffer_t); pmix_buffer_t *jobdata = PMIX_NEW(pmix_buffer_t);
char *nspace = NULL; char *nspace = NULL;
@ -335,6 +336,14 @@ static void _register_nspace(int sd, short args, void *cbdata)
"pmix:server _register_nspace recording %s", "pmix:server _register_nspace recording %s",
cd->info[i].key); cd->info[i].key);
if (0 == strcmp(cd->info[i].key, PMIX_REGISTER_NODATA)) {
/* we don't want to save any job data for this nspace */
nodata = true;
/* free anything that was previously stored */
PMIX_DESTRUCT(&nptr->server->job_info);
PMIX_CONSTRUCT(&nptr->server->job_info, pmix_buffer_t);
break;
}
if (0 == strcmp(cd->info[i].key, PMIX_NODE_MAP)) { if (0 == strcmp(cd->info[i].key, PMIX_NODE_MAP)) {
/* parse the regex to get the argv array of node names */ /* parse the regex to get the argv array of node names */
if (PMIX_SUCCESS != (rc = pmix_regex_parse_nodes(cd->info[i].value.data.string, &nodes))) { if (PMIX_SUCCESS != (rc = pmix_regex_parse_nodes(cd->info[i].value.data.string, &nodes))) {
@ -436,19 +445,21 @@ static void _register_nspace(int sd, short args, void *cbdata)
PMIX_ERROR_LOG(rc); PMIX_ERROR_LOG(rc);
goto release; goto release;
} }
pmix_bfrop.copy_payload(jobdata, &nptr->server->job_info); if (!nodata) {
pmix_bfrop.copy_payload(jobdata, &pmix_server_globals.gdata); pmix_bfrop.copy_payload(jobdata, &nptr->server->job_info);
pmix_bfrop.copy_payload(jobdata, &pmix_server_globals.gdata);
/* unpack the nspace - we don't really need it, but have to /* unpack the nspace - we don't really need it, but have to
* unpack it to maintain sequence */ * unpack it to maintain sequence */
cnt = 1; cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(jobdata, &nspace, &cnt, PMIX_STRING))) { if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(jobdata, &nspace, &cnt, PMIX_STRING))) {
PMIX_ERROR_LOG(rc); PMIX_ERROR_LOG(rc);
goto release; goto release;
} }
if (PMIX_SUCCESS != (rc = pmix_job_data_dstore_store(cd->proc.nspace, jobdata))) { if (PMIX_SUCCESS != (rc = pmix_job_data_dstore_store(cd->proc.nspace, jobdata))) {
PMIX_ERROR_LOG(rc); PMIX_ERROR_LOG(rc);
goto release; goto release;
}
} }
#endif #endif

Просмотреть файл

@ -1558,9 +1558,9 @@ static void scadcon(pmix_setup_caddy_t *p)
static void scaddes(pmix_setup_caddy_t *p) static void scaddes(pmix_setup_caddy_t *p)
{ {
} }
PMIX_CLASS_INSTANCE(pmix_setup_caddy_t, PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_setup_caddy_t,
pmix_object_t, pmix_object_t,
scadcon, scaddes); scadcon, scaddes);
static void ncon(pmix_notify_caddy_t *p) static void ncon(pmix_notify_caddy_t *p)
{ {

Просмотреть файл

@ -217,7 +217,7 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer,
void *cbdata); void *cbdata);
void pmix_server_execute_collective(int sd, short args, void *cbdata); void pmix_server_execute_collective(int sd, short args, void *cbdata);
extern pmix_server_module_t pmix_host_server; PMIX_EXPORT extern pmix_server_module_t pmix_host_server;
extern pmix_server_globals_t pmix_server_globals; PMIX_EXPORT extern pmix_server_globals_t pmix_server_globals;
#endif // PMIX_SERVER_OPS_H #endif // PMIX_SERVER_OPS_H

Просмотреть файл

@ -48,7 +48,8 @@ headers += \
util/net.h \ util/net.h \
util/pif.h \ util/pif.h \
util/tsd.h \ util/tsd.h \
util/parse_options.h util/parse_options.h \
util/compress.h
sources += \ sources += \
util/argv.c \ util/argv.c \
@ -69,7 +70,8 @@ sources += \
util/hash.c \ util/hash.c \
util/net.c \ util/net.c \
util/pif.c \ util/pif.c \
util/parse_options.c util/parse_options.c \
util/compress.c
libpmix_la_LIBADD += \ libpmix_la_LIBADD += \
util/keyval/libpmixutilkeyval.la util/keyval/libpmixutilkeyval.la

Просмотреть файл

@ -74,7 +74,7 @@ BEGIN_C_DECLS
* value into the argv array; there is no need to keep the original * value into the argv array; there is no need to keep the original
* string (i.e., the arg parameter) after invoking this function. * string (i.e., the arg parameter) after invoking this function.
*/ */
pmix_status_t pmix_argv_append(int *argc, char ***argv, const char *arg) __pmix_attribute_nonnull__(1) __pmix_attribute_nonnull__(3); PMIX_EXPORT pmix_status_t pmix_argv_append(int *argc, char ***argv, const char *arg) __pmix_attribute_nonnull__(1) __pmix_attribute_nonnull__(3);
/** /**
* Append to an argv-style array, but ignore the size of the array. * Append to an argv-style array, but ignore the size of the array.
@ -91,7 +91,7 @@ pmix_status_t pmix_argv_append(int *argc, char ***argv, const char *arg) __pmix_
* argv-style arrays that do not have integers that are actively * argv-style arrays that do not have integers that are actively
* maintaing their sizes. * maintaing their sizes.
*/ */
pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg); PMIX_EXPORT pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg);
/** /**
* Insert the provided arg at the beginning of the array * Insert the provided arg at the beginning of the array
@ -102,7 +102,7 @@ pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg);
* @retval PMIX_SUCCESS On success * @retval PMIX_SUCCESS On success
* @retval PMIX_ERROR On failure * @retval PMIX_ERROR On failure
*/ */
pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg); PMIX_EXPORT pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg);
/** /**
* Append to an argv-style array, but only if the provided argument * Append to an argv-style array, but only if the provided argument
@ -119,7 +119,7 @@ pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg);
* except that it only appends the provided argument if it does not already * except that it only appends the provided argument if it does not already
* exist in the provided array, or overwrites it if it is. * exist in the provided array, or overwrites it if it is.
*/ */
pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite); PMIX_EXPORT pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite);
/** /**
* Free a NULL-terminated argv array. * Free a NULL-terminated argv array.
@ -134,7 +134,7 @@ pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool
* not safe to invoke this function with a non-NULL-terminated argv * not safe to invoke this function with a non-NULL-terminated argv
* array. * array.
*/ */
void pmix_argv_free(char **argv); PMIX_EXPORT void pmix_argv_free(char **argv);
/** /**
* Split a string into a NULL-terminated argv array. Do not include empty * Split a string into a NULL-terminated argv array. Do not include empty
@ -151,7 +151,7 @@ void pmix_argv_free(char **argv);
* argument (i.e., it can be freed after calling this function * argument (i.e., it can be freed after calling this function
* without invalidating the output argv). * without invalidating the output argv).
*/ */
char **pmix_argv_split(const char *src_string, int delimiter) __pmix_attribute_malloc__ __pmix_attribute_warn_unused_result__; PMIX_EXPORT char **pmix_argv_split(const char *src_string, int delimiter) __pmix_attribute_malloc__ __pmix_attribute_warn_unused_result__;
/** /**
* Split a string into a NULL-terminated argv array. Include empty * Split a string into a NULL-terminated argv array. Include empty
@ -168,7 +168,7 @@ char **pmix_argv_split(const char *src_string, int delimiter) __pmix_attribute_m
* argument (i.e., it can be freed after calling this function * argument (i.e., it can be freed after calling this function
* without invalidating the output argv). * without invalidating the output argv).
*/ */
char **pmix_argv_split_with_empty(const char *src_string, int delimiter) __pmix_attribute_malloc__ __pmix_attribute_warn_unused_result__; PMIX_EXPORT char **pmix_argv_split_with_empty(const char *src_string, int delimiter) __pmix_attribute_malloc__ __pmix_attribute_warn_unused_result__;
/** /**
* Return the length of a NULL-terminated argv array. * Return the length of a NULL-terminated argv array.
@ -180,7 +180,7 @@ char **pmix_argv_split_with_empty(const char *src_string, int delimiter) __pmix_
* *
* The argv array must be NULL-terminated. * The argv array must be NULL-terminated.
*/ */
int pmix_argv_count(char **argv); PMIX_EXPORT int pmix_argv_count(char **argv);
/** /**
* Join all the elements of an argv array into a single * Join all the elements of an argv array into a single
@ -198,9 +198,9 @@ int pmix_argv_count(char **argv);
* *
* It is the callers responsibility to free the returned string. * It is the callers responsibility to free the returned string.
*/ */
char *pmix_argv_join(char **argv, int delimiter) __pmix_attribute_malloc__ __pmix_attribute_warn_unused_result__; PMIX_EXPORT char *pmix_argv_join(char **argv, int delimiter) __pmix_attribute_malloc__ __pmix_attribute_warn_unused_result__;
char *pmix_argv_join_range(char **argv, size_t start, size_t end, int delimiter) __pmix_attribute_malloc__ __pmix_attribute_warn_unused_result__; PMIX_EXPORT char *pmix_argv_join_range(char **argv, size_t start, size_t end, int delimiter) __pmix_attribute_malloc__ __pmix_attribute_warn_unused_result__;
/** /**
* Return the number of bytes consumed by an argv array. * Return the number of bytes consumed by an argv array.
@ -211,7 +211,7 @@ char *pmix_argv_join_range(char **argv, size_t start, size_t end, int delimiter)
* array. This includes the number of bytes used by each of the * array. This includes the number of bytes used by each of the
* strings as well as the pointers used in the argv array. * strings as well as the pointers used in the argv array.
*/ */
size_t pmix_argv_len(char **argv); PMIX_EXPORT size_t pmix_argv_len(char **argv);
/** /**
* Copy a NULL-terminated argv array. * Copy a NULL-terminated argv array.
@ -225,7 +225,7 @@ size_t pmix_argv_len(char **argv);
* Specifically, the output argv will be an array of the same length * Specifically, the output argv will be an array of the same length
* as the input argv, and strcmp(argv_in[i], argv_out[i]) will be 0. * as the input argv, and strcmp(argv_in[i], argv_out[i]) will be 0.
*/ */
char **pmix_argv_copy(char **argv) __pmix_attribute_malloc__ __pmix_attribute_warn_unused_result__; PMIX_EXPORT char **pmix_argv_copy(char **argv) __pmix_attribute_malloc__ __pmix_attribute_warn_unused_result__;
/** /**
* Delete one or more tokens from the middle of an argv. * Delete one or more tokens from the middle of an argv.
@ -252,7 +252,7 @@ char **pmix_argv_copy(char **argv) __pmix_attribute_malloc__ __pmix_attribute_wa
* free()ed (it is assumed that the argv "owns" the memory that * free()ed (it is assumed that the argv "owns" the memory that
* the pointer points to). * the pointer points to).
*/ */
pmix_status_t pmix_argv_delete(int *argc, char ***argv, PMIX_EXPORT pmix_status_t pmix_argv_delete(int *argc, char ***argv,
int start, int num_to_delete); int start, int num_to_delete);
/** /**
@ -276,7 +276,7 @@ pmix_status_t pmix_argv_delete(int *argc, char ***argv,
* source points to are strdup'ed into the new locations in * source points to are strdup'ed into the new locations in
* target). * target).
*/ */
pmix_status_t pmix_argv_insert(char ***target, int start, char **source); PMIX_EXPORT pmix_status_t pmix_argv_insert(char ***target, int start, char **source);
/** /**
* Insert one argv element in front of a specific position in an array * Insert one argv element in front of a specific position in an array
@ -299,7 +299,7 @@ pmix_status_t pmix_argv_insert(char ***target, int start, char **source);
* source points to is strdup'ed into the new location in * source points to is strdup'ed into the new location in
* target). * target).
*/ */
pmix_status_t pmix_argv_insert_element(char ***target, int location, char *source); PMIX_EXPORT pmix_status_t pmix_argv_insert_element(char ***target, int location, char *source);
END_C_DECLS END_C_DECLS

147
opal/mca/pmix/pmix2x/pmix/src/util/compress.c Обычный файл
Просмотреть файл

@ -0,0 +1,147 @@
/*
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <stdlib.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
#include "src/include/pmix_globals.h"
#include "src/util/compress.h"
#ifdef HAVE_ZLIB_H
bool pmix_util_compress_string(char *instring,
uint8_t **outbytes,
size_t *nbytes)
{
z_stream strm;
size_t len, outlen;
uint8_t *tmp, *ptr;
uint32_t inlen;
/* set default output */
*outbytes = NULL;
/* setup the stream */
inlen = strlen(instring);
memset (&strm, 0, sizeof (strm));
deflateInit (&strm, 9);
/* get an upper bound on the required output storage */
len = deflateBound(&strm, inlen);
if (NULL == (tmp = (uint8_t*)malloc(len))) {
*outbytes = NULL;
return false;
}
strm.next_in = (uint8_t*)instring;
strm.avail_in = strlen(instring);
/* allocating the upper bound guarantees zlib will
* always successfully compress into the available space */
strm.avail_out = len;
strm.next_out = tmp;
deflate (&strm, Z_FINISH);
deflateEnd (&strm);
/* allocate 4 bytes beyond the size reqd by zlib so we
* can pass the size of the uncompressed string to the
* decompress side */
outlen = len - strm.avail_out + sizeof(uint32_t);
ptr = (uint8_t*)malloc(outlen);
if (NULL == ptr) {
free(tmp);
return false;
}
*outbytes = ptr;
*nbytes = outlen;
/* fold the uncompressed length into the buffer */
memcpy(ptr, &inlen, sizeof(uint32_t));
ptr += sizeof(uint32_t);
/* bring over the compressed data */
memcpy(ptr, tmp, outlen-sizeof(uint32_t));
free(tmp);
pmix_output_verbose(10, pmix_globals.debug_output,
"JOBDATA COMPRESS INPUT STRING OF LEN %d OUTPUT SIZE %lu",
inlen, outlen-sizeof(uint32_t));
return true; // we did the compression
}
#else
bool pmix_util_compress_string(char *instring,
uint8_t **outbytes,
size_t *nbytes)
{
return false; // we did not compress
}
#endif
#if PMIX_HAVE_ZLIB
void pmix_util_uncompress_string(char **outstring,
uint8_t *inbytes, size_t len)
{
uint8_t *dest;
int32_t len2;
z_stream strm;
int rc;
/* set the default error answer */
*outstring = NULL;
/* the first 4 bytes contains the uncompressed size */
memcpy(&len2, inbytes, sizeof(uint32_t));
pmix_output_verbose(10, pmix_globals.debug_output,
"DECOMPRESSING INPUT OF LEN %lu OUTPUT %d", len, len2);
/* setting destination to the fully decompressed size, +1 to
* hold the NULL terminator */
dest = (uint8_t*)malloc(len2+1);
if (NULL == dest) {
return;
}
memset(dest, 0, len2+1);
memset (&strm, 0, sizeof (strm));
if (Z_OK != inflateInit(&strm)) {
free(dest);
return;
}
strm.avail_in = len;
strm.next_in = (uint8_t*)(inbytes + sizeof(uint32_t));
strm.avail_out = len2;
strm.next_out = (uint8_t*)dest;
rc = inflate (&strm, Z_FINISH);
inflateEnd (&strm);
/* ensure this is NULL terminated! */
dest[len2] = '\0';
*outstring = (char*)dest;
pmix_output_verbose(10, pmix_globals.debug_output,
"\tFINAL LEN: %lu CODE: %d", strlen(*outstring), rc);
return;
}
#else
/* this can never actually be used - there is no way we should
* receive a PMIX_COMPRESSED_STRING unless we compressed it,
* which means PMIX_HAVE_ZLIB must have been true. Still, we
* include the stub just to avoid requiring #if's in the rest
* of the code */
void pmix_util_uncompress_string(char **outstring,
uint8_t *inbytes, size_t len)
{
*outstring = NULL;
}
#endif

Просмотреть файл

@ -0,0 +1,57 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Compress/decompress long strings
*/
#ifndef PMIX_COMPRESS_H
#define PMIX_COMPRESS_H
#include <src/include/pmix_config.h>
BEGIN_C_DECLS
/* define a limit for storing raw strings */
#define PMIX_STRING_LIMIT 512
/* define a macro for quickly checking if a string exceeds the
* compression limit */
#define PMIX_STRING_SIZE_CHECK(s) \
(PMIX_STRING == (s)->type && NULL != (s)->data.string && PMIX_STRING_LIMIT < strlen((s)->data.string))
/**
* Compress a string into a byte object using Zlib
*/
PMIX_EXPORT bool pmix_util_compress_string(char *instring,
uint8_t **outbytes,
size_t *nbytes);
/**
* Decompress a byte object into a string using Zlib
*/
PMIX_EXPORT void pmix_util_uncompress_string(char **outstring,
uint8_t *inbytes, size_t len);
END_C_DECLS
#endif /* PMIX_COMPRESS_H */

Просмотреть файл

@ -36,7 +36,7 @@ BEGIN_C_DECLS
* Loop over reading from the fd until len bytes are read or an error * Loop over reading from the fd until len bytes are read or an error
* occurs. EAGAIN and EINTR are transparently handled. * occurs. EAGAIN and EINTR are transparently handled.
*/ */
pmix_status_t pmix_fd_read(int fd, int len, void *buffer); PMIX_EXPORT pmix_status_t pmix_fd_read(int fd, int len, void *buffer);
/** /**
* Write a complete buffer to a file descriptor. * Write a complete buffer to a file descriptor.
@ -51,7 +51,7 @@ pmix_status_t pmix_fd_read(int fd, int len, void *buffer);
* Loop over writing to the fd until len bytes are written or an error * Loop over writing to the fd until len bytes are written or an error
* occurs. EAGAIN and EINTR are transparently handled. * occurs. EAGAIN and EINTR are transparently handled.
*/ */
pmix_status_t pmix_fd_write(int fd, int len, const void *buffer); PMIX_EXPORT pmix_status_t pmix_fd_write(int fd, int len, const void *buffer);
/** /**
* Convenience function to set a file descriptor to be close-on-exec. * Convenience function to set a file descriptor to be close-on-exec.
@ -65,7 +65,7 @@ pmix_status_t pmix_fd_write(int fd, int len, const void *buffer);
* This is simply a convenience function because there's a few steps * This is simply a convenience function because there's a few steps
* to setting a file descriptor to be close-on-exec. * to setting a file descriptor to be close-on-exec.
*/ */
pmix_status_t pmix_fd_set_cloexec(int fd); PMIX_EXPORT pmix_status_t pmix_fd_set_cloexec(int fd);
END_C_DECLS END_C_DECLS

Просмотреть файл

@ -65,7 +65,7 @@ BEGIN_C_DECLS
* appropriate to the local operating system. The path_name string has been malloc'd * appropriate to the local operating system. The path_name string has been malloc'd
* and therefore the user is responsible for free'ing the field. * and therefore the user is responsible for free'ing the field.
*/ */
char *pmix_os_path(bool relative, ...) __pmix_attribute_malloc__ __pmix_attribute_sentinel__ __pmix_attribute_warn_unused_result__; PMIX_EXPORT char *pmix_os_path(bool relative, ...) __pmix_attribute_malloc__ __pmix_attribute_sentinel__ __pmix_attribute_warn_unused_result__;
/** /**
* Convert the path to be OS friendly. On UNIX this function will * Convert the path to be OS friendly. On UNIX this function will

Просмотреть файл

@ -131,7 +131,7 @@ int pmix_show_help_finalize(void);
*/ */
typedef int (*pmix_show_help_fn_t)(const char *filename, const char *topic, typedef int (*pmix_show_help_fn_t)(const char *filename, const char *topic,
bool want_error_header, ...); bool want_error_header, ...);
extern pmix_show_help_fn_t pmix_show_help; PMIX_EXPORT extern pmix_show_help_fn_t pmix_show_help;
/** /**
* This function does the same thing as pmix_show_help(), but accepts * This function does the same thing as pmix_show_help(), but accepts
@ -139,23 +139,23 @@ extern pmix_show_help_fn_t pmix_show_help;
*/ */
typedef int (*pmix_show_vhelp_fn_t)(const char *filename, const char *topic, typedef int (*pmix_show_vhelp_fn_t)(const char *filename, const char *topic,
bool want_error_header, va_list ap); bool want_error_header, va_list ap);
extern pmix_show_vhelp_fn_t pmix_show_vhelp; PMIX_EXPORT extern pmix_show_vhelp_fn_t pmix_show_vhelp;
/** /**
* This function does the same thing as pmix_show_help(), but returns * This function does the same thing as pmix_show_help(), but returns
* its output in a string (that must be freed by the caller). * its output in a string (that must be freed by the caller).
*/ */
char* pmix_show_help_string(const char *filename, PMIX_EXPORT char* pmix_show_help_string(const char *filename,
const char *topic, const char *topic,
bool want_error_header, ...); bool want_error_header, ...);
/** /**
* This function does the same thing as pmix_show_help_string(), but * This function does the same thing as pmix_show_help_string(), but
* accepts a va_list form of varargs. * accepts a va_list form of varargs.
*/ */
char* pmix_show_help_vstring(const char *filename, PMIX_EXPORT char* pmix_show_help_vstring(const char *filename,
const char *topic, const char *topic,
bool want_error_header, va_list ap); bool want_error_header, va_list ap);
/** /**
* This function adds another search location for the files that * This function adds another search location for the files that

Просмотреть файл

@ -147,9 +147,12 @@ int pmix2x_server_init(opal_pmix_server_module_t *module,
/* as we might want to use some client-side functions, be sure /* as we might want to use some client-side functions, be sure
* to register our own nspace */ * to register our own nspace */
PMIX_INFO_CREATE(pinfo, 1);
PMIX_INFO_LOAD(&pinfo[0], PMIX_REGISTER_NODATA, NULL, PMIX_BOOL);
active = true; active = true;
PMIx_server_register_nspace(job->nspace, 1, NULL, 0, op2cbfunc, (void*)&active); PMIx_server_register_nspace(job->nspace, 1, pinfo, 1, op2cbfunc, (void*)&active);
PMIX_WAIT_FOR_COMPLETION(active); PMIX_WAIT_FOR_COMPLETION(active);
PMIX_INFO_FREE(pinfo, 1);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }

Просмотреть файл

@ -907,7 +907,7 @@ static void tcon(orte_topology_t *t)
static void tdes(orte_topology_t *t) static void tdes(orte_topology_t *t)
{ {
if (NULL != t->topo) { if (NULL != t->topo) {
hwloc_topology_destroy(t->topo); opal_hwloc_base_free_topology(t->topo);
} }
if (NULL != t->sig) { if (NULL != t->sig) {
free(t->sig); free(t->sig);