1
1

Merge pull request #3787 from rhc54/topic/pmix210

Update to cross-version for PMIx
Этот коммит содержится в:
Ralph Castain 2017-07-20 14:22:49 -05:00 коммит произвёл GitHub
родитель 566c3263cd 7d8d877837
Коммит 4d4dec60b4
317 изменённых файлов: 18068 добавлений и 11960 удалений

6
.gitignore поставляемый
Просмотреть файл

@ -302,7 +302,11 @@ opal/mca/event/libevent*/libevent/libevent_pthreads.pc
opal/mca/event/libevent*/libevent/include/event2/event-config.h
opal/mca/hwloc/hwloc*/hwloc/include/hwloc/autogen/config.h
opal/mca/hwloc/hwloc*/hwloc/include/hwloc/autogen/config.h.in
opal/mca/hwloc/hwloc*/hwloc/include/private/autogen/config.h
opal/mca/hwloc/hwloc*/hwloc/include/private/autogen/config.h.in
opal/mca/hwloc/base/static-components.h.new.extern
opal/mca/hwloc/base/static-components.h.new.struct
opal/mca/installdirs/config/install_dirs.h
@ -310,8 +314,6 @@ opal/mca/pmix/pmix*/pmix/include/pmix/autogen/config.h
opal/mca/pmix/pmix*/pmix/include/pmix/autogen/config.h.in
opal/mca/pmix/pmix*/pmix/src/include/private/autogen/config.h.in
opal/mca/pmix/pmix*/pmix/src/include/private/autogen/config.h
opal/mca/hwloc/base/static-components.h.new.extern
opal/mca/hwloc/base/static-components.h.new.struct
opal/mca/pmix/pmix2x/pmix/src/include/frameworks.h
opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/config/pinstall_dirs.h
opal/mca/pmix/pmix2x/pmix/config/autogen_found_items.m4

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

@ -1,728 +0,0 @@
/* include/private/autogen/config.h.in. Generated from configure.ac by autoheader. */
/* -*- c -*-
*
* Copyright © 2009, 2011, 2012 CNRS, inria., Université Bordeaux All rights reserved.
* Copyright © 2009-2014 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is automatically generated by configure. Edits will be lost
* the next time you run configure!
*/
#ifndef HWLOC_CONFIGURE_H
#define HWLOC_CONFIGURE_H
/* Define to 1 if the system has the type `CACHE_DESCRIPTOR'. */
#undef HAVE_CACHE_DESCRIPTOR
/* Define to 1 if the system has the type `CACHE_RELATIONSHIP'. */
#undef HAVE_CACHE_RELATIONSHIP
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define to 1 if you have the `clz' function. */
#undef HAVE_CLZ
/* Define to 1 if you have the `clzl' function. */
#undef HAVE_CLZL
/* Define to 1 if you have the <CL/cl_ext.h> header file. */
#undef HAVE_CL_CL_EXT_H
/* Define to 1 if you have the `cpuset_setaffinity' function. */
#undef HAVE_CPUSET_SETAFFINITY
/* Define to 1 if you have the `cpuset_setid' function. */
#undef HAVE_CPUSET_SETID
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define to 1 if we have -lcuda */
#undef HAVE_CUDA
/* Define to 1 if you have the <cuda.h> header file. */
#undef HAVE_CUDA_H
/* Define to 1 if you have the <cuda_runtime_api.h> header file. */
#undef HAVE_CUDA_RUNTIME_API_H
/* Define to 1 if you have the declaration of `CL_DEVICE_TOPOLOGY_AMD', and to
0 if you don't. */
#undef HAVE_DECL_CL_DEVICE_TOPOLOGY_AMD
/* Define to 1 if you have the declaration of `CTL_HW', and to 0 if you don't.
*/
#undef HAVE_DECL_CTL_HW
/* Define to 1 if you have the declaration of `fabsf', and to 0 if you don't.
*/
#undef HAVE_DECL_FABSF
/* Define to 1 if you have the declaration of `getexecname', and to 0 if you
don't. */
#undef HAVE_DECL_GETEXECNAME
/* Define to 1 if you have the declaration of `GetModuleFileName', and to 0 if
you don't. */
#undef HAVE_DECL_GETMODULEFILENAME
/* Define to 1 if you have the declaration of `getprogname', and to 0 if you
don't. */
#undef HAVE_DECL_GETPROGNAME
/* Define to 1 if you have the declaration of `HW_NCPU', and to 0 if you
don't. */
#undef HAVE_DECL_HW_NCPU
/* Define to 1 if you have the declaration of `lgrp_latency_cookie', and to 0
if you don't. */
#undef HAVE_DECL_LGRP_LATENCY_COOKIE
/* Define to 1 if you have the declaration of
`nvmlDeviceGetMaxPcieLinkGeneration', and to 0 if you don't. */
#undef HAVE_DECL_NVMLDEVICEGETMAXPCIELINKGENERATION
/* Define to 1 if you have the declaration of `pthread_getaffinity_np', and to
0 if you don't. */
#undef HAVE_DECL_PTHREAD_GETAFFINITY_NP
/* Define to 1 if you have the declaration of `pthread_setaffinity_np', and to
0 if you don't. */
#undef HAVE_DECL_PTHREAD_SETAFFINITY_NP
/* Embedded mode; just assume we do not have Valgrind support */
#undef HAVE_DECL_RUNNING_ON_VALGRIND
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
don't. */
#undef HAVE_DECL_SNPRINTF
/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you
don't. */
#undef HAVE_DECL_STRCASECMP
/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
don't. */
#undef HAVE_DECL_STRTOULL
/* Define to 1 if you have the declaration of `_putenv', and to 0 if you
don't. */
#undef HAVE_DECL__PUTENV
/* Define to 1 if you have the declaration of `_SC_LARGE_PAGESIZE', and to 0
if you don't. */
#undef HAVE_DECL__SC_LARGE_PAGESIZE
/* Define to 1 if you have the declaration of `_SC_NPROCESSORS_CONF', and to 0
if you don't. */
#undef HAVE_DECL__SC_NPROCESSORS_CONF
/* Define to 1 if you have the declaration of `_SC_NPROCESSORS_ONLN', and to 0
if you don't. */
#undef HAVE_DECL__SC_NPROCESSORS_ONLN
/* Define to 1 if you have the declaration of `_SC_NPROC_CONF', and to 0 if
you don't. */
#undef HAVE_DECL__SC_NPROC_CONF
/* Define to 1 if you have the declaration of `_SC_NPROC_ONLN', and to 0 if
you don't. */
#undef HAVE_DECL__SC_NPROC_ONLN
/* Define to 1 if you have the declaration of `_SC_PAGESIZE', and to 0 if you
don't. */
#undef HAVE_DECL__SC_PAGESIZE
/* Define to 1 if you have the declaration of `_SC_PAGE_SIZE', and to 0 if you
don't. */
#undef HAVE_DECL__SC_PAGE_SIZE
/* Define to 1 if you have the declaration of `_strdup', and to 0 if you
don't. */
#undef HAVE_DECL__STRDUP
/* Define to 1 if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `ffs' function. */
#undef HAVE_FFS
/* Define to 1 if you have the `ffsl' function. */
#undef HAVE_FFSL
/* Define to 1 if you have the `fls' function. */
#undef HAVE_FLS
/* Define to 1 if you have the `flsl' function. */
#undef HAVE_FLSL
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
/* Define to 1 if the system has the type `GROUP_AFFINITY'. */
#undef HAVE_GROUP_AFFINITY
/* Define to 1 if the system has the type `GROUP_RELATIONSHIP'. */
#undef HAVE_GROUP_RELATIONSHIP
/* Define to 1 if you have the `host_info' function. */
#undef HAVE_HOST_INFO
/* Define to 1 if you have the <infiniband/verbs.h> header file. */
#undef HAVE_INFINIBAND_VERBS_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if the system has the type `KAFFINITY'. */
#undef HAVE_KAFFINITY
/* Define to 1 if you have the <kstat.h> header file. */
#undef HAVE_KSTAT_H
/* Define to 1 if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H
/* Define to 1 if we have -lgdi32 */
#undef HAVE_LIBGDI32
/* Define to 1 if we have -libverbs */
#undef HAVE_LIBIBVERBS
/* Define to 1 if we have -lkstat */
#undef HAVE_LIBKSTAT
/* Define to 1 if we have -llgrp */
#undef HAVE_LIBLGRP
/* Define to 1 if you have the <libudev.h> header file. */
#undef HAVE_LIBUDEV_H
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if the system has the type `LOGICAL_PROCESSOR_RELATIONSHIP'. */
#undef HAVE_LOGICAL_PROCESSOR_RELATIONSHIP
/* Define to 1 if you have the <mach/mach_host.h> header file. */
#undef HAVE_MACH_MACH_HOST_H
/* Define to 1 if you have the <mach/mach_init.h> header file. */
#undef HAVE_MACH_MACH_INIT_H
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the `memalign' function. */
#undef HAVE_MEMALIGN
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <mpi.h> header file. */
#undef HAVE_MPI_H
/* Define to 1 if we have -lmyriexpress */
#undef HAVE_MYRIEXPRESS
/* Define to 1 if you have the <myriexpress.h> header file. */
#undef HAVE_MYRIEXPRESS_H
/* Define to 1 if you have the `nl_langinfo' function. */
#undef HAVE_NL_LANGINFO
/* Define to 1 if the system has the type `NUMA_NODE_RELATIONSHIP'. */
#undef HAVE_NUMA_NODE_RELATIONSHIP
/* Define to 1 if you have the <NVCtrl/NVCtrl.h> header file. */
#undef HAVE_NVCTRL_NVCTRL_H
/* Define to 1 if you have the <nvml.h> header file. */
#undef HAVE_NVML_H
/* Define to 1 if you have the `openat' function. */
#undef HAVE_OPENAT
/* Define to 1 if you have the <picl.h> header file. */
#undef HAVE_PICL_H
/* Define to 1 if you have the `posix_memalign' function. */
#undef HAVE_POSIX_MEMALIGN
/* Define to 1 if the system has the type `PROCESSOR_CACHE_TYPE'. */
#undef HAVE_PROCESSOR_CACHE_TYPE
/* Define to 1 if the system has the type `PROCESSOR_GROUP_INFO'. */
#undef HAVE_PROCESSOR_GROUP_INFO
/* Define to 1 if the system has the type `PROCESSOR_NUMBER'. */
#undef HAVE_PROCESSOR_NUMBER
/* Define to 1 if the system has the type `PROCESSOR_RELATIONSHIP'. */
#undef HAVE_PROCESSOR_RELATIONSHIP
/* Define to '1' if program_invocation_name is present and usable */
#undef HAVE_PROGRAM_INVOCATION_NAME
/* Define to 1 if the system has the type `PSAPI_WORKING_SET_EX_BLOCK'. */
#undef HAVE_PSAPI_WORKING_SET_EX_BLOCK
/* Define to 1 if the system has the type `PSAPI_WORKING_SET_EX_INFORMATION'.
*/
#undef HAVE_PSAPI_WORKING_SET_EX_INFORMATION
/* Define to 1 if you have the <pthread_np.h> header file. */
#undef HAVE_PTHREAD_NP_H
/* Define to 1 if the system has the type `pthread_t'. */
#undef HAVE_PTHREAD_T
/* Define to 1 if you have the `putwc' function. */
#undef HAVE_PUTWC
/* Define to 1 if the system has the type `RelationProcessorPackage'. */
#undef HAVE_RELATIONPROCESSORPACKAGE
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to 1 if the system has the type `ssize_t'. */
#undef HAVE_SSIZE_T
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strftime' function. */
#undef HAVE_STRFTIME
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strncasecmp' function. */
#undef HAVE_STRNCASECMP
/* Define to 1 if you have the `strtoull' function. */
#undef HAVE_STRTOULL
/* Define to '1' if sysctl is present and usable */
#undef HAVE_SYSCTL
/* Define to '1' if sysctlbyname is present and usable */
#undef HAVE_SYSCTLBYNAME
/* Define to 1 if the system has the type
`SYSTEM_LOGICAL_PROCESSOR_INFORMATION'. */
#undef HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION
/* Define to 1 if the system has the type
`SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX'. */
#undef HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
/* Define to 1 if you have the <sys/cpuset.h> header file. */
#undef HAVE_SYS_CPUSET_H
/* Define to 1 if you have the <sys/lgrp_user.h> header file. */
#undef HAVE_SYS_LGRP_USER_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef HAVE_SYS_SYSCTL_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/utsname.h> header file. */
#undef HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the `uname' function. */
#undef HAVE_UNAME
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `uselocale' function. */
#undef HAVE_USELOCALE
/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
#undef HAVE_VALGRIND_VALGRIND_H
/* Define to 1 if the system has the type `wchar_t'. */
#undef HAVE_WCHAR_T
/* Define to 1 if you have the <X11/keysym.h> header file. */
#undef HAVE_X11_KEYSYM_H
/* Define to 1 if you have the <X11/Xlib.h> header file. */
#undef HAVE_X11_XLIB_H
/* Define to 1 if you have the <X11/Xutil.h> header file. */
#undef HAVE_X11_XUTIL_H
/* Define to 1 if you have the <xlocale.h> header file. */
#undef HAVE_XLOCALE_H
/* Define to '1' if __progname is present and usable */
#undef HAVE___PROGNAME
/* Define to 1 on AIX */
#undef HWLOC_AIX_SYS
/* Define to 1 on BlueGene/Q */
#undef HWLOC_BGQ_SYS
/* Whether C compiler supports symbol visibility or not */
#undef HWLOC_C_HAVE_VISIBILITY
/* Define to 1 on Darwin */
#undef HWLOC_DARWIN_SYS
/* Whether we are in debugging mode or not */
#undef HWLOC_DEBUG
/* Define to 1 on *FREEBSD */
#undef HWLOC_FREEBSD_SYS
/* Whether your compiler has __attribute__ or not */
#undef HWLOC_HAVE_ATTRIBUTE
/* Whether your compiler has __attribute__ aligned or not */
#undef HWLOC_HAVE_ATTRIBUTE_ALIGNED
/* Whether your compiler has __attribute__ always_inline or not */
#undef HWLOC_HAVE_ATTRIBUTE_ALWAYS_INLINE
/* Whether your compiler has __attribute__ cold or not */
#undef HWLOC_HAVE_ATTRIBUTE_COLD
/* Whether your compiler has __attribute__ const or not */
#undef HWLOC_HAVE_ATTRIBUTE_CONST
/* Whether your compiler has __attribute__ deprecated or not */
#undef HWLOC_HAVE_ATTRIBUTE_DEPRECATED
/* Whether your compiler has __attribute__ format or not */
#undef HWLOC_HAVE_ATTRIBUTE_FORMAT
/* Whether your compiler has __attribute__ hot or not */
#undef HWLOC_HAVE_ATTRIBUTE_HOT
/* Whether your compiler has __attribute__ malloc or not */
#undef HWLOC_HAVE_ATTRIBUTE_MALLOC
/* Whether your compiler has __attribute__ may_alias or not */
#undef HWLOC_HAVE_ATTRIBUTE_MAY_ALIAS
/* Whether your compiler has __attribute__ nonnull or not */
#undef HWLOC_HAVE_ATTRIBUTE_NONNULL
/* Whether your compiler has __attribute__ noreturn or not */
#undef HWLOC_HAVE_ATTRIBUTE_NORETURN
/* Whether your compiler has __attribute__ no_instrument_function or not */
#undef HWLOC_HAVE_ATTRIBUTE_NO_INSTRUMENT_FUNCTION
/* Whether your compiler has __attribute__ packed or not */
#undef HWLOC_HAVE_ATTRIBUTE_PACKED
/* Whether your compiler has __attribute__ pure or not */
#undef HWLOC_HAVE_ATTRIBUTE_PURE
/* Whether your compiler has __attribute__ sentinel or not */
#undef HWLOC_HAVE_ATTRIBUTE_SENTINEL
/* Whether your compiler has __attribute__ unused or not */
#undef HWLOC_HAVE_ATTRIBUTE_UNUSED
/* Whether your compiler has __attribute__ warn unused result or not */
#undef HWLOC_HAVE_ATTRIBUTE_WARN_UNUSED_RESULT
/* Whether your compiler has __attribute__ weak alias or not */
#undef HWLOC_HAVE_ATTRIBUTE_WEAK_ALIAS
/* Define to 1 if your `ffs' function is known to be broken. */
#undef HWLOC_HAVE_BROKEN_FFS
/* Define to 1 if you have the `cairo' library. */
#undef HWLOC_HAVE_CAIRO
/* Define to 1 if you have the `clz' function. */
#undef HWLOC_HAVE_CLZ
/* Define to 1 if you have the `clzl' function. */
#undef HWLOC_HAVE_CLZL
/* Define to 1 if the CPU_SET macro works */
#undef HWLOC_HAVE_CPU_SET
/* Define to 1 if the CPU_SET_S macro works */
#undef HWLOC_HAVE_CPU_SET_S
/* Define to 1 if you have the `cudart' SDK. */
#undef HWLOC_HAVE_CUDART
/* Define to 1 if function `clz' is declared by system headers */
#undef HWLOC_HAVE_DECL_CLZ
/* Define to 1 if function `clzl' is declared by system headers */
#undef HWLOC_HAVE_DECL_CLZL
/* Define to 1 if function `ffs' is declared by system headers */
#undef HWLOC_HAVE_DECL_FFS
/* Define to 1 if function `ffsl' is declared by system headers */
#undef HWLOC_HAVE_DECL_FFSL
/* Define to 1 if function `fls' is declared by system headers */
#undef HWLOC_HAVE_DECL_FLS
/* Define to 1 if function `flsl' is declared by system headers */
#undef HWLOC_HAVE_DECL_FLSL
/* Define to 1 if function `strncasecmp' is declared by system headers */
#undef HWLOC_HAVE_DECL_STRNCASECMP
/* Define to 1 if you have the `ffs' function. */
#undef HWLOC_HAVE_FFS
/* Define to 1 if you have the `ffsl' function. */
#undef HWLOC_HAVE_FFSL
/* Define to 1 if you have the `fls' function. */
#undef HWLOC_HAVE_FLS
/* Define to 1 if you have the `flsl' function. */
#undef HWLOC_HAVE_FLSL
/* Define to 1 if you have the GL module components. */
#undef HWLOC_HAVE_GL
/* Define to 1 if you have a library providing the termcap interface */
#undef HWLOC_HAVE_LIBTERMCAP
/* Define to 1 if you have libudev. */
#undef HWLOC_HAVE_LIBUDEV
/* Define to 1 if you have the `libxml2' library. */
#undef HWLOC_HAVE_LIBXML2
/* Define to 1 if building the Linux I/O component */
#undef HWLOC_HAVE_LINUXIO
/* Define to 1 if enabling Linux-specific PCI discovery in the Linux I/O
component */
#undef HWLOC_HAVE_LINUXPCI
/* Define to 1 if you have the `NVML' library. */
#undef HWLOC_HAVE_NVML
/* Define to 1 if glibc provides the old prototype (without length) of
sched_setaffinity() */
#undef HWLOC_HAVE_OLD_SCHED_SETAFFINITY
/* Define to 1 if you have the `OpenCL' library. */
#undef HWLOC_HAVE_OPENCL
/* Define to 1 if the hwloc library should support dynamically-loaded plugins
*/
#undef HWLOC_HAVE_PLUGINS
/* `Define to 1 if you have pthread_getthrds_np' */
#undef HWLOC_HAVE_PTHREAD_GETTHRDS_NP
/* Define to 1 if pthread mutexes are available */
#undef HWLOC_HAVE_PTHREAD_MUTEX
/* Define to 1 if glibc provides a prototype of sched_setaffinity() */
#undef HWLOC_HAVE_SCHED_SETAFFINITY
/* Define to 1 if you have the <stdint.h> header file. */
#undef HWLOC_HAVE_STDINT_H
/* Define to 1 if function `syscall' is available with 6 parameters */
#undef HWLOC_HAVE_SYSCALL
/* Define to 1 if you have the `windows.h' header. */
#undef HWLOC_HAVE_WINDOWS_H
/* Define to 1 if X11 headers including Xutil.h and keysym.h are available. */
#undef HWLOC_HAVE_X11_KEYSYM
/* Define to 1 if you have x86 cpuid */
#undef HWLOC_HAVE_X86_CPUID
/* Define to 1 on HP-UX */
#undef HWLOC_HPUX_SYS
/* Define to 1 on Irix */
#undef HWLOC_IRIX_SYS
/* Define to 1 on Linux */
#undef HWLOC_LINUX_SYS
/* Define to 1 on *NETBSD */
#undef HWLOC_NETBSD_SYS
/* The size of `unsigned int', as computed by sizeof */
#undef HWLOC_SIZEOF_UNSIGNED_INT
/* The size of `unsigned long', as computed by sizeof */
#undef HWLOC_SIZEOF_UNSIGNED_LONG
/* Define to 1 on Solaris */
#undef HWLOC_SOLARIS_SYS
/* The hwloc symbol prefix */
#undef HWLOC_SYM_PREFIX
/* The hwloc symbol prefix in all caps */
#undef HWLOC_SYM_PREFIX_CAPS
/* Whether we need to re-define all the hwloc public symbols or not */
#undef HWLOC_SYM_TRANSFORM
/* Define to 1 on unsupported systems */
#undef HWLOC_UNSUPPORTED_SYS
/* Define to 1 if ncurses works, preferred over curses */
#undef HWLOC_USE_NCURSES
/* The library version, always available, even in embedded mode, contrary to
VERSION */
#undef HWLOC_VERSION
/* Define to 1 on WINDOWS */
#undef HWLOC_WIN_SYS
/* Define to 1 on x86_32 */
#undef HWLOC_X86_32_ARCH
/* Define to 1 on x86_64 */
#undef HWLOC_X86_64_ARCH
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to 1 if scotch is netlocscotch is enabled */
#undef NETLOC_SCOTCH
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `unsigned int', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_INT
/* The size of `unsigned long', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Enable extensions on HP-UX. */
#ifndef _HPUX_SOURCE
# undef _HPUX_SOURCE
#endif
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Version number of package */
#undef VERSION
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Are we building for HP-UX? */
#undef _HPUX_SOURCE
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define this to the process ID type */
#undef hwloc_pid_t
/* Define this to the thread ID type */
#undef hwloc_thread_t
#endif /* HWLOC_CONFIGURE_H */

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

@ -4,7 +4,7 @@ PMIx Authors
The following cumulative list contains the names and GitHub IDs of
all individuals who have committed code to the PMIx repository.
Email Name Affiliation(s)
GitHub ID Name Affiliation(s)
------------------------------- --------------------------- -------------------
alinask Elena Shipunova Mellanox
annu13 Annapurna Dasari Intel

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

@ -21,10 +21,10 @@ For More Information
====================
This file is a *very* short overview of building and installing
the PMIx library. Much more information is available on the
PMIx web site (e.g., see the FAQ section):
the PMIx library. Much more information is available in the
FAQ section on the PMIx web site:
http://pmix.github.io/pmix/pmix
http://pmix.github.io/pmix/faq
Developer Builds

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

@ -15,7 +15,7 @@ Copyright (c) 2007 Myricom, Inc. All rights reserved.
Copyright (c) 2008 IBM Corporation. All rights reserved.
Copyright (c) 2010 Oak Ridge National Labs. All rights reserved.
Copyright (c) 2011 University of Houston. All rights reserved.
Copyright (c) 2013-2015 Intel, Inc. All rights reserved
Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
@ -28,7 +28,7 @@ When submitting questions and problems, be sure to include as much
extra information as possible. This web page details all the
information that we request in order to provide assistance:
http://pmix.github.io/master/community/help/
http://pmix.github.io/pmix/community/help/
The best way to report bugs, send comments, or ask questions is to
sign up on the PMIx mailing list, which is hosted by GoogleGroups:
@ -48,7 +48,7 @@ Thanks for your time.
More information is available in the PMIx FAQ:
http://pmix.github.io/master/faq/
http://pmix.github.io/pmix/faq/
We are in early days, so please be patient - info will grow as questions
are addressed.
@ -63,7 +63,7 @@ General notes
- The majority of PMIx's documentation is here in this file, the
included man pages, and on the web site FAQ
(http://pmix.github.io/master/faq). This will eventually be
(http://pmix.github.io/pmix/faq). This will eventually be
supplemented with cohesive installation and user documentation files.
- Systems that have been tested are:
@ -286,7 +286,7 @@ Common Questions
Many common questions about building and using PMIx are answered
on the FAQ:
http://pmix.github.io/master/faq/
http://pmix.github.io/pmix/faq/
===========================================================================
@ -300,7 +300,7 @@ When submitting questions and problems, be sure to include as much
extra information as possible. This web page details all the
information that we request in order to provide assistance:
http://pmix.github.io/master/community/help/
http://pmix.github.io/pmix/community/help/
Questions and comments should generally be sent to the PMIx mailing
list (pmix@googlegroups.com). Because of spam, only

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

@ -13,8 +13,8 @@
# major, minor, and release are generally combined in the form
# <major>.<minor>.<release>.
major=3
minor=0
major=2
minor=1
release=0
# greek is used for alpha or beta release tags. If it is non-empty,
@ -30,7 +30,7 @@ greek=
# command, or with the date (if "git describe" fails) in the form of
# "date<date>".
repo_rev=gitaa26b56
repo_rev=git4714f20
# If tarball_version is not empty, it is used as the version string in
# the tarball filename, regardless of all other versions listed in
@ -44,7 +44,7 @@ tarball_version=
# The date when this release was created
date="Jun 26, 2017"
date="Jul 20, 2017"
# The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library

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

@ -3,6 +3,8 @@
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -39,8 +41,11 @@ AC_DEFUN([_PMIX_LIBEVENT_EMBEDDED_MODE],[
AC_MSG_CHECKING([for libevent])
AC_MSG_RESULT([assumed available (embedded mode)])
PMIX_EVENT_HEADER="$with_libevent_header"
PMIX_EVENT2_THREAD_HEADER="$with_libevent_header"
AS_IF([test -z "$with_libevent_header" || test "$with_libevent_header" = "yes"],
[PMIX_EVENT_HEADER="<event.h>"
PMIX_EVENT2_THREAD_HEADER="<event2/thread.h>"],
[PMIX_EVENT_HEADER="$with_libevent_header"
PMIX_EVENT2_THREAD_HEADER="$with_libevent_header"])
])

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

@ -55,6 +55,19 @@ AC_CONFIG_MACRO_DIR(./config)
# because it twiddles random bits of autoconf
PMIX_LOAD_PLATFORM
PMIX_TOP_BUILDDIR="`pwd`"
AC_SUBST(PMIX_TOP_BUILDDIR)
cd "$srcdir"
PMIX_TOP_SRCDIR="`pwd`"
AC_SUBST(PMIX_TOP_SRCDIR)
cd "$PMIX_TOP_BUILDDIR"
AC_MSG_NOTICE([builddir: $PMIX_TOP_BUILDDIR])
AC_MSG_NOTICE([srcdir: $PMIX_TOP_SRCDIR])
if test "$PMIX_TOP_BUILDDIR" != "$PMIX_TOP_SRCDIR"; then
AC_MSG_NOTICE([Detected VPATH build])
fi
# setup configure options (e.g., show_title and friends)
PMIX_CONFIGURE_SETUP
pmix_show_title "Configuring PMIx"

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

@ -208,7 +208,7 @@ int main(int argc, char **argv)
* query the status of the allocation request */
usleep(10);
PMIX_QUERY_CREATE(query, 1);
PMIX_ARGV_APPEND(query[0].keys, PMIX_QUERY_ALLOC_STATUS);
PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_QUERY_ALLOC_STATUS);
PMIX_INFO_CREATE(query[0].qualifiers, 1);
PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
mydata.active = true;

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

@ -267,8 +267,8 @@ int main(int argc, char **argv)
* so we know if the RM can stop-on-exec, or only supports stop-in-init */
nq = 1;
PMIX_QUERY_CREATE(query, nq);
PMIX_ARGV_APPEND(query[0].keys, PMIX_QUERY_SPAWN_SUPPORT);
PMIX_ARGV_APPEND(query[0].keys, PMIX_QUERY_DEBUG_SUPPORT);
PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_QUERY_SPAWN_SUPPORT);
PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_QUERY_DEBUG_SUPPORT);
/* setup the caddy to retrieve the data */
myquery_data.info = NULL;
myquery_data.ninfo = 0;
@ -333,7 +333,7 @@ int main(int argc, char **argv)
PMIX_APP_CREATE(app, napps);
/* setup the executable */
app[0].cmd = strdup("client");
PMIX_ARGV_APPEND(app[0].argv, "./client");
PMIX_ARGV_APPEND(rc, app[0].argv, "./client");
getcwd(cwd, 1024); // point us to our current directory
app[0].cwd = strdup(cwd);
app[0].maxprocs = 2;
@ -359,7 +359,7 @@ int main(int argc, char **argv)
/* setup the debugger */
PMIX_APP_CREATE(debugger, 1);
debugger[0].cmd = strdup("./debuggerd");
PMIX_ARGV_APPEND(debugger[0].argv, "./debuggerd");
PMIX_ARGV_APPEND(rc, debugger[0].argv, "./debuggerd");
debugger[0].cwd = strdup(cwd);
/* provide directives so the daemons go where we want, and
* let the RM know these are debugger daemons */

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

@ -13,7 +13,7 @@
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
@ -172,7 +172,7 @@ int main(int argc, char **argv)
* our local target processes */
nq = 1;
PMIX_QUERY_CREATE(query, nq);
PMIX_ARGV_APPEND(query[0].keys, PMIX_QUERY_LOCAL_PROC_TABLE);
PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_QUERY_LOCAL_PROC_TABLE);
query[0].nqual = 1;
PMIX_INFO_CREATE(query[0].qualifiers, 1);
PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_NSPACE, val->data.string, PMIX_STRING); // the nspace we are enquiring about

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

@ -28,6 +28,7 @@
#include <src/include/pmix_config.h>
#include <pmix_server.h>
#include <src/include/types.h>
#include <src/include/pmix_globals.h>
#include <stdio.h>
#include <stdlib.h>
@ -48,7 +49,6 @@
#include "src/util/output.h"
#include "src/util/printf.h"
#include "src/util/argv.h"
#include "src/buffer_ops/buffer_ops.h"
static pmix_status_t connected(const pmix_proc_t *proc, void *server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata);

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

@ -4,7 +4,7 @@
* Copyright (c) 2016-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* Copyright (c) 2016 Mellanox Technologies, Inc.
* Copyright (c) 2016-2017 Mellanox Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -154,6 +154,10 @@ typedef uint32_t pmix_rank_t;
#define PMIX_TCP_DISABLE_IPV4 "pmix.tcp.disipv4" // (bool) true to disable IPv4 family
#define PMIX_TCP_DISABLE_IPV6 "pmix.tcp.disipv6" // (bool) true to disable IPv6 family
/* attributes for GDS */
#define PMIX_GDS_MODULE "pmix.gds.mod" // (char*) comma-delimited string of desired modules
/* general proc-level attributes */
#define PMIX_CPUSET "pmix.cpuset" // (char*) hwloc bitmap applied to proc upon launch
#define PMIX_CREDENTIAL "pmix.cred" // (char*) security credential assigned to proc
@ -219,8 +223,9 @@ typedef uint32_t pmix_rank_t;
/* request-related info */
#define PMIX_COLLECT_DATA "pmix.collect" // (bool) collect data and return it at the end of the operation
#define PMIX_TIMEOUT "pmix.timeout" // (int) time in sec before specified operation should time out (0 => infinite)
#define PMIX_IMMEDIATE "pmix.immediate" // (bool) specified operation should immediately return an error if requested
// data cannot be found - do not request it from the host RM
#define PMIX_IMMEDIATE "pmix.immediate" // (bool) specified operation should immediately return an error from the PMIx
// server if requested data cannot be found - do not request it from
// the host RM
#define PMIX_WAIT "pmix.wait" // (int) caller requests that the server wait until at least the specified
// #values are found (0 => all and is the default)
#define PMIX_COLLECTIVE_ALGO "pmix.calgo" // (char*) comma-delimited list of algorithms to use for collective
@ -229,14 +234,15 @@ typedef uint32_t pmix_rank_t;
#define PMIX_RANGE "pmix.range" // (pmix_data_range_t) value for calls to publish/lookup/unpublish or for
// monitoring event notifications
#define PMIX_PERSISTENCE "pmix.persist" // (pmix_persistence_t) value for calls to publish
#define PMIX_OPTIONAL "pmix.optional" // (bool) look only in the immediate data store for the requested value - do
#define PMIX_DATA_SCOPE "pmix.scope" // (pmix_scope_t) scope of the data to be found in a PMIx_Get call
#define PMIX_OPTIONAL "pmix.optional" // (bool) look only in the client's local data store for the requested value - do
// not request data from the server if not found
#define PMIX_EMBED_BARRIER "pmix.embed.barrier" // (bool) execute a blocking fence operation before executing the
// specified operation
/* attributes used by host server to pass data to the server convenience library - the
* data will then be parsed and provided to the local clients */
#define PMIX_PROC_DATA "pmix.pdata" // (pmix_value_array_t) starts with rank, then contains more data
#define PMIX_PROC_DATA "pmix.pdata" // (pmix_data_array_t) starts with rank, then contains more data
#define PMIX_NODE_MAP "pmix.nmap" // (char*) regex of nodes containing procs for this job
#define PMIX_PROC_MAP "pmix.pmap" // (char*) regex describing procs on each node within this job
#define PMIX_ANL_MAP "pmix.anlmap" // (char*) process mapping in ANL notation (used in PMI-1/PMI-2)
@ -538,6 +544,7 @@ typedef int pmix_status_t;
#define PMIX_ERR_JOB_TERMINATED (PMIX_ERR_OP_BASE - 15)
#define PMIX_ERR_UPDATE_ENDPOINTS (PMIX_ERR_OP_BASE - 16)
#define PMIX_MODEL_DECLARED (PMIX_ERR_OP_BASE - 17)
#define PMIX_GDS_ACTION_COMPLETE (PMIX_ERR_OP_BASE - 18)
/* define a starting point for system error constants so
* we avoid renumbering when making additions */
@ -626,7 +633,7 @@ typedef uint16_t pmix_data_type_t;
#define PMIX_DATA_TYPE_MAX 500
/* define a scope for data "put" by PMI per the following:
/* define a scope for data "put" by PMIx per the following:
*
* PMI_LOCAL - the data is intended only for other application
* processes on the same node. Data marked in this way
@ -642,6 +649,7 @@ typedef uint8_t pmix_scope_t;
#define PMIX_LOCAL 1 // share to procs also on this node
#define PMIX_REMOTE 2 // share with procs not on this node
#define PMIX_GLOBAL 3 // share with all procs (local + remote)
#define PMIX_INTERNAL 4 // store data in the internal tables
/* define a range for data "published" by PMI
*/
@ -690,6 +698,23 @@ typedef struct pmix_byte_object {
char *bytes;
size_t size;
} pmix_byte_object_t;
#define PMIX_BYTE_OBJECT_DESTRUCT(m) \
do { \
if (NULL != (m)->bytes) { \
free((m)->bytes); \
} \
} while(0)
#define PMIX_BYTE_OBJECT_FREE(m, n) \
do { \
size_t _n; \
for (_n=0; _n < n; _n++) { \
if (NULL != (m)[_n].bytes) { \
free((m)[_n].bytes); \
} \
} \
free((m)); \
} while(0)
/**** PMIX DATA BUFFER ****/
@ -860,6 +885,7 @@ typedef struct pmix_value {
pmix_proc_info_t *pinfo;
pmix_data_array_t *darray;
void *ptr;
pmix_alloc_directive_t adir;
/**** DEPRECATED ****/
pmix_info_array_t *array;
/********************/
@ -987,18 +1013,36 @@ typedef struct pmix_value {
/* expose some functions that are resolved in the
* PMIx library, but part of a header that
* includes internal functions - we don't
* want to expose the entire header here
* want to expose the entire header here. For
* consistency, we provide macro versions as well
*/
void pmix_value_load(pmix_value_t *v, const void *data, pmix_data_type_t type);
#define PMIX_VALUE_LOAD(v, d, t) \
pmix_value_load((v), (d), (t))
pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src);
#define PMIX_VALUE_XFER(r, v, s) \
do { \
if (NULL == (v)) { \
(v) = (pmix_value_t*)malloc(sizeof(pmix_value_t)); \
if (NULL == (v)) { \
(r) = PMIX_ERR_NOMEM; \
} else { \
(r) = pmix_value_xfer((v), (s)); \
} \
} else { \
(r) = pmix_value_xfer((v), (s)); \
} \
} while(0)
pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg);
#define PMIX_ARGV_APPEND(r, a, b) \
(r) = pmix_argv_append_nosize(&(a), (b))
pmix_status_t pmix_setenv(const char *name, const char *value,
bool overwrite, char ***env);
#define PMIX_ARGV_APPEND(a, b) \
pmix_argv_append_nosize(&(a), (b))
#define PMIX_SETENV(a, b, c) \
pmix_setenv((a), (b), true, (c))
#define PMIX_SETENV(r, a, b, c) \
(r) = pmix_setenv((a), (b), true, (c))
/**** PMIX INFO STRUCT ****/
struct pmix_info_t {
@ -1052,6 +1096,28 @@ struct pmix_info_t {
#define PMIX_INFO_OPTIONAL(m) \
(m)->flags &= ~PMIX_INFO_REQD;
#define PMIX_INFO_UNLOAD(r, v, l) \
do { \
pmix_info_t *_info; \
size_t _n, _ninfo; \
pmix_kval_t *_kv; \
_info = (pmix_info_t*)(v)->data.darray->array; \
_ninfo = (v)->data.darray->size; \
for (_n = 0; _n < _ninfo; _n++){ \
_kv = PMIX_NEW(pmix_kval_t); \
if (NULL == _kv) { \
(r) = PMIX_ERR_NOMEM; \
break; \
} \
_kv->key = strdup(_info[_n].key); \
PMIX_VALUE_XFER((r), _kv->value, &_info[_n].value);\
if (PMIX_SUCCESS != (r)) { \
PMIX_RELEASE(_kv); \
break; \
} \
pmix_list_append((l), &_kv->super); \
} \
} while(0)
/**** PMIX LOOKUP RETURN STRUCT ****/
typedef struct pmix_pdata {
@ -1105,6 +1171,17 @@ typedef struct pmix_pdata {
} \
} while (0)
#define PMIX_PDATA_XFER(d, s) \
do { \
if (NULL != (d)) { \
memset((d), 0, sizeof(pmix_pdata_t)); \
(void)strncpy((d)->proc.nspace, (s)->proc.nspace, PMIX_MAX_NSLEN); \
(d)->proc.rank = (s)->proc.rank; \
(void)strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \
pmix_value_xfer(&((d)->value), &((s)->value)); \
} \
} while (0)
/**** PMIX APP STRUCT ****/
typedef struct pmix_app {

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

@ -86,11 +86,6 @@ include server/Makefile.include
include runtime/Makefile.include
include tool/Makefile.include
include common/Makefile.include
include buffer_ops/Makefile.am
if WANT_DSTORE
include sm/Makefile.include
include dstore/Makefile.include
endif
MAINTAINERCLEANFILES = Makefile.in config.h config.h.in
DISTCLEANFILES = Makefile

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

@ -47,8 +47,8 @@
/* ...or the v6-specific equivalent... */
#define PMIXMB() __asm__ __volatile__ ("mcr p15, 0, r0, c7, c10, 5" : : : "memory")
#define PMIXRMB() MB()
#define PMIXWMB() MB()
#define PMIXRMB() PMIXMB()
#define PMIXWMB() PMIXMB()
#else
@ -56,8 +56,8 @@
/* ...otherwise use the Linux kernel-provided barrier */
#define PMIXMB() (*((void (*)(void))(0xffff0fa0)))()
#define PMIXRMB() MB()
#define PMIXWMB() MB()
#define PMIXRMB() PMIXMB()
#define PMIXWMB() PMIXMB()
#endif

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

@ -1,538 +0,0 @@
/* -*- C -*-
*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 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) 2012 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef PMIX_BFROP_INTERNAL_H_
#define PMIX_BFROP_INTERNAL_H_
#include <src/include/pmix_config.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> /* for struct timeval */
#endif
#include "src/class/pmix_pointer_array.h"
#include "buffer_ops.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
BEGIN_C_DECLS
/*
* The default starting chunk size
*/
#define PMIX_BFROP_DEFAULT_INITIAL_SIZE 2048
/*
* The default threshold size when we switch from doubling the
* buffer size to addatively increasing it
*/
#define PMIX_BFROP_DEFAULT_THRESHOLD_SIZE 4096
/*
* Internal type corresponding to size_t. Do not use this in
* interface calls - use PMIX_SIZE instead.
*/
#if SIZEOF_SIZE_T == 1
#define BFROP_TYPE_SIZE_T PMIX_UINT8
#elif SIZEOF_SIZE_T == 2
#define BFROP_TYPE_SIZE_T PMIX_UINT16
#elif SIZEOF_SIZE_T == 4
#define BFROP_TYPE_SIZE_T PMIX_UINT32
#elif SIZEOF_SIZE_T == 8
#define BFROP_TYPE_SIZE_T PMIX_UINT64
#else
#error Unsupported size_t size!
#endif
/*
* Internal type corresponding to bool. Do not use this in interface
* calls - use PMIX_BOOL instead.
*/
#if SIZEOF__BOOL == 1
#define BFROP_TYPE_BOOL PMIX_UINT8
#elif SIZEOF__BOOL == 2
#define BFROP_TYPE_BOOL PMIX_UINT16
#elif SIZEOF__BOOL == 4
#define BFROP_TYPE_BOOL PMIX_UINT32
#elif SIZEOF__BOOL == 8
#define BFROP_TYPE_BOOL PMIX_UINT64
#else
#error Unsupported bool size!
#endif
/*
* Internal type corresponding to int and unsigned int. Do not use
* this in interface calls - use PMIX_INT / PMIX_UINT instead.
*/
#if SIZEOF_INT == 1
#define BFROP_TYPE_INT PMIX_INT8
#define BFROP_TYPE_UINT PMIX_UINT8
#elif SIZEOF_INT == 2
#define BFROP_TYPE_INT PMIX_INT16
#define BFROP_TYPE_UINT PMIX_UINT16
#elif SIZEOF_INT == 4
#define BFROP_TYPE_INT PMIX_INT32
#define BFROP_TYPE_UINT PMIX_UINT32
#elif SIZEOF_INT == 8
#define BFROP_TYPE_INT PMIX_INT64
#define BFROP_TYPE_UINT PMIX_UINT64
#else
#error Unsupported int size!
#endif
/*
* Internal type corresponding to pid_t. Do not use this in interface
* calls - use PMIX_PID instead.
*/
#if SIZEOF_PID_T == 1
#define BFROP_TYPE_PID_T PMIX_UINT8
#elif SIZEOF_PID_T == 2
#define BFROP_TYPE_PID_T PMIX_UINT16
#elif SIZEOF_PID_T == 4
#define BFROP_TYPE_PID_T PMIX_UINT32
#elif SIZEOF_PID_T == 8
#define BFROP_TYPE_PID_T PMIX_UINT64
#else
#error Unsupported pid_t size!
#endif
/* Unpack generic size macros */
#define UNPACK_SIZE_MISMATCH(unpack_type, remote_type, ret) \
do { \
switch(remote_type) { \
case PMIX_UINT8: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint8_t, remote_type); \
break; \
case PMIX_INT8: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int8_t, remote_type); \
break; \
case PMIX_UINT16: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint16_t, remote_type); \
break; \
case PMIX_INT16: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int16_t, remote_type); \
break; \
case PMIX_UINT32: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint32_t, remote_type); \
break; \
case PMIX_INT32: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int32_t, remote_type); \
break; \
case PMIX_UINT64: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint64_t, remote_type); \
break; \
case PMIX_INT64: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int64_t, remote_type); \
break; \
default: \
ret = PMIX_ERR_NOT_FOUND; \
} \
} while (0)
/* NOTE: do not need to deal with endianness here, as the unpacking of
the underling sender-side type will do that for us. Repeat: the
data in tmpbuf[] is already in host byte order. */
#define UNPACK_SIZE_MISMATCH_FOUND(unpack_type, tmptype, tmpbfroptype) \
do { \
int32_t i; \
tmptype *tmpbuf = (tmptype*)malloc(sizeof(tmptype) * (*num_vals)); \
ret = pmix_bfrop_unpack_buffer(buffer, tmpbuf, num_vals, tmpbfroptype); \
for (i = 0 ; i < *num_vals ; ++i) { \
((unpack_type*) dest)[i] = (unpack_type)(tmpbuf[i]); \
} \
free(tmpbuf); \
} while (0)
/**
* Internal struct used for holding registered bfrop functions
*/
typedef struct {
pmix_object_t super;
/* type identifier */
pmix_data_type_t odti_type;
/** Debugging string name */
char *odti_name;
/** Pack function */
pmix_bfrop_pack_fn_t odti_pack_fn;
/** Unpack function */
pmix_bfrop_unpack_fn_t odti_unpack_fn;
/** copy function */
pmix_bfrop_copy_fn_t odti_copy_fn;
/** print function */
pmix_bfrop_print_fn_t odti_print_fn;
} pmix_bfrop_type_info_t;
PMIX_CLASS_DECLARATION(pmix_bfrop_type_info_t);
/*
* globals needed within bfrop
*/
extern bool pmix_bfrop_initialized;
extern size_t pmix_bfrop_initial_size;
extern size_t pmix_bfrop_threshold_size;
extern pmix_pointer_array_t pmix_bfrop_types;
extern pmix_data_type_t pmix_bfrop_num_reg_types;
/* macro for registering data types */
#define PMIX_REGISTER_TYPE(n, t, p, u, c, pr) \
do { \
pmix_bfrop_type_info_t *_info; \
_info = PMIX_NEW(pmix_bfrop_type_info_t); \
_info->odti_name = strdup((n)); \
_info->odti_type = (t); \
_info->odti_pack_fn = (pmix_bfrop_pack_fn_t)(p); \
_info->odti_unpack_fn = (pmix_bfrop_unpack_fn_t)(u); \
_info->odti_copy_fn = (pmix_bfrop_copy_fn_t)(c) ; \
_info->odti_print_fn = (pmix_bfrop_print_fn_t)(pr) ; \
pmix_pointer_array_set_item(&pmix_bfrop_types, (t), _info); \
++pmix_bfrop_num_reg_types; \
} while (0)
/*
* Implementations of API functions
*/
pmix_status_t pmix_bfrop_pack(pmix_buffer_t *buffer, const void *src,
int32_t num_vals,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack(pmix_buffer_t *buffer, void *dest,
int32_t *max_num_vals,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy(void **dest, void *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print(char **output, char *prefix, void *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src);
/*
* Specialized functions
*/
pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst,
int32_t *num_vals, pmix_data_type_t type);
/*
* Internal pack functions
*/
pmix_status_t pmix_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_string(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_int(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_float(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_double(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_status(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_value(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_info(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_range(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_infodirs(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_ptr(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_pstate(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_pinfo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_query(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_rank(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_alloc_directive(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
/********************/
/*
* Internal unpack functions
*/
pmix_status_t pmix_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_scope(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_range(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_cmd(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_infodirs(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_ptr(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_pstate(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_pinfo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_rank(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_alloc_directive(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
/********************/
/*
* Internal copy functions
*/
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_value(pmix_value_t **dest, pmix_value_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_pinfo(pmix_proc_info_t **dest, pmix_proc_info_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest, pmix_data_array_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_query(pmix_query_t **dest, pmix_query_t *src,
pmix_data_type_t type);
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_copy_array(pmix_info_array_t **dest,
pmix_info_array_t *src,
pmix_data_type_t type);
/********************/
/*
* Internal print functions
*/
pmix_status_t pmix_bfrop_print_bool(char **output, char *prefix, bool *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_byte(char **output, char *prefix, uint8_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_string(char **output, char *prefix, char *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_size(char **output, char *prefix, size_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_pid(char **output, char *prefix, pid_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_int(char **output, char *prefix, int *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_int8(char **output, char *prefix, int8_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_int16(char **output, char *prefix, int16_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_int32(char **output, char *prefix, int32_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_int64(char **output, char *prefix, int64_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_uint(char **output, char *prefix, uint *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_uint8(char **output, char *prefix, uint8_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_uint16(char **output, char *prefix, uint16_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_uint32(char **output, char *prefix, uint32_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_uint64(char **output, char *prefix, uint64_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_float(char **output, char *prefix, float *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_double(char **output, char *prefix, double *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_status(char **output, char *prefix, pmix_status_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_proc_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_app(char **output, char *prefix,
pmix_app_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_info(char **output, char *prefix,
pmix_info_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_buf(char **output, char *prefix,
pmix_buffer_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_kval(char **output, char *prefix,
pmix_kval_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_modex(char **output, char *prefix,
pmix_modex_data_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_persist(char **output, char *prefix,
pmix_persistence_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_scope(char **output, char *prefix,
pmix_scope_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_range(char **output, char *prefix,
pmix_data_range_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_cmd(char **output, char *prefix,
pmix_cmd_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_infodirs(char **output, char *prefix,
pmix_info_directives_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_bo(char **output, char *prefix,
pmix_byte_object_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_pdata(char **output, char *prefix,
pmix_pdata_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_ptr(char **output, char *prefix,
void *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_pstate(char **output, char *prefix,
pmix_proc_state_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_pinfo(char **output, char *prefix,
pmix_proc_info_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_darray(char **output, char *prefix,
pmix_data_array_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_query(char **output, char *prefix,
pmix_query_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_rank(char **output, char *prefix,
pmix_rank_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_alloc_directive(char **output, char *prefix,
pmix_alloc_directive_t *src,
pmix_data_type_t type);
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_print_array(char **output, char *prefix,
pmix_info_array_t *src,
pmix_data_type_t type);
/********************/
/*
* Internal helper functions
*/
char* pmix_bfrop_buffer_extend(pmix_buffer_t *bptr, size_t bytes_to_add);
bool pmix_bfrop_too_small(pmix_buffer_t *buffer, size_t bytes_reqd);
pmix_bfrop_type_info_t* pmix_bfrop_find_type(pmix_data_type_t type);
pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type);
pmix_status_t pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type);
END_C_DECLS
#endif

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

@ -1,118 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 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-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "src/class/pmix_pointer_array.h"
#include "src/buffer_ops/internal.h"
/**
* Internal function that resizes (expands) an inuse buffer if
* necessary.
*/
char* pmix_bfrop_buffer_extend(pmix_buffer_t *buffer, size_t bytes_to_add)
{
size_t required, to_alloc;
size_t pack_offset, unpack_offset;
char *tmp;
/* Check to see if we have enough space already */
if ((buffer->bytes_allocated - buffer->bytes_used) >= bytes_to_add) {
return buffer->pack_ptr;
}
required = buffer->bytes_used + bytes_to_add;
if (required >= pmix_bfrop_threshold_size) {
to_alloc = (required + pmix_bfrop_threshold_size - 1) & ~(pmix_bfrop_threshold_size - 1);
} else {
to_alloc = buffer->bytes_allocated ? buffer->bytes_allocated : pmix_bfrop_initial_size;
while(to_alloc < required) {
to_alloc <<= 1;
}
}
pack_offset = ((char*) buffer->pack_ptr) - ((char*) buffer->base_ptr);
unpack_offset = ((char*) buffer->unpack_ptr) - ((char*) buffer->base_ptr);
tmp = (char*)realloc(buffer->base_ptr, to_alloc);
if (NULL == tmp) {
return NULL;
}
buffer->base_ptr = tmp;
/* This memset is meant to keep valgrind happy. If possible it should be removed
* in the future. */
memset(buffer->base_ptr + pack_offset, 0, to_alloc - buffer->bytes_allocated);
buffer->pack_ptr = ((char*) buffer->base_ptr) + pack_offset;
buffer->unpack_ptr = ((char*) buffer->base_ptr) + unpack_offset;
buffer->bytes_allocated = to_alloc;
/* All done */
return buffer->pack_ptr;
}
/*
* Internal function that checks to see if the specified number of bytes
* remain in the buffer for unpacking
*/
bool pmix_bfrop_too_small(pmix_buffer_t *buffer, size_t bytes_reqd)
{
size_t bytes_remaining_packed;
if (buffer->pack_ptr < buffer->unpack_ptr) {
return true;
}
bytes_remaining_packed = buffer->pack_ptr - buffer->unpack_ptr;
if (bytes_remaining_packed < bytes_reqd) {
/* don't error log this - it could be that someone is trying to
* simply read until the buffer is empty
*/
return true;
}
return false;
}
pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type)
{
/* Lookup the pack function for the actual pmix_data_type type and call it */
return pmix_bfrop_pack_datatype(buffer, &type, 1, PMIX_DATA_TYPE);
}
pmix_status_t pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type)
{
int32_t cnt = 1;
return pmix_bfrop_unpack_datatype(buffer, type, &cnt, PMIX_DATA_TYPE);
}

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

@ -1,755 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2009 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) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
*/
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/buffer_ops/internal.h"
/**
* globals
*/
bool pmix_bfrop_initialized = false;
size_t pmix_bfrop_initial_size = 0;
size_t pmix_bfrop_threshold_size = 0;
pmix_pointer_array_t pmix_bfrop_types = {{0}};
pmix_data_type_t pmix_bfrop_num_reg_types = PMIX_UNDEF;
static pmix_bfrop_buffer_type_t pmix_default_buf_type = PMIX_BFROP_BUFFER_NON_DESC;
PMIX_EXPORT pmix_bfrop_t pmix_bfrop = {
pmix_bfrop_pack,
pmix_bfrop_unpack,
pmix_bfrop_copy,
pmix_bfrop_print,
pmix_bfrop_copy_payload,
};
/**
* Object constructors, destructors, and instantiations
*/
/** Value **/
static void pmix_buffer_construct (pmix_buffer_t* buffer)
{
/** set the default buffer type */
buffer->type = pmix_default_buf_type;
/* Make everything NULL to begin with */
buffer->base_ptr = buffer->pack_ptr = buffer->unpack_ptr = NULL;
buffer->bytes_allocated = buffer->bytes_used = 0;
}
static void pmix_buffer_destruct (pmix_buffer_t* buffer)
{
if (NULL != buffer->base_ptr) {
free (buffer->base_ptr);
}
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_buffer_t,
pmix_object_t,
pmix_buffer_construct,
pmix_buffer_destruct);
static void pmix_bfrop_type_info_construct(pmix_bfrop_type_info_t *obj)
{
obj->odti_name = NULL;
obj->odti_pack_fn = NULL;
obj->odti_unpack_fn = NULL;
obj->odti_copy_fn = NULL;
obj->odti_print_fn = NULL;
}
static void pmix_bfrop_type_info_destruct(pmix_bfrop_type_info_t *obj)
{
if (NULL != obj->odti_name) {
free(obj->odti_name);
}
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_bfrop_type_info_t, pmix_object_t,
pmix_bfrop_type_info_construct,
pmix_bfrop_type_info_destruct);
static void kvcon(pmix_kval_t *k)
{
k->key = NULL;
k->value = NULL;
}
static void kvdes(pmix_kval_t *k)
{
if (NULL != k->key) {
free(k->key);
}
if (NULL != k->value) {
PMIX_VALUE_RELEASE(k->value);
}
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_kval_t,
pmix_list_item_t,
kvcon, kvdes);
static void rcon(pmix_regex_range_t *p)
{
p->start = 0;
p->cnt = 0;
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_regex_range_t,
pmix_list_item_t,
rcon, NULL);
static void rvcon(pmix_regex_value_t *p)
{
p->prefix = NULL;
p->suffix = NULL;
p->num_digits = 0;
PMIX_CONSTRUCT(&p->ranges, pmix_list_t);
}
static void rvdes(pmix_regex_value_t *p)
{
if (NULL != p->prefix) {
free(p->prefix);
}
if (NULL != p->suffix) {
free(p->suffix);
}
PMIX_LIST_DESTRUCT(&p->ranges);
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_regex_value_t,
pmix_list_item_t,
rvcon, rvdes);
PMIX_EXPORT pmix_status_t pmix_bfrop_open(void)
{
pmix_status_t rc;
if (pmix_bfrop_initialized) {
return PMIX_SUCCESS;
}
/** set the default buffer type. If we are in debug mode, then we default
* to fully described buffers. Otherwise, we default to non-described for brevity
* and performance
*/
#if PMIX_ENABLE_DEBUG
pmix_default_buf_type = PMIX_BFROP_BUFFER_FULLY_DESC;
#else
pmix_default_buf_type = PMIX_BFROP_BUFFER_NON_DESC;
#endif
/* Setup the types array */
PMIX_CONSTRUCT(&pmix_bfrop_types, pmix_pointer_array_t);
if (PMIX_SUCCESS != (rc = pmix_pointer_array_init(&pmix_bfrop_types, 64, 255, 64))) {
return rc;
}
pmix_bfrop_num_reg_types = PMIX_UNDEF;
pmix_bfrop_threshold_size = PMIX_BFROP_DEFAULT_THRESHOLD_SIZE;
pmix_bfrop_initial_size = PMIX_BFROP_DEFAULT_INITIAL_SIZE;
/* Register all the supported types */
PMIX_REGISTER_TYPE("PMIX_BOOL", PMIX_BOOL,
pmix_bfrop_pack_bool,
pmix_bfrop_unpack_bool,
pmix_bfrop_std_copy,
pmix_bfrop_print_bool);
PMIX_REGISTER_TYPE("PMIX_BYTE", PMIX_BYTE,
pmix_bfrop_pack_byte,
pmix_bfrop_unpack_byte,
pmix_bfrop_std_copy,
pmix_bfrop_print_byte);
PMIX_REGISTER_TYPE("PMIX_STRING", PMIX_STRING,
pmix_bfrop_pack_string,
pmix_bfrop_unpack_string,
pmix_bfrop_copy_string,
pmix_bfrop_print_string);
PMIX_REGISTER_TYPE("PMIX_SIZE", PMIX_SIZE,
pmix_bfrop_pack_sizet,
pmix_bfrop_unpack_sizet,
pmix_bfrop_std_copy,
pmix_bfrop_print_size);
PMIX_REGISTER_TYPE("PMIX_PID", PMIX_PID,
pmix_bfrop_pack_pid,
pmix_bfrop_unpack_pid,
pmix_bfrop_std_copy,
pmix_bfrop_print_pid);
PMIX_REGISTER_TYPE("PMIX_INT", PMIX_INT,
pmix_bfrop_pack_int,
pmix_bfrop_unpack_int,
pmix_bfrop_std_copy,
pmix_bfrop_print_int);
PMIX_REGISTER_TYPE("PMIX_INT8", PMIX_INT8,
pmix_bfrop_pack_byte,
pmix_bfrop_unpack_byte,
pmix_bfrop_std_copy,
pmix_bfrop_print_int8);
PMIX_REGISTER_TYPE("PMIX_INT16", PMIX_INT16,
pmix_bfrop_pack_int16,
pmix_bfrop_unpack_int16,
pmix_bfrop_std_copy,
pmix_bfrop_print_int16);
PMIX_REGISTER_TYPE("PMIX_INT32", PMIX_INT32,
pmix_bfrop_pack_int32,
pmix_bfrop_unpack_int32,
pmix_bfrop_std_copy,
pmix_bfrop_print_int32);
PMIX_REGISTER_TYPE("PMIX_INT64", PMIX_INT64,
pmix_bfrop_pack_int64,
pmix_bfrop_unpack_int64,
pmix_bfrop_std_copy,
pmix_bfrop_print_int64);
PMIX_REGISTER_TYPE("PMIX_UINT", PMIX_UINT,
pmix_bfrop_pack_int,
pmix_bfrop_unpack_int,
pmix_bfrop_std_copy,
pmix_bfrop_print_uint);
PMIX_REGISTER_TYPE("PMIX_UINT8", PMIX_UINT8,
pmix_bfrop_pack_byte,
pmix_bfrop_unpack_byte,
pmix_bfrop_std_copy,
pmix_bfrop_print_uint8);
PMIX_REGISTER_TYPE("PMIX_UINT16", PMIX_UINT16,
pmix_bfrop_pack_int16,
pmix_bfrop_unpack_int16,
pmix_bfrop_std_copy,
pmix_bfrop_print_uint16);
PMIX_REGISTER_TYPE("PMIX_UINT32", PMIX_UINT32,
pmix_bfrop_pack_int32,
pmix_bfrop_unpack_int32,
pmix_bfrop_std_copy,
pmix_bfrop_print_uint32);
PMIX_REGISTER_TYPE("PMIX_UINT64", PMIX_UINT64,
pmix_bfrop_pack_int64,
pmix_bfrop_unpack_int64,
pmix_bfrop_std_copy,
pmix_bfrop_print_uint64);
PMIX_REGISTER_TYPE("PMIX_FLOAT", PMIX_FLOAT,
pmix_bfrop_pack_float,
pmix_bfrop_unpack_float,
pmix_bfrop_std_copy,
pmix_bfrop_print_float);
PMIX_REGISTER_TYPE("PMIX_DOUBLE", PMIX_DOUBLE,
pmix_bfrop_pack_double,
pmix_bfrop_unpack_double,
pmix_bfrop_std_copy,
pmix_bfrop_print_double);
PMIX_REGISTER_TYPE("PMIX_TIMEVAL", PMIX_TIMEVAL,
pmix_bfrop_pack_timeval,
pmix_bfrop_unpack_timeval,
pmix_bfrop_std_copy,
pmix_bfrop_print_timeval);
PMIX_REGISTER_TYPE("PMIX_TIME", PMIX_TIME,
pmix_bfrop_pack_time,
pmix_bfrop_unpack_time,
pmix_bfrop_std_copy,
pmix_bfrop_print_time);
PMIX_REGISTER_TYPE("PMIX_STATUS", PMIX_STATUS,
pmix_bfrop_pack_status,
pmix_bfrop_unpack_status,
pmix_bfrop_std_copy,
pmix_bfrop_print_status);
PMIX_REGISTER_TYPE("PMIX_VALUE", PMIX_VALUE,
pmix_bfrop_pack_value,
pmix_bfrop_unpack_value,
pmix_bfrop_copy_value,
pmix_bfrop_print_value);
PMIX_REGISTER_TYPE("PMIX_PROC", PMIX_PROC,
pmix_bfrop_pack_proc,
pmix_bfrop_unpack_proc,
pmix_bfrop_copy_proc,
pmix_bfrop_print_proc);
PMIX_REGISTER_TYPE("PMIX_APP", PMIX_APP,
pmix_bfrop_pack_app,
pmix_bfrop_unpack_app,
pmix_bfrop_copy_app,
pmix_bfrop_print_app);
PMIX_REGISTER_TYPE("PMIX_INFO", PMIX_INFO,
pmix_bfrop_pack_info,
pmix_bfrop_unpack_info,
pmix_bfrop_copy_info,
pmix_bfrop_print_info);
PMIX_REGISTER_TYPE("PMIX_PDATA", PMIX_PDATA,
pmix_bfrop_pack_pdata,
pmix_bfrop_unpack_pdata,
pmix_bfrop_copy_pdata,
pmix_bfrop_print_pdata);
PMIX_REGISTER_TYPE("PMIX_BUFFER", PMIX_BUFFER,
pmix_bfrop_pack_buf,
pmix_bfrop_unpack_buf,
pmix_bfrop_copy_buf,
pmix_bfrop_print_buf);
PMIX_REGISTER_TYPE("PMIX_BYTE_OBJECT", PMIX_BYTE_OBJECT,
pmix_bfrop_pack_bo,
pmix_bfrop_unpack_bo,
pmix_bfrop_copy_bo,
pmix_bfrop_print_bo);
PMIX_REGISTER_TYPE("PMIX_KVAL", PMIX_KVAL,
pmix_bfrop_pack_kval,
pmix_bfrop_unpack_kval,
pmix_bfrop_copy_kval,
pmix_bfrop_print_kval);
PMIX_REGISTER_TYPE("PMIX_MODEX", PMIX_MODEX,
pmix_bfrop_pack_modex,
pmix_bfrop_unpack_modex,
pmix_bfrop_copy_modex,
pmix_bfrop_print_modex);
PMIX_REGISTER_TYPE("PMIX_PERSIST", PMIX_PERSIST,
pmix_bfrop_pack_persist,
pmix_bfrop_unpack_persist,
pmix_bfrop_std_copy,
pmix_bfrop_print_persist);
PMIX_REGISTER_TYPE("PMIX_POINTER", PMIX_POINTER,
pmix_bfrop_pack_ptr,
pmix_bfrop_unpack_ptr,
pmix_bfrop_std_copy,
pmix_bfrop_print_ptr);
PMIX_REGISTER_TYPE("PMIX_SCOPE", PMIX_SCOPE,
pmix_bfrop_pack_scope,
pmix_bfrop_unpack_scope,
pmix_bfrop_std_copy,
pmix_bfrop_print_scope);
PMIX_REGISTER_TYPE("PMIX_DATA_RANGE", PMIX_DATA_RANGE,
pmix_bfrop_pack_range,
pmix_bfrop_unpack_range,
pmix_bfrop_std_copy,
pmix_bfrop_print_range);
PMIX_REGISTER_TYPE("PMIX_COMMAND", PMIX_COMMAND,
pmix_bfrop_pack_cmd,
pmix_bfrop_unpack_cmd,
pmix_bfrop_std_copy,
pmix_bfrop_print_cmd);
PMIX_REGISTER_TYPE("PMIX_INFO_DIRECTIVES", PMIX_INFO_DIRECTIVES,
pmix_bfrop_pack_infodirs,
pmix_bfrop_unpack_infodirs,
pmix_bfrop_std_copy,
pmix_bfrop_print_infodirs);
PMIX_REGISTER_TYPE("PMIX_PROC_STATE", PMIX_PROC_STATE,
pmix_bfrop_pack_pstate,
pmix_bfrop_unpack_pstate,
pmix_bfrop_std_copy,
pmix_bfrop_print_pstate);
PMIX_REGISTER_TYPE("PMIX_PROC_INFO", PMIX_PROC_INFO,
pmix_bfrop_pack_pinfo,
pmix_bfrop_unpack_pinfo,
pmix_bfrop_copy_pinfo,
pmix_bfrop_print_pinfo);
PMIX_REGISTER_TYPE("PMIX_DATA_ARRAY", PMIX_DATA_ARRAY,
pmix_bfrop_pack_darray,
pmix_bfrop_unpack_darray,
pmix_bfrop_copy_darray,
pmix_bfrop_print_darray);
PMIX_REGISTER_TYPE("PMIX_PROC_RANK", PMIX_PROC_RANK,
pmix_bfrop_pack_rank,
pmix_bfrop_unpack_rank,
pmix_bfrop_std_copy,
pmix_bfrop_print_rank);
PMIX_REGISTER_TYPE("PMIX_QUERY", PMIX_QUERY,
pmix_bfrop_pack_query,
pmix_bfrop_unpack_query,
pmix_bfrop_copy_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);
PMIX_REGISTER_TYPE("PMIX_ALLOC_DIRECTIVE",
PMIX_ALLOC_DIRECTIVE,
pmix_bfrop_pack_alloc_directive,
pmix_bfrop_unpack_alloc_directive,
pmix_bfrop_std_copy,
pmix_bfrop_print_alloc_directive);
/**** DEPRECATED ****/
PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY,
pmix_bfrop_pack_array,
pmix_bfrop_unpack_array,
pmix_bfrop_copy_array,
pmix_bfrop_print_array);
/********************/
/* All done */
pmix_bfrop_initialized = true;
return PMIX_SUCCESS;
}
PMIX_EXPORT pmix_status_t pmix_bfrop_close(void)
{
int32_t i;
if (!pmix_bfrop_initialized) {
return PMIX_SUCCESS;
}
pmix_bfrop_initialized = false;
for (i = 0 ; i < pmix_pointer_array_get_size(&pmix_bfrop_types) ; ++i) {
pmix_bfrop_type_info_t *info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&pmix_bfrop_types, i);
if (NULL != info) {
pmix_pointer_array_set_item(&pmix_bfrop_types, i, NULL);
PMIX_RELEASE(info);
}
}
PMIX_DESTRUCT(&pmix_bfrop_types);
return PMIX_SUCCESS;
}
/**** UTILITY SUPPORT ****/
PMIX_EXPORT void pmix_value_load(pmix_value_t *v,
const void *data,
pmix_data_type_t type)
{
pmix_byte_object_t *bo;
pmix_proc_info_t *pi;
v->type = type;
if (NULL == data) {
/* just set the fields to zero */
memset(&v->data, 0, sizeof(v->data));
if (PMIX_BOOL == type) {
v->data.flag = true; // existence of the attribute indicates true unless specified different
}
} else {
switch(type) {
case PMIX_UNDEF:
break;
case PMIX_BOOL:
memcpy(&(v->data.flag), data, 1);
break;
case PMIX_BYTE:
memcpy(&(v->data.byte), data, 1);
break;
case PMIX_STRING:
v->data.string = strdup(data);
break;
case PMIX_SIZE:
memcpy(&(v->data.size), data, sizeof(size_t));
break;
case PMIX_PID:
memcpy(&(v->data.pid), data, sizeof(pid_t));
break;
case PMIX_INT:
memcpy(&(v->data.integer), data, sizeof(int));
break;
case PMIX_INT8:
memcpy(&(v->data.int8), data, 1);
break;
case PMIX_INT16:
memcpy(&(v->data.int16), data, 2);
break;
case PMIX_INT32:
memcpy(&(v->data.int32), data, 4);
break;
case PMIX_INT64:
memcpy(&(v->data.int64), data, 8);
break;
case PMIX_UINT:
memcpy(&(v->data.uint), data, sizeof(int));
break;
case PMIX_UINT8:
memcpy(&(v->data.uint8), data, 1);
break;
case PMIX_UINT16:
memcpy(&(v->data.uint16), data, 2);
break;
case PMIX_UINT32:
memcpy(&(v->data.uint32), data, 4);
break;
case PMIX_UINT64:
memcpy(&(v->data.uint64), data, 8);
break;
case PMIX_FLOAT:
memcpy(&(v->data.fval), data, sizeof(float));
break;
case PMIX_DOUBLE:
memcpy(&(v->data.dval), data, sizeof(double));
break;
case PMIX_TIMEVAL:
memcpy(&(v->data.tv), data, sizeof(struct timeval));
break;
case PMIX_TIME:
memcpy(&(v->data.time), data, sizeof(time_t));
break;
case PMIX_STATUS:
memcpy(&(v->data.status), data, sizeof(pmix_status_t));
break;
case PMIX_PROC_RANK:
memcpy(&(v->data.rank), data, sizeof(pmix_rank_t));
break;
case PMIX_PROC:
PMIX_PROC_CREATE(v->data.proc, 1);
if (NULL == v->data.proc) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
return;
}
memcpy(v->data.proc, data, sizeof(pmix_proc_t));
break;
case PMIX_BYTE_OBJECT:
bo = (pmix_byte_object_t*)data;
v->data.bo.bytes = bo->bytes;
memcpy(&(v->data.bo.size), &bo->size, sizeof(size_t));
break;
case PMIX_PERSIST:
memcpy(&(v->data.persist), data, sizeof(pmix_persistence_t));
break;
case PMIX_SCOPE:
memcpy(&(v->data.scope), data, sizeof(pmix_scope_t));
break;
case PMIX_DATA_RANGE:
memcpy(&(v->data.range), data, sizeof(pmix_data_range_t));
break;
case PMIX_PROC_STATE:
memcpy(&(v->data.state), data, sizeof(pmix_proc_state_t));
break;
case PMIX_PROC_INFO:
PMIX_PROC_INFO_CREATE(v->data.pinfo, 1);
if (NULL == v->data.pinfo) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
return;
}
pi = (pmix_proc_info_t*)data;
memcpy(&(v->data.pinfo->proc), &pi->proc, sizeof(pmix_proc_t));
if (NULL != pi->hostname) {
v->data.pinfo->hostname = strdup(pi->hostname);
}
if (NULL != pi->executable_name) {
v->data.pinfo->executable_name = strdup(pi->executable_name);
}
memcpy(&(v->data.pinfo->pid), &pi->pid, sizeof(pid_t));
memcpy(&(v->data.pinfo->exit_code), &pi->exit_code, sizeof(int));
break;
case PMIX_POINTER:
memcpy(&(v->data.ptr), data, sizeof(void*));
break;
default:
/* silence warnings */
PMIX_ERROR_LOG(PMIX_ERR_UNKNOWN_DATA_TYPE);
break;
}
}
}
pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data,
size_t *sz, pmix_data_type_t type)
{
pmix_status_t rc;
pmix_proc_t *pc;
rc = PMIX_SUCCESS;
if (type != kv->type) {
rc = PMIX_ERR_TYPE_MISMATCH;
} else if (NULL == data ||
(NULL == *data && PMIX_STRING != type && PMIX_BYTE_OBJECT != type)) {
rc = PMIX_ERR_BAD_PARAM;
} else {
switch(type) {
case PMIX_UNDEF:
rc = PMIX_ERR_UNKNOWN_DATA_TYPE;
break;
case PMIX_BOOL:
memcpy(*data, &(kv->data.flag), 1);
*sz = 1;
break;
case PMIX_BYTE:
memcpy(*data, &(kv->data.byte), 1);
*sz = 1;
break;
case PMIX_STRING:
if (NULL != kv->data.string) {
*data = strdup(kv->data.string);
*sz = strlen(kv->data.string);
}
break;
case PMIX_SIZE:
memcpy(*data, &(kv->data.size), sizeof(size_t));
*sz = sizeof(size_t);
break;
case PMIX_PID:
memcpy(*data, &(kv->data.pid), sizeof(pid_t));
*sz = sizeof(pid_t);
break;
case PMIX_INT:
memcpy(*data, &(kv->data.integer), sizeof(int));
*sz = sizeof(int);
break;
case PMIX_INT8:
memcpy(*data, &(kv->data.int8), 1);
*sz = 1;
break;
case PMIX_INT16:
memcpy(*data, &(kv->data.int16), 2);
*sz = 2;
break;
case PMIX_INT32:
memcpy(*data, &(kv->data.int32), 4);
*sz = 4;
break;
case PMIX_INT64:
memcpy(*data, &(kv->data.int64), 8);
*sz = 8;
break;
case PMIX_UINT:
memcpy(*data, &(kv->data.uint), sizeof(int));
*sz = sizeof(int);
break;
case PMIX_UINT8:
memcpy(*data, &(kv->data.uint8), 1);
*sz = 1;
break;
case PMIX_UINT16:
memcpy(*data, &(kv->data.uint16), 2);
*sz = 2;
break;
case PMIX_UINT32:
memcpy(*data, &(kv->data.uint32), 4);
*sz = 4;
break;
case PMIX_UINT64:
memcpy(*data, &(kv->data.uint64), 8);
*sz = 8;
break;
case PMIX_FLOAT:
memcpy(*data, &(kv->data.fval), sizeof(float));
*sz = sizeof(float);
break;
case PMIX_DOUBLE:
memcpy(*data, &(kv->data.dval), sizeof(double));
*sz = sizeof(double);
break;
case PMIX_TIMEVAL:
memcpy(*data, &(kv->data.tv), sizeof(struct timeval));
*sz = sizeof(struct timeval);
break;
case PMIX_TIME:
memcpy(*data, &(kv->data.time), sizeof(time_t));
*sz = sizeof(time_t);
break;
case PMIX_STATUS:
memcpy(*data, &(kv->data.status), sizeof(pmix_status_t));
*sz = sizeof(pmix_status_t);
break;
case PMIX_PROC_RANK:
memcpy(*data, &(kv->data.rank), sizeof(pmix_rank_t));
*sz = sizeof(pmix_rank_t);
break;
case PMIX_PROC:
PMIX_PROC_CREATE(pc, 1);
if (NULL == pc) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
break;
}
memcpy(pc, kv->data.proc, sizeof(pmix_proc_t));
*sz = sizeof(pmix_proc_t);
*data = pc;
break;
case PMIX_BYTE_OBJECT:
if (NULL != kv->data.bo.bytes && 0 < kv->data.bo.size) {
*data = kv->data.bo.bytes;
*sz = kv->data.bo.size;
} else {
*data = NULL;
*sz = 0;
}
break;
case PMIX_PERSIST:
memcpy(*data, &(kv->data.persist), sizeof(pmix_persistence_t));
*sz = sizeof(pmix_persistence_t);
break;
case PMIX_SCOPE:
memcpy(*data, &(kv->data.scope), sizeof(pmix_scope_t));
*sz = sizeof(pmix_scope_t);
break;
case PMIX_DATA_RANGE:
memcpy(*data, &(kv->data.range), sizeof(pmix_data_range_t));
*sz = sizeof(pmix_data_range_t);
break;
case PMIX_PROC_STATE:
memcpy(*data, &(kv->data.state), sizeof(pmix_proc_state_t));
*sz = sizeof(pmix_proc_state_t);
break;
case PMIX_POINTER:
memcpy(*data, &(kv->data.ptr), sizeof(void*));
*sz = sizeof(void*);
break;
default:
/* silence warnings */
rc = PMIX_ERROR;
break;
}
}
return rc;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,105 +0,0 @@
/* -*- C -*-
*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 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) 2007-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Buffer management types.
*/
#ifndef PMIX_BFROP_TYPES_H_
#define PMIX_BFROP_TYPES_H_
#include <src/include/pmix_config.h>
#include "src/class/pmix_object.h"
#include "src/class/pmix_pointer_array.h"
#include "src/class/pmix_list.h"
#include <pmix_common.h>
BEGIN_C_DECLS
/* define the results values for comparisons so we can change them in only one place */
#define PMIX_VALUE1_GREATER +1
#define PMIX_VALUE2_GREATER -1
#define PMIX_EQUAL 0
/**
* buffer type
*/
enum pmix_bfrop_buffer_type_t {
PMIX_BFROP_BUFFER_NON_DESC = 0x00,
PMIX_BFROP_BUFFER_FULLY_DESC = 0x01
};
typedef enum pmix_bfrop_buffer_type_t pmix_bfrop_buffer_type_t;
#define PMIX_BFROP_BUFFER_TYPE_HTON(h);
#define PMIX_BFROP_BUFFER_TYPE_NTOH(h);
/**
* Structure for holding a buffer */
typedef struct {
/** First member must be the object's parent */
pmix_object_t parent;
/** type of buffer */
pmix_bfrop_buffer_type_t type;
/** Start of my memory */
char *base_ptr;
/** Where the next data will be packed to (within the allocated
memory starting at base_ptr) */
char *pack_ptr;
/** Where the next data will be unpacked from (within the
allocated memory starting as base_ptr) */
char *unpack_ptr;
/** Number of bytes allocated (starting at base_ptr) */
size_t bytes_allocated;
/** Number of bytes used by the buffer (i.e., amount of data --
including overhead -- packed in the buffer) */
size_t bytes_used;
} pmix_buffer_t;
PMIX_CLASS_DECLARATION (pmix_buffer_t);
/* these classes are required by the regex code shared
* between the client and server implementations - it
* is put here so that both can access these objects */
typedef struct {
pmix_list_item_t super;
int start;
int cnt;
} pmix_regex_range_t;
PMIX_CLASS_DECLARATION(pmix_regex_range_t);
typedef struct {
/* list object */
pmix_list_item_t super;
char *prefix;
char *suffix;
int num_digits;
pmix_list_t ranges;
} pmix_regex_value_t;
PMIX_CLASS_DECLARATION(pmix_regex_value_t);
END_C_DECLS
#endif /* PMIX_BFROP_TYPES_H */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#

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

@ -11,7 +11,7 @@
* All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -9,7 +9,7 @@
* 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 (c) 2015-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Mellanox Technologies, Inc.

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

@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Voltaire All rights reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2007 Voltaire All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -224,4 +224,3 @@ static void expand_array(void)
classes[i] = NULL;
}
}

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

@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -64,4 +64,3 @@ int pmix_value_array_set_size(pmix_value_array_t* array, size_t size)
array->array_size = size;
return PMIX_SUCCESS;
}

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Mellanox Technologies, Inc.
@ -34,7 +34,7 @@
#define ANL_MAPPING "PMI_process_mapping"
#include "src/buffer_ops/buffer_ops.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"

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

@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Mellanox Technologies, Inc.
@ -30,7 +30,7 @@
#include <pmi2.h>
#include <pmix.h>
#include "src/buffer_ops/buffer_ops.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"

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

@ -5,7 +5,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>.
* All rights reserved.
* Copyright (c) 2016 Mellanox Technologies, Inc.
* Copyright (c) 2016-2017 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* $COPYRIGHT$
@ -61,7 +61,6 @@ static const char pmix_version_string[] = PMIX_VERSION;
#include "src/class/pmix_list.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/event/pmix_event.h"
#include "src/util/argv.h"
#include "src/util/compress.h"
@ -71,17 +70,13 @@ static const char pmix_version_string[] = PMIX_VERSION;
#include "src/runtime/pmix_progress_threads.h"
#include "src/runtime/pmix_rte.h"
#include "src/threads/threads.h"
#include "src/mca/ptl/ptl.h"
#include "src/mca/bfrops/base/base.h"
#include "src/mca/gds/base/base.h"
#include "src/mca/preg/preg.h"
#include "src/mca/ptl/base/base.h"
#include "src/include/pmix_globals.h"
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
#include "src/dstore/pmix_dstore.h"
#endif /* PMIX_ENABLE_DSTORE */
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
#include "pmix_client_ops.h"
#include "src/include/pmix_jobdata.h"
#define PMIX_MAX_RETRIES 10
@ -107,43 +102,67 @@ static void pmix_client_notify_recv(struct pmix_peer_t *peer,
/* start the local notification chain */
chain = PMIX_NEW(pmix_event_chain_t);
if (NULL == chain) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
return;
}
chain->final_cbfunc = _notify_complete;
chain->final_cbdata = chain;
cnt=1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &cmd, &cnt, PMIX_CMD))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &cmd, &cnt, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(chain);
goto error;
}
/* unpack the status */
cnt=1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &chain->status, &cnt, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &chain->status, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(chain);
goto error;
}
/* unpack the source of the event */
cnt=1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &chain->source, &cnt, PMIX_PROC))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &chain->source, &cnt, PMIX_PROC);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(chain);
goto error;
}
/* unpack the info that might have been provided */
cnt=1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ninfo, &cnt, PMIX_SIZE))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &ninfo, &cnt, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(chain);
goto error;
}
/* we always leave space for a callback object */
chain->ninfo = ninfo + 1;
PMIX_INFO_CREATE(chain->info, chain->ninfo);
if (NULL == chain->info) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
PMIX_RELEASE(chain);
return;
}
if (0 < ninfo) {
cnt = ninfo;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, chain->info, &cnt, PMIX_INFO))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, chain->info, &cnt, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(chain);
goto error;
}
}
@ -162,6 +181,10 @@ static void pmix_client_notify_recv(struct pmix_peer_t *peer,
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:client_notify_recv - unpack error status =%d, calling def errhandler", rc);
chain = PMIX_NEW(pmix_event_chain_t);
if (NULL == chain) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
return;
}
chain->status = rc;
pmix_invoke_local_event_hdlr(chain);
}
@ -191,22 +214,21 @@ static void job_data(struct pmix_peer_t *pr,
int32_t cnt = 1;
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
/* unpack the nspace - we don't really need it, but have to
* unpack it to maintain sequence */
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &nspace, &cnt, PMIX_STRING))) {
/* unpack the nspace - should be same as our own */
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &nspace, &cnt, PMIX_STRING);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
cb->status = PMIX_ERROR;
PMIX_POST_OBJECT(cb);
PMIX_WAKEUP_THREAD(&cb->lock);
return;
}
assert(NULL != nspace);
free(nspace);
/* decode it */
#if !(defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1))
pmix_job_data_htable_store(pmix_globals.myid.nspace, buf);
#endif
PMIX_GDS_STORE_JOB_INFO(cb->status,
pmix_client_globals.myserver,
nspace, buf);
cb->status = PMIX_SUCCESS;
PMIX_POST_OBJECT(cb);
PMIX_WAKEUP_THREAD(&cb->lock);
@ -321,10 +343,8 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
pmix_info_t ginfo;
pmix_value_t *val = NULL;
pmix_lock_t reglock;
if (NULL == proc) {
return PMIX_ERR_BAD_PARAM;
}
size_t n;
bool found;
PMIX_ACQUIRE_THREAD(&pmix_global_lock);
@ -368,6 +388,21 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_NOMEM;
}
pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_nspace_t);
if (NULL == pmix_client_globals.myserver->nptr) {
PMIX_RELEASE(pmix_client_globals.myserver);
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_NOMEM;
}
pmix_client_globals.myserver->info = PMIX_NEW(pmix_rank_info_t);
if (NULL == pmix_client_globals.myserver->info) {
PMIX_RELEASE(pmix_client_globals.myserver);
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_NOMEM;
}
/* construct the global notification ring buffer */
PMIX_CONSTRUCT(&pmix_globals.notifications, pmix_ring_buffer_t);
pmix_ring_buffer_init(&pmix_globals.notifications, 256);
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: init called");
@ -382,9 +417,14 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
(void)strncpy(proc->nspace, evar, PMIX_MAX_NSLEN);
}
(void)strncpy(pmix_globals.myid.nspace, evar, PMIX_MAX_NSLEN);
/* create a pmix_nspace_t object for our peer */
nsptr = PMIX_NEW(pmix_nspace_t);
(void)strncpy(nsptr->nspace, evar, PMIX_MAX_NSLEN);
pmix_list_append(&pmix_globals.nspaces, &nsptr->super);
if (NULL == nsptr){
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_NOMEM;
}
nsptr->nspace = strdup(evar);
pmix_globals.mypeer->nptr = nsptr;
/* we also require our rank */
if (NULL == (evar = getenv("PMIX_RANK"))) {
@ -397,39 +437,108 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
proc->rank = pmix_globals.myid.rank;
}
pmix_globals.pindex = -1;
/* setup a rank_info object for us */
pmix_globals.mypeer->info = PMIX_NEW(pmix_rank_info_t);
if (NULL == pmix_globals.mypeer->info) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_NOMEM;
}
pmix_globals.mypeer->info->pname.nspace = strdup(proc->nspace);
pmix_globals.mypeer->info->pname.rank = proc->rank;
/* select our bfrops compat module - the selection will be based
* on the corresponding envars that should have been passed
* to us at launch */
evar = getenv("PMIX_BFROPS_MODE");
pmix_globals.mypeer->nptr->compat.bfrops = pmix_bfrops_base_assign_module(evar);
if (NULL == pmix_globals.mypeer->nptr->compat.bfrops) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_INIT;
}
/* the server will be using the same */
pmix_client_globals.myserver->nptr->compat.bfrops = pmix_globals.mypeer->nptr->compat.bfrops;
/* set the buffer type - the selection will be based
* on the corresponding envars that should have been passed
* to us at launch */
evar = getenv("PMIX_BFROP_BUFFER_TYPE");
if (NULL == evar) {
/* just set to our default */
pmix_globals.mypeer->nptr->compat.type = pmix_bfrops_globals.default_type;
} else if (0 == strcmp(evar, "PMIX_BFROP_BUFFER_FULLY_DESC")) {
pmix_globals.mypeer->nptr->compat.type = PMIX_BFROP_BUFFER_FULLY_DESC;
} else {
pmix_globals.mypeer->nptr->compat.type = PMIX_BFROP_BUFFER_NON_DESC;
}
/* the server will be using the same */
pmix_client_globals.myserver->nptr->compat.type = pmix_globals.mypeer->nptr->compat.type;
/* select our psec compat module - the selection will be based
* on the corresponding envars that should have been passed
* to us at launch */
evar = getenv("PMIX_SECURITY_MODE");
if (PMIX_SUCCESS != (rc = pmix_psec.assign_module(pmix_globals.mypeer, evar))) {
pmix_globals.mypeer->nptr->compat.psec = pmix_psec_base_assign_module(evar);
if (NULL == pmix_globals.mypeer->nptr->compat.psec) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_INIT;
}
/* the server will be using the same */
pmix_client_globals.myserver->compat.psec = pmix_globals.mypeer->compat.psec;
pmix_client_globals.myserver->nptr->compat.psec = pmix_globals.mypeer->nptr->compat.psec;
/* setup the shared memory support */
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (PMIX_SUCCESS != (rc = pmix_dstore_init(NULL, 0))) {
/* select the gds compat module we will use to interact with
* our server- the selection will be based
* on the corresponding envars that should have been passed
* to us at launch */
evar = getenv("PMIX_GDS_MODULE");
PMIX_INFO_LOAD(&ginfo, PMIX_GDS_MODULE, evar, PMIX_STRING);
pmix_client_globals.myserver->nptr->compat.gds = pmix_gds_base_assign_module(&ginfo, 1);
if (NULL == pmix_client_globals.myserver->nptr->compat.gds) {
PMIX_INFO_DESTRUCT(&ginfo);
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_DATA_VALUE_NOT_FOUND;
return PMIX_ERR_INIT;
}
#endif /* PMIX_ENABLE_DSTORE */
PMIX_INFO_DESTRUCT(&ginfo);
/* now select a GDS module for our own internal use - the user may
* have passed down a directive for this purpose. If they did, then
* use it. Otherwise, we want the "hash" module */
found = false;
if (info != NULL) {
for (n=0; n < ninfo; n++) {
if (0 == strncmp(info[n].key, PMIX_GDS_MODULE, PMIX_MAX_KEYLEN)) {
PMIX_INFO_LOAD(&ginfo, PMIX_GDS_MODULE, info[n].value.data.string, PMIX_STRING);
found = true;
break;
}
}
}
if (!found) {
PMIX_INFO_LOAD(&ginfo, PMIX_GDS_MODULE, "hash", PMIX_STRING);
}
pmix_globals.mypeer->nptr->compat.gds = pmix_gds_base_assign_module(&ginfo, 1);
if (NULL == pmix_globals.mypeer->nptr->compat.gds) {
PMIX_INFO_DESTRUCT(&ginfo);
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_INIT;
}
PMIX_INFO_DESTRUCT(&ginfo);
/* connect to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.connect_to_peer(pmix_client_globals.myserver, info, ninfo))){
rc = pmix_ptl_base_connect_to_peer((struct pmix_peer_t*)pmix_client_globals.myserver, info, ninfo);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
return rc;
}
/* mark that we are using the same module as used for the server */
pmix_globals.mypeer->compat.ptl = pmix_client_globals.myserver->compat.ptl;
pmix_globals.mypeer->nptr->compat.ptl = pmix_client_globals.myserver->nptr->compat.ptl;
/* send a request for our job info - we do this as a non-blocking
* transaction because some systems cannot handle very large
* blocking operations and error out if we try them. */
req = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(req, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
req, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(req);
PMIX_RELEASE_THREAD(&pmix_global_lock);
@ -437,8 +546,9 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
}
/* send to the server */
PMIX_CONSTRUCT(&cb, pmix_cb_t);
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, req, job_data, (void*)&cb))){
PMIX_DESTRUCT(&cb);
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
req, job_data, (void*)&cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
return rc;
}
@ -577,9 +687,12 @@ PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo)
* server that we are normally terminating */
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE_THREAD(&pmix_global_lock);
return rc;
}
@ -597,8 +710,10 @@ PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo)
PMIX_POST_OBJECT(&tev);
pmix_event_add(&tev.ev, &tv);
/* send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg,
finwait_cbfunc, (void*)&tev))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, finwait_cbfunc, (void*)&tev);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
return rc;
}
@ -622,13 +737,6 @@ PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo)
(void)pmix_progress_thread_pause(NULL);
}
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (0 > (rc = pmix_dstore_nspace_del(pmix_globals.myid.nspace))) {
PMIX_ERROR_LOG(rc);
return rc;
}
#endif
PMIX_LIST_DESTRUCT(&pmix_client_globals.pending_requests);
if (0 <= pmix_client_globals.myserver->sd) {
@ -672,32 +780,42 @@ PMIX_EXPORT pmix_status_t PMIx_Abort(int flag, const char msg[],
/* create a buffer to hold the message */
bfr = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(bfr, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
bfr, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
return rc;
}
/* pack the status flag */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(bfr, &flag, 1, PMIX_STATUS))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
bfr, &flag, 1, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
return rc;
}
/* pack the string message - a NULL is okay */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(bfr, &msg, 1, PMIX_STRING))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
bfr, &msg, 1, PMIX_STRING);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
return rc;
}
/* pack the number of procs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(bfr, &nprocs, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
bfr, &nprocs, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
return rc;
}
/* pack any provided procs */
if (0 < nprocs) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(bfr, procs, 1, PMIX_PROC))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
bfr, procs, nprocs, PMIX_PROC);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
return rc;
@ -706,8 +824,10 @@ PMIX_EXPORT pmix_status_t PMIx_Abort(int flag, const char msg[],
/* send to the server */
PMIX_CONSTRUCT_LOCK(&reglock);
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, bfr,
wait_cbfunc, (void*)&reglock))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, bfr,
wait_cbfunc, (void*)&reglock);
if (PMIX_SUCCESS != rc) {
PMIX_DESTRUCT_LOCK(&reglock);
return rc;
}
@ -722,7 +842,6 @@ static void _putfn(int sd, short args, void *cbdata)
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
pmix_status_t rc;
pmix_kval_t *kv = NULL;
pmix_nspace_t *ns;
uint8_t *tmp;
size_t len;
@ -754,52 +873,29 @@ static void _putfn(int sd, short args, void *cbdata)
kv->value->data.bo.size = len;
rc = PMIX_SUCCESS;
} else {
rc = pmix_value_xfer(kv->value, cb->value);
PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer,
kv->value, cb->value);
}
} else {
rc = pmix_value_xfer(kv->value, cb->value);
PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer,
kv->value, cb->value);
}
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto done;
}
/* put it in our own modex hash table in case something
* internal to us wants it - our nsrecord is always
* first on the list */
if (NULL == (ns = (pmix_nspace_t*)pmix_list_get_first(&pmix_globals.nspaces))) {
/* shouldn't be possible */
goto done;
}
if (PMIX_SUCCESS != (rc = pmix_hash_store(&ns->modex, pmix_globals.myid.rank, kv))) {
/* store it */
PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer,
&pmix_globals.myid,
cb->scope, kv);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
}
/* pack the cache that matches the scope - global scope needs
* to go into both local and remote caches */
if (PMIX_LOCAL == cb->scope || PMIX_GLOBAL == cb->scope) {
if (NULL == pmix_globals.cache_local) {
pmix_globals.cache_local = PMIX_NEW(pmix_buffer_t);
}
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: put %s data for key %s in local cache",
cb->key, (PMIX_GLOBAL == cb->scope) ? "global" : "local");
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(pmix_globals.cache_local, kv, 1, PMIX_KVAL))) {
PMIX_ERROR_LOG(rc);
}
}
if (PMIX_REMOTE == cb->scope || PMIX_GLOBAL == cb->scope) {
if (NULL == pmix_globals.cache_remote) {
pmix_globals.cache_remote = PMIX_NEW(pmix_buffer_t);
}
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: put %s data for key %s in remote cache",
cb->key, (PMIX_GLOBAL == cb->scope) ? "global" : "remote");
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(pmix_globals.cache_remote, kv, 1, PMIX_KVAL))) {
PMIX_ERROR_LOG(rc);
}
}
/* mark that fresh values have been stored so we know
* to commit them later */
pmix_globals.commits_pending = true;
done:
if (NULL != kv) {
@ -849,59 +945,131 @@ static void _commitfn(int sd, short args, void *cbdata)
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
pmix_status_t rc;
pmix_scope_t scope;
pmix_buffer_t *msgout;
pmix_buffer_t *msgout, bkt;
pmix_cmd_t cmd=PMIX_COMMIT_CMD;
pmix_kval_t *kv, *kvn;
/* need to acquire the cb object from its originating thread */
PMIX_ACQUIRE_OBJECT(cb);
msgout = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msgout, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msgout, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msgout);
goto done;
goto error;
}
/* if we haven't already done it, ensure we have committed our values */
if (NULL != pmix_globals.cache_local) {
if (pmix_globals.commits_pending) {
/* fetch and pack the local values */
scope = PMIX_LOCAL;
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msgout, &scope, 1, PMIX_SCOPE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msgout, &scope, 1, PMIX_SCOPE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msgout);
goto done;
goto error;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msgout, &pmix_globals.cache_local, 1, PMIX_BUFFER))) {
/* allow the GDS module to pass us this info
* as a local connection as this data would
* only go to another local client */
cb->proc = &pmix_globals.myid;
cb->scope = scope;
cb->copy = false;
PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msgout);
goto done;
goto error;
}
PMIX_RELEASE(pmix_globals.cache_local);
PMIX_CONSTRUCT(&bkt, pmix_buffer_t);
PMIX_LIST_FOREACH_SAFE(kv, kvn, &cb->kvs, pmix_kval_t) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
&bkt, kv, 1, PMIX_KVAL);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&bkt);
PMIX_RELEASE(msgout);
goto error;
}
if (NULL != pmix_globals.cache_remote) {
pmix_list_remove_item(&cb->kvs, &kv->super);
PMIX_RELEASE(kv);
}
/* now pack the result */
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msgout, &bkt, 1, PMIX_BUFFER);
PMIX_DESTRUCT(&bkt);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msgout);
goto error;
}
/* fetch and pack the remote values */
scope = PMIX_REMOTE;
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msgout, &scope, 1, PMIX_SCOPE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msgout, &scope, 1, PMIX_SCOPE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msgout);
goto done;
goto error;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msgout, &pmix_globals.cache_remote, 1, PMIX_BUFFER))) {
/* we need real copies here as this data will
* go to remote procs - so a connection will
* not suffice */
cb->proc = &pmix_globals.myid;
cb->scope = scope;
cb->copy = true;
PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msgout);
goto done;
goto error;
}
PMIX_RELEASE(pmix_globals.cache_remote);
PMIX_CONSTRUCT(&bkt, pmix_buffer_t);
PMIX_LIST_FOREACH_SAFE(kv, kvn, &cb->kvs, pmix_kval_t) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
&bkt, kv, 1, PMIX_KVAL);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&bkt);
PMIX_RELEASE(msgout);
goto error;
}
pmix_list_remove_item(&cb->kvs, &kv->super);
PMIX_RELEASE(kv);
}
/* now pack the result */
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msgout, &bkt, 1, PMIX_BUFFER);
PMIX_DESTRUCT(&bkt);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msgout);
goto error;
}
/* record that all committed data to-date has been sent */
pmix_globals.commits_pending = false;
}
/* always send, even if we have nothing to contribute, so the server knows
* that we contributed whatever we had */
if (PMIX_SUCCESS == (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msgout,
wait_cbfunc, (void*)&cb->lock))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, msgout,
wait_cbfunc, (void*)&cb->lock);
if (PMIX_SUCCESS == rc) {
/* we should wait for the callback, so don't
* modify the active flag */
cb->pstatus = PMIX_SUCCESS;
return;
}
done:
error:
cb->pstatus = rc;
/* post the data so the receiving thread can acquire it */
PMIX_POST_OBJECT(cb);
@ -943,86 +1111,11 @@ static void _commitfn(int sd, short args, void *cbdata)
return rc;
}
static void _peersfn(int sd, short args, void *cbdata)
{
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
pmix_status_t rc;
char **nsprocs=NULL, **nsps=NULL, **tmp;
#if !(defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1))
pmix_nspace_t *nsptr;
pmix_nrec_t *nptr;
#endif
size_t i;
/* need to acquire the cb object from its originating thread */
PMIX_ACQUIRE_OBJECT(cb);
/* cycle across our known nspaces */
tmp = NULL;
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (PMIX_SUCCESS == (rc = pmix_dstore_fetch(cb->nspace, PMIX_RANK_WILDCARD,
cb->key, &cb->value))) {
tmp = pmix_argv_split(cb->value->data.string, ',');
for (i=0; NULL != tmp[i]; i++) {
pmix_argv_append_nosize(&nsps, cb->nspace);
pmix_argv_append_nosize(&nsprocs, tmp[i]);
}
pmix_argv_free(tmp);
tmp = NULL;
}
#else
PMIX_LIST_FOREACH(nsptr, &pmix_globals.nspaces, pmix_nspace_t) {
if (0 == strncmp(nsptr->nspace, cb->nspace, PMIX_MAX_NSLEN)) {
/* cycle across the nodes in this nspace */
PMIX_LIST_FOREACH(nptr, &nsptr->nodes, pmix_nrec_t) {
if (0 == strcmp(cb->key, nptr->name)) {
/* add the contribution from this node */
tmp = pmix_argv_split(nptr->procs, ',');
for (i=0; NULL != tmp[i]; i++) {
pmix_argv_append_nosize(&nsps, nsptr->nspace);
pmix_argv_append_nosize(&nsprocs, tmp[i]);
}
pmix_argv_free(tmp);
tmp = NULL;
}
}
}
}
#endif
if (0 == (i = pmix_argv_count(nsps))) {
/* we don't know this nspace */
rc = PMIX_ERR_NOT_FOUND;
goto done;
}
/* create the required storage */
PMIX_PROC_CREATE(cb->procs, i);
cb->nvals = pmix_argv_count(nsps);
/* transfer the data */
for (i=0; NULL != nsps[i]; i++) {
(void)strncpy(cb->procs[i].nspace, nsps[i], PMIX_MAX_NSLEN);
cb->procs[i].rank = strtol(nsprocs[i], NULL, 10);
}
pmix_argv_free(nsps);
pmix_argv_free(nsprocs);
rc = PMIX_SUCCESS;
done:
cb->pstatus = rc;
/* post the data so the receiving thread can acquire it */
PMIX_POST_OBJECT(cb);
PMIX_WAKEUP_THREAD(&cb->lock);
}
/* need to thread-shift this request */
PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename,
const char *nspace,
pmix_proc_t **procs, size_t *nprocs)
{
pmix_cb_t *cb;
pmix_status_t rc;
PMIX_ACQUIRE_THREAD(&pmix_global_lock);
if (pmix_globals.init_cntr <= 0) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
@ -1030,69 +1123,16 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename,
}
PMIX_RELEASE_THREAD(&pmix_global_lock);
/* create a callback object */
cb = PMIX_NEW(pmix_cb_t);
cb->key = (char*)nodename;
if (NULL != nspace) {
(void)strncpy(cb->nspace, nspace, PMIX_MAX_NSLEN);
}
/* pass this into the event library for thread protection */
PMIX_THREADSHIFT(cb, _peersfn);
/* wait for the result */
PMIX_WAIT_THREAD(&cb->lock);
rc = cb->pstatus;
/* transfer the result */
*procs = cb->procs;
*nprocs = cb->nvals;
/* cleanup */
PMIX_RELEASE(cb);
return rc;
}
static void _nodesfn(int sd, short args, void *cbdata)
{
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
pmix_status_t rc;
char **tmp;
pmix_nspace_t *nsptr;
pmix_nrec_t *nptr;
/* need to acquire the cb object from its originating thread */
PMIX_ACQUIRE_OBJECT(cb);
/* cycle across our known nspaces */
tmp = NULL;
PMIX_LIST_FOREACH(nsptr, &pmix_globals.nspaces, pmix_nspace_t) {
if (0 == strncmp(nsptr->nspace, cb->nspace, PMIX_MAX_NSLEN)) {
/* cycle across the nodes in this nspace */
PMIX_LIST_FOREACH(nptr, &nsptr->nodes, pmix_nrec_t) {
pmix_argv_append_unique_nosize(&tmp, nptr->name, false);
}
}
}
if (NULL == tmp) {
rc = PMIX_ERR_NOT_FOUND;
} else {
cb->key = pmix_argv_join(tmp, ',');
pmix_argv_free(tmp);
rc = PMIX_SUCCESS;
}
cb->pstatus = rc;
/* post the data so the receiving thread can acquire it */
PMIX_POST_OBJECT(cb);
PMIX_WAKEUP_THREAD(&cb->lock);
/* set default */
*procs = NULL;
*nprocs = 0;
return pmix_preg.resolve_peers(nodename, nspace, procs, nprocs);
}
/* need to thread-shift this request */
PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist)
{
pmix_cb_t *cb;
pmix_status_t rc;
PMIX_ACQUIRE_THREAD(&pmix_global_lock);
if (pmix_globals.init_cntr <= 0) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
@ -1100,20 +1140,8 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist
}
PMIX_RELEASE_THREAD(&pmix_global_lock);
/* create a callback object */
cb = PMIX_NEW(pmix_cb_t);
if (NULL != nspace) {
(void)strncpy(cb->nspace, nspace, PMIX_MAX_NSLEN);
}
/* pass this into the event library for thread protection */
PMIX_THREADSHIFT(cb, _nodesfn);
/* wait for the result */
PMIX_WAIT_THREAD(&cb->lock);
rc = cb->pstatus;
*nodelist = cb->key;
PMIX_RELEASE(cb);
return rc;
/* set default */
*nodelist = NULL;
return pmix_preg.resolve_nodes(nspace, nodelist);
}

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

@ -47,16 +47,15 @@
#include PMIX_EVENT_HEADER
#include "src/class/pmix_list.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/threads/threads.h"
#include "src/mca/gds/gds.h"
#include "src/mca/ptl/ptl.h"
#include "pmix_client_ops.h"
#include "src/include/pmix_jobdata.h"
/* callback for wait completion */
static void wait_cbfunc(struct pmix_peer_t *pr,
@ -142,29 +141,39 @@ PMIX_EXPORT pmix_status_t PMIx_Connect_nb(const pmix_proc_t procs[], size_t npro
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack the number of procs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &nprocs, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &nprocs, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, procs, nprocs, PMIX_PROC))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, procs, nprocs, PMIX_PROC);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack the info structs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < ninfo) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, info, ninfo, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -175,11 +184,13 @@ PMIX_EXPORT pmix_status_t PMIx_Connect_nb(const pmix_proc_t procs[], size_t npro
* recv routine so we know which callback to use when
* the return message is recvd */
cb = PMIX_NEW(pmix_cb_t);
cb->op_cbfunc = cbfunc;
cb->cbfunc.opfn = cbfunc;
cb->cbdata = cbdata;
/* push the message into our event base to send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, wait_cbfunc, (void*)cb))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, wait_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
PMIX_RELEASE(cb);
}
@ -260,29 +271,39 @@ PMIX_EXPORT pmix_status_t PMIx_Disconnect_nb(const pmix_proc_t procs[], size_t n
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack the number of procs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &nprocs, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &nprocs, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, procs, nprocs, PMIX_PROC))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, procs, nprocs, PMIX_PROC);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack the info structs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < ninfo) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, info, ninfo, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -293,11 +314,13 @@ PMIX_EXPORT pmix_status_t PMIx_Disconnect_nb(const pmix_proc_t procs[], size_t n
* recv routine so we know which callback to use when
* the return message is recvd */
cb = PMIX_NEW(pmix_cb_t);
cb->op_cbfunc = cbfunc;
cb->cbfunc.opfn = cbfunc;
cb->cbdata = cbdata;
/* push the message into our event base to send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, wait_cbfunc, (void*)cb))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, wait_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
PMIX_RELEASE(cb);
}
@ -317,43 +340,65 @@ static void wait_cbfunc(struct pmix_peer_t *pr,
pmix_status_t ret;
int32_t cnt;
char *nspace;
pmix_buffer_t *bptr;
pmix_buffer_t bkt;
pmix_byte_object_t bo;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:client recv callback activated with %d bytes",
(NULL == buf) ? -1 : (int)buf->bytes_used);
if (NULL == buf) {
ret = PMIX_ERR_BAD_PARAM;
goto report;
}
/* unpack the returned status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &ret, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
ret = rc;
}
/* connect has to also pass back data from all nspace's involved in
* the operation, including our own. Each will come as a buffer */
* the operation, including our own. Each will come as a byte object */
cnt = 1;
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(buf, &bptr, &cnt, PMIX_BUFFER))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &bo, &cnt, PMIX_BYTE_OBJECT);
while (PMIX_SUCCESS == rc) {
/* load it for unpacking */
PMIX_CONSTRUCT(&bkt, pmix_buffer_t);
PMIX_LOAD_BUFFER(pmix_client_globals.myserver, &bkt, bo.bytes, bo.size);
/* unpack the nspace for this blob */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(bptr, &nspace, &cnt, PMIX_STRING))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
&bkt, &nspace, &cnt, PMIX_STRING);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bptr);
PMIX_DESTRUCT(&bkt);
continue;
}
/* extract and process any proc-related info for this nspace */
#if !(defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1))
pmix_job_data_htable_store(nspace, bptr);
#endif
PMIX_GDS_STORE_JOB_INFO(rc, pmix_globals.mypeer, nspace, &bkt);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
}
free(nspace);
PMIX_RELEASE(bptr);
PMIX_DESTRUCT(&bkt);
/* get the next one */
cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &bo, &cnt, PMIX_BYTE_OBJECT);
}
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) {
PMIX_ERROR_LOG(rc);
ret = rc;
}
if (NULL != cb->op_cbfunc) {
cb->op_cbfunc(ret, cb->cbdata);
report:
if (NULL != cb->cbfunc.opfn) {
cb->cbfunc.opfn(ret, cb->cbdata);
}
PMIX_RELEASE(cb);
}

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

@ -47,7 +47,7 @@
#include PMIX_EVENT_HEADER
#include "src/class/pmix_list.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/hash.h"
@ -96,6 +96,7 @@ PMIX_EXPORT pmix_status_t PMIx_Fence(const pmix_proc_t procs[], size_t nprocs,
/* push the message into our event base to send to the server */
if (PMIX_SUCCESS != (rc = PMIx_Fence_nb(procs, nprocs, info, ninfo,
op_cbfunc, cb))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cb);
return rc;
}
@ -165,11 +166,13 @@ PMIX_EXPORT pmix_status_t PMIx_Fence_nb(const pmix_proc_t procs[], size_t nprocs
* recv routine so we know which callback to use when
* the return message is recvd */
cb = PMIX_NEW(pmix_cb_t);
cb->op_cbfunc = cbfunc;
cb->cbfunc.opfn = cbfunc;
cb->cbdata = cbdata;
/* push the message into our event base to send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, wait_cbfunc, (void*)cb))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, wait_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
PMIX_RELEASE(cb);
}
@ -187,7 +190,9 @@ static pmix_status_t unpack_return(pmix_buffer_t *data)
/* unpack the status code */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(data, &ret, &cnt, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
data, &ret, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
@ -203,29 +208,39 @@ static pmix_status_t pack_fence(pmix_buffer_t *msg, pmix_cmd_t cmd,
pmix_status_t rc;
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack the number of procs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &nprocs, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &nprocs, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack any provided procs - must always be at least one (our own) */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, procs, nprocs, PMIX_PROC))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, procs, nprocs, PMIX_PROC);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack the number of info */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack any provided info - may be NULL */
if (NULL != info && 0 < ninfo) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, info, ninfo, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
@ -250,8 +265,8 @@ static void wait_cbfunc(struct pmix_peer_t *pr, pmix_ptl_hdr_t *hdr,
rc = unpack_return(buf);
/* if a callback was provided, execute it */
if (NULL != cb->op_cbfunc) {
cb->op_cbfunc(rc, cb->cbdata);
if (NULL != cb->cbfunc.opfn) {
cb->cbfunc.opfn(rc, cb->cbdata);
}
PMIX_RELEASE(cb);
}

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

@ -24,7 +24,6 @@
#include <pmix_rename.h>
#include "src/include/pmix_globals.h"
#include "src/include/pmix_jobdata.h"
#ifdef HAVE_STRING_H
#include <string.h>
@ -52,20 +51,17 @@
#include PMIX_EVENT_HEADER
#include "src/class/pmix_list.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/threads/threads.h"
#include "src/util/argv.h"
#include "src/util/compress.h"
#include "src/util/error.h"
#include "src/util/hash.h"
#include "src/util/output.h"
#include "src/mca/gds/gds.h"
#include "src/mca/ptl/ptl.h"
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
#include "src/dstore/pmix_dstore.h"
#endif /* PMIX_ENABLE_DSTORE */
#include "pmix_client_ops.h"
#include "src/include/pmix_jobdata.h"
static pmix_buffer_t* _pack_get(char *nspace, pmix_rank_t rank,
const pmix_info_t info[], size_t ninfo,
@ -107,11 +103,13 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
/* wait for the data to return */
PMIX_WAIT_THREAD(&cb->lock);
rc = cb->status;
if (NULL != val) {
*val = cb->value;
}
PMIX_RELEASE(cb);
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:client get completed %d", rc);
"pmix:client get completed");
return rc;
}
@ -174,14 +172,14 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char *key,
"pmix: get_nb value for proc %s:%u key %s",
nm, rank, (NULL == key) ? "NULL" : key);
/* thread-shift so we can check global objects */
/* threadshift this request so we can access global structures */
cb = PMIX_NEW(pmix_cb_t);
(void)strncpy(cb->nspace, nm, PMIX_MAX_NSLEN);
cb->rank = rank;
cb->pname.nspace = strdup(nm);
cb->pname.rank = rank;
cb->key = (char*)key;
cb->info = (pmix_info_t*)info;
cb->ninfo = ninfo;
cb->value_cbfunc = cbfunc;
cb->cbfunc.valuefn = cbfunc;
cb->cbdata = cbdata;
PMIX_THREADSHIFT(cb, _getnbfn);
@ -196,7 +194,9 @@ static void _value_cbfunc(pmix_status_t status, pmix_value_t *kv, void *cbdata)
PMIX_ACQUIRE_OBJECT(cb);
cb->status = status;
if (PMIX_SUCCESS == status) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.copy((void**)&cb->value, kv, PMIX_VALUE))) {
PMIX_BFROPS_COPY(rc, pmix_client_globals.myserver,
(void**)&cb->value, kv, PMIX_VALUE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
}
}
@ -214,31 +214,41 @@ static pmix_buffer_t* _pack_get(char *nspace, pmix_rank_t rank,
/* nope - see if we can get it */
msg = PMIX_NEW(pmix_buffer_t);
/* pack the get cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return NULL;
}
/* pack the request information - we'll get the entire blob
* for this proc, so we don't need to pass the key */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &nspace, 1, PMIX_STRING))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &nspace, 1, PMIX_STRING);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return NULL;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &rank, 1, PMIX_PROC_RANK))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &rank, 1, PMIX_PROC_RANK);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return NULL;
}
/* pack the number of info structs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return NULL;
}
if (0 < ninfo) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, info, ninfo, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return NULL;
@ -247,6 +257,7 @@ static pmix_buffer_t* _pack_get(char *nspace, pmix_rank_t rank,
return msg;
}
/* this callback is coming from the ptl recv, and thus
* is occurring inside of our progress thread - hence, no
* need to thread shift */
@ -259,12 +270,8 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr,
pmix_status_t rc, ret;
pmix_value_t *val = NULL;
int32_t cnt;
pmix_nspace_t *ns, *nptr;
pmix_rank_t rank;
#if (PMIX_ENABLE_DSTORE != 1)
pmix_rank_t cur_rank;
#endif
char *tmp;
pmix_proc_t proc;
pmix_kval_t *kv;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: get_nb callback recvd");
@ -274,210 +281,120 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr,
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return;
}
/* cache the rank */
rank = cb->rank;
/* cache the proc id */
(void)strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
proc.rank = cb->pname.rank;
/* unpack the status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &ret, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
pmix_list_remove_item(&pmix_client_globals.pending_requests, &cb->super);
PMIX_RELEASE(cb);
return;
}
/* look up the nspace object for this proc */
nptr = NULL;
PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_nspace_t) {
if (0 == strncmp(cb->nspace, ns->nspace, PMIX_MAX_NSLEN)) {
nptr = ns;
break;
}
}
if (NULL == nptr) {
/* new nspace - setup a record for it */
nptr = PMIX_NEW(pmix_nspace_t);
(void)strncpy(nptr->nspace, cb->nspace, PMIX_MAX_NSLEN);
pmix_list_append(&pmix_globals.nspaces, &nptr->super);
}
if (PMIX_SUCCESS != ret) {
goto done;
}
#if (defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1))
if (PMIX_SUCCESS != (rc = pmix_dstore_fetch(nptr->nspace, cb->rank, cb->key, &val))){
/* DO NOT error log this status - it is perfectly okay
* for a key not to be found */
PMIX_GDS_ACCEPT_KVS_RESP(rc, pmix_client_globals.myserver, buf);
if (PMIX_SUCCESS != rc) {
goto done;
}
#else
/* we received the entire blob for this process, so
* unpack and store it in the modex - this could consist
* of buffers from multiple scopes */
cur_rank = rank;
cnt = 1;
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(buf, &cur_rank, &cnt, PMIX_PROC_RANK))) {
pmix_kval_t *cur_kval;
pmix_buffer_t *bptr;
cnt = 1;
if (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(buf, &bptr, &cnt, PMIX_BUFFER))) {
/* if the rank is WILDCARD, then this is an nspace blob */
if (PMIX_RANK_WILDCARD == cur_rank) {
char *nspace;
/* unpack the nspace - we don't really need it, but have to
* unpack it to maintain sequence */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(bptr, &nspace, &cnt, PMIX_STRING))) {
PMIX_ERROR_LOG(rc);
return;
}
free(nspace);
pmix_job_data_htable_store(cb->nspace, bptr);
/* Check if the key is in this blob */
pmix_hash_fetch(&nptr->internal, cb->rank, cb->key, &val);
} else {
cnt = 1;
cur_kval = PMIX_NEW(pmix_kval_t);
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(bptr, cur_kval, &cnt, PMIX_KVAL))) {
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: unpacked key %s", cur_kval->key);
if (PMIX_SUCCESS != (rc = pmix_hash_store(&nptr->modex, cur_rank, cur_kval))) {
PMIX_ERROR_LOG(rc);
}
if (NULL != cb->key && 0 == strcmp(cb->key, cur_kval->key)) {
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: found requested value");
if (PMIX_SUCCESS != (rc = pmix_bfrop.copy((void**)&val, cur_kval->value, PMIX_VALUE))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cur_kval);
val = NULL;
goto done;
}
}
PMIX_RELEASE(cur_kval); // maintain acctg - hash_store does a retain
cnt = 1;
cur_kval = PMIX_NEW(pmix_kval_t);
}
cnt = 1;
PMIX_RELEASE(cur_kval);
}
}
PMIX_RELEASE(bptr); // free's the data region
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc &&
PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
rc = PMIX_ERR_SILENT; // avoid error-logging twice
break;
}
}
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc &&
PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
} else {
rc = PMIX_SUCCESS;
}
#endif /* PMIX_ENABLE_DSTORE */
done:
/* if a callback was provided, execute it */
if (NULL != cb && NULL != cb->value_cbfunc) {
if (NULL == val) {
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);
}
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
}
/* we obviously processed this one, so remove it from the
* list of pending requests */
pmix_list_remove_item(&pmix_client_globals.pending_requests, &cb->super);
PMIX_RELEASE(cb);
/* now search any pending requests to see if they can be met */
/* now search any pending requests (including the one this was in
* response to) to see if they can be met. Note that this function
* will only be called if the user requested a specific key - we
* don't support calls to "get" for a NULL key */
PMIX_LIST_FOREACH_SAFE(cb, cb2, &pmix_client_globals.pending_requests, pmix_cb_t) {
if (0 == strncmp(nptr->nspace, cb->nspace, PMIX_MAX_NSLEN) && cb->rank == rank) {
/* we have the data - see if we can find the key */
if (0 == strncmp(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN) &&
cb->pname.rank == proc.rank) {
/* we have the data for this proc - see if we can find the key */
cb->proc = &proc;
cb->scope = PMIX_SCOPE_UNDEF;
/* fetch the data from server peer module - since it is passing
* it back to the user, we need a copy of it */
cb->copy = true;
PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb);
if (PMIX_SUCCESS == rc) {
if (1 != pmix_list_get_size(&cb->kvs)) {
rc = PMIX_ERR_INVALID_VAL;
val = NULL;
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
rc = pmix_dstore_fetch(nptr->nspace, rank, cb->key, &val);
#else
rc = pmix_hash_fetch(&nptr->modex, rank, cb->key, &val);
#endif /* PMIX_ENABLE_DSTORE */
cb->value_cbfunc(rc, val, cb->cbdata);
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
} else {
kv = (pmix_kval_t*)pmix_list_remove_first(&cb->kvs);
val = kv->value;
kv->value = NULL; // protect the value
PMIX_RELEASE(kv);
}
}
cb->cbfunc.valuefn(rc, val, cb->cbdata);
pmix_list_remove_item(&pmix_client_globals.pending_requests, &cb->super);
PMIX_RELEASE(cb);
}
}
}
static pmix_status_t process_val(pmix_value_t *val,
size_t *num_vals,
pmix_pointer_array_t *results)
static void timeout(int fd, short flags, void *cbdata)
{
pmix_info_t *info;
size_t n, nsize, nvals;
pmix_status_t rc;
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
/* let them know that we timed out */
cb->cbfunc.valuefn(PMIX_ERR_TIMEOUT, NULL, cb->cbdata);
cb->timer_running = false;
/* remove this request */
pmix_list_remove_item(&pmix_client_globals.pending_requests, &cb->super);
PMIX_RELEASE(cb);
}
static pmix_status_t process_values(pmix_value_t **v, pmix_cb_t *cb)
{
pmix_list_t *kvs = &cb->kvs;
pmix_kval_t *kv;
pmix_value_t *val;
pmix_info_t *info;
size_t ninfo, n;
if (NULL != cb->key && 1 == pmix_list_get_size(kvs)) {
kv = (pmix_kval_t*)pmix_list_get_first(kvs);
*v = kv->value;
kv->value = NULL; // protect the value
return PMIX_SUCCESS;
}
/* we will return the data as an array of pmix_info_t
* in the kvs pmix_value_t */
val = (pmix_value_t*)malloc(sizeof(pmix_value_t));
if (NULL == val) {
/* this is an error */
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return PMIX_ERR_BAD_PARAM;
return PMIX_ERR_NOMEM;
}
/* since we didn't provide them with a key, the hash function
* must return the results in the pmix_data_array field of the
* value */
/* must account for the deprecated pmix_info_array_t */
if (PMIX_DATA_ARRAY != val->type &&
PMIX_INFO_ARRAY != val->type) {
/* this is an error */
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return PMIX_ERR_BAD_PARAM;
val->type = PMIX_DATA_ARRAY;
val->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t));
if (NULL == val->data.darray) {
PMIX_VALUE_RELEASE(val);
return PMIX_ERR_NOMEM;
}
/* save the results */
if (PMIX_DATA_ARRAY == val->type) {
info = (pmix_info_t*)val->data.darray->array;
nsize = val->data.darray->size;
} else {
info = (pmix_info_t*)val->data.array->array;
nsize = val->data.array->size;
}
nvals = 0;
for (n=0; n < nsize; n++) {
if (0 > (rc = pmix_pointer_array_add(results, &info[n]))) {
return rc;
}
++nvals;
}
if (PMIX_DATA_ARRAY == val->type) {
val->data.darray->array = NULL; // protect the data
val->data.darray->type = PMIX_INFO;
val->data.darray->size = 0;
} else {
val->data.array->array = NULL;
val->data.array->size = 0;
val->data.darray->array = NULL;
ninfo = pmix_list_get_size(kvs);
PMIX_INFO_CREATE(info, ninfo);
if (NULL == info) {
PMIX_VALUE_RELEASE(val);
return PMIX_ERR_NOMEM;
}
/* increment the number of values */
(*num_vals) += nvals;
/* copy the list elements */
n=0;
PMIX_LIST_FOREACH(kv, kvs, pmix_kval_t) {
(void)strncpy(info[n].key, kv->key, PMIX_MAX_KEYLEN);
pmix_value_xfer(&info[n].value, kv->value);
++n;
}
val->data.darray->size = ninfo;
val->data.darray->array = info;
*v = val;
return PMIX_SUCCESS;
}
@ -487,303 +404,96 @@ static void _getnbfn(int fd, short flags, void *cbdata)
pmix_cb_t *cbret;
pmix_buffer_t *msg;
pmix_value_t *val = NULL;
pmix_info_t *info, *iptr;
pmix_pointer_array_t results;
pmix_status_t rc;
pmix_nspace_t *ns, *nptr;
size_t n, nvals;
size_t n;
char *tmp;
bool my_nspace = false, my_rank = false;
pmix_proc_t proc;
bool optional = false;
struct timeval tv;
/* cb was passed to us from another thread - acquire it */
PMIX_ACQUIRE_OBJECT(cb);
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: getnbfn value for proc %s:%d key %s",
cb->nspace, cb->rank,
"pmix: getnbfn value for proc %s:%u key %s",
cb->pname.nspace, cb->pname.rank,
(NULL == cb->key) ? "NULL" : cb->key);
/* find the nspace object */
nptr = NULL;
PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_nspace_t) {
if (0 == strcmp(cb->nspace, ns->nspace)) {
nptr = ns;
break;
}
}
if (NULL == nptr) {
/* we are asking for info about a new nspace - give us
* a chance to learn about it from the server. If the
* server has never heard of it, the server will return
* an error */
nptr = PMIX_NEW(pmix_nspace_t);
(void)strncpy(nptr->nspace, cb->nspace, PMIX_MAX_NSLEN);
pmix_list_append(&pmix_globals.nspaces, &nptr->super);
/* there is no point in looking for data in this nspace
* object, so let's just go generate the request */
goto request;
}
/* set the proc object identifier */
(void)strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
proc.rank = cb->pname.rank;
/* The NULL==key scenario only pertains to cases where legacy
* PMI methods are being employed. In this case, we have to check
* both the job-data and the modex tables. If we don't yet have
* the modex data, then we are going to have to go get it. So let's
* check that case first */
if (NULL == cb->key) {
PMIX_CONSTRUCT(&results, pmix_pointer_array_t);
pmix_pointer_array_init(&results, 2, INT_MAX, 1);
nvals = 0;
/* if the rank is WILDCARD, then they want all the job-level info,
* so no need to check the modex */
if (PMIX_RANK_WILDCARD != cb->rank) {
rc = PMIX_ERR_NOT_FOUND;
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
/* my own data is in the hash table, so don't bother looking
* in the dstore if that is what they want */
if (pmix_globals.myid.rank != cb->rank) {
if (PMIX_SUCCESS == (rc = pmix_dstore_fetch(nptr->nspace, cb->rank, NULL, &val))) {
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_get[%d]: value retrieved from dstore", __LINE__);
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
cb->value_cbfunc(rc, NULL, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
/* scan the incoming directives */
if (NULL != cb->info) {
for (n=0; n < cb->ninfo; n++) {
if (0 == strncmp(cb->info[n].key, PMIX_OPTIONAL, PMIX_MAX_KEYLEN)) {
if (PMIX_UNDEF == cb->info[n].value.type ||
cb->info[n].value.data.flag) {
optional = true;
}
PMIX_RELEASE(cb);
return;
} else if (0 == strncmp(cb->info[n].key, PMIX_TIMEOUT, PMIX_MAX_KEYLEN)) {
/* set a timer to kick us out if we don't
* have an answer within their window */
if (0 < cb->info[n].value.data.integer) {
tv.tv_sec = cb->info[n].value.data.integer;
tv.tv_usec = 0;
pmix_event_evtimer_set(pmix_globals.evbase, &cb->ev,
timeout, cb);
pmix_event_evtimer_add(&cb->ev, &tv);
cb->timer_running = true;
}
} else if (0 == strncmp(cb->info[n].key, PMIX_DATA_SCOPE, PMIX_MAX_KEYLEN)) {
cb->scope = cb->info[n].value.data.scope;
}
}
}
#endif /* PMIX_ENABLE_DSTORE */
if (PMIX_SUCCESS != rc) {
/* if the user was asking about themselves, or we aren't using the dstore,
* then we need to check the hash table */
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->modex, cb->rank, NULL, &val))) {
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_get[%d]: value retrieved from hash", __LINE__);
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
cb->value_cbfunc(rc, NULL, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
}
PMIX_RELEASE(cb);
return;
}
PMIX_VALUE_RELEASE(val);
}
}
if (PMIX_SUCCESS != rc) {
/* if we didn't find a modex for this rank, then we need
* to go get it. Thus, the caller wants -all- information for
* the specified rank, not just the job-level info. */
goto request;
}
}
/* now get any data from the job-level info */
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, PMIX_RANK_WILDCARD, NULL, &val))) {
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
cb->value_cbfunc(rc, NULL, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
}
PMIX_RELEASE(cb);
return;
}
PMIX_VALUE_RELEASE(val);
}
/* now let's package up the results */
PMIX_VALUE_CREATE(val, 1);
val->type = PMIX_DATA_ARRAY;
val->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t));
if (NULL == val->data.darray) {
PMIX_VALUE_RELEASE(val);
cb->value_cbfunc(PMIX_ERR_NOMEM, NULL, cb->cbdata);
return;
}
val->data.darray->type = PMIX_INFO;
val->data.darray->size = nvals;
PMIX_INFO_CREATE(iptr, nvals);
val->data.darray->array = (void*)iptr;
for (n=0; n < (size_t)results.size && n < nvals; n++) {
if (NULL != (info = (pmix_info_t*)pmix_pointer_array_get_item(&results, n))) {
(void)strncpy(iptr[n].key, info->key, PMIX_MAX_KEYLEN);
/* 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_DESTRUCT(info);
}
}
/* done with results array */
PMIX_DESTRUCT(&results);
/* return the result to the caller - they are responsible for releasing it */
cb->value_cbfunc(PMIX_SUCCESS, val, cb->cbdata);
PMIX_RELEASE(cb);
return;
}
/* check the internal storage first */
rc = pmix_hash_fetch(&nptr->internal, cb->rank, cb->key, &val);
cb->proc = &proc;
cb->copy = true;
PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb);
if (PMIX_SUCCESS == rc) {
rc = process_values(&val, cb);
goto respond;
}
my_nspace = (0 == strncmp(cb->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN));
my_rank = (pmix_globals.myid.rank == cb->rank);
/* if the key starts from "pmix", then they are looking for data
* that was provided at startup */
if (0 == strncmp(cb->key, "pmix", 4)) {
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
/* if this is a dstore - check there */
rc = pmix_dstore_fetch(cb->nspace, cb->rank, cb->key, &val);
#endif
if( PMIX_SUCCESS != rc && !my_nspace ){
/* if the key is NULL or starts with "pmix", then they are looking
* for data that was provided by the server at startup */
if (NULL == cb->key || 0 == strncmp(cb->key, "pmix", 4)) {
cb->proc = &proc;
/* fetch the data from my server's module - since we are passing
* it back to the user, we need a copy of it */
cb->copy = true;
PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb);
if (PMIX_SUCCESS != rc) {
if (0 != strncmp(cb->pname.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN)) {
/* we are asking about the job-level info from another
* namespace. It seems that we don't have it - go and
* ask server
*/
goto request;
}
/* we supposed to already have all local namespace data */
} else {
/* we should have had this info, so respond with the error */
goto respond;
}
/* if we were asked about this rank */
if ( my_nspace && my_rank ){
/* if we asking the data about this rank - check local hash table.
* All the data passed through PMIx_Put settle down there
* if there is nothing there - it's nothing else we can do
*/
rc = pmix_hash_fetch(&nptr->modex, pmix_globals.myid.rank, cb->key, &val);
}
rc = process_values(&val, cb);
goto respond;
} else {
cb->proc = &proc;
cb->copy = true;
PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb);
if (PMIX_SUCCESS != rc) {
rc = PMIX_ERR_NOT_FOUND;
}
goto respond;
}
/* otherwise, the data must be something they "put" */
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
rc = PMIX_ERR_PROC_ENTRY_NOT_FOUND;
/* if rank is undefined - check local table first */
if ( my_nspace && (PMIX_RANK_UNDEF == cb->rank)){
/* if we asking about undefined process - check local hash table first
* local rank may have submitted this key. */
rc = pmix_hash_fetch(&nptr->modex, pmix_globals.myid.rank, cb->key, &val);
}
/* try to take it from dstore */
if( PMIX_ERR_PROC_ENTRY_NOT_FOUND == rc ){
/* Two option possible here:
- we asking the key from UNDEF process and local proc
haven't pushed this data
- we askin the key from the particular process which is not us.
*/
rc = pmix_dstore_fetch(nptr->nspace, cb->rank, cb->key, &val);
}
#else
rc = pmix_hash_fetch(&nptr->modex, cb->rank, cb->key, &val);
#endif /* PMIX_ENABLE_DSTORE */
if ( PMIX_SUCCESS == rc ) {
goto respond;
} else if ( PMIX_ERR_PROC_ENTRY_NOT_FOUND == rc ){
goto request;
}else if (PMIX_ERR_NOT_FOUND == rc) {
/* we have the modex data from this proc, but didn't find the key
* the user requested. It's possible someone pushed something since
* we got this data, so let's ask the server for an update. However,
* we do have to protect against an infinite loop! */
if (cb->checked) {
goto respond;
}
pmix_output_verbose(2, pmix_globals.debug_output,
"Unable to locally satisfy request for key=%s for rank = %d, namespace = %s",
cb->key, cb->rank, cb->nspace);
cb->checked = true; // flag that we are going to check this again
goto request;
} else if (PMIX_ERR_PROC_ENTRY_NOT_FOUND != rc) {
/* errors are fatal */
goto respond;
}
request:
/* if we got here, then we don't have the data for this proc. If we
* are a server, or we are a client and not connected, then there is
* nothing more we can do */
if (PMIX_PROC_IS_SERVER ||
(!PMIX_PROC_IS_SERVER && !pmix_globals.connected)) {
rc = PMIX_ERR_NOT_FOUND;
goto respond;
}
/* we also have to check the user's directives to see if they do not want
* us to attempt to retrieve it from the server */
for (n=0; n < cb->ninfo; n++) {
if ((0 == strcmp(cb->info[n].key, PMIX_OPTIONAL) || (0 == strcmp(cb->info[n].key, PMIX_IMMEDIATE))) &&
(PMIX_UNDEF == cb->info[n].value.type || cb->info[n].value.data.flag)) {
/* they don't want us to try and retrieve it */
pmix_output_verbose(2, pmix_globals.debug_output,
"PMIx_Get key=%s for rank = %d, namespace = %s was not found - request was optional",
cb->key, cb->rank, cb->nspace);
rc = PMIX_ERR_NOT_FOUND;
val = NULL;
goto respond;
goto request;
}
/* return whatever we found */
rc = process_values(&val, cb);
}
/* see if we already have a request in place with the server for data from
* this nspace:rank. If we do, then no need to ask again as the
* request will return _all_ data from that proc */
PMIX_LIST_FOREACH(cbret, &pmix_client_globals.pending_requests, pmix_cb_t) {
if (0 == strncmp(cbret->nspace, cb->nspace, PMIX_MAX_NSLEN) &&
cbret->rank == cb->rank) {
/* we do have a pending request, but we still need to track this
* outstanding request so we can satisfy it once the data is returned */
pmix_list_append(&pmix_client_globals.pending_requests, &cb->super);
return;
}
}
/* we don't have a pending request, so let's create one - don't worry
* about packing the key as we return everything from that proc */
msg = _pack_get(cb->nspace, cb->rank, cb->info, cb->ninfo, PMIX_GETNB_CMD);
if (NULL == msg) {
rc = PMIX_ERROR;
goto respond;
}
pmix_output_verbose(2, pmix_globals.debug_output,
"%s:%d REQUESTING DATA FROM SERVER FOR %s:%d KEY %s",
pmix_globals.myid.nspace, pmix_globals.myid.rank,
cb->nspace, cb->rank, cb->key);
/* track the callback object */
pmix_list_append(&pmix_client_globals.pending_requests, &cb->super);
/* send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, _getnb_cbfunc, (void*)cb))){
pmix_list_remove_item(&pmix_client_globals.pending_requests, &cb->super);
rc = PMIX_ERROR;
goto respond;
}
/* we made a lot of changes to cb, so ensure they get
* written out before we return */
PMIX_POST_OBJECT(cb);
return;
respond:
/* if a callback was provided, execute it */
if (NULL != cb->value_cbfunc) {
if (NULL != cb->cbfunc.valuefn) {
if (NULL != val) {
/* if this is a compressed string, then uncompress it */
if (PMIX_COMPRESSED_STRING == val->type) {
@ -799,11 +509,72 @@ static void _getnbfn(int fd, short flags, void *cbdata)
}
}
}
cb->value_cbfunc(rc, val, cb->cbdata);
cb->cbfunc.valuefn(rc, val, cb->cbdata);
}
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
}
PMIX_RELEASE(cb);
return;
request:
/* if we got here, then we don't have the data for this proc. If we
* are a server, or we are a client and not connected, then there is
* nothing more we can do */
if (PMIX_PROC_SERVER == pmix_globals.proc_type ||
(PMIX_PROC_SERVER != pmix_globals.proc_type && !pmix_globals.connected)) {
rc = PMIX_ERR_NOT_FOUND;
goto respond;
}
/* we also have to check the user's directives to see if they do not want
* us to attempt to retrieve it from the server */
if (optional) {
/* they don't want us to try and retrieve it */
pmix_output_verbose(2, pmix_globals.debug_output,
"PMIx_Get key=%s for rank = %u, namespace = %s was not found - request was optional",
cb->key, cb->pname.rank, cb->pname.nspace);
rc = PMIX_ERR_NOT_FOUND;
goto respond;
}
/* see if we already have a request in place with the server for data from
* this nspace:rank. If we do, then no need to ask again as the
* request will return _all_ data from that proc */
PMIX_LIST_FOREACH(cbret, &pmix_client_globals.pending_requests, pmix_cb_t) {
if (0 == strncmp(cbret->pname.nspace, cb->pname.nspace, PMIX_MAX_NSLEN) &&
cbret->pname.rank == cb->pname.rank) {
/* we do have a pending request, but we still need to track this
* outstanding request so we can satisfy it once the data is returned */
pmix_list_append(&pmix_client_globals.pending_requests, &cb->super);
return;
}
}
/* we don't have a pending request, so let's create one - don't worry
* about packing the key as we return everything from that proc */
msg = _pack_get(cb->pname.nspace, cb->pname.rank, cb->info, cb->ninfo, PMIX_GETNB_CMD);
if (NULL == msg) {
rc = PMIX_ERROR;
goto respond;
}
pmix_output_verbose(2, pmix_globals.debug_output,
"%s:%d REQUESTING DATA FROM SERVER FOR %s:%d KEY %s",
pmix_globals.myid.nspace, pmix_globals.myid.rank,
cb->pname.nspace, cb->pname.rank, cb->key);
/* track the callback object */
pmix_list_append(&pmix_client_globals.pending_requests, &cb->super);
/* send to the server */
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, msg, _getnb_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
pmix_list_remove_item(&pmix_client_globals.pending_requests, &cb->super);
rc = PMIX_ERROR;
goto respond;
}
/* we made a lot of changes to cb, so ensure they get
* written out before we return */
PMIX_POST_OBJECT(cb);
return;
}

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

@ -13,9 +13,9 @@
#include <src/include/pmix_config.h>
#include "src/buffer_ops/buffer_ops.h"
#include "src/class/pmix_hash_table.h"
#include "src/threads/threads.h"
#include "src/class/pmix_list.h"
#include "src/include/pmix_globals.h"
BEGIN_C_DECLS

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

@ -47,8 +47,8 @@
#include PMIX_EVENT_HEADER
#include "src/class/pmix_list.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/threads/threads.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
@ -141,40 +141,52 @@ PMIX_EXPORT pmix_status_t PMIx_Publish_nb(const pmix_info_t info[], size_t ninfo
/* create the publish cmd */
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack our effective userid - will be used to constrain lookup */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &pmix_globals.uid, 1, PMIX_UINT32))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &pmix_globals.uid, 1, PMIX_UINT32);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pass the number of info structs - needed on remote end so
* space can be malloc'd for the values */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < ninfo) {
/* pack the info structs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, info, ninfo, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
}
/* create a callback object as we need to pass it to the
* recv routine so we know which callback to use when
* the return message is recvd */
cb = PMIX_NEW(pmix_cb_t);
cb->op_cbfunc = cbfunc;
cb->cbfunc.opfn = cbfunc;
cb->cbdata = cbdata;
/* push the message into our event base to send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, wait_cbfunc, (void*)cb))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, wait_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
PMIX_RELEASE(cb);
}
@ -256,7 +268,7 @@ PMIX_EXPORT pmix_status_t PMIx_Lookup_nb(char **keys,
PMIX_ACQUIRE_THREAD(&pmix_global_lock);
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: lookup called");
"pmix: lookup_nb called");
if (pmix_globals.init_cntr <= 0) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
@ -278,27 +290,35 @@ PMIX_EXPORT pmix_status_t PMIx_Lookup_nb(char **keys,
/* create the lookup cmd */
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack our effective userid - will be used to constrain lookup */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &pmix_globals.uid, 1, PMIX_UINT32))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &pmix_globals.uid, 1, PMIX_UINT32);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack the keys */
nkeys = pmix_argv_count(keys);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &nkeys, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &nkeys, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < nkeys) {
for (n=0; n < nkeys; n++) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &keys[n], 1, PMIX_STRING))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &keys[n], 1, PMIX_STRING);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -307,27 +327,35 @@ PMIX_EXPORT pmix_status_t PMIx_Lookup_nb(char **keys,
}
/* pass the number of info structs - needed on remote end so
* space can be malloc'd for the values */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < ninfo) {
/* pack the info structs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, info, ninfo, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
}
/* create a callback object as we need to pass it to the
* recv routine so we know which callback to use when
* the return message is recvd */
cb = PMIX_NEW(pmix_cb_t);
cb->lookup_cbfunc = cbfunc;
cb->cbfunc.lookupfn = cbfunc;
cb->cbdata = cbdata;
/* send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, wait_lookup_cbfunc, (void*)cb))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, wait_lookup_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
PMIX_RELEASE(cb);
}
@ -408,27 +436,35 @@ PMIX_EXPORT pmix_status_t PMIx_Unpublish_nb(char **keys,
/* create the unpublish cmd */
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack our effective userid - will be used to constrain lookup */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &pmix_globals.uid, 1, PMIX_UINT32))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &pmix_globals.uid, 1, PMIX_UINT32);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack the number of keys */
i = pmix_argv_count(keys);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &i, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &i, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < i) {
for (j=0; j < i; j++) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &keys[j], 1, PMIX_STRING))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &keys[j], 1, PMIX_STRING);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -437,25 +473,33 @@ PMIX_EXPORT pmix_status_t PMIx_Unpublish_nb(char **keys,
}
/* pass the number of info structs - needed on remote end so
* space can be malloc'd for the values */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < ninfo) {
/* pack the info structs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, info, ninfo, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
}
/* create a callback object */
cb = PMIX_NEW(pmix_cb_t);
cb->op_cbfunc = cbfunc;
cb->cbfunc.opfn = cbfunc;
cb->cbdata = cbdata;
/* send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, wait_cbfunc, (void*)cb))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, wait_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
PMIX_RELEASE(cb);
}
@ -478,13 +522,22 @@ static void wait_cbfunc(struct pmix_peer_t *pr,
"pmix:client recv callback activated with %d bytes",
(NULL == buf) ? -1 : (int)buf->bytes_used);
if (NULL == buf) {
rc = PMIX_ERR_BAD_PARAM;
goto report;
}
/* unpack the returned status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &ret, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
}
if (NULL != cb->op_cbfunc) {
cb->op_cbfunc(rc, cb->cbdata);
report:
if (NULL != cb->cbfunc.opfn) {
cb->cbfunc.opfn(rc, cb->cbdata);
}
PMIX_RELEASE(cb);
}
@ -505,8 +558,8 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr,
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
pmix_status_t rc, ret;
int32_t cnt;
pmix_pdata_t *pdata;
size_t ndata;
pmix_pdata_t *pdata = NULL;
size_t ndata = 0;
PMIX_ACQUIRE_OBJECT(cb);
@ -514,11 +567,15 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr,
"pmix:client recv callback activated with %d bytes",
(NULL == buf) ? -1 : (int)buf->bytes_used);
if (NULL == cb->lookup_cbfunc) {
if (NULL == cb->cbfunc.lookupfn) {
/* nothing we can do with this */
PMIX_RELEASE(cb);
return;
}
if (NULL == buf) {
rc = PMIX_ERR_BAD_PARAM;
goto report;
}
/* set the defaults */
pdata = NULL;
@ -526,13 +583,15 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr,
/* unpack the returned status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &ret, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
ret = rc;
}
if (PMIX_SUCCESS != ret) {
if (NULL != cb->lookup_cbfunc) {
cb->lookup_cbfunc(ret, NULL, 0, cb->cbdata);
if (NULL != cb->cbfunc.lookupfn) {
cb->cbfunc.lookupfn(ret, NULL, 0, cb->cbdata);
}
PMIX_RELEASE(cb);
return;
@ -540,7 +599,9 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr,
/* unpack the number of returned values */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ndata, &cnt, PMIX_SIZE))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &ndata, &cnt, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cb);
return;
@ -550,19 +611,24 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr,
PMIX_PDATA_CREATE(pdata, ndata);
cnt = ndata;
/* unpack the returned values into the pdata array */
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, pdata, &cnt, PMIX_PDATA))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, pdata, &cnt, PMIX_PDATA);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
}
if (NULL != cb->lookup_cbfunc) {
cb->lookup_cbfunc(rc, pdata, ndata, cb->cbdata);
report:
if (NULL != cb->cbfunc.lookupfn) {
cb->cbfunc.lookupfn(rc, pdata, ndata, cb->cbdata);
}
cleanup:
/* cleanup */
if (NULL != pdata) {
PMIX_PDATA_FREE(pdata, ndata);
}
PMIX_RELEASE(cb);
}
@ -585,7 +651,7 @@ static void lookup_cbfunc(pmix_status_t status, pmix_pdata_t pdata[], size_t nda
(void)strncpy(tgt[j].proc.nspace, pdata[i].proc.nspace, PMIX_MAX_NSLEN);
tgt[j].proc.rank = pdata[i].proc.rank;
/* transfer the value to the pmix_info_t */
pmix_value_xfer(&tgt[j].value, &pdata[i].value);
PMIX_BFROPS_VALUE_XFER(cb->status, pmix_client_globals.myserver, &tgt[j].value, &pdata[i].value);
break;
}
}

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

@ -47,15 +47,15 @@
#include PMIX_EVENT_HEADER
#include "src/class/pmix_list.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/threads/threads.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/mca/gds/gds.h"
#include "src/mca/ptl/ptl.h"
#include "pmix_client_ops.h"
#include "src/include/pmix_jobdata.h"
static void wait_cbfunc(struct pmix_peer_t *pr,
pmix_ptl_hdr_t *hdr,
@ -104,7 +104,7 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo,
PMIX_WAIT_THREAD(&cb->lock);
rc = cb->status;
if (NULL != nspace) {
(void)strncpy(nspace, cb->nspace, PMIX_MAX_NSLEN);
(void)strncpy(nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
}
PMIX_RELEASE(cb);
@ -139,20 +139,26 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack the job-level directives */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < ninfo) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, job_info, ninfo, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, job_info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -160,13 +166,17 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin
}
/* pack the apps */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &napps, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &napps, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < napps) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, apps, napps, PMIX_APP))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, apps, napps, PMIX_APP);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -177,11 +187,13 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin
* recv routine so we know which callback to use when
* the return message is recvd */
cb = PMIX_NEW(pmix_cb_t);
cb->spawn_cbfunc = cbfunc;
cb->cbfunc.spawnfn = cbfunc;
cb->cbdata = cbdata;
/* push the message into our event base to send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, wait_cbfunc, (void*)cb))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, wait_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
PMIX_RELEASE(cb);
}
@ -209,16 +221,25 @@ static void wait_cbfunc(struct pmix_peer_t *pr,
/* init */
memset(nspace, 0, PMIX_MAX_NSLEN+1);
if (NULL == buf) {
ret = PMIX_ERR_BAD_PARAM;
goto report;
}
/* unpack the returned status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &ret, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
ret = rc;
}
if (PMIX_SUCCESS == ret) {
/* unpack the namespace */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &n2, &cnt, PMIX_STRING))) {
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
buf, &n2, &cnt, PMIX_STRING);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
ret = rc;
}
@ -226,19 +247,21 @@ static void wait_cbfunc(struct pmix_peer_t *pr,
"pmix:client recv '%s'", n2);
if (NULL != n2) {
/* protect length */
(void)strncpy(nspace, n2, PMIX_MAX_NSLEN);
#if !(defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1))
/* extract and process any proc-related info for this nspace */
pmix_job_data_htable_store(nspace, buf);
#endif
free(n2);
PMIX_GDS_STORE_JOB_INFO(rc, pmix_globals.mypeer, nspace, buf);
/* extract and process any job-related info for this nspace */
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
}
}
}
if (NULL != cb->spawn_cbfunc) {
cb->spawn_cbfunc(ret, nspace, cb->cbdata);
report:
if (NULL != cb->cbfunc.spawnfn) {
cb->cbfunc.spawnfn(ret, nspace, cb->cbdata);
}
cb->cbdata = NULL;
PMIX_RELEASE(cb);
}
@ -249,7 +272,7 @@ static void spawn_cbfunc(pmix_status_t status, char nspace[], void *cbdata)
PMIX_ACQUIRE_OBJECT(cb);
cb->status = status;
if (NULL != nspace) {
(void)strncpy(cb->nspace, nspace, PMIX_MAX_NSLEN);
cb->pname.nspace = strdup(nspace);
}
PMIX_POST_OBJECT(cb);
PMIX_WAKEUP_THREAD(&cb->lock);

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

@ -13,6 +13,5 @@ sources += \
common/pmix_query.c \
common/pmix_strings.c \
common/pmix_log.c \
common/pmix_jobdata.c \
common/pmix_control.c \
common/pmix_data.c

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

@ -25,7 +25,7 @@
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/mca/ptl/ptl.h"
#include "src/client/pmix_client_ops.h"
@ -60,7 +60,8 @@ static void query_cbfunc(struct pmix_peer_t *peer,
/* unpack the status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &results->status, &cnt, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, peer, buf, &results->status, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto complete;
}
@ -70,14 +71,16 @@ static void query_cbfunc(struct pmix_peer_t *peer,
/* unpack any returned data */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &results->ninfo, &cnt, PMIX_SIZE))) {
PMIX_BFROPS_UNPACK(rc, peer, buf, &results->ninfo, &cnt, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto complete;
}
if (0 < results->ninfo) {
PMIX_INFO_CREATE(results->info, results->ninfo);
cnt = results->ninfo;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, results->info, &cnt, PMIX_INFO))) {
PMIX_BFROPS_UNPACK(rc, peer, buf, results->info, &cnt, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto complete;
}
@ -138,14 +141,18 @@ PMIX_EXPORT pmix_status_t PMIx_Job_control_nb(const pmix_proc_t targets[], size_
/* if we are a client, then relay this request to the server */
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack the number of targets */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ntargets, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ntargets, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -154,7 +161,9 @@ PMIX_EXPORT pmix_status_t PMIx_Job_control_nb(const pmix_proc_t targets[], size_
* is to be done against all members of our nspace */
if (0 < ntargets) {
/* pack the targets */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, targets, ntargets, PMIX_PROC))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, targets, ntargets, PMIX_PROC);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -162,13 +171,17 @@ PMIX_EXPORT pmix_status_t PMIx_Job_control_nb(const pmix_proc_t targets[], size_
}
/* pack the directives */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ndirs, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ndirs, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < ndirs) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, directives, ndirs, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, directives, ndirs, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -183,7 +196,9 @@ PMIX_EXPORT pmix_status_t PMIx_Job_control_nb(const pmix_proc_t targets[], size_
cb->cbdata = cbdata;
/* push the message into our event base to send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, query_cbfunc, (void*)cb))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, query_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
PMIX_RELEASE(cb);
}
@ -234,34 +249,44 @@ PMIX_EXPORT pmix_status_t PMIx_Process_monitor_nb(const pmix_info_t *monitor, pm
/* if we are a client, then relay this request to the server */
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack the monitor */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, monitor, 1, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, monitor, 1, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack the error */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &error, 1, PMIX_STATUS))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &error, 1, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack the directives */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ndirs, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ndirs, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < ndirs) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, directives, ndirs, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, directives, ndirs, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -276,7 +301,9 @@ PMIX_EXPORT pmix_status_t PMIx_Process_monitor_nb(const pmix_info_t *monitor, pm
cb->cbdata = cbdata;
/* push the message into our event base to send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, query_cbfunc, (void*)cb))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, query_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
PMIX_RELEASE(cb);
}

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

@ -34,7 +34,8 @@
#include <pmix_common.h>
#include <pmix_rename.h>
#include "src/buffer_ops/buffer_ops.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/include/pmix_globals.h"
#define PMIX_EMBED_DATA_BUFFER(b, db) \
do { \
@ -78,7 +79,8 @@ PMIX_EXPORT pmix_status_t PMIx_Data_pack(pmix_data_buffer_t *buffer,
PMIX_EMBED_DATA_BUFFER(&buf, buffer);
/* pack the value */
rc = pmix_bfrop.pack(&buf, src, num_vals, type);
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer,
&buf, src, num_vals, type);
/* extract the data buffer - the pointers may have changed */
PMIX_EXTRACT_DATA_BUFFER(&buf, buffer);
@ -102,7 +104,8 @@ PMIX_EXPORT pmix_status_t PMIx_Data_unpack(pmix_data_buffer_t *buffer, void *des
PMIX_EMBED_DATA_BUFFER(&buf, buffer);
/* unpack the value */
rc = pmix_bfrop.unpack(&buf, dest, max_num_values, type);
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer,
&buf, dest, max_num_values, type);
/* extract the data buffer - the pointers may have changed */
PMIX_EXTRACT_DATA_BUFFER(&buf, buffer);
@ -117,7 +120,8 @@ PMIX_EXPORT pmix_status_t PMIx_Data_copy(void **dest, void *src,
pmix_status_t rc;
/* copy the value */
rc = pmix_bfrop.copy(dest, src, type);
PMIX_BFROPS_COPY(rc, pmix_globals.mypeer,
dest, src, type);
return rc;
}
@ -128,7 +132,8 @@ PMIX_EXPORT pmix_status_t PMIx_Data_print(char **output, char *prefix,
pmix_status_t rc;
/* print the value */
rc = pmix_bfrop.print(output, prefix, src, type);
PMIX_BFROPS_PRINT(rc, pmix_globals.mypeer,
output, prefix, src, type);
return rc;
}
@ -148,7 +153,8 @@ PMIX_EXPORT pmix_status_t PMIx_Data_copy_payload(pmix_data_buffer_t *dest,
PMIX_EMBED_DATA_BUFFER(&buf2, src);
/* copy payload */
rc = pmix_bfrop.copy_payload(&buf1, &buf2);
PMIX_BFROPS_COPY_PAYLOAD(rc, pmix_globals.mypeer,
&buf1, &buf2);
/* extract the dest data buffer - the pointers may have changed */
PMIX_EXTRACT_DATA_BUFFER(&buf1, dest);

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

@ -1,415 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2016-2017 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <pmix_server.h>
#include <pmix_common.h>
#include "src/include/pmix_globals.h"
#include "src/client/pmix_client_ops.h"
#include "src/class/pmix_value_array.h"
#include "src/util/error.h"
#include "src/buffer_ops/internal.h"
#include "src/util/argv.h"
#include "src/util/compress.h"
#include "src/util/hash.h"
#include "src/util/show_help.h"
#include "src/runtime/pmix_rte.h"
#include "src/include/pmix_jobdata.h"
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
#include "src/dstore/pmix_dstore.h"
#endif
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 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_status_t rc = PMIX_SUCCESS;
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
uint32_t i, size;
pmix_buffer_t *tmp = NULL;
pmix_rank_t cur_rank;
if (NULL != cb->dstore_fn) {
/* rank WILDCARD contained in the 0 item */
cur_rank = PMIX_RANK_WILDCARD == rank ? 0 : rank + 1;
size = (uint32_t)pmix_value_array_get_size(cb->bufs);
if ((cur_rank + 1) <= size) {
tmp = &(PMIX_VALUE_ARRAY_GET_ITEM(cb->bufs, pmix_buffer_t, cur_rank));
pmix_bfrop.pack(tmp, kv, 1, PMIX_KVAL);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_value_array_set_size(cb->bufs, cur_rank + 1))) {
PMIX_ERROR_LOG(rc);
return rc;
}
for (i = size; i < (cur_rank + 1); i++) {
tmp = &(PMIX_VALUE_ARRAY_GET_ITEM(cb->bufs, pmix_buffer_t, i));
PMIX_CONSTRUCT(tmp, pmix_buffer_t);
}
pmix_bfrop.pack(tmp, kv, 1, PMIX_KVAL);
}
#endif
if (cb->hstore_fn) {
if (PMIX_SUCCESS != (rc = cb->hstore_fn(&cb->nsptr->internal, rank, kv))) {
PMIX_ERROR_LOG(rc);
}
}
return rc;
}
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
static inline int _rank_key_dstore_store(void *cbdata)
{
int rc = PMIX_SUCCESS;
uint32_t i, size;
pmix_buffer_t *tmp;
pmix_job_data_caddy_t *cb = (pmix_job_data_caddy_t*)cbdata;
pmix_rank_t rank;
pmix_kval_t *kv = NULL;
bool flag = true;
if (NULL == cb->bufs) {
rc = PMIX_ERR_BAD_PARAM;
PMIX_ERROR_LOG(rc);
goto exit;
}
kv = PMIX_NEW(pmix_kval_t);
kv->key = strdup("jobinfo");
PMIX_VALUE_CREATE(kv->value, 1);
kv->value->type = PMIX_BYTE_OBJECT;
size = pmix_value_array_get_size(cb->bufs);
for (i = 0; i < size; i++) {
tmp = &(PMIX_VALUE_ARRAY_GET_ITEM(cb->bufs, pmix_buffer_t, i));
rank = 0 == i ? PMIX_RANK_WILDCARD : i - 1;
PMIX_UNLOAD_BUFFER(tmp, kv->value->data.bo.bytes, kv->value->data.bo.size);
if (NULL == kv->value->data.bo.bytes) {
if (flag && !pmix_suppress_missing_data_warning) {
/* this occurs if the host RM did _not_ provide us with
* data for every process in the job, in non-compliance
* with the PMIx standard. Warn the user that their job
* may not scale as desired, and give them a way to turn
* that warning off in case the RM just can't do it */
pmix_show_help("help-pmix-runtime.txt", "missingdata", true);
/* only show this once */
flag = false;
}
} else {
if (PMIX_SUCCESS != (rc = cb->dstore_fn(cb->nsptr->nspace, rank, kv))) {
PMIX_ERROR_LOG(rc);
goto exit;
}
}
}
exit:
if (NULL != kv) {
PMIX_RELEASE(kv);
}
return rc;
}
#endif
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
pmix_status_t pmix_job_data_dstore_store(const char *nspace, pmix_buffer_t *bptr)
{
pmix_job_data_caddy_t *cd = PMIX_NEW(pmix_job_data_caddy_t);
cd->job_data = bptr;
cd->dstore_fn = pmix_dstore_store;
return _job_data_store(nspace, cd);
}
#endif
pmix_status_t pmix_job_data_htable_store(const char *nspace, pmix_buffer_t *bptr)
{
pmix_job_data_caddy_t *cb = PMIX_NEW(pmix_job_data_caddy_t);
cb->job_data = bptr;
cb->hstore_fn = pmix_hash_store;
return _job_data_store(nspace, cb);
}
static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
{
pmix_buffer_t *job_data = ((pmix_job_data_caddy_t*)(cbdata))->job_data;
pmix_job_data_caddy_t *cb = (pmix_job_data_caddy_t*)(cbdata);
pmix_status_t rc = PMIX_SUCCESS;
pmix_nspace_t *nsptr = NULL, *nsptr2 = NULL;
pmix_kval_t *kptr, *kp2, kv;
int32_t cnt;
size_t nnodes, len;
uint32_t i;
#if !(defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1))
uint32_t j;
#endif
pmix_nrec_t *nrec, *nr2;
char **procs = NULL;
uint8_t *tmp;
pmix_byte_object_t *bo;
pmix_buffer_t buf2;
int rank;
char *proc_type_str = PMIX_PROC_SERVER == pmix_globals.proc_type ?
"server" : "client";
pmix_output_verbose(10, pmix_globals.debug_output,
"[%s:%d] pmix:%s pmix_jobdata_store %s",
pmix_globals.myid.nspace, pmix_globals.myid.rank,
proc_type_str, nspace);
/* check buf data */
if ((NULL == job_data) || (0 == job_data->bytes_used)) {
rc = PMIX_ERR_BAD_PARAM;
PMIX_ERROR_LOG(rc);
return rc;
}
PMIX_LIST_FOREACH(nsptr2, &pmix_globals.nspaces, pmix_nspace_t) {
if (0 == strcmp(nsptr2->nspace, nspace)) {
nsptr = nsptr2;
break;
}
}
if (NULL == nsptr) {
/* we don't know this nspace - add it */
nsptr = PMIX_NEW(pmix_nspace_t);
(void)strncpy(nsptr->nspace, nspace, PMIX_MAX_NSLEN);
pmix_list_append(&pmix_globals.nspaces, &nsptr->super);
}
cb->nsptr = nsptr;
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (NULL == (cb->bufs = PMIX_NEW(pmix_value_array_t))) {
rc = PMIX_ERR_OUT_OF_RESOURCE;
PMIX_ERROR_LOG(rc);
goto exit;
}
if (PMIX_SUCCESS != (rc = pmix_value_array_init(cb->bufs, sizeof(pmix_buffer_t)))) {
PMIX_ERROR_LOG(rc);
goto exit;
}
#endif
cnt = 1;
kptr = PMIX_NEW(pmix_kval_t);
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(job_data, kptr, &cnt, PMIX_KVAL)))
{
if (0 == strcmp(kptr->key, PMIX_PROC_BLOB)) {
bo = &(kptr->value->data.bo);
PMIX_CONSTRUCT(&buf2, pmix_buffer_t);
PMIX_LOAD_BUFFER(&buf2, bo->bytes, bo->size);
/* start by unpacking the rank */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(&buf2, &rank, &cnt, PMIX_PROC_RANK))) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&buf2);
goto exit;
}
kp2 = PMIX_NEW(pmix_kval_t);
kp2->key = strdup(PMIX_RANK);
PMIX_VALUE_CREATE(kp2->value, 1);
kp2->value->type = PMIX_PROC_RANK;
kp2->value->data.rank = rank;
if (PMIX_SUCCESS != (rc = _add_key_for_rank(rank, kp2, cb))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(kp2);
PMIX_DESTRUCT(&buf2);
goto exit;
}
PMIX_RELEASE(kp2); // maintain accounting
cnt = 1;
kp2 = PMIX_NEW(pmix_kval_t);
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
* in the job-level data hash_table */
if (PMIX_SUCCESS != (rc = _add_key_for_rank(rank, kp2, cb))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(kp2);
PMIX_DESTRUCT(&buf2);
goto exit;
}
PMIX_RELEASE(kp2); // maintain accounting
kp2 = PMIX_NEW(pmix_kval_t);
}
/* cleanup */
PMIX_DESTRUCT(&buf2); // releases the original kptr data
PMIX_RELEASE(kp2);
} else if (0 == strcmp(kptr->key, PMIX_MAP_BLOB)) {
/* transfer the byte object for unpacking */
bo = &(kptr->value->data.bo);
PMIX_CONSTRUCT(&buf2, pmix_buffer_t);
PMIX_LOAD_BUFFER(&buf2, bo->bytes, bo->size);
/* start by unpacking the number of nodes */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(&buf2, &nnodes, &cnt, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&buf2);
goto exit;
}
/* unpack the list of procs on each node */
for (i=0; i < nnodes; i++) {
cnt = 1;
PMIX_CONSTRUCT(&kv, pmix_kval_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(&buf2, &kv, &cnt, PMIX_KVAL))) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&buf2);
PMIX_DESTRUCT(&kv);
goto exit;
}
/* 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
* have this node */
nrec = NULL;
PMIX_LIST_FOREACH(nr2, &nsptr->nodes, pmix_nrec_t) {
if (0 == strcmp(nr2->name, kv.key)) {
nrec = nr2;
break;
}
}
if (NULL == nrec) {
/* Create a node record and store that list */
nrec = PMIX_NEW(pmix_nrec_t);
if (NULL == nrec) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
PMIX_DESTRUCT(&buf2);
PMIX_DESTRUCT(&kv);
goto exit;
}
nrec->name = strdup(kv.key);
pmix_list_append(&nsptr->nodes, &nrec->super);
} else {
/* refresh the list */
if (NULL != nrec->procs) {
free(nrec->procs);
}
}
nrec->procs = strdup(kv.value->data.string);
/* split the list of procs so we can store their
* individual location data */
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (PMIX_SUCCESS != (rc = _add_key_for_rank(PMIX_RANK_WILDCARD, &kv, cb))) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&kv);
PMIX_DESTRUCT(&buf2);
pmix_argv_free(procs);
goto exit;
}
#else
procs = pmix_argv_split(nrec->procs, ',');
for (j=0; NULL != procs[j]; j++) {
/* store the hostname for each proc - again, this is
* data obtained via a job-level exchange, so store it
* in the job-level data hash_table */
kp2 = PMIX_NEW(pmix_kval_t);
kp2->key = strdup(PMIX_HOSTNAME);
kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t));
kp2->value->type = PMIX_STRING;
kp2->value->data.string = strdup(nrec->name);
rank = strtol(procs[j], NULL, 10);
if (PMIX_SUCCESS != (rc = _add_key_for_rank(rank, kp2, cb))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(kp2);
PMIX_DESTRUCT(&kv);
PMIX_DESTRUCT(&buf2);
pmix_argv_free(procs);
goto exit;
}
PMIX_RELEASE(kp2);
}
pmix_argv_free(procs);
#endif
PMIX_DESTRUCT(&kv);
}
/* cleanup */
PMIX_DESTRUCT(&buf2);
} 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))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(kptr);
goto exit;
}
}
PMIX_RELEASE(kptr);
kptr = PMIX_NEW(pmix_kval_t);
cnt = 1;
}
/* need to release the leftover kptr */
PMIX_RELEASE(kptr);
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) {
PMIX_ERROR_LOG(rc);
goto exit;
}
rc = PMIX_SUCCESS;
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (NULL != cb->dstore_fn) {
if (PMIX_SUCCESS != (rc = _rank_key_dstore_store(cbdata))) {
PMIX_ERROR_LOG(rc);
goto exit;
}
}
#endif
exit:
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (NULL != cb->bufs) {
size_t size = pmix_value_array_get_size(cb->bufs);
size_t i;
for (i = 0; i < size; i++) {
pmix_buffer_t *tmp = &(PMIX_VALUE_ARRAY_GET_ITEM(cb->bufs, pmix_buffer_t, i));
PMIX_DESTRUCT(tmp);
}
PMIX_RELEASE(cb->bufs);
}
#endif
PMIX_RELEASE(cb);
/* reset buf unpack ptr */
job_data->unpack_ptr = job_data->base_ptr;
return rc;
}

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

@ -25,7 +25,7 @@
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/mca/ptl/ptl.h"
#include "src/client/pmix_client_ops.h"
@ -42,7 +42,8 @@ static void log_cbfunc(struct pmix_peer_t *peer,
/* unpack the return status */
m=1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &status, &m, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, peer, buf, &status, &m, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
status = rc;
}
@ -91,7 +92,7 @@ PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata,
return PMIX_ERR_NOT_SUPPORTED;
}
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query handed to RM");
"pmix:log handed to RM");
pmix_host_server.log(&pmix_globals.myid,
data, ndata, directives, ndirs,
cbfunc, cbdata);
@ -102,32 +103,42 @@ PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata,
cd->cbfunc.opcbfn = cbfunc;
cd->cbdata = cbdata;
msg = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ndata, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ndata, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, data, ndata, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, data, ndata, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ndirs, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ndirs, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (0 < ndirs) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, data, ndata, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, directives, ndirs, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
@ -136,8 +147,11 @@ PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata,
}
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query sending to server");
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, log_cbfunc, (void*)cd))){
"pmix:log sending to server");
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, log_cbfunc, (void*)cd);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cd);
}
}

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

@ -25,7 +25,7 @@
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/mca/ptl/ptl.h"
#include "src/client/pmix_client_ops.h"
@ -60,7 +60,8 @@ static void query_cbfunc(struct pmix_peer_t *peer,
/* unpack the status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &results->status, &cnt, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, peer, buf, &results->status, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto complete;
}
@ -70,14 +71,16 @@ static void query_cbfunc(struct pmix_peer_t *peer,
/* unpack any returned data */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &results->ninfo, &cnt, PMIX_SIZE))) {
PMIX_BFROPS_UNPACK(rc, peer, buf, &results->ninfo, &cnt, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto complete;
}
if (0 < results->ninfo) {
PMIX_INFO_CREATE(results->info, results->ninfo);
cnt = results->ninfo;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, results->info, &cnt, PMIX_INFO))) {
PMIX_BFROPS_UNPACK(rc, peer, buf, results->info, &cnt, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto complete;
}
@ -142,19 +145,25 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
cd->cbfunc = cbfunc;
cd->cbdata = cbdata;
msg = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &nqueries, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &nqueries, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, queries, nqueries, PMIX_QUERY))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, queries, nqueries, PMIX_QUERY);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
@ -162,7 +171,9 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
}
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query sending to server");
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, query_cbfunc, (void*)cd))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, query_cbfunc, (void*)cd);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(cd);
}
}
@ -210,27 +221,35 @@ PMIX_EXPORT pmix_status_t PMIx_Allocation_request_nb(pmix_alloc_directive_t dire
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack the directive */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &directive, 1, PMIX_ALLOC_DIRECTIVE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &directive, 1, PMIX_ALLOC_DIRECTIVE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
/* pack the info */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
}
if (0 < ninfo) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, info, ninfo, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return rc;
@ -245,7 +264,9 @@ PMIX_EXPORT pmix_status_t PMIx_Allocation_request_nb(pmix_alloc_directive_t dire
cb->cbdata = cbdata;
/* push the message into our event base to send to the server */
if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, query_cbfunc, (void*)cb))){
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, query_cbfunc, (void*)cb);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
PMIX_RELEASE(cb);
}

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

@ -34,7 +34,6 @@
#include <pmix_common.h>
#include <pmix_rename.h>
#include "src/buffer_ops/internal.h"
#include "src/include/pmix_globals.h"
PMIX_EXPORT const char* PMIx_Proc_state_string(pmix_proc_state_t state)
@ -98,6 +97,8 @@ PMIX_EXPORT const char* PMIx_Scope_string(pmix_scope_t scope)
return "SHARE ON REMOTE NODES ONLY";
case PMIX_GLOBAL:
return "SHARE ACROSS ALL NODES";
case PMIX_INTERNAL:
return "STORE INTERNALLY";
default:
return "UNKNOWN SCOPE";
}
@ -209,16 +210,3 @@ PMIX_EXPORT const char* pmix_command_string(pmix_cmd_t cmd)
return "UNKNOWN";
}
}
PMIX_EXPORT const char* PMIx_Data_type_string(pmix_data_type_t type)
{
pmix_bfrop_type_info_t *info;
if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&pmix_bfrop_types, type))) {
return "UNKNOWN";
}
if (NULL == info->odti_name) {
return "UNKNOWN";
}
return info->odti_name;
}

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

@ -1,16 +0,0 @@
# Copyright (c) 2015-2016 Mellanox Technologies, Inc.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
headers += \
dstore/pmix_dstore.h \
dstore/pmix_esh.h
sources += \
dstore/pmix_dstore.c \
dstore/pmix_esh.c

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

@ -1,100 +0,0 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#include "src/include/pmix_globals.h"
#include "pmix_dstore.h"
#include "pmix_esh.h"
/*
* Array of all possible DSTOREs
*/
/**** ENSURE THE FOLLOWING VALUE IS AT LEAST AS
**** LARGE AS THE TOTAL NUMBER OF SUPPORTED SPCs
**** IN THE ARRAY BELOW
*/
static pmix_dstore_base_module_t *all[] = {
&pmix_dstore_esh_module,
/* Always end the array with a NULL */
NULL
};
pmix_dstore_base_module_t pmix_dstore = {0};
int pmix_dstore_init(pmix_info_t info[], size_t ninfo)
{
pmix_dstore = *all[0];
if (!pmix_dstore.init) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.init(info, ninfo);
}
void pmix_dstore_finalize(void)
{
if (!pmix_dstore.finalize) {
return ;
}
pmix_dstore.finalize();
return ;
}
int pmix_dstore_store(const char *nspace, pmix_rank_t rank, pmix_kval_t *kv)
{
if (!pmix_dstore.store) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.store(nspace, rank, kv);
}
int pmix_dstore_fetch(const char *nspace, pmix_rank_t rank,
const char *key, pmix_value_t **kvs)
{
if (!pmix_dstore.fetch) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.fetch(nspace, rank, key, kvs);
}
int pmix_dstore_patch_env(const char *nspace, char ***env)
{
if (!pmix_dstore.patch_env) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.patch_env(nspace, env);
}
int pmix_dstore_nspace_add(const char *nspace, pmix_info_t info[], size_t ninfo)
{
if (!pmix_dstore.nspace_add) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.nspace_add(nspace, info, ninfo);
}
int pmix_dstore_nspace_del(const char *nspace)
{
if (!pmix_dstore.nspace_del) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.nspace_del(nspace);
}

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

@ -1,137 +0,0 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_DSTORE_H
#define PMIX_DSTORE_H
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#include "src/buffer_ops/buffer_ops.h"
BEGIN_C_DECLS
int pmix_dstore_init(pmix_info_t info[], size_t ninfo);
void pmix_dstore_finalize(void);
int pmix_dstore_store(const char *nspace, pmix_rank_t rank, pmix_kval_t *kv);
/*
* Return codes:
* - PMIX_ERR_BAD_PARAM - bad parameters - can't proceed.
* - PMIX_ERR_FATAL - fatal error
* - PMIX_ERR_NOT_FOUND - we have the BLOB for the process but the
* requested key wasn't found there
* - PMIX_ERR_PROC_ENTRY_NOT_FOUND - the BLOB for the process wasn't
* found - need to request it from the server.
*/
int pmix_dstore_fetch(const char *nspace, pmix_rank_t rank,
const char *key, pmix_value_t **kvs);
int pmix_dstore_patch_env(const char *nspace, char ***env);
int pmix_dstore_nspace_add(const char *nspace, pmix_info_t info[], size_t ninfo);
int pmix_dstore_nspace_del(const char *nspace);
/**
* Initialize the module. Returns an error if the module cannot
* run, success if it can and wants to be used.
*/
typedef int (*pmix_dstore_base_module_init_fn_t)(pmix_info_t info[], size_t ninfo);
/**
* Finalize the module. Tear down any allocated storage, disconnect
* from any system support.
*/
typedef int (*pmix_dstore_base_module_fini_fn_t)(void);
/**
* store key/value pair in datastore.
*
* @param nspace namespace string
*
* @param rank rank.
*
* @param kv key/value pair.
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstore_base_module_store_fn_t)(const char *nspace,
pmix_rank_t rank,
pmix_kval_t *kv);
/**
* fetch value in datastore.
*
* @param nspace namespace string
*
* @param rank rank.
*
* @param key key.
*
* @return kvs(key/value pair) and PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstore_base_module_fetch_fn_t)(const char *nspace,
pmix_rank_t rank,
const char *key,
pmix_value_t **kvs);
/**
* get base dstore path.
*
* @param nspace namespace string
*
* @param rank rank.
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstore_base_module_proc_patch_env_fn_t)(const char *nspace, char ***env);
/**
* get base dstore path.
*
* @param nspace namespace string
*
* @param rank rank.
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstore_base_module_add_nspace_fn_t)(const char *nspace,
pmix_info_t info[],
size_t ninfo);
/**
* finalize nspace.
*
* @param nspace namespace string
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstore_base_module_del_nspace_fn_t)(const char *nspace);
/**
* structure for dstore modules
*/
typedef struct {
const char *name;
pmix_dstore_base_module_init_fn_t init;
pmix_dstore_base_module_fini_fn_t finalize;
pmix_dstore_base_module_store_fn_t store;
pmix_dstore_base_module_fetch_fn_t fetch;
pmix_dstore_base_module_proc_patch_env_fn_t patch_env;
pmix_dstore_base_module_add_nspace_fn_t nspace_add;
pmix_dstore_base_module_del_nspace_fn_t nspace_del;
} pmix_dstore_base_module_t;
END_C_DECLS
#endif /* PMIX_DSTORE_H */

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

@ -1,6 +1,6 @@
# -*- makefile -*-
#
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -147,9 +147,9 @@ void pmix_event_timeout_cb(int fd, short flags, void *arg);
ch->status = (e); \
ch->range = (r); \
(void)strncpy(ch->source.nspace, \
(p)->info->nptr->nspace, \
(p)->nptr->nspace, \
PMIX_MAX_NSLEN); \
ch->source.rank = (p)->info->rank; \
ch->source.rank = (p)->info->pname.rank; \
ch->ninfo = 2; \
ch->final_cbfunc = (f); \
ch->final_cbdata = ch; \
@ -169,8 +169,8 @@ void pmix_event_timeout_cb(int fd, short flags, void *arg);
pmix_event_add(&ch->ev, &pmix_globals.event_window); \
} else { \
/* add this peer to the array of sources */ \
(void)strncpy(proc.nspace, (p)->info->nptr->nspace, PMIX_MAX_NSLEN); \
proc.rank = (p)->info->rank; \
(void)strncpy(proc.nspace, (p)->nptr->nspace, PMIX_MAX_NSLEN); \
proc.rank = (p)->info->pname.rank; \
ninfo = ch->ninfo + 1; \
PMIX_INFO_CREATE(info, ninfo); \
/* must keep the hdlr name and return object at the end, so prepend */ \

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

@ -22,6 +22,7 @@
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/client/pmix_client_ops.h"
#include "src/server/pmix_server_ops.h"
#include "src/include/pmix_globals.h"
@ -88,13 +89,14 @@ static void notify_event_cbfunc(struct pmix_peer_t *pr, pmix_ptl_hdr_t *hdr,
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
/* unpack the status */
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_BFROPS_UNPACK(rc, pr, buf, &ret, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
ret = rc;
}
/* do the cback */
if (NULL != cb->op_cbfunc) {
cb->op_cbfunc(ret, cb->cbdata);
if (NULL != cb->cbfunc.opfn) {
cb->cbfunc.opfn(ret, cb->cbdata);
}
PMIX_RELEASE(cb);
}
@ -124,29 +126,34 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
msg = PMIX_NEW(pmix_buffer_t);
/* pack the command */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
/* pack the status */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &status, 1, PMIX_STATUS))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, &status, 1, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
/* no need to pack the source as it is us */
/* pack the range */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &range, 1, PMIX_DATA_RANGE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, &range, 1, PMIX_DATA_RANGE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
/* pack the info */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
if (0 < ninfo) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, info, ninfo, PMIX_INFO))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
@ -231,13 +238,14 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
* server will _not_ send this notification back to us,
* so we handle it locally */
cb = PMIX_NEW(pmix_cb_t);
cb->op_cbfunc = cbfunc;
cb->cbfunc.opfn = cbfunc;
cb->cbdata = cbdata;
/* send to the server */
pmix_output_verbose(2, pmix_globals.debug_output,
"client: notifying server %s:%d - sending",
pmix_globals.myid.nspace, pmix_globals.myid.rank);
rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, notify_event_cbfunc, cb);
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
msg, notify_event_cbfunc, cb);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cb);
@ -721,6 +729,7 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain)
}
/* if we got here, then nothing was found */
complete:
/* we still have to call their final callback */
if (NULL != chain->final_cbfunc) {
@ -783,12 +792,15 @@ static void _notify_client_event(int sd, short args, void *cbdata)
pmix_event_chain_t *chain;
size_t n;
bool matched, holdcd;
pmix_buffer_t *bfr;
pmix_cmd_t cmd = PMIX_NOTIFY_CMD;
pmix_status_t rc;
/* need to acquire the object from its originating thread */
PMIX_ACQUIRE_OBJECT(cd);
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_server: _notify_error notifying clients of error %s",
"pmix_server: _notify_client_event notifying clients of event %s",
PMIx_Error_string(cd->status));
/* we cannot know if everyone who wants this notice has had a chance
@ -814,19 +826,19 @@ static void _notify_client_event(int sd, short args, void *cbdata)
/* if this client was the source of the event, then
* don't send it back as they will have processed it
* when they generated it */
if (0 == strncmp(cd->source.nspace, pr->peer->info->nptr->nspace, PMIX_MAX_NSLEN) &&
cd->source.rank == pr->peer->info->rank) {
if (0 == strncmp(cd->source.nspace, pr->peer->info->pname.nspace, PMIX_MAX_NSLEN) &&
cd->source.rank == pr->peer->info->pname.rank) {
continue;
}
/* if we were given specific targets, check if this is one */
if (NULL != cd->targets) {
matched = false;
for (n=0; n < cd->ntargets; n++) {
if (0 != strncmp(pr->peer->info->nptr->nspace, cd->targets[n].nspace, PMIX_MAX_NSLEN)) {
if (0 != strncmp(pr->peer->info->pname.nspace, cd->targets[n].nspace, PMIX_MAX_NSLEN)) {
continue;
}
if (PMIX_RANK_WILDCARD == cd->targets[n].rank ||
pr->peer->info->rank == cd->targets[n].rank) {
pr->peer->info->pname.rank == cd->targets[n].rank) {
matched = true;
break;
}
@ -837,10 +849,53 @@ static void _notify_client_event(int sd, short args, void *cbdata)
}
}
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_server: notifying client %s:%d",
pr->peer->info->nptr->nspace, pr->peer->info->rank);
PMIX_RETAIN(cd->buf);
PMIX_SERVER_QUEUE_REPLY(pr->peer, 0, cd->buf);
"pmix_server: notifying client %s:%u",
pr->peer->info->pname.nspace, pr->peer->info->pname.rank);
bfr = PMIX_NEW(pmix_buffer_t);
if (NULL == bfr) {
continue;
}
/* pack the command */
PMIX_BFROPS_PACK(rc, pr->peer, bfr, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
continue;
}
/* pack the status */
PMIX_BFROPS_PACK(rc, pr->peer, bfr, &cd->status, 1, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
continue;
}
/* pack the source */
PMIX_BFROPS_PACK(rc, pr->peer, bfr, &cd->source, 1, PMIX_PROC);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
continue;
}
/* pack any info */
PMIX_BFROPS_PACK(rc, pr->peer, bfr, &cd->ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
continue;
}
if (0 < cd->ninfo) {
PMIX_BFROPS_PACK(rc, pr->peer, bfr, cd->info, cd->ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
continue;
}
}
PMIX_SERVER_QUEUE_REPLY(pr->peer, 0, bfr);
}
}
}
@ -909,8 +964,6 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_notify_caddy_t *cd;
pmix_cmd_t cmd = PMIX_NOTIFY_CMD;
pmix_status_t rc;
size_t n;
pmix_output_verbose(2, pmix_globals.debug_output,
@ -927,6 +980,8 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status,
cd->source.rank = source->rank;
}
cd->range = range;
cd->info = info;
cd->ninfo = ninfo;
/* check for directives */
if (NULL != info) {
@ -972,42 +1027,6 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status,
}
}
/* pack the command */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(cd->buf, &cmd, 1, PMIX_CMD))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cd);
return rc;
}
/* pack the status */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(cd->buf, &status, 1, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cd);
return rc;
}
/* pack the source */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(cd->buf, source, 1, PMIX_PROC))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cd);
return rc;
}
/* pack any info */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(cd->buf, &ninfo, 1, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cd);
return rc;
}
if (0 < ninfo) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(cd->buf, info, ninfo, PMIX_INFO))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cd);
return rc;
}
}
/* track the eventual callback info */
cd->cbfunc = cbfunc;
cd->cbdata = cbdata;

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

@ -23,6 +23,7 @@
#include "src/client/pmix_client_ops.h"
#include "src/server/pmix_server_ops.h"
#include "src/include/pmix_globals.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/event/pmix_event.h"
typedef struct {
@ -84,7 +85,8 @@ static void regevents_cbfunc(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr,
/* unpack the status code */
cnt = 1;
if ((PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) ||
PMIX_BFROPS_UNPACK(rc, peer, buf, &ret, &cnt, PMIX_STATUS);
if ((PMIX_SUCCESS != rc) ||
(PMIX_SUCCESS != ret)) {
PMIX_ERROR_LOG(rc);
/* remove the err handler and call the error handler reg completion callback fn.*/
@ -176,36 +178,41 @@ static pmix_status_t _send_to_server(pmix_rshift_caddy_t *rcd)
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack the number of codes */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cd->ncodes, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, &cd->ncodes, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack any provided codes - may be NULL */
if (NULL != cd->codes && 0 < cd->ncodes) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, cd->codes, cd->ncodes, PMIX_STATUS))) {
/* pack any provided codes */
if (0 < cd->ncodes) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, cd->codes, cd->ncodes, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
}
/* pack the number of info */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &rcd->ninfo, 1, PMIX_SIZE))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, &rcd->ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack any provided info - may be NULL */
if (NULL != rcd->info && 0 < rcd->ninfo) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, rcd->info, rcd->ninfo, PMIX_INFO))) {
/* pack any provided info */
if (0 < rcd->ninfo) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, rcd->info, rcd->ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
}
rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, regevents_cbfunc, rcd);
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, msg, regevents_cbfunc, rcd);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
@ -280,7 +287,10 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer)
n=0;
PMIX_LIST_FOREACH(ixfer, xfer, pmix_info_caddy_t) {
(void)strncpy(cd2->info[n].key, ixfer->info[n].key, PMIX_MAX_KEYLEN);
pmix_value_load(&cd2->info[n].value, &ixfer->info[n].value.data, ixfer->info[n].value.type);
PMIX_BFROPS_VALUE_LOAD(pmix_client_globals.myserver,
&cd2->info[n].value,
&ixfer->info[n].value.data,
ixfer->info[n].value.type);
++n;
}
}
@ -815,7 +825,9 @@ static void dereg_event_hdlr(int sd, short args, void *cbdata)
* to remove my registration */
if (!PMIX_PROC_IS_SERVER) {
msg = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
goto cleanup;
}
@ -836,7 +848,9 @@ static void dereg_event_hdlr(int sd, short args, void *cbdata)
if (NULL == ev->codes) {
if (0 == pmix_list_get_size(&pmix_globals.events.default_events)) {
/* tell the server to dereg our default handler */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &wildcard, 1, PMIX_STATUS))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &wildcard, 1, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
goto cleanup;
}
@ -850,7 +864,9 @@ static void dereg_event_hdlr(int sd, short args, void *cbdata)
if (0 == active->nregs) {
pmix_list_remove_item(&pmix_globals.events.actives, &active->super);
/* tell the server to dereg this code */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &active->code, 1, PMIX_STATUS))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &active->code, 1, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(active);
PMIX_RELEASE(msg);
goto cleanup;
@ -881,7 +897,9 @@ static void dereg_event_hdlr(int sd, short args, void *cbdata)
/* if there are no more default handlers registered, tell
* the server to dereg the default handler */
if (0 == pmix_list_get_size(&pmix_globals.events.default_events)) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &wildcard, 1, PMIX_STATUS))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &wildcard, 1, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(msg);
goto cleanup;
}
@ -904,7 +922,9 @@ static void dereg_event_hdlr(int sd, short args, void *cbdata)
pmix_list_remove_item(&pmix_globals.events.actives, &active->super);
if (NULL != msg) {
/* tell the server to dereg this code */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &active->code, 1, PMIX_STATUS))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &active->code, 1, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(active);
PMIX_RELEASE(msg);
goto cleanup;
@ -933,7 +953,9 @@ static void dereg_event_hdlr(int sd, short args, void *cbdata)
pmix_list_remove_item(&pmix_globals.events.actives, &active->super);
if (NULL != msg) {
/* tell the server to dereg this code */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &active->code, 1, PMIX_STATUS))) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &active->code, 1, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(active);
PMIX_RELEASE(msg);
goto cleanup;
@ -958,7 +980,7 @@ static void dereg_event_hdlr(int sd, short args, void *cbdata)
report:
if (NULL != msg) {
/* send to the server */
rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, NULL, NULL);
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, msg, NULL, NULL);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
}

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

@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
@ -37,8 +37,7 @@ headers += \
include/prefetch.h \
include/types.h \
include/pmix_config_top.h \
include/pmix_config_bottom.h \
include/pmix_jobdata.h
include/pmix_config_bottom.h
endif ! PMIX_EMBEDDED_MODE

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

@ -12,6 +12,7 @@
* Copyright (c) 2006 Voltaire All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -2,6 +2,7 @@
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*

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

@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*

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

@ -37,7 +37,7 @@
#include <ctype.h>
#include PMIX_EVENT_HEADER
#include "src/buffer_ops/types.h"
#include "src/mca/bfrops/bfrops_types.h"
#include "src/class/pmix_hash_table.h"
#include "src/class/pmix_list.h"
#include "src/threads/threads.h"
@ -48,49 +48,86 @@ pmix_lock_t pmix_global_lock = {
.active = false
};
static void cbcon(pmix_cb_t *p)
{
PMIX_CONSTRUCT_LOCK(&p->lock);
p->checked = false;
PMIX_CONSTRUCT(&p->data, pmix_buffer_t);
p->cbfunc = NULL;
p->op_cbfunc = NULL;
p->value_cbfunc = NULL;
p->lookup_cbfunc = NULL;
p->spawn_cbfunc = NULL;
p->cbdata = NULL;
memset(p->nspace, 0, PMIX_MAX_NSLEN+1);
p->rank = -1;
p->key = NULL;
p->value = NULL;
p->procs = NULL;
p->info = NULL;
p->ninfo = 0;
p->nvals = 0;
}
static void cbdes(pmix_cb_t *p)
{
PMIX_DESTRUCT_LOCK(&p->lock);
PMIX_DESTRUCT(&p->data);
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_cb_t,
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_namelist_t,
pmix_list_item_t,
cbcon, cbdes);
NULL, NULL);
static void nscon(pmix_nspace_t *p)
{
p->nspace = NULL;
p->nlocalprocs = 0;
p->all_registered = false;
p->jobinfo = NULL;
p->njobinfo = 0;
p->jobbkt = NULL;
p->ndelivered = 0;
PMIX_CONSTRUCT(&p->ranks, pmix_list_t);
memset(&p->compat, 0, sizeof(p->compat));
}
static void nsdes(pmix_nspace_t *p)
{
if (NULL != p->nspace) {
free(p->nspace);
}
if (NULL != p->jobinfo) {
PMIX_INFO_FREE(p->jobinfo, p->njobinfo);
}
if (NULL != p->jobbkt) {
PMIX_RELEASE(p->jobbkt);
}
PMIX_LIST_DESTRUCT(&p->ranks);
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_nspace_t,
pmix_list_item_t,
nscon, nsdes);
static void ncdcon(pmix_nspace_caddy_t *p)
{
p->ns = NULL;
}
static void ncddes(pmix_nspace_caddy_t *p)
{
if (NULL != p->ns) {
PMIX_RELEASE(p->ns);
}
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_nspace_caddy_t,
pmix_list_item_t,
ncdcon, ncddes);
static void info_con(pmix_rank_info_t *info)
{
info->peerid = -1;
info->gid = info->uid = 0;
info->pname.nspace = NULL;
info->pname.rank = PMIX_RANK_UNDEF;
info->modex_recvd = false;
info->proc_cnt = 0;
info->server_object = NULL;
}
static void info_des(pmix_rank_info_t *info)
{
if (NULL != info->pname.nspace) {
free(info->pname.nspace);
}
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_rank_info_t,
pmix_list_item_t,
info_con, info_des);
static void pcon(pmix_peer_t *p)
{
p->finalized = false;
p->info = NULL;
p->proc_cnt = 0;
p->server_object = NULL;
p->index = 0;
p->sd = -1;
p->finalized = false;
p->send_ev_active = false;
p->recv_ev_active = false;
PMIX_CONSTRUCT(&p->send_queue, pmix_list_t);
p->send_msg = NULL;
p->recv_msg = NULL;
memset(&p->compat, 0, sizeof(p->compat));
}
static void pdes(pmix_peer_t *p)
{
@ -120,120 +157,16 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_peer_t,
pmix_object_t,
pcon, pdes);
static void nscon(pmix_nspace_t *p)
{
memset(p->nspace, 0, PMIX_MAX_NSLEN);
PMIX_CONSTRUCT(&p->nodes, pmix_list_t);
PMIX_CONSTRUCT(&p->internal, pmix_hash_table_t);
pmix_hash_table_init(&p->internal, 16);
PMIX_CONSTRUCT(&p->modex, pmix_hash_table_t);
pmix_hash_table_init(&p->modex, 256);
p->server = NULL;
}
static void nsdes(pmix_nspace_t *p)
{
uint64_t key;
pmix_object_t *obj;
PMIX_LIST_DESTRUCT(&p->nodes);
PMIX_HASH_TABLE_FOREACH(key, uint64, obj, &p->internal) {
if (NULL != obj) {
PMIX_RELEASE(obj);
}
}
PMIX_DESTRUCT(&p->internal);
PMIX_HASH_TABLE_FOREACH(key, uint64, obj, &p->modex) {
if (NULL != obj) {
PMIX_RELEASE(obj);
}
}
PMIX_DESTRUCT(&p->modex);
if (NULL != p->server) {
PMIX_RELEASE(p->server);
}
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_nspace_t,
pmix_list_item_t,
nscon, nsdes);
static void ncon(pmix_nrec_t *p)
{
p->name = NULL;
p->procs = NULL;
}
static void ndes(pmix_nrec_t *p)
{
if (NULL != p->name) {
free(p->name);
}
if (NULL != p->procs) {
free(p->procs);
}
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_nrec_t,
pmix_list_item_t,
ncon, ndes);
static void sncon(pmix_server_nspace_t *p)
{
p->nlocalprocs = 0;
p->all_registered = false;
PMIX_CONSTRUCT(&p->job_info, pmix_buffer_t);
PMIX_CONSTRUCT(&p->ranks, pmix_list_t);
PMIX_CONSTRUCT(&p->mylocal, pmix_hash_table_t);
pmix_hash_table_init(&p->mylocal, 16);
PMIX_CONSTRUCT(&p->myremote, pmix_hash_table_t);
pmix_hash_table_init(&p->myremote, 16);
PMIX_CONSTRUCT(&p->remote, pmix_hash_table_t);
pmix_hash_table_init(&p->remote, 256);
}
static void sndes(pmix_server_nspace_t *p)
{
uint64_t key;
pmix_peer_t * peer;
PMIX_DESTRUCT(&p->job_info);
PMIX_LIST_DESTRUCT(&p->ranks);
PMIX_HASH_TABLE_FOREACH(key, uint64, peer, &p->mylocal) {
PMIX_RELEASE(peer);
}
PMIX_DESTRUCT(&p->mylocal);
PMIX_HASH_TABLE_FOREACH(key, uint64, peer, &p->myremote) {
PMIX_RELEASE(peer);
}
PMIX_DESTRUCT(&p->myremote);
PMIX_DESTRUCT(&p->remote);
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_server_nspace_t,
pmix_object_t,
sncon, sndes);
static void info_con(pmix_rank_info_t *info)
{
info->gid = info->uid = 0;
info->nptr = NULL;
info->rank = PMIX_RANK_WILDCARD;
info->modex_recvd = false;
info->proc_cnt = 0;
info->server_object = NULL;
}
static void info_des(pmix_rank_info_t *info)
{
if (NULL!= info->nptr) {
PMIX_RELEASE(info->nptr);
}
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_rank_info_t,
pmix_list_item_t,
info_con, info_des);
static void scon(pmix_shift_caddy_t *p)
{
PMIX_CONSTRUCT_LOCK(&p->lock);
p->codes = NULL;
p->ncodes = 0;
p->nspace = NULL;
p->pname.nspace = NULL;
p->pname.rank = PMIX_RANK_UNDEF;
p->data = NULL;
p->ndata = 0;
p->key = NULL;
p->info = NULL;
p->ninfo = 0;
p->directives = NULL;
@ -251,6 +184,9 @@ static void scon(pmix_shift_caddy_t *p)
static void scdes(pmix_shift_caddy_t *p)
{
PMIX_DESTRUCT_LOCK(&p->lock);
if (NULL != p->pname.nspace) {
free(p->pname.nspace);
}
if (NULL != p->kv) {
PMIX_RELEASE(p->kv);
}
@ -259,6 +195,42 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_shift_caddy_t,
pmix_object_t,
scon, scdes);
static void cbcon(pmix_cb_t *p)
{
PMIX_CONSTRUCT_LOCK(&p->lock);
p->checked = false;
PMIX_CONSTRUCT(&p->data, pmix_buffer_t);
p->cbfunc.ptlfn = NULL;
p->cbdata = NULL;
p->pname.nspace = NULL;
p->pname.rank = PMIX_RANK_UNDEF;
p->scope = PMIX_SCOPE_UNDEF;
p->key = NULL;
p->value = NULL;
p->procs = NULL;
p->nprocs = 0;
p->info = NULL;
p->ninfo = 0;
p->nvals = 0;
PMIX_CONSTRUCT(&p->kvs, pmix_list_t);
p->copy = false;
p->timer_running = false;
}
static void cbdes(pmix_cb_t *p)
{
if (p->timer_running) {
pmix_event_del(&p->ev);
}
if (NULL != p->pname.nspace) {
free(p->pname.nspace);
}
PMIX_DESTRUCT(&p->data);
PMIX_LIST_DESTRUCT(&p->kvs);
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_cb_t,
pmix_list_item_t,
cbcon, cbdes);
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_info_caddy_t,
pmix_list_item_t,
NULL, NULL);
@ -283,18 +255,3 @@ static void qdes(pmix_query_caddy_t *p)
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_query_caddy_t,
pmix_object_t,
qcon, qdes);
static void jdcon(pmix_job_data_caddy_t *p)
{
p->nsptr = NULL;
p->job_data = NULL;
p->dstore_fn = NULL;
p->hstore_fn = NULL;
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
p->bufs = NULL;
#endif
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_job_data_caddy_t,
pmix_object_t,
jdcon, NULL);

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

@ -33,12 +33,14 @@
#include <pmix_common.h>
#include "src/buffer_ops/types.h"
#include "src/mca/bfrops/bfrops.h"
#include "src/class/pmix_hash_table.h"
#include "src/class/pmix_list.h"
#include "src/class/pmix_ring_buffer.h"
#include "src/event/pmix_event.h"
#include "src/threads/threads.h"
#include "src/mca/gds/gds.h"
#include "src/mca/psec/psec.h"
#include "src/mca/ptl/ptl.h"
@ -49,34 +51,47 @@ BEGIN_C_DECLS
#define PMIX_MAX_ERR_CONSTANT INT_MIN
/**** ENUM DEFINITIONS ****/
/* define an internal-only process name that has
* a dynamically-sized nspace field to save memory */
typedef struct {
char *nspace;
pmix_rank_t rank;
} pmix_name_t;
/* define an internal-only object for creating
* lists of names */
typedef struct {
pmix_list_item_t super;
pmix_name_t *pname;
} pmix_namelist_t;
PMIX_CLASS_DECLARATION(pmix_namelist_t);
/* define a command type for communicating to the
* pmix server */
typedef uint32_t pmix_cmd_t;
#define PMIX_CMD PMIX_UINT32
/* define some commands */
typedef enum {
PMIX_REQ_CMD,
PMIX_ABORT_CMD,
PMIX_COMMIT_CMD,
PMIX_FENCENB_CMD,
PMIX_GETNB_CMD,
PMIX_FINALIZE_CMD,
PMIX_PUBLISHNB_CMD,
PMIX_LOOKUPNB_CMD,
PMIX_UNPUBLISHNB_CMD,
PMIX_SPAWNNB_CMD,
PMIX_CONNECTNB_CMD,
PMIX_DISCONNECTNB_CMD,
PMIX_NOTIFY_CMD,
PMIX_REGEVENTS_CMD,
PMIX_DEREGEVENTS_CMD,
PMIX_QUERY_CMD,
PMIX_LOG_CMD,
PMIX_ALLOC_CMD,
PMIX_JOB_CONTROL_CMD,
PMIX_MONITOR_CMD
} pmix_cmd_t;
#define PMIX_REQ_CMD 0
#define PMIX_ABORT_CMD 1
#define PMIX_COMMIT_CMD 2
#define PMIX_FENCENB_CMD 3
#define PMIX_GETNB_CMD 4
#define PMIX_FINALIZE_CMD 5
#define PMIX_PUBLISHNB_CMD 6
#define PMIX_LOOKUPNB_CMD 7
#define PMIX_UNPUBLISHNB_CMD 8
#define PMIX_SPAWNNB_CMD 9
#define PMIX_CONNECTNB_CMD 10
#define PMIX_DISCONNECTNB_CMD 11
#define PMIX_NOTIFY_CMD 12
#define PMIX_REGEVENTS_CMD 13
#define PMIX_DEREGEVENTS_CMD 14
#define PMIX_QUERY_CMD 15
#define PMIX_LOG_CMD 16
#define PMIX_ALLOC_CMD 17
#define PMIX_JOB_CONTROL_CMD 18
#define PMIX_MONITOR_CMD 19
/* provide a "pretty-print" function for cmds */
const char* pmix_command_string(pmix_cmd_t cmd);
@ -104,47 +119,52 @@ typedef enum {
#define PMIX_PROC_IS_TOOL (PMIX_PROC_TOOL == pmix_globals.proc_type)
/* internally used object for transferring data
* to/from the server and for storing in the
* hash tables */
/**** PEER STRUCTURES ****/
/* clients can only talk to their server, and servers are
* assumed to all have the same personality. Thus, each
* process only needs to track a single set of personality
* modules. All interactions between a client and its local
* server, or between servers, are done thru these modules */
typedef struct pmix_personality_t {
pmix_bfrop_buffer_type_t type;
pmix_bfrops_module_t *bfrops;
pmix_psec_module_t *psec;
pmix_ptl_module_t *ptl;
pmix_gds_base_module_t *gds;
} pmix_personality_t;
/* objects used by servers for tracking active nspaces */
typedef struct {
pmix_list_item_t super;
char *key;
pmix_value_t *value;
} pmix_kval_t;
PMIX_CLASS_DECLARATION(pmix_kval_t);
// forward declaration
struct pmix_peer_t;
/**** PEER STRUCTURES ****/
/* objects for tracking active nspaces */
typedef struct {
pmix_object_t super;
char *nspace;
size_t nlocalprocs;
bool all_registered; // all local ranks have been defined
pmix_buffer_t job_info; // packed copy of the job-level info to be delivered to each proc
pmix_info_t *jobinfo; // copy of the job-level info to be delivered to each proc
size_t njobinfo;
pmix_buffer_t *jobbkt; // packed version of jobinfo
size_t ndelivered; // count of #local clients that have received the jobinfo
pmix_list_t ranks; // list of pmix_rank_info_t for connection support of my clients
pmix_hash_table_t mylocal; // hash_table for storing data PUT with local/global scope by my clients
pmix_hash_table_t myremote; // hash_table for storing data PUT with remote/global scope by my clients
pmix_hash_table_t remote; // hash_table for storing data PUT with remote/global scope recvd from remote clients via modex
} pmix_server_nspace_t;
PMIX_CLASS_DECLARATION(pmix_server_nspace_t);
typedef struct {
pmix_list_item_t super;
char nspace[PMIX_MAX_NSLEN+1];
pmix_list_t nodes; // list of pmix_nrec_t nodes that house procs in this nspace
pmix_hash_table_t internal; // hash_table for storing job-level/internal data related to this nspace
pmix_hash_table_t modex; // hash_table of received modex data
pmix_server_nspace_t *server; // isolate these so the client doesn't instantiate them
/* all members of an nspace are required to have the
* same personality, but it can differ between nspaces.
* Since servers may support clients from multiple nspaces,
* track their respective compatibility modules here */
pmix_personality_t compat;
} pmix_nspace_t;
PMIX_CLASS_DECLARATION(pmix_nspace_t);
/* define a caddy for quickly creating a list of pmix_nspace_t
* objects for local, dedicated purposes */
typedef struct {
pmix_list_item_t super;
pmix_nspace_t *ns;
} pmix_nspace_caddy_t;
PMIX_CLASS_DECLARATION(pmix_nspace_caddy_t);
typedef struct pmix_rank_info_t {
pmix_list_item_t super;
pmix_nspace_t *nptr;
pmix_rank_t rank;
int peerid; // peer object index into the local clients array on the server
pmix_name_t pname;
uid_t uid;
gid_t gid;
bool modex_recvd;
@ -153,13 +173,6 @@ typedef struct pmix_rank_info_t {
} pmix_rank_info_t;
PMIX_CLASS_DECLARATION(pmix_rank_info_t);
/* define a structure for holding personality pointers
* to plugins for cross-version support */
typedef struct pmix_personality_t {
pmix_psec_module_t *psec;
pmix_ptl_module_t *ptl;
} pmix_personality_t;
/* object for tracking peers - each peer can have multiple
* connections. This can occur if the initial app executes
* a fork/exec, and the child initiates its own connection
@ -167,12 +180,12 @@ typedef struct pmix_personality_t {
* by the socket, not the process nspace/rank */
typedef struct pmix_peer_t {
pmix_object_t super;
bool finalized;
pmix_nspace_t *nptr; // point to the nspace object for this process
pmix_rank_info_t *info;
int proc_cnt;
void *server_object;
int index;
int index; // index into the local clients array on the server
int sd;
bool finalized; // peer has called finalize
pmix_event_t send_event; /**< registration with event thread for send events */
bool send_ev_active;
pmix_event_t recv_event; /**< registration with event thread for recv events */
@ -180,33 +193,17 @@ typedef struct pmix_peer_t {
pmix_list_t send_queue; /**< list of messages to send */
pmix_ptl_send_t *send_msg; /**< current send in progress */
pmix_ptl_recv_t *recv_msg; /**< current recv in progress */
pmix_personality_t compat;
} pmix_peer_t;
PMIX_CLASS_DECLARATION(pmix_peer_t);
typedef struct {
pmix_list_item_t super;
char *name; // name of the node
char *procs; // comma-separated list of proc ranks on that node
} pmix_nrec_t;
PMIX_CLASS_DECLARATION(pmix_nrec_t);
/* define an object for moving a send
* request into the server's event base */
typedef struct {
pmix_object_t super;
int sd;
} pmix_snd_caddy_t;
PMIX_CLASS_DECLARATION(pmix_snd_caddy_t);
/* define an object for moving a send
* request into the server's event base */
* request into the server's event base
* - instanced in pmix_server_ops.c */
typedef struct {
pmix_list_item_t super;
pmix_ptl_hdr_t hdr;
pmix_peer_t *peer;
pmix_snd_caddy_t snd;
} pmix_server_caddy_t;
PMIX_CLASS_DECLARATION(pmix_server_caddy_t);
@ -228,16 +225,19 @@ typedef struct {
} pmix_query_caddy_t;
PMIX_CLASS_DECLARATION(pmix_query_caddy_t);
/* define a tracker for collective operations */
/* define a tracker for collective operations
* - instanced in pmix_server_ops.c */
typedef struct {
pmix_list_item_t super;
pmix_cmd_t type;
bool hybrid; // true if participating procs are from more than one nspace
pmix_proc_t *pcs; // copy of the original array of participants
size_t npcs; // number of procs in the array
pmix_lock_t lock; // flag for waiting for completion
bool def_complete; // all local procs have been registered and the trk definition is complete
pmix_list_t ranks; // list of pmix_rank_info_t of the local participants
pmix_list_t local_cbs; // list of pmix_server_caddy_t for sending result to the local participants
// Note: there may be multiple entries for a given proc if that proc
// has fork/exec'd clones that are also participating
uint32_t nlocal; // number of local participants
uint32_t local_cnt; // number of local participants who have contributed
pmix_info_t *info; // array of info structs
@ -248,24 +248,6 @@ typedef struct {
} pmix_server_trkr_t;
PMIX_CLASS_DECLARATION(pmix_server_trkr_t);
typedef int (*pmix_store_dstor_cbfunc_t)(const char *nsname,
pmix_rank_t rank, pmix_kval_t *kv);
typedef int (*pmix_store_hash_cbfunc_t)(pmix_hash_table_t *table,
pmix_rank_t rank, pmix_kval_t *kv);
typedef struct {
pmix_object_t super;
pmix_nspace_t *nsptr;
pmix_buffer_t *job_data;
pmix_store_dstor_cbfunc_t dstore_fn;
pmix_store_hash_cbfunc_t hstore_fn;
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
/* array of buffers per rank */
pmix_value_array_t *bufs;
#endif
} pmix_job_data_caddy_t;
PMIX_CLASS_DECLARATION(pmix_job_data_caddy_t);
/**** THREAD-RELATED ****/
/* define a caddy for thread-shifting operations */
typedef struct {
@ -275,8 +257,7 @@ PMIX_CLASS_DECLARATION(pmix_job_data_caddy_t);
pmix_status_t status;
pmix_status_t *codes;
size_t ncodes;
const char *nspace;
pmix_rank_t rank;
pmix_name_t pname;
const char *data;
size_t ndata;
const char *key;
@ -311,22 +292,28 @@ typedef struct {
pmix_status_t pstatus;
pmix_scope_t scope;
pmix_buffer_t data;
pmix_ptl_cbfunc_t cbfunc;
pmix_op_cbfunc_t op_cbfunc;
pmix_value_cbfunc_t value_cbfunc;
pmix_lookup_cbfunc_t lookup_cbfunc;
pmix_spawn_cbfunc_t spawn_cbfunc;
pmix_evhdlr_reg_cbfunc_t errreg_cbfunc;
union {
pmix_ptl_cbfunc_t ptlfn;
pmix_op_cbfunc_t opfn;
pmix_value_cbfunc_t valuefn;
pmix_lookup_cbfunc_t lookupfn;
pmix_spawn_cbfunc_t spawnfn;
pmix_evhdlr_reg_cbfunc_t errregfn;
} cbfunc;
size_t errhandler_ref;
void *cbdata;
char nspace[PMIX_MAX_NSLEN+1];
pmix_rank_t rank;
pmix_name_t pname;
char *key;
pmix_value_t *value;
pmix_proc_t *proc;
pmix_proc_t *procs;
size_t nprocs;
pmix_info_t *info;
size_t ninfo;
size_t nvals;
pmix_list_t kvs;
bool copy;
bool timer_running;
} pmix_cb_t;
PMIX_CLASS_DECLARATION(pmix_cb_t);
@ -376,7 +363,7 @@ PMIX_CLASS_DECLARATION(pmix_notify_caddy_t);
/**** GLOBAL STORAGE ****/
/* define a global construct that includes values that must be shared
* between various parts of the code library. Both the client
* between various parts of the code library. The client, tool,
* and server libraries must instance this structure */
typedef struct {
int init_cntr; // #times someone called Init - #times called Finalize
@ -391,12 +378,17 @@ typedef struct {
int debug_output;
pmix_events_t events; // my event handler registrations.
bool connected;
pmix_list_t nspaces; // list of pmix_nspace_t for the nspaces we know about
pmix_buffer_t *cache_local; // data PUT by me to local scope
pmix_buffer_t *cache_remote; // data PUT by me to remote scope
bool commits_pending;
struct timeval event_window;
pmix_list_t cached_events; // events waiting in the window prior to processing
pmix_ring_buffer_t notifications; // ring buffer of pending notifications
/* processes also need a place where they can store
* their own internal data - e.g., data provided by
* the user via the store_internal interface, as well
* as caching their own data obtained thru the "put"
* interface so that other parts of the process can
* look them up */
pmix_gds_base_module_t *mygds;
} pmix_globals_t;

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

@ -1,24 +0,0 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_JOBDATA_H
#define PMIX_JOBDATA_H
#include <src/include/pmix_config.h>
#include "src/buffer_ops/buffer_ops.h"
#include "src/class/pmix_hash_table.h"
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
pmix_status_t pmix_job_data_dstore_store(const char *nspace, pmix_buffer_t *bptr);
#endif
pmix_status_t pmix_job_data_htable_store(const char *nspace, pmix_buffer_t *bptr);
#endif // PMIX_JOBDATA_H

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#

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

@ -10,6 +10,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2010-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -15,7 +15,7 @@
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -11,6 +11,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -13,6 +13,7 @@
# Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -149,4 +149,3 @@ char * pmix_mca_base_component_to_string(const pmix_mca_base_component_t *a) {
}
return str;
}

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

@ -16,7 +16,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -15,7 +15,7 @@
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -14,7 +14,7 @@
* Copyright (c) 2011-2015 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014 Hochschule Esslingen. All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2015 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -5,7 +5,7 @@
* Corporation. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -3,7 +3,7 @@
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -2,7 +2,7 @@
/*
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -13,7 +13,7 @@
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -0,0 +1,44 @@
# -*- makefile -*-
#
# 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) 2012 Los Alamos National Security, Inc. All rights reserved.
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AM_CPPFLAGS = $(LTDLINCL)
# main library setup
noinst_LTLIBRARIES = libmca_bfrops.la
libmca_bfrops_la_SOURCES =
# local files
headers = bfrops.h bfrops_types.h
sources =
# Conditionally install the header files
if WANT_INSTALL_HEADERS
pmixdir = $(pmixincludedir)/$(subdir)
nobase_pmix_HEADERS = $(headers)
endif
include base/Makefile.include
libmca_bfrops_la_SOURCES += $(headers) $(sources)
distclean-local:
rm -f base/static-components.h

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

@ -0,0 +1,37 @@
# -*- makefile -*-
#
# 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) 2012 Los Alamos National Security, Inc. All rights reserved.
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# This makefile.am does not stand on its own - it is included from
# src/Makefile.am
headers += \
base/base.h
sources += \
base/bfrop_base_frame.c \
base/bfrop_base_fns.c \
base/bfrop_base_select.c \
base/bfrop_base_copy.c \
base/bfrop_base_pack.c \
base/bfrop_base_print.c \
base/bfrop_base_unpack.c \
base/bfrop_base_stubs.c

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

@ -0,0 +1,626 @@
/* -*- C -*-
*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 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) 2012 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef PMIX_BFROP_BASE_H_
#define PMIX_BFROP_BASE_H_
#include <src/include/pmix_config.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> /* for struct timeval */
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "src/class/pmix_pointer_array.h"
#include "src/mca/mca.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/include/pmix_globals.h"
#include "src/mca/bfrops/bfrops.h"
BEGIN_C_DECLS
/*
* MCA Framework
*/
PMIX_EXPORT extern pmix_mca_base_framework_t pmix_bfrops_base_framework;
/**
* BFROP select function
*
* Cycle across available components and construct the list
* of active modules
*/
PMIX_EXPORT pmix_status_t pmix_bfrop_base_select(void);
/**
* Track an active component / module
*/
struct pmix_bfrops_base_active_module_t {
pmix_list_item_t super;
pmix_status_t pri;
pmix_bfrops_module_t *module;
pmix_bfrops_base_component_t *component;
};
typedef struct pmix_bfrops_base_active_module_t pmix_bfrops_base_active_module_t;
PMIX_CLASS_DECLARATION(pmix_bfrops_base_active_module_t);
/* framework globals */
struct pmix_bfrops_globals_t {
pmix_list_t actives;
bool initialized;
size_t initial_size;
size_t threshold_size;
pmix_bfrop_buffer_type_t default_type;
};
typedef struct pmix_bfrops_globals_t pmix_bfrops_globals_t;
PMIX_EXPORT extern pmix_bfrops_globals_t pmix_bfrops_globals;
/*
* The default starting chunk size
*/
#define PMIX_BFROP_DEFAULT_INITIAL_SIZE 128
/*
* The default threshold size when we switch from doubling the
* buffer size to additively increasing it
*/
#define PMIX_BFROP_DEFAULT_THRESHOLD_SIZE 1024
/*
* Internal type corresponding to size_t. Do not use this in
* interface calls - use PMIX_SIZE instead.
*/
#if SIZEOF_SIZE_T == 1
#define BFROP_TYPE_SIZE_T PMIX_UINT8
#elif SIZEOF_SIZE_T == 2
#define BFROP_TYPE_SIZE_T PMIX_UINT16
#elif SIZEOF_SIZE_T == 4
#define BFROP_TYPE_SIZE_T PMIX_UINT32
#elif SIZEOF_SIZE_T == 8
#define BFROP_TYPE_SIZE_T PMIX_UINT64
#else
#error Unsupported size_t size!
#endif
/*
* Internal type corresponding to bool. Do not use this in interface
* calls - use PMIX_BOOL instead.
*/
#if SIZEOF__BOOL == 1
#define BFROP_TYPE_BOOL PMIX_UINT8
#elif SIZEOF__BOOL == 2
#define BFROP_TYPE_BOOL PMIX_UINT16
#elif SIZEOF__BOOL == 4
#define BFROP_TYPE_BOOL PMIX_UINT32
#elif SIZEOF__BOOL == 8
#define BFROP_TYPE_BOOL PMIX_UINT64
#else
#error Unsupported bool size!
#endif
/*
* Internal type corresponding to int and unsigned int. Do not use
* this in interface calls - use PMIX_INT / PMIX_UINT instead.
*/
#if SIZEOF_INT == 1
#define BFROP_TYPE_INT PMIX_INT8
#define BFROP_TYPE_UINT PMIX_UINT8
#elif SIZEOF_INT == 2
#define BFROP_TYPE_INT PMIX_INT16
#define BFROP_TYPE_UINT PMIX_UINT16
#elif SIZEOF_INT == 4
#define BFROP_TYPE_INT PMIX_INT32
#define BFROP_TYPE_UINT PMIX_UINT32
#elif SIZEOF_INT == 8
#define BFROP_TYPE_INT PMIX_INT64
#define BFROP_TYPE_UINT PMIX_UINT64
#else
#error Unsupported INT size!
#endif
/*
* Internal type corresponding to pid_t. Do not use this in interface
* calls - use PMIX_PID instead.
*/
#if SIZEOF_PID_T == 1
#define BFROP_TYPE_PID_T PMIX_UINT8
#elif SIZEOF_PID_T == 2
#define BFROP_TYPE_PID_T PMIX_UINT16
#elif SIZEOF_PID_T == 4
#define BFROP_TYPE_PID_T PMIX_UINT32
#elif SIZEOF_PID_T == 8
#define BFROP_TYPE_PID_T PMIX_UINT64
#else
#error Unsupported pid_t size!
#endif
/**
* Internal struct used for holding registered bfrop functions
*/
typedef struct {
pmix_object_t super;
/* type identifier */
pmix_data_type_t odti_type;
/** Debugging string name */
char *odti_name;
/** Pack function */
pmix_bfrop_pack_fn_t odti_pack_fn;
/** Unpack function */
pmix_bfrop_unpack_fn_t odti_unpack_fn;
/** copy function */
pmix_bfrop_copy_fn_t odti_copy_fn;
/** prpmix_status_t function */
pmix_bfrop_print_fn_t odti_print_fn;
} pmix_bfrop_type_info_t;
PMIX_CLASS_DECLARATION(pmix_bfrop_type_info_t);
/* macro for registering data types - overwrite an existing
* duplicate one based on type name */
#define PMIX_REGISTER_TYPE(n, t, p, u, c, pr, arr) \
do { \
pmix_bfrop_type_info_t *_info; \
_info = PMIX_NEW(pmix_bfrop_type_info_t); \
_info->odti_name = strdup((n)); \
_info->odti_type = (t); \
_info->odti_pack_fn = (pmix_bfrop_pack_fn_t)(p); \
_info->odti_unpack_fn = (pmix_bfrop_unpack_fn_t)(u); \
_info->odti_copy_fn = (pmix_bfrop_copy_fn_t)(c) ; \
_info->odti_print_fn = (pmix_bfrop_print_fn_t)(pr) ; \
pmix_pointer_array_set_item((arr), (t), _info); \
} while (0)
/* API Stub functions */
PMIX_EXPORT char* pmix_bfrops_stub_get_available_modules(void);
PMIX_EXPORT pmix_status_t pmix_bfrops_stub_assign_module(struct pmix_peer_t *peer,
const char *version);
PMIX_EXPORT pmix_buffer_t* pmix_bfrops_stub_create_buffer(struct pmix_peer_t *pr);
PMIX_EXPORT void pmix_bfrops_construct_buffer(struct pmix_peer_t *pr,
pmix_buffer_t *buf);
PMIX_EXPORT pmix_status_t pmix_bfrops_stub_pack(struct pmix_peer_t *peer,
pmix_buffer_t *buffer,
const void *src,
int32_t num_values,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_stub_unpack(struct pmix_peer_t *peer,
pmix_buffer_t *buffer, void *dest,
int32_t *max_num_values,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_stub_copy(struct pmix_peer_t *peer,
void **dest, void *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_stub_print(struct pmix_peer_t *peer,
char **output, char *prefix,
void *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_stub_copy_payload(struct pmix_peer_t *peer,
pmix_buffer_t *dest,
pmix_buffer_t *src);
PMIX_EXPORT pmix_status_t pmix_bfrops_stub_value_xfer(struct pmix_peer_t *peer,
pmix_value_t *dest,
pmix_value_t *src);
PMIX_EXPORT void pmix_bfrops_stub_value_load(struct pmix_peer_t *peer,
pmix_value_t *v, void *data,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_stub_value_unload(struct pmix_peer_t *peer,
pmix_value_t *kv,
void **data, size_t *sz);
PMIX_EXPORT pmix_value_cmp_t pmix_bfrops_stub_value_cmp(struct pmix_peer_t *peer,
pmix_value_t *p1, pmix_value_t *p2);
PMIX_EXPORT pmix_status_t pmix_bfrops_stub_register_type(struct pmix_peer_t *peer,
const char *name, pmix_data_type_t type,
pmix_bfrop_pack_fn_t pack,
pmix_bfrop_unpack_fn_t unpack,
pmix_bfrop_copy_fn_t copy,
pmix_bfrop_print_fn_t print);
/* data type string function */
PMIX_EXPORT const char* pmix_bfrops_base_data_type_string(pmix_pointer_array_t *regtypes,
pmix_data_type_t type);
/*
* "Standard" pack functions
*/
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer,
const void *src, int num_vals,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_buffer(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer,
const void *src, int32_t num_vals,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_bool(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_sizet(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_byte(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_string(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pid(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int16(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int32(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int64(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_string(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_float(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_double(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_timeval(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_time(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_status(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_buf(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_bo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_proc(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_value(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_info(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pdata(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_app(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_kval(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_array(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_modex(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_persist(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_datatype(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_ptr(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_scope(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_range(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_cmd(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_info_directives(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pstate(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pinfo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_darray(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_rank(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_query(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_val(pmix_buffer_t *buffer,
pmix_value_t *p);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_alloc_directive(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
/*
* "Standard" unpack functions
*/
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer,
void *dst, int32_t *num_vals,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_bool(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_byte(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_string(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_sizet(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pid(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int16(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int32(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_datatype(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int64(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_float(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_double(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_timeval(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_time(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_status(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_val(pmix_buffer_t *buffer,
pmix_value_t *val);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_value(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_info(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_buf(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_proc(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_app(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_kval(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_modex(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_persist(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_bo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_ptr(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_scope(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_range(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_cmd(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_info_directives(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_datatype(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pstate(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pinfo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_darray(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_rank(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_query(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_alloc_directive(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
/**** DEPRECATED ****/
PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_array(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
/*
* "Standard" copy functions
*/
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy(pmix_pointer_array_t *regtypes,
void **dest, void *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_payload(pmix_buffer_t *dest,
pmix_buffer_t *src);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_std_copy(void **dest, void *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_string(char **dest, char *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_value(pmix_value_t **dest,
pmix_value_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_array(pmix_info_array_t **dest,
pmix_info_array_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_proc(pmix_proc_t **dest,
pmix_proc_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_app(pmix_app_t **dest,
pmix_app_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_info(pmix_info_t **dest,
pmix_info_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_buf(pmix_buffer_t **dest,
pmix_buffer_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_kval(pmix_kval_t **dest,
pmix_kval_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_modex(pmix_modex_data_t **dest,
pmix_modex_data_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrop_base_copy_persist(pmix_persistence_t **dest,
pmix_persistence_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_bo(pmix_byte_object_t **dest,
pmix_byte_object_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_pdata(pmix_pdata_t **dest,
pmix_pdata_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_pinfo(pmix_proc_info_t **dest,
pmix_proc_info_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_darray(pmix_data_array_t **dest,
pmix_data_array_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_query(pmix_query_t **dest,
pmix_query_t *src,
pmix_data_type_t type);
/**** DEPRECATED ****/
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_array(pmix_info_array_t **dest,
pmix_info_array_t *src,
pmix_data_type_t type);
/*
* "Standard" print functions
*/
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print(pmix_pointer_array_t *regtypes,
char **output, char *prefix,
void *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_bool(char **output, char *prefix,
bool *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_byte(char **output, char *prefix,
uint8_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_string(char **output, char *prefix,
char *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_size(char **output, char *prefix,
size_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_pid(char **output, char *prefix,
pid_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_int(char **output, char *prefix,
int *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_int8(char **output, char *prefix,
int8_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_int16(char **output, char *prefix,
int16_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_int32(char **output, char *prefix,
int32_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_int64(char **output, char *prefix,
int64_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_uint(char **output, char *prefix,
uint *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_uint8(char **output, char *prefix,
uint8_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_uint16(char **output, char *prefix,
uint16_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_uint32(char **output, char *prefix,
uint32_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_uint64(char **output, char *prefix,
uint64_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_float(char **output, char *prefix,
float *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_double(char **output, char *prefix,
double *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_timeval(char **output, char *prefix,
struct timeval *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_time(char **output, char *prefix,
time_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_status(char **output, char *prefix,
pmix_status_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_value(char **output, char *prefix,
pmix_value_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_array(char **output, char *prefix,
pmix_info_array_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_proc(char **output, char *prefix,
pmix_proc_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_app(char **output, char *prefix,
pmix_app_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_info(char **output, char *prefix,
pmix_info_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_buf(char **output, char *prefix,
pmix_buffer_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_kval(char **output, char *prefix,
pmix_kval_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_modex(char **output, char *prefix,
pmix_modex_data_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_persist(char **output, char *prefix,
pmix_persistence_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_bo(char **output, char *prefix,
pmix_byte_object_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_pdata(char **output, char *prefix,
pmix_pdata_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_ptr(char **output, char *prefix,
void *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_scope(char **output, char *prefix,
pmix_scope_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_range(char **output, char *prefix,
pmix_data_range_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_cmd(char **output, char *prefix,
pmix_cmd_t *src, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_info_directives(char **output, char *prefix,
pmix_info_directives_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_datatype(char **output, char *prefix,
pmix_data_type_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_pstate(char **output, char *prefix,
pmix_proc_state_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_pinfo(char **output, char *prefix,
pmix_proc_info_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_darray(char **output, char *prefix,
pmix_data_array_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_query(char **output, char *prefix,
pmix_query_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_rank(char **output, char *prefix,
pmix_rank_t *src,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_alloc_directive(char **output, char *prefix,
pmix_alloc_directive_t *src,
pmix_data_type_t type);
/*
* Common helper functions
*/
PMIX_EXPORT char* pmix_bfrop_buffer_extend(pmix_buffer_t *bptr, size_t bytes_to_add);
PMIX_EXPORT bool pmix_bfrop_too_small(pmix_buffer_t *buffer, size_t bytes_reqd);
PMIX_EXPORT pmix_bfrop_type_info_t* pmix_bfrop_find_type(pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_payload(pmix_buffer_t *dest,
pmix_buffer_t *src);
PMIX_EXPORT void pmix_bfrops_base_value_load(pmix_value_t *v, const void *data,
pmix_data_type_t type);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_value_unload(pmix_value_t *kv,
void **data,
size_t *sz);
PMIX_EXPORT pmix_status_t pmix_bfrops_base_value_xfer(pmix_value_t *p,
pmix_value_t *src);
PMIX_EXPORT pmix_value_cmp_t pmix_bfrops_base_value_cmp(pmix_value_t *p,
pmix_value_t *p1);
END_C_DECLS
#endif

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

@ -0,0 +1,871 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 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) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/include/pmix_globals.h"
#include "src/mca/bfrops/base/base.h"
pmix_status_t pmix_bfrops_base_copy(pmix_pointer_array_t *regtypes,
void **dest, void *src,
pmix_data_type_t type)
{
pmix_bfrop_type_info_t *info;
/* check for error */
if (NULL == dest || NULL == src) {
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return PMIX_ERR_BAD_PARAM;
}
/* Lookup the copy function for this type and call it */
if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(regtypes, type))) {
PMIX_ERROR_LOG(PMIX_ERR_UNKNOWN_DATA_TYPE);
return PMIX_ERR_UNKNOWN_DATA_TYPE;
}
return info->odti_copy_fn(dest, src, type);
}
pmix_status_t pmix_bfrops_base_copy_payload(pmix_buffer_t *dest,
pmix_buffer_t *src)
{
size_t to_copy = 0;
char *ptr;
/* deal with buffer type */
if (NULL == dest->base_ptr){
/* destination buffer is empty - derive src buffer type */
dest->type = src->type;
} else if (dest->type != src->type) {
/* buffer types mismatch */
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return PMIX_ERR_BAD_PARAM;
}
to_copy = src->pack_ptr - src->unpack_ptr;
if (NULL == (ptr = pmix_bfrop_buffer_extend(dest, to_copy))) {
PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE);
return PMIX_ERR_OUT_OF_RESOURCE;
}
memcpy(ptr,src->unpack_ptr, to_copy);
dest->bytes_used += to_copy;
dest->pack_ptr += to_copy;
return PMIX_SUCCESS;
}
/*
* STANDARD COPY FUNCTION - WORKS FOR EVERYTHING NON-STRUCTURED
*/
pmix_status_t pmix_bfrops_base_std_copy(void **dest, void *src,
pmix_data_type_t type)
{
size_t datasize;
uint8_t *val = NULL;
switch(type) {
case PMIX_BOOL:
datasize = sizeof(bool);
break;
case PMIX_INT:
case PMIX_UINT:
datasize = sizeof(int);
break;
case PMIX_SIZE:
datasize = sizeof(size_t);
break;
case PMIX_PID:
datasize = sizeof(pid_t);
break;
case PMIX_BYTE:
case PMIX_INT8:
case PMIX_UINT8:
datasize = 1;
break;
case PMIX_INT16:
case PMIX_UINT16:
datasize = 2;
break;
case PMIX_INT32:
case PMIX_UINT32:
datasize = 4;
break;
case PMIX_INT64:
case PMIX_UINT64:
datasize = 8;
break;
case PMIX_FLOAT:
datasize = sizeof(float);
break;
case PMIX_TIMEVAL:
datasize = sizeof(struct timeval);
break;
case PMIX_TIME:
datasize = sizeof(time_t);
break;
case PMIX_STATUS:
datasize = sizeof(pmix_status_t);
break;
case PMIX_PROC_RANK:
datasize = sizeof(pmix_rank_t);
break;
case PMIX_PERSIST:
datasize = sizeof(pmix_persistence_t);
break;
case PMIX_POINTER:
datasize = sizeof(char*);
break;
case PMIX_SCOPE:
datasize = sizeof(pmix_scope_t);
break;
case PMIX_DATA_RANGE:
datasize = sizeof(pmix_data_range_t);
break;
case PMIX_COMMAND:
datasize = sizeof(pmix_cmd_t);
break;
case PMIX_INFO_DIRECTIVES:
datasize = sizeof(pmix_info_directives_t);
break;
case PMIX_PROC_STATE:
datasize = sizeof(pmix_proc_state_t);
break;
case PMIX_ALLOC_DIRECTIVE:
datasize = sizeof(pmix_alloc_directive_t);
break;
default:
return PMIX_ERR_UNKNOWN_DATA_TYPE;
}
val = (uint8_t*)malloc(datasize);
if (NULL == val) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
memcpy(val, src, datasize);
*dest = val;
return PMIX_SUCCESS;
}
/* COPY FUNCTIONS FOR NON-STANDARD SYSTEM TYPES */
/*
* STRING
*/
pmix_status_t pmix_bfrops_base_copy_string(char **dest, char *src,
pmix_data_type_t type)
{
if (NULL == src) { /* got zero-length string/NULL pointer - store NULL */
*dest = NULL;
} else {
*dest = strdup(src);
}
return PMIX_SUCCESS;
}
/* PMIX_VALUE */
pmix_status_t pmix_bfrops_base_copy_value(pmix_value_t **dest,
pmix_value_t *src,
pmix_data_type_t type)
{
pmix_value_t *p;
/* create the new object */
*dest = (pmix_value_t*)malloc(sizeof(pmix_value_t));
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
p = *dest;
/* copy the type */
p->type = src->type;
/* copy the data */
return pmix_bfrops_base_value_xfer(p, src);
}
pmix_status_t pmix_bfrops_base_copy_info(pmix_info_t **dest,
pmix_info_t *src,
pmix_data_type_t type)
{
*dest = (pmix_info_t*)malloc(sizeof(pmix_info_t));
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
(*dest)->flags = src->flags;
return pmix_bfrops_base_value_xfer(&(*dest)->value, &src->value);
}
pmix_status_t pmix_bfrops_base_copy_buf(pmix_buffer_t **dest,
pmix_buffer_t *src,
pmix_data_type_t type)
{
*dest = PMIX_NEW(pmix_buffer_t);
pmix_bfrops_base_copy_payload(*dest, src);
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrops_base_copy_app(pmix_app_t **dest,
pmix_app_t *src,
pmix_data_type_t type)
{
size_t j;
*dest = (pmix_app_t*)malloc(sizeof(pmix_app_t));
(*dest)->cmd = strdup(src->cmd);
(*dest)->argv = pmix_argv_copy(src->argv);
(*dest)->env = pmix_argv_copy(src->env);
if (NULL != src->cwd) {
(*dest)->cwd = strdup(src->cwd);
}
(*dest)->maxprocs = src->maxprocs;
(*dest)->ninfo = src->ninfo;
(*dest)->info = (pmix_info_t*)malloc(src->ninfo * sizeof(pmix_info_t));
for (j=0; j < src->ninfo; j++) {
(void)strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN);
pmix_value_xfer(&(*dest)->info[j].value, &src->info[j].value);
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrops_base_copy_kval(pmix_kval_t **dest,
pmix_kval_t *src,
pmix_data_type_t type)
{
pmix_kval_t *p;
/* create the new object */
*dest = PMIX_NEW(pmix_kval_t);
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
p = *dest;
/* copy the type */
p->value->type = src->value->type;
/* copy the data */
return pmix_bfrops_base_value_xfer(p->value, src->value);
}
pmix_status_t pmix_bfrops_base_copy_proc(pmix_proc_t **dest,
pmix_proc_t *src,
pmix_data_type_t type)
{
*dest = (pmix_proc_t*)malloc(sizeof(pmix_proc_t));
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
(void)strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN);
(*dest)->rank = src->rank;
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrops_base_copy_modex(pmix_modex_data_t **dest,
pmix_modex_data_t *src,
pmix_data_type_t type)
{
*dest = (pmix_modex_data_t*)malloc(sizeof(pmix_modex_data_t));
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
(*dest)->blob = NULL;
(*dest)->size = 0;
if (NULL != src->blob) {
(*dest)->blob = (uint8_t*)malloc(src->size * sizeof(uint8_t));
if (NULL == (*dest)->blob) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
memcpy((*dest)->blob, src->blob, src->size * sizeof(uint8_t));
(*dest)->size = src->size;
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_base_copy_persist(pmix_persistence_t **dest,
pmix_persistence_t *src,
pmix_data_type_t type)
{
*dest = (pmix_persistence_t*)malloc(sizeof(pmix_persistence_t));
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
memcpy(*dest, src, sizeof(pmix_persistence_t));
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrops_base_copy_bo(pmix_byte_object_t **dest,
pmix_byte_object_t *src,
pmix_data_type_t type)
{
*dest = (pmix_byte_object_t*)malloc(sizeof(pmix_byte_object_t));
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
(*dest)->bytes = (char*)malloc(src->size);
memcpy((*dest)->bytes, src->bytes, src->size);
(*dest)->size = src->size;
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrops_base_copy_pdata(pmix_pdata_t **dest,
pmix_pdata_t *src,
pmix_data_type_t type)
{
*dest = (pmix_pdata_t*)malloc(sizeof(pmix_pdata_t));
(void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN);
(*dest)->proc.rank = src->proc.rank;
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
return pmix_bfrops_base_value_xfer(&(*dest)->value, &src->value);
}
pmix_status_t pmix_bfrops_base_copy_pinfo(pmix_proc_info_t **dest,
pmix_proc_info_t *src,
pmix_data_type_t type)
{
*dest = (pmix_proc_info_t*)malloc(sizeof(pmix_proc_info_t));
(void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN);
(*dest)->proc.rank = src->proc.rank;
if (NULL != src->hostname) {
(*dest)->hostname = strdup(src->hostname);
}
if (NULL != src->executable_name) {
(*dest)->executable_name = strdup(src->executable_name);
}
(*dest)->pid = src->pid;
(*dest)->exit_code = src->exit_code;
(*dest)->state = src->state;
return PMIX_SUCCESS;
}
/* the pmix_data_array_t is a little different in that it
* is an array of values, and so we cannot just copy one
* value at a time. So handle all value types here */
pmix_status_t pmix_bfrops_base_copy_darray(pmix_data_array_t **dest,
pmix_data_array_t *src,
pmix_data_type_t type)
{
pmix_data_array_t *p;
size_t n, m;
pmix_status_t rc;
char **prarray, **strarray;
pmix_value_t *pv, *sv;
pmix_app_t *pa, *sa;
pmix_info_t *p1, *s1;
pmix_pdata_t *pd, *sd;
pmix_buffer_t *pb, *sb;
pmix_byte_object_t *pbo, *sbo;
pmix_kval_t *pk, *sk;
pmix_modex_data_t *pm, *sm;
pmix_proc_info_t *pi, *si;
pmix_query_t *pq, *sq;
p = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t));
if (NULL == p) {
return PMIX_ERR_NOMEM;
}
p->type = src->type;
p->size = src->size;
/* process based on type of array element */
switch (src->type) {
p->type = src->type;
p->size = src->size;
if (0 == p->size || NULL == src->array) {
p->array = NULL;
p->size = 0;
break;
}
case PMIX_UINT8:
case PMIX_INT8:
case PMIX_BYTE:
p->array = (char*)malloc(src->size);
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size);
break;
case PMIX_UINT16:
case PMIX_INT16:
p->array = (char*)malloc(src->size * sizeof(uint16_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(uint16_t));
break;
case PMIX_UINT32:
case PMIX_INT32:
p->array = (char*)malloc(src->size * sizeof(uint32_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(uint32_t));
break;
case PMIX_UINT64:
case PMIX_INT64:
p->array = (char*)malloc(src->size * sizeof(uint64_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(uint64_t));
break;
case PMIX_BOOL:
p->array = (char*)malloc(src->size * sizeof(bool));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(bool));
break;
case PMIX_SIZE:
p->array = (char*)malloc(src->size * sizeof(size_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(size_t));
break;
case PMIX_PID:
p->array = (char*)malloc(src->size * sizeof(pid_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pid_t));
break;
case PMIX_STRING:
p->array = (char**)malloc(src->size * sizeof(char*));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
prarray = (char**)p->array;
strarray = (char**)src->array;
for (n=0; n < src->size; n++) {
if (NULL != strarray[n]) {
prarray[n] = strdup(strarray[n]);
}
}
break;
case PMIX_INT:
case PMIX_UINT:
p->array = (char*)malloc(src->size * sizeof(int));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(int));
break;
case PMIX_FLOAT:
p->array = (char*)malloc(src->size * sizeof(float));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(float));
break;
case PMIX_DOUBLE:
p->array = (char*)malloc(src->size * sizeof(double));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(double));
break;
case PMIX_TIMEVAL:
p->array = (struct timeval*)malloc(src->size * sizeof(struct timeval));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(struct timeval));
break;
case PMIX_TIME:
p->array = (time_t*)malloc(src->size * sizeof(time_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(time_t));
break;
case PMIX_STATUS:
p->array = (pmix_status_t*)malloc(src->size * sizeof(pmix_status_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_status_t));
break;
case PMIX_VALUE:
PMIX_VALUE_CREATE(p->array, src->size);
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
pv = (pmix_value_t*)p->array;
sv = (pmix_value_t*)src->array;
for (n=0; n < src->size; n++) {
if (PMIX_SUCCESS != (rc = pmix_bfrops_base_value_xfer(&pv[n], &sv[n]))) {
PMIX_VALUE_FREE(pv, src->size);
free(p);
return rc;
}
}
break;
case PMIX_PROC:
PMIX_PROC_CREATE(p->array, src->size);
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_proc_t));
break;
case PMIX_PROC_RANK:
p->array = (char*)malloc(src->size * sizeof(pmix_rank_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_proc_t));
break;
case PMIX_APP:
PMIX_APP_CREATE(p->array, src->size);
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
pa = (pmix_app_t*)p->array;
sa = (pmix_app_t*)src->array;
for (n=0; n < src->size; n++) {
if (NULL != sa[n].cmd) {
pa[n].cmd = strdup(sa[n].cmd);
}
if (NULL != sa[n].argv) {
pa[n].argv = pmix_argv_copy(sa[n].argv);
}
if (NULL != sa[n].env) {
pa[n].env = pmix_argv_copy(sa[n].env);
}
if (NULL != sa[n].cwd) {
pa[n].cwd = strdup(sa[n].cwd);
}
pa[n].maxprocs = sa[n].maxprocs;
if (0 < sa[n].ninfo && NULL != sa[n].info) {
PMIX_INFO_CREATE(pa[n].info, sa[n].ninfo);
if (NULL == pa[n].info) {
PMIX_APP_FREE(pa, p->size);
free(p);
return PMIX_ERR_NOMEM;
}
pa[n].ninfo = sa[n].ninfo;
for (m=0; m < pa[n].ninfo; m++) {
PMIX_INFO_XFER(&pa[n].info[m], &sa[n].info[m]);
}
}
}
break;
case PMIX_INFO:
PMIX_INFO_CREATE(p->array, src->size);
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
p1 = (pmix_info_t*)p->array;
s1 = (pmix_info_t*)src->array;
for (n=0; n < src->size; n++) {
PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type);
}
break;
case PMIX_PDATA:
PMIX_PDATA_CREATE(p->array, src->size);
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
pd = (pmix_pdata_t*)p->array;
sd = (pmix_pdata_t*)src->array;
for (n=0; n < src->size; n++) {
PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value.data.flag, sd[n].value.type);
}
break;
case PMIX_BUFFER:
p->array = (pmix_buffer_t*)malloc(src->size * sizeof(pmix_buffer_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
pb = (pmix_buffer_t*)p->array;
sb = (pmix_buffer_t*)src->array;
for (n=0; n < src->size; n++) {
PMIX_CONSTRUCT(&pb[n], pmix_buffer_t);
pmix_bfrops_base_copy_payload(&pb[n], &sb[n]);
}
break;
case PMIX_BYTE_OBJECT:
case PMIX_COMPRESSED_STRING:
p->array = (pmix_byte_object_t*)malloc(src->size * sizeof(pmix_byte_object_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
pbo = (pmix_byte_object_t*)p->array;
sbo = (pmix_byte_object_t*)src->array;
for (n=0; n < src->size; n++) {
if (NULL != sbo[n].bytes && 0 < sbo[n].size) {
pbo[n].size = sbo[n].size;
pbo[n].bytes = (char*)malloc(pbo[n].size);
memcpy(pbo[n].bytes, sbo[n].bytes, pbo[n].size);
} else {
pbo[n].bytes = NULL;
pbo[n].size = 0;
}
}
break;
case PMIX_KVAL:
p->array = (pmix_kval_t*)calloc(src->size , sizeof(pmix_kval_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
pk = (pmix_kval_t*)p->array;
sk = (pmix_kval_t*)src->array;
for (n=0; n < src->size; n++) {
if (NULL != sk[n].key) {
pk[n].key = strdup(sk[n].key);
}
if (NULL != sk[n].value) {
PMIX_VALUE_CREATE(pk[n].value, 1);
if (NULL == pk[n].value) {
PMIX_VALUE_FREE(pk[n].value, 1);
free(p);
return PMIX_ERR_NOMEM;
}
if (PMIX_SUCCESS != (rc = pmix_bfrops_base_value_xfer(pk[n].value, sk[n].value))) {
PMIX_VALUE_FREE(pk[n].value, 1);
free(p);
return rc;
}
}
}
break;
case PMIX_MODEX:
PMIX_MODEX_CREATE(p->array, src->size);
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
pm = (pmix_modex_data_t*)p->array;
sm = (pmix_modex_data_t*)src->array;
for (n=0; n < src->size; n++) {
memcpy(&pm[n], &sm[n], sizeof(pmix_modex_data_t));
if (NULL != sm[n].blob && 0 < sm[n].size) {
pm[n].blob = (uint8_t*)malloc(sm[n].size);
if (NULL == pm[n].blob) {
PMIX_MODEX_FREE(pm, src->size);
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(pm[n].blob, sm[n].blob, sm[n].size);
pm[n].size = sm[n].size;
} else {
pm[n].blob = NULL;
pm[n].size = 0;
}
}
break;
case PMIX_PERSIST:
p->array = (pmix_persistence_t*)malloc(src->size * sizeof(pmix_persistence_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_persistence_t));
break;
case PMIX_POINTER:
p->array = (char**)malloc(src->size * sizeof(char*));
prarray = (char**)p->array;
strarray = (char**)src->array;
for (n=0; n < src->size; n++) {
prarray[n] = strarray[n];
}
break;
case PMIX_SCOPE:
p->array = (pmix_scope_t*)malloc(src->size * sizeof(pmix_scope_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_scope_t));
break;
case PMIX_DATA_RANGE:
p->array = (pmix_data_range_t*)malloc(src->size * sizeof(pmix_data_range_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_data_range_t));
break;
case PMIX_COMMAND:
p->array = (pmix_cmd_t*)malloc(src->size * sizeof(pmix_cmd_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_cmd_t));
break;
case PMIX_INFO_DIRECTIVES:
p->array = (pmix_info_directives_t*)malloc(src->size * sizeof(pmix_info_directives_t));
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_info_directives_t));
break;
case PMIX_PROC_INFO:
PMIX_PROC_INFO_CREATE(p->array, src->size);
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
pi = (pmix_proc_info_t*)p->array;
si = (pmix_proc_info_t*)src->array;
for (n=0; n < src->size; n++) {
memcpy(&pi[n].proc, &si[n].proc, sizeof(pmix_proc_t));
if (NULL != si[n].hostname) {
pi[n].hostname = strdup(si[n].hostname);
} else {
pi[n].hostname = NULL;
}
if (NULL != si[n].executable_name) {
pi[n].executable_name = strdup(si[n].executable_name);
} else {
pi[n].executable_name = NULL;
}
pi[n].pid = si[n].pid;
pi[n].exit_code = si[n].exit_code;
pi[n].state = si[n].state;
}
break;
case PMIX_DATA_ARRAY:
free(p);
return PMIX_ERR_NOT_SUPPORTED; // don't support iterative arrays
case PMIX_QUERY:
PMIX_QUERY_CREATE(p->array, src->size);
if (NULL == p->array) {
free(p);
return PMIX_ERR_NOMEM;
}
pq = (pmix_query_t*)p->array;
sq = (pmix_query_t*)src->array;
for (n=0; n < src->size; n++) {
if (NULL != sq[n].keys) {
pq[n].keys = pmix_argv_copy(sq[n].keys);
}
if (NULL != sq[n].qualifiers && 0 < sq[n].nqual) {
PMIX_INFO_CREATE(pq[n].qualifiers, sq[n].nqual);
if (NULL == pq[n].qualifiers) {
PMIX_INFO_FREE(pq[n].qualifiers, sq[n].nqual);
free(p);
return PMIX_ERR_NOMEM;
}
for (m=0; m < sq[n].nqual; m++) {
PMIX_INFO_XFER(&pq[n].qualifiers[m], &sq[n].qualifiers[m]);
}
pq[n].nqual = sq[n].nqual;
} else {
pq[n].qualifiers = NULL;
pq[n].nqual = 0;
}
}
break;
default:
free(p);
return PMIX_ERR_UNKNOWN_DATA_TYPE;
}
(*dest) = p;
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrops_base_copy_query(pmix_query_t **dest,
pmix_query_t *src,
pmix_data_type_t type)
{
pmix_status_t rc;
*dest = (pmix_query_t*)malloc(sizeof(pmix_query_t));
if (NULL != src->keys) {
(*dest)->keys = pmix_argv_copy(src->keys);
}
(*dest)->nqual = src->nqual;
if (NULL != src->qualifiers) {
if (PMIX_SUCCESS != (rc = pmix_bfrops_base_copy_info(&((*dest)->qualifiers), src->qualifiers, PMIX_INFO))) {
free(*dest);
return rc;
}
}
return PMIX_SUCCESS;
}
/**** DEPRECATED ****/
pmix_status_t pmix_bfrops_base_copy_array(pmix_info_array_t **dest,
pmix_info_array_t *src,
pmix_data_type_t type)
{
pmix_info_t *d1, *s1;
*dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
(*dest)->size = src->size;
(*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t));
d1 = (pmix_info_t*)(*dest)->array;
s1 = (pmix_info_t*)src->array;
memcpy(d1, s1, src->size * sizeof(pmix_info_t));
return PMIX_SUCCESS;
}
/*******************/

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,184 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2009 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) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
*/
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "src/mca/mca.h"
#include "src/mca/base/base.h"
#include "src/mca/base/pmix_mca_base_var.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/class/pmix_list.h"
#include "src/mca/bfrops/base/base.h"
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* component's public mca_base_component_t struct.
*/
#include "src/mca/bfrops/base/static-components.h"
/* Instantiate the global vars */
pmix_bfrops_globals_t pmix_bfrops_globals = {{{0}}};
static int pmix_bfrop_register(pmix_mca_base_register_flag_t flags)
{
pmix_bfrops_globals.initial_size = PMIX_BFROP_DEFAULT_INITIAL_SIZE;
pmix_mca_base_var_register("pmix", "bfrops", "base", "initial_size",
"Initial size of a buffer",
PMIX_MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
PMIX_INFO_LVL_2,
PMIX_MCA_BASE_VAR_SCOPE_READONLY,
&pmix_bfrops_globals.initial_size);
pmix_bfrops_globals.threshold_size = PMIX_BFROP_DEFAULT_THRESHOLD_SIZE;
pmix_mca_base_var_register("pmix", "bfrops", "base", "threshold_size",
"Size at which we switch from extending a buffer by doubling to extending by a smaller value",
PMIX_MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
PMIX_INFO_LVL_2,
PMIX_MCA_BASE_VAR_SCOPE_READONLY,
&pmix_bfrops_globals.threshold_size);
#if PMIX_ENABLE_DEBUG
pmix_bfrops_globals.default_type = PMIX_BFROP_BUFFER_FULLY_DESC;
#else
pmix_bfrops_globals.default_type = PMIX_BFROP_BUFFER_NON_DESC;
#endif
pmix_mca_base_var_register("pmix", "bfrops", "base", "default_type",
"Default type for buffers",
PMIX_MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
PMIX_INFO_LVL_2,
PMIX_MCA_BASE_VAR_SCOPE_READONLY,
&pmix_bfrops_globals.default_type);
return PMIX_SUCCESS;
}
static pmix_status_t pmix_bfrop_close(void)
{
if (!pmix_bfrops_globals.initialized) {
return PMIX_SUCCESS;
}
pmix_bfrops_globals.initialized = false;
/* the components will cleanup when closed */
PMIX_DESTRUCT(&pmix_bfrops_globals.actives);
return pmix_mca_base_framework_components_close(&pmix_bfrops_base_framework, NULL);
}
static pmix_status_t pmix_bfrop_open(pmix_mca_base_open_flag_t flags)
{
/* initialize globals */
pmix_bfrops_globals.initialized = true;
PMIX_CONSTRUCT(&pmix_bfrops_globals.actives, pmix_list_t);
/* Open up all available components */
return pmix_mca_base_framework_components_open(&pmix_bfrops_base_framework, flags);
}
PMIX_MCA_BASE_FRAMEWORK_DECLARE(pmix, bfrops, "PMIx Buffer Operations",
pmix_bfrop_register, pmix_bfrop_open, pmix_bfrop_close,
mca_bfrops_base_static_components, 0);
static void moddes(pmix_bfrops_base_active_module_t *p)
{
if (NULL != p->module->finalize) {
p->module->finalize();
}
}
PMIX_CLASS_INSTANCE(pmix_bfrops_base_active_module_t,
pmix_list_item_t,
NULL, moddes);
/**
* Object constructors, destructors, and instantiations
*/
/** Value **/
static void pmix_buffer_construct (pmix_buffer_t* buffer)
{
/** set the default buffer type */
buffer->type = PMIX_BFROP_BUFFER_UNDEF;
/* Make everything NULL to begin with */
buffer->base_ptr = buffer->pack_ptr = buffer->unpack_ptr = NULL;
buffer->bytes_allocated = buffer->bytes_used = 0;
}
static void pmix_buffer_destruct (pmix_buffer_t* buffer)
{
if (NULL != buffer->base_ptr) {
free (buffer->base_ptr);
}
}
PMIX_CLASS_INSTANCE(pmix_buffer_t,
pmix_object_t,
pmix_buffer_construct,
pmix_buffer_destruct);
static void pmix_bfrop_type_info_construct(pmix_bfrop_type_info_t *obj)
{
obj->odti_name = NULL;
obj->odti_pack_fn = NULL;
obj->odti_unpack_fn = NULL;
obj->odti_copy_fn = NULL;
obj->odti_print_fn = NULL;
}
static void pmix_bfrop_type_info_destruct(pmix_bfrop_type_info_t *obj)
{
if (NULL != obj->odti_name) {
free(obj->odti_name);
}
}
PMIX_CLASS_INSTANCE(pmix_bfrop_type_info_t, pmix_object_t,
pmix_bfrop_type_info_construct,
pmix_bfrop_type_info_destruct);
static void kvcon(pmix_kval_t *k)
{
k->key = NULL;
k->value = NULL;
}
static void kvdes(pmix_kval_t *k)
{
if (NULL != k->key) {
free(k->key);
}
if (NULL != k->value) {
PMIX_VALUE_RELEASE(k->value);
}
}
PMIX_CLASS_INSTANCE(pmix_kval_t,
pmix_list_item_t,
kvcon, kvdes);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,120 @@
/*
* Copyright (c) 2004-2008 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) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#include <string.h>
#include "src/mca/mca.h"
#include "src/mca/base/base.h"
#include "src/mca/bfrops/base/base.h"
static bool selected = false;
/* Function for selecting a prioritized list of components
* from all those that are available. */
int pmix_bfrop_base_select(void)
{
pmix_mca_base_component_list_item_t *cli = NULL;
pmix_mca_base_component_t *component = NULL;
pmix_mca_base_module_t *module = NULL;
pmix_bfrops_module_t *nmodule;
pmix_bfrops_base_active_module_t *newmodule, *mod;
int rc, priority;
bool inserted;
if (selected) {
/* ensure we don't do this twice */
return PMIX_SUCCESS;
}
selected = true;
/* Query all available components and ask if they have a module */
PMIX_LIST_FOREACH(cli, &pmix_bfrops_base_framework.framework_components, pmix_mca_base_component_list_item_t) {
component = (pmix_mca_base_component_t *) cli->cli_component;
pmix_output_verbose(5, pmix_bfrops_base_framework.framework_output,
"mca:bfrops:select: checking available component %s", component->pmix_mca_component_name);
/* If there's no query function, skip it */
if (NULL == component->pmix_mca_query_component) {
pmix_output_verbose(5, pmix_bfrops_base_framework.framework_output,
"mca:bfrops:select: Skipping component [%s]. It does not implement a query function",
component->pmix_mca_component_name );
continue;
}
/* Query the component */
pmix_output_verbose(5, pmix_bfrops_base_framework.framework_output,
"mca:bfrops:select: Querying component [%s]",
component->pmix_mca_component_name);
rc = component->pmix_mca_query_component(&module, &priority);
/* If no module was returned, then skip component */
if (PMIX_SUCCESS != rc || NULL == module) {
pmix_output_verbose(5, pmix_bfrops_base_framework.framework_output,
"mca:bfrops:select: Skipping component [%s]. Query failed to return a module",
component->pmix_mca_component_name );
continue;
}
nmodule = (pmix_bfrops_module_t*) module;
/* give it a chance to initialize */
if (NULL != nmodule->init) {
if (PMIX_SUCCESS != nmodule->init()) {
/* reject the module */
continue;
}
}
/* If we got a module, keep it */
/* add to the list of selected modules */
newmodule = PMIX_NEW(pmix_bfrops_base_active_module_t);
newmodule->pri = priority;
newmodule->module = nmodule;
newmodule->component = (pmix_bfrops_base_component_t*)cli->cli_component;
/* maintain priority order */
inserted = false;
PMIX_LIST_FOREACH(mod, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
if (priority > mod->pri) {
pmix_list_insert_pos(&pmix_bfrops_globals.actives,
(pmix_list_item_t*)mod, &newmodule->super);
inserted = true;
break;
}
}
if (!inserted) {
/* must be lowest priority - add to end */
pmix_list_append(&pmix_bfrops_globals.actives, &newmodule->super);
}
}
if (4 < pmix_output_get_verbosity(pmix_bfrops_base_framework.framework_output)) {
pmix_output(0, "Final Bfrop priorities");
/* show the prioritized list */
PMIX_LIST_FOREACH(mod, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
pmix_output(0, "\tBfrop: %s Priority: %d", mod->component->base.pmix_mca_component_name, mod->pri);
}
}
return PMIX_SUCCESS;;
}

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

@ -0,0 +1,109 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 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-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/include/pmix_globals.h"
#include "src/mca/bfrops/base/base.h"
PMIX_EXPORT const char* PMIx_Data_type_string(pmix_data_type_t type)
{
pmix_bfrops_base_active_module_t *active;
char *reply;
if (!pmix_bfrops_globals.initialized) {
return "NOT INITIALIZED";
}
PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
if (NULL != active->module->data_type_string) {
if (NULL != (reply = (char*)active->module->data_type_string(type))) {
return reply;
}
}
}
return "UNKNOWN";
}
char* pmix_bfrops_base_get_available_modules(void)
{
pmix_bfrops_base_active_module_t *active;
char **tmp=NULL, *reply=NULL;
if (!pmix_bfrops_globals.initialized) {
return NULL;
}
PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
pmix_argv_append_nosize(&tmp, active->component->base.pmix_mca_component_name);
}
if (NULL != tmp) {
reply = pmix_argv_join(tmp, ',');
pmix_argv_free(tmp);
}
return reply;
}
pmix_bfrops_module_t* pmix_bfrops_base_assign_module(const char *version)
{
pmix_bfrops_base_active_module_t *active;
pmix_bfrops_module_t *mod;
char **tmp=NULL;
int i;
if (!pmix_bfrops_globals.initialized) {
return NULL;
}
if (NULL != version) {
tmp = pmix_argv_split(version, ',');
}
PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
if (NULL == tmp) {
if (NULL != (mod = active->component->assign_module())) {
return mod;
}
} else {
for (i=0; NULL != tmp[i]; i++) {
if (0 == strcmp(tmp[i], active->component->base.pmix_mca_component_name)) {
if (NULL != (mod = active->component->assign_module())) {
pmix_argv_free(tmp);
return mod;
}
}
}
}
}
/* we only get here if nothing was found */
if (NULL != tmp) {
pmix_argv_free(tmp);
}
return NULL;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Mellanox Technologies, Inc.
@ -35,14 +35,70 @@
#include <src/include/types.h>
#include "src/include/pmix_globals.h"
#include "src/buffer_ops/types.h"
#include "src/mca/mca.h"
#include "bfrops_types.h"
BEGIN_C_DECLS
/* A non-API function for something that happens in a number
* of places throughout the code base - transferring a value to
* another pmix_value_t structure
/* The overall objective of this framework is to provide seamless
* cross-version support for communications by allowing a process
* to communicate with a peer:
*
* (a) using a different version of the buffer operations. We are
* allowing changes in the structure compositions and/or data
* type definitions between versions. This specifically affects
* our ability to pack/unpack across versions.
*
* (b) using a different buffer type (described vs non-described).
* This resolves conflicts when one side was compiled with a
* debug option, while the other side has been "optimized".
*
* This is a mult-select framework - i.e., multiple components
* are selected and "active" at the same time. The intent is
* to have one component for each data type variation, with the
* expectation that the community will do its best not to revise
* existing data type definitions. Thus, new variations should be
* rare, and only a few components will exist.
*
* The framework itself reflects the fact that any given peer
* will utilize only one variation of the data type definitions.
* Thus, once a peer is identified, it will pass its version string
* to this framework's "assign_module" function, which will then
* pass it to each component until one returns a module capable of
* processing the given version. This module is then "attached" to
* the pmix_peer_t object so it can be used for all subsequent
* communication to/from that peer.
*
* Buffer type is included in the buffer metadata. Unfortunately,
* the metadata is not communicated at each exchange. Thus, the
* peers will indicate during the connection handshake the type
* of buffer they will use for all subsequent communications. The
* peer must then utilize that same buffer type for all messages
* sent to that remote proc, so we provide new macros for creating
* and constructing buffers that ensures the correct buffer type
* is marked.
*
* Accordingly, there are two levels of APIs defined for this
* framework:
*
* (a) component level - these allow for init/finalize of the
* component, and assignment of a module to a given peer
* based on the version that peer is using
*
* (b) module level - implement pack/unpack/copy/recv/etc. of
* the various datatypes. Note that the module only needs
* to provide those functions that differ from the base
* functions - they don't need to duplicate all that code!
*/
/* The following functions are exposed to the user - they
* therefore are implemented in the bfrops/base functions
* as wrappers to the real functions.
*
* NOTE: THESE FUNCTIONS ARE NOT TO BE USED INTERNALLY -
* USE THE MACROS INSTEAD
*/
pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src);
void pmix_value_load(pmix_value_t *v, const void *data,
@ -52,32 +108,18 @@ pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data,
bool pmix_value_cmp(pmix_value_t *p, pmix_value_t *p1);
#define PMIX_LOAD_BUFFER(b, d, s) \
do { \
(b)->base_ptr = (char*)(d); \
(b)->bytes_used = (s); \
(b)->bytes_allocated = (s); \
(b)->pack_ptr = ((char*)(b)->base_ptr) + (s); \
(b)->unpack_ptr = (b)->base_ptr; \
(d) = NULL; \
(s) = 0; \
} while (0)
#define PMIX_UNLOAD_BUFFER(b, d, s) \
do { \
(d) = (char*)(b)->unpack_ptr; \
(s) = (b)->bytes_used; \
(b)->base_ptr = NULL; \
(b)->bytes_used = 0; \
(b)->bytes_allocated = 0; \
(b)->pack_ptr = NULL; \
(b)->unpack_ptr = NULL; \
} while (0)
/**** MODULE INTERFACE DEFINITION ****/
/* initialize the module - the module is expected
* to register its datatype functions at this time */
typedef pmix_status_t (*pmix_bfrop_init_fn_t)(void);
/* finalize the module */
typedef void (*pmix_bfrop_finalize_fn_t)(void);
/**
* Top-level interface function to pack one or more values into a
* buffer.
* Pack one or more values into a buffer.
*
* The pack function packs one or more values of a specified type into
* the specified buffer. The buffer must have already been
@ -96,8 +138,10 @@ bool pmix_value_cmp(pmix_value_t *p, pmix_value_t *p1);
* @param *buffer A pointer to the buffer into which the value is to
* be packed.
*
* @param *src A void* pointer to the data that is to be packed. Note
* that strings are to be passed as (char **) - i.e., the caller must
* @param *src A void* pointer to the data that is to be packed. This
* is interpreted as a pointer to an array of that data type containing
* length num_values. Note that strings are of data type char*, and so
* they are to be passed as (char **) - i.e., the caller must
* pass the address of the pointer to the string as the void*. This
* allows the BFROP to use a single interface function, but still allow
* the caller to pass multiple strings in a single call.
@ -125,7 +169,8 @@ bool pmix_value_cmp(pmix_value_t *p, pmix_value_t *p1);
* status_code = pmix_bfrop.pack(buffer, &src, 1, PMIX_INT32);
* @endcode
*/
typedef pmix_status_t (*pmix_bfrop_pack_fn_t)(pmix_buffer_t *buffer, const void *src,
typedef pmix_status_t (*pmix_bfrop_pack_fn_t)(pmix_buffer_t *buffer,
const void *src,
int32_t num_values,
pmix_data_type_t type);
@ -151,12 +196,6 @@ typedef pmix_status_t (*pmix_bfrop_pack_fn_t)(pmix_buffer_t *buffer, const void
* matches the specified data type flag). Therefore, the data type error check
* is NOT completely safe. This is true for ALL unpack functions.
*
*
* Unpacking values is a "destructive" process - i.e., the values are
* removed from the buffer, thus reducing the buffer size. It is
* therefore not possible for the caller to re-unpack a value from the
* same buffer.
*
* Warning: The caller is responsible for providing adequate memory
* storage for the requested data. As noted below, the user
* must provide a parameter indicating the maximum number of values that
@ -239,22 +278,6 @@ typedef pmix_status_t (*pmix_bfrop_unpack_fn_t)(pmix_buffer_t *buffer, void *des
typedef pmix_status_t (*pmix_bfrop_copy_payload_fn_t)(pmix_buffer_t *dest,
pmix_buffer_t *src);
/**
* BFROP initialization function.
*
* In dynamic libraries, declared objects and functions don't get
* loaded until called. We need to ensure that the pmix_bfrop function
* structure gets loaded, so we provide an "open" call that is
* executed as part of the program startup.
*/
pmix_status_t pmix_bfrop_open(void);
/**
* BFROP finalize function
*/
pmix_status_t pmix_bfrop_close(void);
/**
* Copy a data value from one location to another.
*
@ -278,7 +301,8 @@ pmix_status_t pmix_bfrop_close(void);
* @retval PMIX_ERROR(s) An appropriate error code.
*
*/
typedef pmix_status_t (*pmix_bfrop_copy_fn_t)(void **dest, void *src, pmix_data_type_t type);
typedef pmix_status_t (*pmix_bfrop_copy_fn_t)(void **dest, void *src,
pmix_data_type_t type);
/**
* Print a data value.
@ -291,24 +315,169 @@ typedef pmix_status_t (*pmix_bfrop_copy_fn_t)(void **dest, void *src, pmix_data_
*
* @retval PMIX_ERROR(s) An appropriate error code.
*/
typedef pmix_status_t (*pmix_bfrop_print_fn_t)(char **output, char *prefix, void *src, pmix_data_type_t type);
typedef pmix_status_t (*pmix_bfrop_print_fn_t)(char **output, char *prefix,
void *src, pmix_data_type_t type);
/**
* Base structure for the BFROP
* Transfer a value from one pmix_value_t to another. Ordinarily,
* this would be executed as a base function. However, it is
* possible that future versions may add new data types, and
* thus the xfer function may differ
*
* Base module structure for the BFROP - presents the required function
* pointers to the calling interface.
* @retval PMIX_SUCCESS The value was successfully transferred
*
* @retval PMIX_ERROR(s) An appropriate error code
*/
struct pmix_bfrop_t {
typedef pmix_status_t (*pmix_bfrop_value_xfer_fn_t)(pmix_value_t *dest,
pmix_value_t *src);
/**
* Load data into a pmix_value_t object. Again, this is provided
* as a component function to support different data types
*/
typedef void (*pmix_bfrop_value_load_fn_t)(pmix_value_t *v, const void *data,
pmix_data_type_t type);
/**
* Unload data from a pmix_value_t object
*
* @retval PMIX_SUCCESS The value was successfully unloaded
*
* @retval PMIX_ERROR(s) An appropriate error code
*/
typedef pmix_status_t (*pmix_bfrop_value_unload_fn_t)(pmix_value_t *kv,
void **data, size_t *sz);
/**
* Compare two pmix_value_t structs
*/
typedef pmix_value_cmp_t (*pmix_bfrop_value_cmp_fn_t)(pmix_value_t *p1, pmix_value_t *p2);
/* define a component-level API for registering a new
* datatype, providing all the required functions */
typedef pmix_status_t (*pmix_bfrop_base_register_fn_t)(const char *name, pmix_data_type_t type,
pmix_bfrop_pack_fn_t pack,
pmix_bfrop_unpack_fn_t unpack,
pmix_bfrop_copy_fn_t copy,
pmix_bfrop_print_fn_t print);
/* return the string name of a provided data type */
typedef const char* (*pmix_bfrop_data_type_string_fn_t)(pmix_data_type_t type);
/**
* Base structure for a BFROP module
*/
typedef struct {
char *version;
pmix_bfrop_init_fn_t init;
pmix_bfrop_finalize_fn_t finalize;
pmix_bfrop_pack_fn_t pack;
pmix_bfrop_unpack_fn_t unpack;
pmix_bfrop_copy_fn_t copy;
pmix_bfrop_print_fn_t print;
pmix_bfrop_copy_payload_fn_t copy_payload;
};
typedef struct pmix_bfrop_t pmix_bfrop_t;
pmix_bfrop_value_xfer_fn_t value_xfer;
pmix_bfrop_value_load_fn_t value_load;
pmix_bfrop_value_unload_fn_t value_unload;
pmix_bfrop_value_cmp_fn_t value_cmp;
pmix_bfrop_base_register_fn_t register_type;
pmix_bfrop_data_type_string_fn_t data_type_string;
} pmix_bfrops_module_t;
extern pmix_bfrop_t pmix_bfrop; /* holds bfrop function pointers */
/* get a list of available versions - caller must free results
* when done */
PMIX_EXPORT char* pmix_bfrops_base_get_available_modules(void);
/* Select a bfrops module for a given version */
PMIX_EXPORT pmix_bfrops_module_t* pmix_bfrops_base_assign_module(const char *version);
/* MACROS FOR EXECUTING BFROPS FUNCTIONS */
#define PMIX_BFROPS_ASSIGN_TYPE(p, b) \
(b)->type = (p)->nptr->compat.type
#define PMIX_BFROPS_PACK(r, p, b, s, n, t) \
do { \
if (PMIX_BFROP_BUFFER_UNDEF == (b)->type) { \
(b)->type = (p)->nptr->compat.type; \
(r) = (p)->nptr->compat.bfrops->pack(b, s, n, t); \
} else if ((b)->type == (p)->nptr->compat.type) { \
(r) = (p)->nptr->compat.bfrops->pack(b, s, n, t); \
} else { \
(r) = PMIX_ERR_PACK_MISMATCH; \
} \
} while(0)
#define PMIX_BFROPS_UNPACK(r, p, b, d, m, t) \
do { \
if ((b)->type == (p)->nptr->compat.type) { \
(r) = (p)->nptr->compat.bfrops->unpack(b, d, m, t); \
} else { \
pmix_output(0, "MISMATCH %d %d", (b)->type, (p)->nptr->compat.type); \
(r) = PMIX_ERR_UNPACK_FAILURE; \
} \
} while(0)
#define PMIX_BFROPS_COPY(r, p, d, s, t) \
(r) = (p)->nptr->compat.bfrops->copy(d, s, t)
#define PMIX_BFROPS_PRINT(r, p, o, pr, s, t) \
(r) = (p)->nptr->compat.bfrops->print(o, pr, s, t)
#define PMIX_BFROPS_COPY_PAYLOAD(r, p, d, s) \
do { \
if (PMIX_BFROP_BUFFER_UNDEF == (d)->type) { \
(d)->type = (p)->nptr->compat.type; \
(r) = (p)->nptr->compat.bfrops->copy_payload(d, s); \
} else if ((d)->type == (p)->nptr->compat.type) { \
(r) = (p)->nptr->compat.bfrops->copy_payload(d, s); \
} else { \
(r) = PMIX_ERR_PACK_MISMATCH; \
} \
} while(0)
#define PMIX_BFROPS_VALUE_XFER(r, p, d, s) \
(r) = (p)->nptr->compat.bfrops->value_xfer(d, s)
#define PMIX_BFROPS_VALUE_LOAD(p, v, d, t) \
(p)->nptr->compat.bfrops->value_load(v, d, t)
#define PMIX_BFROPS_VALUE_UNLOAD(r, p, k, d, s) \
(r) = (p)->nptr->compat.bfrops->value_unload(k,, d, s)
#define PMIX_BFROPS_VALUE_CMP(r, p, q, s) \
(r) = (p)->nptr->compat.bfrops->value_cmp(q, s)
#define PMIX_BFROPS_REGISTER(r, p, n, t, pk, u, c, pr) \
(r) = (p)->nptr->compat.bfrops->register_type(n, t, pk, u, c, pr)
#define PMIX_BFROPS_PRINT_TYPE(c, p, t) \
(c) = (p)->nptr->compat.bfrops->data_type_string(t)
/**** COMPONENT STRUCTURE DEFINITION ****/
/* define a component-level API for getting a module */
typedef pmix_bfrops_module_t* (*pmix_bfrop_base_component_assign_module_fn_t)(void);
/*
* the standard component data structure
*/
struct pmix_bfrops_base_component_t {
pmix_mca_base_component_t base;
pmix_mca_base_component_data_t data;
int priority;
pmix_pointer_array_t types;
pmix_bfrop_base_component_assign_module_fn_t assign_module;
};
typedef struct pmix_bfrops_base_component_t pmix_bfrops_base_component_t;
/*
* Macro for use in components that are of type bfrops
*/
#define PMIX_BFROPS_BASE_VERSION_1_0_0 \
PMIX_MCA_BASE_VERSION_1_0_0("bfrops", 1, 0, 0)
END_C_DECLS

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

@ -0,0 +1,149 @@
/* -*- C -*-
*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 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) 2007-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Buffer management types.
*/
#ifndef PMIX_MCA_BFROP_TYPES_H_
#define PMIX_MCA_BFROP_TYPES_H_
#include <src/include/pmix_config.h>
#include "src/class/pmix_object.h"
#include "src/class/pmix_pointer_array.h"
#include "src/class/pmix_list.h"
#include <pmix_common.h>
BEGIN_C_DECLS
/* define the results values for comparisons so we can change them in only one place */
typedef enum {
PMIX_EQUAL = 0,
PMIX_VALUE1_GREATER,
PMIX_VALUE2_GREATER
} pmix_value_cmp_t;
/**
* buffer type
*/
typedef uint8_t pmix_bfrop_buffer_type_t;
#define PMIX_BFROP_BUFFER_UNDEF 0x00
#define PMIX_BFROP_BUFFER_NON_DESC 0x01
#define PMIX_BFROP_BUFFER_FULLY_DESC 0x02
#define PMIX_BFROP_BUFFER_TYPE_HTON(h)
#define PMIX_BFROP_BUFFER_TYPE_NTOH(h)
/* internally used object for transferring data
* to/from the server and for storing in the
* hash tables */
typedef struct {
pmix_list_item_t super;
char *key;
pmix_value_t *value;
} pmix_kval_t;
PMIX_CLASS_DECLARATION(pmix_kval_t);
/**
* Structure for holding a buffer */
typedef struct {
/** First member must be the object's parent */
pmix_object_t parent;
/** type of buffer */
pmix_bfrop_buffer_type_t type;
/** Start of my memory */
char *base_ptr;
/** Where the next data will be packed to (within the allocated
memory starting at base_ptr) */
char *pack_ptr;
/** Where the next data will be unpacked from (within the
allocated memory starting as base_ptr) */
char *unpack_ptr;
/** Number of bytes allocated (starting at base_ptr) */
size_t bytes_allocated;
/** Number of bytes used by the buffer (i.e., amount of data --
including overhead -- packed in the buffer) */
size_t bytes_used;
} pmix_buffer_t;
PMIX_CLASS_DECLARATION(pmix_buffer_t);
/* Convenience macro for loading a data blob into a pmix_buffer_t
*
* p - the pmix_peer_t of the process that provided the blob. This
* is needed so we can set the buffer type for later unpacking
*
* b - pointer to pmix_buffer_t
*
* d - pointer to the data blob
*
* s - number of bytes in the blob
*
* NOTE: the macro does NOT copy the data, but simply assigns
* its address to the buffer. Accordingly, the macro will
* set the provided data blob pointer to NULL and the size
* to zero.
*/
#define PMIX_LOAD_BUFFER(p, b, d, s) \
do { \
(b)->type = (p)->nptr->compat.type; \
(b)->base_ptr = (char*)(d); \
(b)->bytes_used = (s); \
(b)->bytes_allocated = (s); \
(b)->pack_ptr = ((char*)(b)->base_ptr) + (s); \
(b)->unpack_ptr = (b)->base_ptr; \
(d) = NULL; \
(s) = 0; \
} while (0)
/* Convenience macro for extracting a pmix_buffer_t's payload
* as a data blob
*
* b - pointer to the pmix_buffer_t
*
* d - char* pointer to the data blob
*
* s - number of bytes in the blob
*
* NOTE: the macro does NOT copy the data, but simply assigns
* the address of the buffer's payload to the provided pointer.
* Accordingly, the macro will set all pmix_buffer_t internal
* tracking pointers to NULL and all counters to zero */
#define PMIX_UNLOAD_BUFFER(b, d, s) \
do { \
(d) = (char*)(b)->unpack_ptr; \
(s) = (b)->bytes_used; \
(b)->base_ptr = NULL; \
(b)->bytes_used = 0; \
(b)->bytes_allocated = 0; \
(b)->pack_ptr = NULL; \
(b)->unpack_ptr = NULL; \
} while (0)
END_C_DECLS
#endif /* PMIX_BFROP_TYPES_H */

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше