1
1

Merge pull request #2784 from rhc54/topic/pmixup

Update to latest PMIx master
Этот коммит содержится в:
Ralph Castain 2017-01-23 11:01:19 -08:00 коммит произвёл GitHub
родитель 2215f29849 8c960bae8d
Коммит f3920828ed
150 изменённых файлов: 2757 добавлений и 267 удалений

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

@ -9,7 +9,7 @@ Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
Copyright (c) 2004-2005 The Regents of the University of California.
All rights reserved.
Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow

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

@ -45,7 +45,7 @@ Copyright (c) 2010 ARM ltd. All rights reserved.
Copyright (c) 2010-2011 Alex Brick <bricka@ccs.neu.edu>. All rights reserved.
Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights
reserved.
Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved.
$COPYRIGHT$

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

@ -11,7 +11,7 @@
# All rights reserved.
# Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012-2013 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$
#
# Additional copyrights may follow

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

@ -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-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow

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

@ -23,14 +23,14 @@ release=0
# The only requirement is that it must be entirely printable ASCII
# characters and have no white space.
greek=a1
greek=
# If repo_rev is empty, then the repository version number will be
# obtained during "make dist" via the "git describe --tags --always"
# command, or with the date (if "git describe" fails) in the form of
# "date<date>".
repo_rev=git8ed98a0
repo_rev=git89ec3bc
# 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="Dec 30, 2016"
date="Jan 23, 2017"
# The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library

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

@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$

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

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

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

@ -322,7 +322,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[
crt_externs.h signal.h \
ioLib.h sockLib.h hostLib.h limits.h \
sys/statfs.h sys/statvfs.h \
netdb.h ucred.h])
netdb.h ucred.h zlib.h])
AC_CHECK_HEADERS([sys/mount.h], [], [],
[AC_INCLUDES_DEFAULT

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

@ -1,6 +1,6 @@
# -*- shell-script -*-
# PMIx copyrights:
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
#
#########################
#

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

@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl

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

@ -1,7 +1,7 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
dnl
dnl $COPYRIGHT$
dnl

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

@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
dnl Copyright (c) 2016 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$

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

@ -1,7 +1,7 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow

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

@ -12,7 +12,7 @@
# All rights reserved.
# Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -0,0 +1,89 @@
# -*- shell-script -*-
#
# 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-2006 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006 QLogic Corp. All rights reserved.
# Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# PMIX_CHECK_PSM2(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if PSM2 support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([PMIX_CHECK_PSM2],[
if test -z "$pmix_check_psm2_happy" ; then
AC_ARG_WITH([psm2],
[AC_HELP_STRING([--with-psm2(=DIR)],
[Build PSM2 (Intel PSM2) support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
PMIX_CHECK_WITHDIR([psm2], [$with_psm2], [include/psm2.h])
AC_ARG_WITH([psm2-libdir],
[AC_HELP_STRING([--with-psm2-libdir=DIR],
[Search for PSM (Intel PSM2) libraries in DIR])])
PMIX_CHECK_WITHDIR([psm2-libdir], [$with_psm2_libdir], [libpsm2.*])
pmix_check_psm2_$1_save_CPPFLAGS="$CPPFLAGS"
pmix_check_psm2_$1_save_LDFLAGS="$LDFLAGS"
pmix_check_psm2_$1_save_LIBS="$LIBS"
AS_IF([test "$with_psm2" != "no"],
[AS_IF([test ! -z "$with_psm2" && test "$with_psm2" != "yes"],
[pmix_check_psm2_dir="$with_psm2"])
AS_IF([test ! -z "$with_psm2_libdir" && test "$with_psm2_libdir" != "yes"],
[pmix_check_psm2_libdir="$with_psm2_libdir"])
PMIX_CHECK_PACKAGE([pmix_check_psm2],
[psm2.h],
[psm2],
[psm_mq_irecv],
[],
[$pmix_check_psm2_dir],
[$pmix_check_psm2_libdir],
[pmix_check_psm2_happy="yes"],
[pmix_check_psm2_happy="no"])],
[pmix_check_psm2_happy="no"])
CPPFLAGS="$pmix_check_psm2_$1_save_CPPFLAGS"
LDFLAGS="$pmix_check_psm2_$1_save_LDFLAGS"
LIBS="$pmix_check_psm2_$1_save_LIBS"
AS_IF([test "$pmix_check_psm2_happy" = "yes" && test "$enable_progress_threads" = "yes"],
[AC_MSG_WARN([PSM2 driver does not currently support progress threads. Disabling MTL.])
pmix_check_psm2_happy="no"])
AS_IF([test "$pmix_check_psm2_happy" = "yes"],
[AC_CHECK_HEADERS(
glob.h,
[],
[AC_MSG_WARN([glob.h not found. Can not build component.])
pmix_check_psm2_happy="no"])])
fi
AS_IF([test "$pmix_check_psm2_happy" = "yes"],
[$1_LDFLAGS="[$]$1_LDFLAGS $pmix_check_psm2_LDFLAGS"
$1_CPPFLAGS="[$]$1_CPPFLAGS $pmix_check_psm2_CPPFLAGS"
$1_LIBS="[$]$1_LIBS $pmix_check_psm2_LIBS"
$2],
[AS_IF([test ! -z "$with_psm2" && test "$with_psm2" != "no"],
[AC_MSG_ERROR([PSM2 support requested but not found. Aborting])])
$3])
])

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

@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.

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

@ -12,7 +12,7 @@
# All rights reserved.
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009-2011 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -0,0 +1,39 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# PMIX_CHECK_WITHDIR(with_option_name, dir_value, file_in_dir)
# ----------------------------------------------------
AC_DEFUN([PMIX_CHECK_WITHDIR],[
AC_MSG_CHECKING([--with-$1 value])
AS_IF([test "$2" = "yes" || test "$2" = "no" || test "x$2" = "x"],
[AC_MSG_RESULT([simple ok (unspecified)])],
[AS_IF([test ! -d "$2"],
[AC_MSG_RESULT([not found])
AC_MSG_WARN([Directory $2 not found])
AC_MSG_ERROR([Cannot continue])],
[AS_IF([test "x`ls $2/$3 2> /dev/null`" = "x"],
[AC_MSG_RESULT([not found])
AC_MSG_WARN([Expected file $2/$3 not found])
AC_MSG_ERROR([Cannot continue])],
[AC_MSG_RESULT([sanity check ok ($2)])]
)
]
)
]
)
])dnl

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

@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$

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

@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow

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

@ -11,7 +11,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2015 Cisco Systems, Inc. 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

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

@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$

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

@ -2,7 +2,7 @@
#
# Copyright (c) 2010 Sandia National Laboratories. All rights reserved.
#
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -1,7 +1,7 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow

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

@ -11,7 +11,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2013 Cisco Systems, Inc. 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

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

@ -1,7 +1,7 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -1,7 +1,7 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

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

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

@ -12,7 +12,7 @@
# Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, Inc.
# 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

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

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Los Alamos National Security, LLC. All rights
# reserved
# Copyright (c) 2015 Cisco Systems, Inc.

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

@ -11,7 +11,7 @@
# All rights reserved.
# Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -19,7 +19,7 @@
# $HEADER$
#
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/src/api
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/include -I$(top_builddir)/include/pmix
noinst_PROGRAMS = client dmodex dynamic fault pub tool
if !WANT_HIDDEN
@ -28,6 +28,12 @@ if !WANT_HIDDEN
noinst_PROGRAMS += debugger debuggerd
endif
if !WANT_HIDDEN
# this example uses internal symbols
# use --disable-visibility
noinst_PROGRAMS += server
endif
client_SOURCES = client.c
client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
client_LDADD = $(top_builddir)/src/libpmix.la
@ -62,5 +68,13 @@ tool_SOURCES = tool.c
tool_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
tool_LDADD = $(top_builddir)/src/libpmix.la
if !WANT_HIDDEN
# this example uses internal symbols
# use --disable-visibility
server_SOURCES = server.c
server_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
server_LDADD = $(top_builddir)/src/libpmix.la
endif
distclean-local:
rm -f *.o client debugger debuggerd dmodex dynamic fault pub server

893
opal/mca/pmix/pmix2x/pmix/examples/server.c Обычный файл
Просмотреть файл

@ -0,0 +1,893 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 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) 2006-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* Copyright (c) 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$
*
*/
#include <src/include/pmix_config.h>
#include <pmix_server.h>
#include <src/include/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <signal.h>
#include <pwd.h>
#include <sys/stat.h>
#include <dirent.h>
#include PMIX_EVENT_HEADER
#include "src/class/pmix_list.h"
#include "src/util/pmix_environ.h"
#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);
static pmix_status_t finalized(const pmix_proc_t *proc, void *server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t abort_fn(const pmix_proc_t *proc, void *server_object,
int status, const char msg[],
pmix_proc_t procs[], size_t nprocs,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
char *data, size_t ndata,
pmix_modex_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t dmodex_fn(const pmix_proc_t *proc,
const pmix_info_t info[], size_t ninfo,
pmix_modex_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t publish_fn(const pmix_proc_t *proc,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys,
const pmix_info_t info[], size_t ninfo,
pmix_lookup_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t unpublish_fn(const pmix_proc_t *proc, char **keys,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t spawn_fn(const pmix_proc_t *proc,
const pmix_info_t job_info[], size_t ninfo,
const pmix_app_t apps[], size_t napps,
pmix_spawn_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t connect_fn(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t disconnect_fn(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t register_event_fn(pmix_status_t *codes, size_t ncodes,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t deregister_events(pmix_status_t *codes, size_t ncodes,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t notify_event(pmix_status_t code,
const pmix_proc_t *source,
pmix_data_range_t range,
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t query_fn(pmix_proc_t *proct,
pmix_query_t *queries, size_t nqueries,
pmix_info_cbfunc_t cbfunc,
void *cbdata);
static void tool_connect_fn(pmix_info_t *info, size_t ninfo,
pmix_tool_connection_cbfunc_t cbfunc,
void *cbdata);
static void log_fn(const pmix_proc_t *client,
const pmix_info_t data[], size_t ndata,
const pmix_info_t directives[], size_t ndirs,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_server_module_t mymodule = {
.client_connected = connected,
.client_finalized = finalized,
.abort = abort_fn,
.fence_nb = fencenb_fn,
.direct_modex = dmodex_fn,
.publish = publish_fn,
.lookup = lookup_fn,
.unpublish = unpublish_fn,
.spawn = spawn_fn,
.connect = connect_fn,
.disconnect = disconnect_fn,
.register_events = register_event_fn,
.deregister_events = deregister_events,
.notify_event = notify_event,
.query = query_fn,
.tool_connected = tool_connect_fn,
.log = log_fn
};
typedef struct {
pmix_list_item_t super;
pmix_pdata_t pdata;
} pmix_locdat_t;
PMIX_CLASS_INSTANCE(pmix_locdat_t,
pmix_list_item_t,
NULL, NULL);
typedef struct {
pmix_object_t super;
volatile bool active;
pmix_proc_t caller;
pmix_info_t *info;
size_t ninfo;
pmix_op_cbfunc_t cbfunc;
pmix_spawn_cbfunc_t spcbfunc;
void *cbdata;
} myxfer_t;
static void xfcon(myxfer_t *p)
{
p->info = NULL;
p->ninfo = 0;
p->active = true;
p->cbfunc = NULL;
p->spcbfunc = NULL;
p->cbdata = NULL;
}
static void xfdes(myxfer_t *p)
{
if (NULL != p->info) {
PMIX_INFO_FREE(p->info, p->ninfo);
}
}
PMIX_CLASS_INSTANCE(myxfer_t,
pmix_object_t,
xfcon, xfdes);
typedef struct {
pmix_list_item_t super;
pid_t pid;
} wait_tracker_t;
PMIX_CLASS_INSTANCE(wait_tracker_t,
pmix_list_item_t,
NULL, NULL);
static volatile int wakeup;
static pmix_list_t pubdata;
static pmix_event_t handler;
static pmix_list_t children;
static void set_namespace(int nprocs, char *ranks, char *nspace,
pmix_op_cbfunc_t cbfunc, myxfer_t *x);
static void errhandler(size_t evhdlr_registration_id,
pmix_status_t status,
const pmix_proc_t *source,
pmix_info_t info[], size_t ninfo,
pmix_info_t results[], size_t nresults,
pmix_event_notification_cbfunc_fn_t cbfunc,
void *cbdata);
static void wait_signal_callback(int fd, short event, void *arg);
static void errhandler_reg_callbk (pmix_status_t status,
size_t errhandler_ref,
void *cbdata);
static void opcbfunc(pmix_status_t status, void *cbdata)
{
myxfer_t *x = (myxfer_t*)cbdata;
/* release the caller, if necessary */
if (NULL != x->cbfunc) {
x->cbfunc(PMIX_SUCCESS, x->cbdata);
}
x->active = false;
}
int main(int argc, char **argv)
{
char **client_env=NULL;
char **client_argv=NULL;
char *tmp, **atmp, *executable=NULL, *tmpdir, *cleanup;
int rc, nprocs=1, n, k;
uid_t myuid;
gid_t mygid;
pid_t pid;
myxfer_t *x;
pmix_proc_t proc;
wait_tracker_t *child;
char *tdir;
uid_t uid = geteuid();
pmix_info_t *info;
struct stat buf;
/* define and pass a personal tmpdir to protect the system */
if (NULL == (tdir = getenv("TMPDIR"))) {
if (NULL == (tdir = getenv("TEMP"))) {
if (NULL == (tdir = getenv("TMP"))) {
tdir = "/tmp";
}
}
}
if (0 > asprintf(&tmpdir, "%s/pmix.%lu", tdir, (long unsigned)uid)) {
fprintf(stderr, "Out of memory\n");
exit(1);
}
/* create the directory */
if (0 != stat(tmpdir, &buf)) {
/* try to make directory */
if (0 != mkdir(tmpdir, S_IRWXU)) {
fprintf(stderr, "Cannot make tmpdir %s", tmpdir);
exit(1);
}
}
asprintf(&cleanup, "rm -rf %s", tmpdir);
PMIX_INFO_CREATE(info, 1);
PMIX_INFO_LOAD(&info[0], PMIX_SERVER_TMPDIR, tmpdir, PMIX_STRING);
/* setup the server library */
if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, info, 1))) {
fprintf(stderr, "Init failed with error %d\n", rc);
return rc;
}
PMIX_INFO_FREE(info, 1);
/* register the errhandler */
PMIx_Register_event_handler(NULL, 0, NULL, 0,
errhandler, errhandler_reg_callbk, NULL);
/* setup the pub data, in case it is used */
PMIX_CONSTRUCT(&pubdata, pmix_list_t);
/* setup to see sigchld on the forked tests */
PMIX_CONSTRUCT(&children, pmix_list_t);
event_assign(&handler, pmix_globals.evbase, SIGCHLD,
EV_SIGNAL|EV_PERSIST,wait_signal_callback, &handler);
event_add(&handler, NULL);
/* see if we were passed the number of procs to run or
* the executable to use */
for (n=1; n < (argc-1); n++) {
if (0 == strcmp("-n", argv[n]) &&
NULL != argv[n+1]) {
nprocs = strtol(argv[n+1], NULL, 10);
++n; // step over the argument
} else if (0 == strcmp("-e", argv[n]) &&
NULL != argv[n+1]) {
executable = strdup(argv[n+1]);
for (k=n+2; NULL != argv[k]; k++) {
pmix_argv_append_nosize(&client_argv, argv[k]);
}
n += k;
}
}
if (NULL == executable) {
executable = strdup("./simpclient");
}
/* we have a single namespace for all clients */
atmp = NULL;
for (n=0; n < nprocs; n++) {
asprintf(&tmp, "%d", n);
pmix_argv_append_nosize(&atmp, tmp);
free(tmp);
}
tmp = pmix_argv_join(atmp, ',');
pmix_argv_free(atmp);
/* register the nspace */
x = PMIX_NEW(myxfer_t);
set_namespace(nprocs, tmp, "foobar", opcbfunc, x);
/* set common argv and env */
client_env = pmix_argv_copy(environ);
pmix_argv_prepend_nosize(&client_argv, executable);
wakeup = nprocs;
myuid = getuid();
mygid = getgid();
/* if the nspace registration hasn't completed yet,
* wait for it here */
PMIX_WAIT_FOR_COMPLETION(x->active);
free(tmp);
PMIX_RELEASE(x);
/* prep the local node for launch */
x = PMIX_NEW(myxfer_t);
if (PMIX_SUCCESS != (rc = PMIx_server_setup_local_support("foobar", NULL, 0, opcbfunc, x))) {
fprintf(stderr, "Setup local support failed: %d\n", rc);
PMIx_server_finalize();
system(cleanup);
return rc;
}
PMIX_WAIT_FOR_COMPLETION(x->active);
PMIX_RELEASE(x);
/* fork/exec the test */
(void)strncpy(proc.nspace, "foobar", PMIX_MAX_NSLEN);
for (n = 0; n < nprocs; n++) {
proc.rank = n;
if (PMIX_SUCCESS != (rc = PMIx_server_setup_fork(&proc, &client_env))) {//n
fprintf(stderr, "Server fork setup failed with error %d\n", rc);
PMIx_server_finalize();
system(cleanup);
return rc;
}
x = PMIX_NEW(myxfer_t);
if (PMIX_SUCCESS != (rc = PMIx_server_register_client(&proc, myuid, mygid,
NULL, opcbfunc, x))) {
fprintf(stderr, "Server fork setup failed with error %d\n", rc);
PMIx_server_finalize();
system(cleanup);
return rc;
}
/* don't fork/exec the client until we know it is registered
* so we avoid a potential race condition in the server */
PMIX_WAIT_FOR_COMPLETION(x->active);
PMIX_RELEASE(x);
pid = fork();
if (pid < 0) {
fprintf(stderr, "Fork failed\n");
PMIx_server_finalize();
system(cleanup);
return -1;
}
child = PMIX_NEW(wait_tracker_t);
child->pid = pid;
pmix_list_append(&children, &child->super);
if (pid == 0) {
execve(executable, client_argv, client_env);
/* Does not return */
exit(0);
}
}
free(executable);
pmix_argv_free(client_argv);
pmix_argv_free(client_env);
/* hang around until the client(s) finalize */
while (0 < wakeup) {
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 100000;
nanosleep(&ts, NULL);
}
/* deregister the errhandler */
PMIx_Deregister_event_handler(0, NULL, NULL);
/* release any pub data */
PMIX_LIST_DESTRUCT(&pubdata);
/* finalize the server library */
if (PMIX_SUCCESS != (rc = PMIx_server_finalize())) {
fprintf(stderr, "Finalize failed with error %d\n", rc);
}
fprintf(stderr, "Test finished OK!\n");
system(cleanup);
return rc;
}
static void setup_cbfunc(pmix_status_t status,
pmix_info_t info[], size_t ninfo,
void *provided_cbdata,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
myxfer_t *myxfer = (myxfer_t*)provided_cbdata;
size_t i;
if (PMIX_SUCCESS == status && 0 < ninfo) {
myxfer->ninfo = ninfo;
PMIX_INFO_CREATE(myxfer->info, ninfo);
for (i=0; i < ninfo; i++) {
PMIX_INFO_XFER(&myxfer->info[i], &info[i]);
}
}
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
myxfer->active = false;
}
static void set_namespace(int nprocs, char *ranks, char *nspace,
pmix_op_cbfunc_t cbfunc, myxfer_t *x)
{
char *regex, *ppn;
char hostname[PMIX_MAXHOSTNAMELEN];
pmix_status_t rc;
myxfer_t myxfer;
size_t i;
gethostname(hostname, sizeof(hostname));
/* request application setup information - e.g., network
* security keys or endpoint info */
PMIX_CONSTRUCT(&myxfer, myxfer_t);
myxfer.active = true;
if (PMIX_SUCCESS != (rc = PMIx_server_setup_application(nspace, NULL, 0, setup_cbfunc, &myxfer))) {
PMIX_DESTRUCT(&myxfer);
fprintf(stderr, "Failed to setup application: %d\n", rc);
exit(1);
}
PMIX_WAIT_FOR_COMPLETION(myxfer.active);
x->ninfo = myxfer.ninfo + 7;
PMIX_INFO_CREATE(x->info, x->ninfo);
if (0 < myxfer.ninfo) {
for (i=0; i < myxfer.ninfo; i++) {
PMIX_INFO_XFER(&x->info[i], &myxfer.info[i]);
}
}
PMIX_DESTRUCT(&myxfer);
(void)strncpy(x->info[i].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN);
x->info[i].value.type = PMIX_UINT32;
x->info[i].value.data.uint32 = nprocs;
++i;
(void)strncpy(x->info[i].key, PMIX_SPAWNED, PMIX_MAX_KEYLEN);
x->info[i].value.type = PMIX_UINT32;
x->info[i].value.data.uint32 = 0;
++i;
(void)strncpy(x->info[i].key, PMIX_LOCAL_SIZE, PMIX_MAX_KEYLEN);
x->info[i].value.type = PMIX_UINT32;
x->info[i].value.data.uint32 = nprocs;
++i;
(void)strncpy(x->info[i].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN);
x->info[i].value.type = PMIX_STRING;
x->info[i].value.data.string = strdup(ranks);
++i;
PMIx_generate_regex(hostname, &regex);
(void)strncpy(x->info[i].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN);
x->info[i].value.type = PMIX_STRING;
x->info[i].value.data.string = regex;
++i;
PMIx_generate_ppn(ranks, &ppn);
(void)strncpy(x->info[i].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN);
x->info[i].value.type = PMIX_STRING;
x->info[i].value.data.string = ppn;
++i;
(void)strncpy(x->info[i].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN);
x->info[i].value.type = PMIX_UINT32;
x->info[i].value.data.uint32 = nprocs;
PMIx_server_register_nspace(nspace, nprocs, x->info, x->ninfo,
cbfunc, x);
}
static void errhandler(size_t evhdlr_registration_id,
pmix_status_t status,
const pmix_proc_t *source,
pmix_info_t info[], size_t ninfo,
pmix_info_t results[], size_t nresults,
pmix_event_notification_cbfunc_fn_t cbfunc,
void *cbdata)
{
pmix_output(0, "SERVER: ERRHANDLER CALLED WITH STATUS %d", status);
}
static void errhandler_reg_callbk (pmix_status_t status,
size_t errhandler_ref,
void *cbdata)
{
return;
}
static pmix_status_t connected(const pmix_proc_t *proc, void *server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
return PMIX_SUCCESS;
}
static pmix_status_t finalized(const pmix_proc_t *proc, void *server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_output(0, "SERVER: FINALIZED %s:%d",
proc->nspace, proc->rank);
--wakeup;
/* ensure we call the cbfunc so the proc can exit! */
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
return PMIX_SUCCESS;
}
static void abcbfunc(pmix_status_t status, void *cbdata)
{
myxfer_t *x = (myxfer_t*)cbdata;
/* be sure to release the caller */
if (NULL != x->cbfunc) {
x->cbfunc(status, x->cbdata);
}
PMIX_RELEASE(x);
}
static pmix_status_t abort_fn(const pmix_proc_t *proc,
void *server_object,
int status, const char msg[],
pmix_proc_t procs[], size_t nprocs,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_status_t rc;
myxfer_t *x;
if (NULL != procs) {
pmix_output(0, "SERVER: ABORT on %s:%d", procs[0].nspace, procs[0].rank);
} else {
pmix_output(0, "SERVER: ABORT OF ALL PROCS IN NSPACE %s", proc->nspace);
}
/* instead of aborting the specified procs, notify them
* (if they have registered their errhandler) */
/* use the myxfer_t object to ensure we release
* the caller when notification has been queued */
x = PMIX_NEW(myxfer_t);
(void)strncpy(x->caller.nspace, proc->nspace, PMIX_MAX_NSLEN);
x->caller.rank = proc->rank;
PMIX_INFO_CREATE(x->info, 2);
(void)strncpy(x->info[0].key, "DARTH", PMIX_MAX_KEYLEN);
x->info[0].value.type = PMIX_INT8;
x->info[0].value.data.int8 = 12;
(void)strncpy(x->info[1].key, "VADER", PMIX_MAX_KEYLEN);
x->info[1].value.type = PMIX_DOUBLE;
x->info[1].value.data.dval = 12.34;
x->cbfunc = cbfunc;
x->cbdata = cbdata;
if (PMIX_SUCCESS != (rc = PMIx_Notify_event(status, &x->caller,
PMIX_RANGE_NAMESPACE,
x->info, 2,
abcbfunc, x))) {
pmix_output(0, "SERVER: FAILED NOTIFY ERROR %d", (int)rc);
}
return PMIX_SUCCESS;
}
static pmix_status_t fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
char *data, size_t ndata,
pmix_modex_cbfunc_t cbfunc, void *cbdata)
{
pmix_output(0, "SERVER: FENCENB");
/* pass the provided data back to each participating proc */
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, data, ndata, cbdata, NULL, NULL);
}
return PMIX_SUCCESS;
}
static pmix_status_t dmodex_fn(const pmix_proc_t *proc,
const pmix_info_t info[], size_t ninfo,
pmix_modex_cbfunc_t cbfunc, void *cbdata)
{
pmix_output(0, "SERVER: DMODEX");
/* we don't have any data for remote procs as this
* test only runs one server - so report accordingly */
if (NULL != cbfunc) {
cbfunc(PMIX_ERR_NOT_FOUND, NULL, 0, cbdata, NULL, NULL);
}
return PMIX_SUCCESS;
}
static pmix_status_t publish_fn(const pmix_proc_t *proc,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_locdat_t *p;
size_t n;
pmix_output(0, "SERVER: PUBLISH");
for (n=0; n < ninfo; n++) {
p = PMIX_NEW(pmix_locdat_t);
(void)strncpy(p->pdata.proc.nspace, proc->nspace, PMIX_MAX_NSLEN);
p->pdata.proc.rank = proc->rank;
(void)strncpy(p->pdata.key, info[n].key, PMIX_MAX_KEYLEN);
pmix_value_xfer(&p->pdata.value, (pmix_value_t*)&info[n].value);
pmix_list_append(&pubdata, &p->super);
}
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
return PMIX_SUCCESS;
}
static pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys,
const pmix_info_t info[], size_t ninfo,
pmix_lookup_cbfunc_t cbfunc, void *cbdata)
{
pmix_locdat_t *p, *p2;
pmix_list_t results;
size_t i, n;
pmix_pdata_t *pd = NULL;
pmix_status_t ret = PMIX_ERR_NOT_FOUND;
pmix_output(0, "SERVER: LOOKUP");
PMIX_CONSTRUCT(&results, pmix_list_t);
for (n=0; NULL != keys[n]; n++) {
PMIX_LIST_FOREACH(p, &pubdata, pmix_locdat_t) {
if (0 == strncmp(keys[n], p->pdata.key, PMIX_MAX_KEYLEN)) {
p2 = PMIX_NEW(pmix_locdat_t);
(void)strncpy(p2->pdata.proc.nspace, p->pdata.proc.nspace, PMIX_MAX_NSLEN);
p2->pdata.proc.rank = p->pdata.proc.rank;
(void)strncpy(p2->pdata.key, p->pdata.key, PMIX_MAX_KEYLEN);
pmix_value_xfer(&p2->pdata.value, &p->pdata.value);
pmix_list_append(&results, &p2->super);
break;
}
}
}
if (0 < (n = pmix_list_get_size(&results))) {
ret = PMIX_SUCCESS;
PMIX_PDATA_CREATE(pd, n);
for (i=0; i < n; i++) {
p = (pmix_locdat_t*)pmix_list_remove_first(&results);
if (p) {
(void)strncpy(pd[i].proc.nspace, p->pdata.proc.nspace, PMIX_MAX_NSLEN);
pd[i].proc.rank = p->pdata.proc.rank;
(void)strncpy(pd[i].key, p->pdata.key, PMIX_MAX_KEYLEN);
pmix_value_xfer(&pd[i].value, &p->pdata.value);
}
}
}
PMIX_LIST_DESTRUCT(&results);
if (NULL != cbfunc) {
cbfunc(ret, pd, n, cbdata);
}
if (0 < n) {
PMIX_PDATA_FREE(pd, n);
}
return PMIX_SUCCESS;
}
static pmix_status_t unpublish_fn(const pmix_proc_t *proc, char **keys,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_locdat_t *p, *p2;
size_t n;
pmix_output(0, "SERVER: UNPUBLISH");
for (n=0; NULL != keys[n]; n++) {
PMIX_LIST_FOREACH_SAFE(p, p2, &pubdata, pmix_locdat_t) {
if (0 == strncmp(keys[n], p->pdata.key, PMIX_MAX_KEYLEN)) {
pmix_list_remove_item(&pubdata, &p->super);
PMIX_RELEASE(p);
break;
}
}
}
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
return PMIX_SUCCESS;
}
static void spcbfunc(pmix_status_t status, void *cbdata)
{
myxfer_t *x = (myxfer_t*)cbdata;
if (NULL != x->spcbfunc) {
x->spcbfunc(PMIX_SUCCESS, "DYNSPACE", x->cbdata);
}
}
static pmix_status_t spawn_fn(const pmix_proc_t *proc,
const pmix_info_t job_info[], size_t ninfo,
const pmix_app_t apps[], size_t napps,
pmix_spawn_cbfunc_t cbfunc, void *cbdata)
{
myxfer_t *x;
pmix_output(0, "SERVER: SPAWN");
/* in practice, we would pass this request to the local
* resource manager for launch, and then have that server
* execute our callback function. For now, we will fake
* the spawn and just pretend */
/* must register the nspace for the new procs before
* we return to the caller */
x = PMIX_NEW(myxfer_t);
x->spcbfunc = cbfunc;
x->cbdata = cbdata;
set_namespace(2, "0,1", "DYNSPACE", spcbfunc, x);
return PMIX_SUCCESS;
}
static pmix_status_t connect_fn(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_output(0, "SERVER: CONNECT");
/* in practice, we would pass this request to the local
* resource manager for handling */
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
return PMIX_SUCCESS;
}
static pmix_status_t disconnect_fn(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_output(0, "SERVER: DISCONNECT");
/* in practice, we would pass this request to the local
* resource manager for handling */
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
return PMIX_SUCCESS;
}
static pmix_status_t register_event_fn(pmix_status_t *codes, size_t ncodes,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
return PMIX_SUCCESS;
}
static pmix_status_t deregister_events(pmix_status_t *codes, size_t ncodes,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
return PMIX_SUCCESS;
}
static pmix_status_t notify_event(pmix_status_t code,
const pmix_proc_t *source,
pmix_data_range_t range,
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
return PMIX_SUCCESS;
}
typedef struct query_data_t {
pmix_info_t *data;
size_t ndata;
} query_data_t;
static pmix_status_t query_fn(pmix_proc_t *proct,
pmix_query_t *queries, size_t nqueries,
pmix_info_cbfunc_t cbfunc,
void *cbdata)
{
size_t n;
pmix_info_t *info;
pmix_output(0, "SERVER: QUERY");
if (NULL == cbfunc) {
return PMIX_ERROR;
}
/* keep this simple */
PMIX_INFO_CREATE(info, nqueries);
for (n=0; n < nqueries; n++) {
(void)strncpy(info[n].key, queries[n].keys[0], PMIX_MAX_KEYLEN);
info[n].value.type = PMIX_STRING;
if (0 > asprintf(&info[n].value.data.string, "%d", (int)n)) {
return PMIX_ERROR;
}
}
cbfunc(PMIX_SUCCESS, info, nqueries, cbdata, NULL, NULL);
return PMIX_SUCCESS;
}
static void tool_connect_fn(pmix_info_t *info, size_t ninfo,
pmix_tool_connection_cbfunc_t cbfunc,
void *cbdata)
{
pmix_proc_t proc;
pmix_output(0, "SERVER: TOOL CONNECT");
/* just pass back an arbitrary nspace */
(void)strncpy(proc.nspace, "TOOL", PMIX_MAX_NSLEN);
proc.rank = 0;
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, &proc, cbdata);
}
}
static void log_fn(const pmix_proc_t *client,
const pmix_info_t data[], size_t ndata,
const pmix_info_t directives[], size_t ndirs,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_output(0, "SERVER: LOG");
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
}
static void wait_signal_callback(int fd, short event, void *arg)
{
pmix_event_t *sig = (pmix_event_t*) arg;
int status;
pid_t pid;
wait_tracker_t *t2;
if (SIGCHLD != event_get_signal(sig)) {
return;
}
/* we can have multiple children leave but only get one
* sigchild callback, so reap all the waitpids until we
* don't get anything valid back */
while (1) {
pid = waitpid(-1, &status, WNOHANG);
if (-1 == pid && EINTR == errno) {
/* try it again */
continue;
}
/* if we got garbage, then nothing we can do */
if (pid <= 0) {
return;
}
/* we are already in an event, so it is safe to access the list */
PMIX_LIST_FOREACH(t2, &children, wait_tracker_t) {
if (pid == t2->pid) {
/* found it! */
--wakeup;
break;
}
}
}
}

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

@ -182,6 +182,7 @@ typedef uint32_t pmix_rank_t;
#define PMIX_LOCAL_PROCS "pmix.lprocs" // (pmix_proc_t array) array of pmix_proc_t of procs on the specified node
#define PMIX_LOCAL_CPUSETS "pmix.lcpus" // (char*) colon-delimited cpusets of local peers within the specified nspace
#define PMIX_PROC_URI "pmix.puri" // (char*) URI containing contact info for proc
#define PMIX_LOCALITY "pmix.loc" // (uint16_t) relative locality of two procs
/* size info */
#define PMIX_UNIV_SIZE "pmix.univ.size" // (uint32_t) #procs in this nspace
@ -193,11 +194,18 @@ typedef uint32_t pmix_rank_t;
#define PMIX_MAX_PROCS "pmix.max.size" // (uint32_t) max #procs for this job
#define PMIX_NUM_NODES "pmix.num.nodes" // (uint32_t) #nodes in this nspace
/* Memory info */
#define PMIX_AVAIL_PHYS_MEMORY "pmix.pmem" // (uint64_t) total available physical memory on this node
#define PMIX_DAEMON_MEMORY "pmix.dmn.mem" // (float) Mbytes of memory currently used by daemon
#define PMIX_CLIENT_AVG_MEMORY "pmix.cl.mem.avg" // (float) Average Mbytes of memory used by client processes
/* topology info */
#define PMIX_NET_TOPO "pmix.ntopo" // (char*) xml-representation of network topology
#define PMIX_LOCAL_TOPO "pmix.ltopo" // (char*) xml-representation of local node topology
#define PMIX_NODE_LIST "pmix.nlist" // (char*) comma-delimited list of nodes running procs for this job
#define PMIX_TOPOLOGY "pmix.topo" // (hwloc_topology_t) pointer to the PMIx client's internal topology object
#define PMIX_TOPOLOGY_SIGNATURE "pmix.toposig" // (char*) topology signature string
#define PMIX_LOCALITY_STRING "pmix.locstr" // (char*) string describing a proc's location
/* request-related info */
#define PMIX_COLLECT_DATA "pmix.collect" // (bool) collect data and return it at the end of the operation
@ -222,6 +230,8 @@ typedef uint32_t pmix_rank_t;
#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)
#define PMIX_APP_MAP_TYPE "pmix.apmap.type" // (char*) type of mapping used to layout the application (e.g., cyclic)
#define PMIX_APP_MAP_REGEX "pmix.apmap.regex" // (char*) regex describing the result of the mapping
/* attributes used internally to communicate data from the server to the client */
#define PMIX_PROC_BLOB "pmix.pblob" // (pmix_byte_object_t) packed blob of process data
@ -287,12 +297,15 @@ typedef uint32_t pmix_rank_t;
#define PMIX_QUERY_DEBUG_SUPPORT "pmix.qry.debug" // return a comma-delimited list of supported debug attributes
#define PMIX_QUERY_MEMORY_USAGE "pmix.qry.mem" // return info on memory usage for the procs indicated in the qualifiers
#define PMIX_QUERY_LOCAL_ONLY "pmix.qry.local" // constrain the query to local information only
#define PMIX_QUERY_REPORT_AVG "pmix.qry.avg" // report average values
#define PMIX_QUERY_REPORT_MINMAX "pmix.qry.minmax" // report minimum and maximum value
/* log attributes */
#define PMIX_LOG_STDERR "pmix.log.stderr" // (bool) log data to stderr
#define PMIX_LOG_STDOUT "pmix.log.stdout" // (bool) log data to stdout
#define PMIX_LOG_SYSLOG "pmix.log.syslog" // (bool) log data to syslog - defaults to ERROR priority unless
// modified by directive
#define PMIX_LOG_STDERR "pmix.log.stderr" // (char*) log string to stderr
#define PMIX_LOG_STDOUT "pmix.log.stdout" // (char*) log string to stdout
#define PMIX_LOG_SYSLOG "pmix.log.syslog" // (char*) log data to syslog - defaults to ERROR priority unless
#define PMIX_LOG_MSG "pmix.log.msg" // (pmix_byte_object_t) message blob to be sent somewhere
/* debugger attributes */
#define PMIX_DEBUG_STOP_ON_EXEC "pmix.dbg.exec" // (bool) job is being spawned under debugger - instruct it to pause on start
#define PMIX_DEBUG_STOP_IN_INIT "pmix.dbg.init" // (bool) instruct job to stop during PMIx init
@ -300,6 +313,15 @@ typedef uint32_t pmix_rank_t;
#define PMIX_DEBUG_JOB "pmix.dbg.job" // (char*) nspace of the job to be debugged - the RM/PMIx server are
#define PMIX_DEBUG_WAITING_FOR_NOTIFY "pmix.dbg.waiting" // (bool) job to be debugged is waiting for a release
/* Resource Manager identification */
#define PMIX_RM_NAME "pmix.rm.name" // (char*) string name of the resource manager
#define PMIX_RM_VERSION "pmix.rm.version" // (char*) RM version string
/* attributes for setting envars */
#define PMIX_SET_ENVAR "pmix.set.envar" // (char*) string "key=value" value shall be put into the environment
#define PMIX_UNSET_ENVAR "pmix.unset.envar" // (char*) unset envar specified in string
/**** PROCESS STATE DEFINITIONS ****/
typedef uint8_t pmix_proc_state_t;
#define PMIX_PROC_STATE_UNDEF 0 /* undefined process state */

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Artem Y. Polyakov <artpol84@gmail.com>.
* All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
@ -483,6 +483,34 @@ pmix_status_t PMIx_server_dmodex_request(const pmix_proc_t *proc,
pmix_dmodex_response_fn_t cbfunc,
void *cbdata);
/* define a callback function for the setup_application API. The returned info
* array is owned by the PMIx server library and will be free'd when the
* provided cbfunc is called. */
typedef void (*pmix_setup_application_cbfunc_t)(pmix_status_t status,
pmix_info_t info[], size_t ninfo,
void *provided_cbdata,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Provide a function by which the resource manager can request
* any application-specific environmental variables prior to
* launch of an application. For example, network libraries may
* opt to provide security credentials for the application. This
* is defined as a non-blocking operation in case network
* libraries need to perform some action before responding. The
* returned env will be distributed along with the application */
pmix_status_t PMIx_server_setup_application(const char nspace[],
pmix_info_t info[], size_t ninfo,
pmix_setup_application_cbfunc_t cbfunc, void *cbdata);
/* Provide a function by which the local PMIx server can perform
* any application-specific operations prior to spawning local
* clients of a given application. For example, a network library
* might need to setup the local driver for "instant on" addressing.
*/
pmix_status_t PMIx_server_setup_local_support(const char nspace[],
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif

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

@ -1,7 +1,7 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 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-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 IBM Corporation. All rights reserved.
@ -1221,7 +1221,7 @@ pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest,
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, sd[n].value.type);
PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value.data, sd[n].value.type);
}
break;
case PMIX_BUFFER:

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

@ -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) 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 IBM Corporation. All rights reserved.
@ -45,12 +45,12 @@
/*
* The default starting chunk size
*/
#define PMIX_BFROP_DEFAULT_INITIAL_SIZE 128
#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 1024
#define PMIX_BFROP_DEFAULT_THRESHOLD_SIZE 4096
/*
* Internal type corresponding to size_t. Do not use this in

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

@ -9,8 +9,10 @@
* 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) 2016 IBM Corporation. All rights reserved.
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -38,6 +40,7 @@ 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 */
@ -47,35 +50,27 @@ char* pmix_bfrop_buffer_extend(pmix_buffer_t *buffer, size_t bytes_to_add)
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) * pmix_bfrop_threshold_size;
to_alloc = (required + pmix_bfrop_threshold_size - 1) & ~(pmix_bfrop_threshold_size - 1);
} else {
to_alloc = buffer->bytes_allocated;
if(0 == to_alloc) {
to_alloc = pmix_bfrop_initial_size;
}
to_alloc = buffer->bytes_allocated ? buffer->bytes_allocated : pmix_bfrop_initial_size;
while(to_alloc < required) {
to_alloc <<= 1;
}
}
if (NULL != buffer->base_ptr) {
pack_offset = ((char*) buffer->pack_ptr) - ((char*) buffer->base_ptr);
unpack_offset = ((char*) buffer->unpack_ptr) -
((char*) buffer->base_ptr);
buffer->base_ptr = (char*)realloc(buffer->base_ptr, to_alloc);
memset(buffer->base_ptr + pack_offset, 0, to_alloc - buffer->bytes_allocated);
} else {
pack_offset = 0;
unpack_offset = 0;
buffer->bytes_used = 0;
buffer->base_ptr = (char*)malloc(to_alloc);
memset(buffer->base_ptr, 0, to_alloc);
}
if (NULL == buffer->base_ptr) {
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;
@ -117,6 +112,5 @@ pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t
pmix_status_t pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type)
{
int32_t n=1;
return pmix_bfrop_unpack_datatype(buffer, type, &n, PMIX_DATA_TYPE);
return pmix_bfrop_unpack_datatype(buffer, type, &(int32_t){1}, PMIX_DATA_TYPE);
}

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

@ -11,7 +11,7 @@
* 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-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 IBM Corporation. All rights reserved.
@ -174,7 +174,7 @@ pmix_status_t pmix_bfrop_open(void)
}
pmix_bfrop_num_reg_types = PMIX_UNDEF;
pmix_bfrop_threshold_size = PMIX_BFROP_DEFAULT_THRESHOLD_SIZE;
pmix_bfrop_initial_size = 1;
pmix_bfrop_initial_size = PMIX_BFROP_DEFAULT_INITIAL_SIZE;
/* Register all the supported types */
PMIX_REGISTER_TYPE("PMIX_BOOL", PMIX_BOOL,

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

@ -12,7 +12,7 @@
* 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-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -10,7 +10,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) 2014-2017 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.
@ -688,7 +688,6 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
return PMIX_ERR_NOMEM;
}
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, val->data.darray, &m, PMIX_DATA_ARRAY))) {
PMIX_ERROR_LOG(ret);
return ret;
}
break;
@ -1275,9 +1274,6 @@ pmix_status_t pmix_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest,
case PMIX_COMPRESSED_STRING:
nbytes = sizeof(pmix_byte_object_t);
break;
case PMIX_INFO:
nbytes = sizeof(pmix_info_t);
break;
case PMIX_PERSIST:
nbytes = sizeof(pmix_persistence_t);
break;

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

@ -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-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-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) 2007 Voltaire All rights reserved.
* Copyright (c) 2013-2016 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-2016 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-2016 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$

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

@ -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 @@
# -*- makefile -*-
#
# Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>.
# All rights reserved.
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.

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

@ -575,6 +575,8 @@ static void _putfn(int sd, short args, void *cbdata)
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
PMIX_ERROR_LOG(rc);
goto done;
}
kv->value->type = PMIX_COMPRESSED_STRING;
kv->value->data.bo.bytes = (char*)tmp;

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

@ -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-2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>.

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

@ -1,6 +1,6 @@
# -*- makefile -*-
#
# Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#

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

@ -2,7 +2,7 @@
/*
* Copyright (c) 2016 Mellanox Technologies, 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
@ -157,7 +157,7 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
proc_type_str, nspace);
/* check buf data */
if ((NULL == job_data) && (0 != job_data->bytes_used)) {
if ((NULL == job_data) || (0 == job_data->bytes_used)) {
rc = PMIX_ERR_BAD_PARAM;
PMIX_ERROR_LOG(rc);
return rc;
@ -269,21 +269,6 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
PMIX_DESTRUCT(&kv);
goto exit;
}
/* if the value contains a string that is longer than the
* limit, then compress it */
if (PMIX_STRING_SIZE_CHECK(kv.value)) {
if (pmix_util_compress_string(kv.value->data.string, &tmp, &len)) {
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
rc = PMIX_ERR_NOMEM;
goto exit;
}
kv.value->type = PMIX_COMPRESSED_STRING;
free(kv.value->data.string);
kv.value->data.bo.bytes = (char*)tmp;
kv.value->data.bo.size = len;
}
}
/* the name of the node is in the key, and the value is
* a comma-delimited list of procs on that node. See if we already
* have this node */
@ -297,6 +282,12 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
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 {
@ -381,12 +372,9 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (NULL != cb->dstore_fn) {
uint32_t size = (uint32_t)pmix_value_array_get_size(cb->bufs);
for (i = 0; i < size; i++) {
if (PMIX_SUCCESS != (rc = _rank_key_dstore_store(cbdata))) {
PMIX_ERROR_LOG(rc);
goto exit;
}
if (PMIX_SUCCESS != (rc = _rank_key_dstore_store(cbdata))) {
PMIX_ERROR_LOG(rc);
goto exit;
}
}
#endif

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

@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
@ -78,11 +78,7 @@ static void query_cbfunc(struct pmix_peer_t *peer,
cnt = results->ninfo;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, results->info, &cnt, PMIX_INFO))) {
PMIX_ERROR_LOG(rc);
pmix_output(0, "TYPE: %d", results->info[0].value.type);
results->status = rc;
PMIX_INFO_FREE(results->info, results->ninfo);
results->info = NULL;
results->ninfo = 0;
goto complete;
}
}

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

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

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

@ -1,7 +1,7 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -1,7 +1,7 @@
/*
* Copyright (c) 2015-2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 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-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -438,15 +438,6 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain)
return;
}
/* just a simple tracker so we know who we notified */
typedef struct pmix_event_trkr_t {
pmix_list_item_t super;
pmix_peer_t *peer;
} pmix_event_trkr_t;
static PMIX_CLASS_INSTANCE(pmix_event_trkr_t,
pmix_list_item_t,
NULL, NULL);
static void _notify_client_event(int sd, short args, void *cbdata)
{
@ -455,9 +446,7 @@ static void _notify_client_event(int sd, short args, void *cbdata)
pmix_regevents_info_t *reginfoptr;
pmix_peer_events_info_t *pr;
size_t n;
bool matched, notify;;
pmix_list_t recips;
pmix_event_trkr_t *trkr;
bool matched;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_server: _notify_error notifying clients of error %s",
@ -477,7 +466,6 @@ static void _notify_client_event(int sd, short args, void *cbdata)
/* cycle across our registered events and send the message to
* any client who registered for it */
PMIX_CONSTRUCT(&recips, pmix_list_t);
PMIX_LIST_FOREACH(reginfoptr, &pmix_server_globals.events, pmix_regevents_info_t) {
if ((PMIX_MAX_ERR_CONSTANT == reginfoptr->code && !cd->nondefault) ||
cd->status == reginfoptr->code) {
@ -506,30 +494,14 @@ static void _notify_client_event(int sd, short args, void *cbdata)
continue;
}
}
/* if we have already notified this client, then don't do it again */
notify = true;
PMIX_LIST_FOREACH(trkr, &recips, pmix_event_trkr_t) {
if (trkr->peer == pr->peer) {
notify = false;
break;
}
}
if (!notify) {
continue;
}
/* add this peer to the list of prior recipients */
trkr = PMIX_NEW(pmix_event_trkr_t);
trkr->peer = pr->peer;
pmix_list_append(&recips, &trkr->super);
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_server: notifying client %s:%d of code %d",
pr->peer->info->nptr->nspace, pr->peer->info->rank, cd->status);
"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_LIST_DESTRUCT(&recips);
/* notify the caller */
if (NULL != cd->cbfunc) {
@ -558,8 +530,8 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status,
size_t n;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_server: notify client of event %s with %lu ninfos",
PMIx_Error_string(status), ninfo);
"pmix_server: notify client of event %s",
PMIx_Error_string(status));
cd = PMIX_NEW(pmix_notify_caddy_t);
cd->status = status;

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

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

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

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

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

@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Cisco Systems, 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,7 +1,7 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 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$
*
* Additional copyrights may follow

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

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

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

@ -10,7 +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) 2016 Intel, Inc. All rights reserved.
# Copyright (c) 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) 2008-2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# Copyright (c) 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) 2013 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# Copyright (c) 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) 2008-2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* 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$
@ -1926,7 +1926,7 @@ static char *source_name(pmix_mca_base_var_t *var)
static int var_value_string (pmix_mca_base_var_t *var, char **value_string)
{
const pmix_mca_base_var_storage_t *value=NULL;
pmix_mca_base_var_storage_t *value=NULL;
int ret;
assert (PMIX_MCA_BASE_VAR_TYPE_MAX > var->mbv_type);

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

@ -3,7 +3,7 @@
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

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

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

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

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

@ -3,7 +3,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) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -2,7 +2,7 @@
# Copyright (c) 2004-2010 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

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

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

@ -3,7 +3,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) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

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

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

@ -1,7 +1,7 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -1,7 +1,7 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -1,7 +1,7 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -4,7 +4,7 @@
* Copyright (c) 2013 The University of Tennessee and The University
* of Tennessee Research Foundation. 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

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

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

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

@ -3,7 +3,7 @@
# Copyright (c) 2006 Los Alamos National Security, LLC. 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 (c) 2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$

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

@ -3,7 +3,7 @@
# reserved.
# Copyright (c) 2009 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -3,7 +3,7 @@
# Copyright (c) 2006 Los Alamos National Security, LLC. 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 (c) 2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$

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

@ -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_pnet.la
libmca_pnet_la_SOURCES =
# local files
headers = pnet.h
sources =
# Conditionally install the header files
if WANT_INSTALL_HEADERS
pmixdir = $(pmixincludedir)/$(subdir)
nobase_pmix_HEADERS = $(headers)
endif
include base/Makefile.include
libmca_pnet_la_SOURCES += $(headers) $(sources)
distclean-local:
rm -f base/static-components.h

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

@ -0,0 +1,32 @@
# -*- 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/pnet_base_frame.c \
base/pnet_base_select.c \
base/pnet_base_fns.c

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

@ -0,0 +1,91 @@
/* -*- 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_PNET_BASE_H_
#define PMIX_PNET_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_list.h"
#include "src/class/pmix_pointer_array.h"
#include "src/mca/mca.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/pnet/pnet.h"
BEGIN_C_DECLS
/*
* MCA Framework
*/
extern pmix_mca_base_framework_t pmix_pnet_base_framework;
/**
* PNET select function
*
* Cycle across available components and construct the list
* of active modules
*/
pmix_status_t pmix_pnet_base_select(void);
/**
* Track an active component / module
*/
struct pmix_pnet_base_active_module_t {
pmix_list_item_t super;
int pri;
pmix_pnet_module_t *module;
pmix_pnet_base_component_t *component;
};
typedef struct pmix_pnet_base_active_module_t pmix_pnet_base_active_module_t;
PMIX_CLASS_DECLARATION(pmix_pnet_base_active_module_t);
/* framework globals */
struct pmix_pnet_globals_t {
pmix_list_t actives;
bool initialized;
};
typedef struct pmix_pnet_globals_t pmix_pnet_globals_t;
extern pmix_pnet_globals_t pmix_pnet_globals;
pmix_status_t pmix_pnet_base_setup_app(char *nspace, pmix_list_t *ilist);
pmix_status_t pmix_pnet_base_setup_local_network(char *nspace,
pmix_info_t info[],
size_t ninfo);
pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *peer, char ***env);
void pmix_pnet_base_child_finalized(pmix_peer_t *peer);
void pmix_pnet_base_local_app_finalized(char *nspace);
END_C_DECLS
#endif

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

@ -0,0 +1,146 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
* 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 "src/class/pmix_list.h"
#include "src/util/error.h"
#include "src/mca/pnet/base/base.h"
pmix_status_t pmix_pnet_base_setup_app(char *nspace, pmix_list_t *ilist)
{
pmix_pnet_base_active_module_t *active;
pmix_status_t rc;
if (!pmix_pnet_globals.initialized) {
return PMIX_ERR_INIT;
}
/* protect against bozo inputs */
if (NULL == nspace || NULL == ilist) {
return PMIX_ERR_BAD_PARAM;
}
PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) {
if (NULL != active->module->setup_app) {
if (PMIX_SUCCESS != (rc = active->module->setup_app(nspace, ilist))) {
return rc;
}
}
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_pnet_base_setup_local_network(char *nspace,
pmix_info_t info[],
size_t ninfo)
{
pmix_pnet_base_active_module_t *active;
pmix_status_t rc;
if (!pmix_pnet_globals.initialized) {
return PMIX_ERR_INIT;
}
/* protect against bozo inputs */
if (NULL == nspace) {
return PMIX_ERR_BAD_PARAM;
}
PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) {
if (NULL != active->module->setup_local_network) {
if (PMIX_SUCCESS != (rc = active->module->setup_local_network(nspace, info, ninfo))) {
return rc;
}
}
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *peer, char ***env)
{
pmix_pnet_base_active_module_t *active;
pmix_status_t rc;
if (!pmix_pnet_globals.initialized) {
return PMIX_ERR_INIT;
}
/* protect against bozo inputs */
if (NULL == peer || NULL == env) {
return PMIX_ERR_BAD_PARAM;
}
PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) {
if (NULL != active->module->setup_fork) {
if (PMIX_SUCCESS != (rc = active->module->setup_fork(peer, env))) {
return rc;
}
}
}
return PMIX_SUCCESS;
}
void pmix_pnet_base_child_finalized(pmix_peer_t *peer)
{
pmix_pnet_base_active_module_t *active;
if (!pmix_pnet_globals.initialized) {
return;
}
/* protect against bozo inputs */
if (NULL == peer) {
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return;
}
PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) {
if (NULL != active->module->child_finalized) {
active->module->child_finalized(peer);
}
}
return;
}
void pmix_pnet_base_local_app_finalized(char *nspace)
{
pmix_pnet_base_active_module_t *active;
if (!pmix_pnet_globals.initialized) {
return;
}
/* protect against bozo inputs */
if (NULL == nspace) {
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return;
}
PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) {
if (NULL != active->module->local_app_finalized) {
active->module->local_app_finalized(nspace);
}
}
return;
}

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

@ -0,0 +1,93 @@
/* -*- 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-2016 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/class/pmix_list.h"
#include "src/mca/base/base.h"
#include "src/mca/pnet/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/pnet/base/static-components.h"
/* Instantiate the global vars */
pmix_pnet_globals_t pmix_pnet_globals = {{{0}}};
pmix_pnet_module_t pmix_pnet = {
.setup_app = pmix_pnet_base_setup_app,
.setup_local_network = pmix_pnet_base_setup_local_network,
.setup_fork = pmix_pnet_base_setup_fork,
.child_finalized = pmix_pnet_base_child_finalized,
.local_app_finalized = pmix_pnet_base_local_app_finalized
};
static pmix_status_t pmix_pnet_close(void)
{
pmix_pnet_base_active_module_t *active, *prev;
if (!pmix_pnet_globals.initialized) {
return PMIX_SUCCESS;
}
pmix_pnet_globals.initialized = false;
PMIX_LIST_FOREACH_SAFE(active, prev, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) {
pmix_list_remove_item(&pmix_pnet_globals.actives, &active->super);
if (NULL != active->module->finalize) {
active->module->finalize();
}
PMIX_RELEASE(active);
}
PMIX_DESTRUCT(&pmix_pnet_globals.actives);
return pmix_mca_base_framework_components_close(&pmix_pnet_base_framework, NULL);
}
static pmix_status_t pmix_pnet_open(pmix_mca_base_open_flag_t flags)
{
/* initialize globals */
pmix_pnet_globals.initialized = true;
PMIX_CONSTRUCT(&pmix_pnet_globals.actives, pmix_list_t);
/* Open up all available components */
return pmix_mca_base_framework_components_open(&pmix_pnet_base_framework, flags);
}
PMIX_MCA_BASE_FRAMEWORK_DECLARE(pmix, pnet, "PMIx Network Operations",
NULL, pmix_pnet_open, pmix_pnet_close,
mca_pnet_base_static_components, 0);
PMIX_CLASS_INSTANCE(pmix_pnet_base_active_module_t,
pmix_list_item_t,
NULL, NULL);

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

@ -0,0 +1,116 @@
/*
* 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/pnet/base/base.h"
static bool selected = false;
/* Function for selecting a prioritized list of components
* from all those that are available. */
int pmix_pnet_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_pnet_module_t *nmodule;
pmix_pnet_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_pnet_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_pnet_base_framework.framework_output,
"mca:pnet: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_pnet_base_framework.framework_output,
"mca:pnet: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_pnet_base_framework.framework_output,
"mca:pnet: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_pnet_base_framework.framework_output,
"mca:pnet:select: Skipping component [%s]. Query failed to return a module",
component->pmix_mca_component_name );
continue;
}
/* If we got a module, keep it */
nmodule = (pmix_pnet_module_t*) module;
/* let it initialize */
if (NULL != nmodule->init && PMIX_SUCCESS != nmodule->init()) {
continue;
}
/* add to the list of selected modules */
newmodule = PMIX_NEW(pmix_pnet_base_active_module_t);
newmodule->pri = priority;
newmodule->module = nmodule;
newmodule->component = (pmix_pnet_base_component_t*)cli->cli_component;
/* maintain priority order */
inserted = false;
PMIX_LIST_FOREACH(mod, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) {
if (priority > mod->pri) {
pmix_list_insert_pos(&pmix_pnet_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_pnet_globals.actives, &newmodule->super);
}
}
if (4 < pmix_output_get_verbosity(pmix_pnet_base_framework.framework_output)) {
pmix_output(0, "Final pnet priorities");
/* show the prioritized list */
PMIX_LIST_FOREACH(mod, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) {
pmix_output(0, "\tpnet: %s Priority: %d", mod->component->base.pmix_mca_component_name, mod->pri);
}
}
return PMIX_SUCCESS;;
}

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

@ -0,0 +1,54 @@
# -*- 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$
#
# Additional copyrights may follow
#
# $HEADER$
#
AM_CPPFLAGS = $(pnet_opa_CPPFLAGS)
headers = pnet_opa.h
sources = \
pnet_opa_component.c \
pnet_opa.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_pmix_pnet_opa_DSO
lib =
lib_sources =
component = mca_pnet_opa.la
component_sources = $(headers) $(sources)
else
lib = libmca_pnet_opa.la
lib_sources = $(headers) $(sources)
component =
component_sources =
endif
mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_pnet_opa_la_SOURCES = $(component_sources)
mca_pnet_opa_la_LIBADD = $(pnet_opa_LIBS)
mca_pnet_opa_la_LDFLAGS = -module -avoid-version $(pnet_opa_LDFLAGS)
noinst_LTLIBRARIES = $(lib)
libmca_pnet_opa_la_SOURCES = $(lib_sources)
libmca_pnet_opa_la_LIBADD = $(pnet_opa_LIBS)
libmca_pnet_opa_la_LDFLAGS = -module -avoid-version $(pnet_opa_LDFLAGS

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

@ -0,0 +1,42 @@
# -*- shell-script -*-
#
# 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) 2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Sandia National Laboratories. All rights reserved.
# Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_pnet_opa_CONFIG([action-if-can-compile],
# [action-if-cant-compile])
# ------------------------------------------------
AC_DEFUN([MCA_pmix_pnet_opa_CONFIG],[
AC_CONFIG_FILES([src/mca/pnet/opa/Makefile])
PMIX_CHECK_PSM2([pnet_opa],
[pnet_opa_happy="yes"],
[pnet_opa_happy="no"])
AS_IF([test "$pnet_opa_happy" = "yes"],
[$1],
[$2])
# substitute in the things needed to build psm2
AC_SUBST([pnet_opa_CFLAGS])
AC_SUBST([pnet_opa_CPPFLAGS])
AC_SUBST([pnet_opa_LDFLAGS])
AC_SUBST([pnet_opa_LIBS])
])dnl

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

@ -0,0 +1,238 @@
/*
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <time.h>
#include <pmix_common.h>
#include "src/mca/base/pmix_mca_base_var.h"
#include "src/include/pmix_socket_errno.h"
#include "src/include/pmix_globals.h"
#include "src/class/pmix_list.h"
#include "src/util/alfg.h"
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/util/pmix_environ.h"
#include "src/mca/pnet/pnet.h"
#include "pnet_opa.h"
static pmix_status_t opa_init(void);
static void opa_finalize(void);
static pmix_status_t setup_app(char *nspace, pmix_list_t *ilist);
static pmix_status_t setup_local_network(char *nspace,
pmix_info_t info[],
size_t ninfo);
static pmix_status_t setup_fork(const pmix_proc_t *peer, char ***env);
static void child_finalized(pmix_peer_t *peer);
static void local_app_finalized(char *nspace);
pmix_pnet_module_t pmix_opa_module = {
.init = opa_init,
.finalize = opa_finalize,
.setup_app = setup_app,
.setup_local_network = setup_local_network,
.setup_fork = setup_fork,
.child_finalized = child_finalized,
.local_app_finalized = local_app_finalized
};
static pmix_status_t opa_init(void)
{
pmix_output_verbose(2, pmix_globals.debug_output,
"pnet: opa init");
return PMIX_SUCCESS;
}
static void opa_finalize(void)
{
pmix_output_verbose(2, pmix_globals.debug_output,
"pnet: opa finalize");
}
/* some network transports require a little bit of information to
* "pre-condition" them - i.e., to setup their individual transport
* connections so they can generate their endpoint addresses. This
* function provides a means for doing so. The resulting info is placed
* into the app_context's env array so it will automatically be pushed
* into the environment of every MPI process when launched.
*/
static inline void transports_use_rand(uint64_t* unique_key) {
pmix_rng_buff_t rng;
pmix_srand(&rng,(unsigned int)time(NULL));
unique_key[0] = pmix_rand(&rng);
unique_key[1] = pmix_rand(&rng);
}
static char* transports_print(uint64_t *unique_key)
{
unsigned int *int_ptr;
size_t i, j, string_key_len, written_len;
char *string_key = NULL, *format = NULL;
/* string is two 64 bit numbers printed in hex with a dash between
* and zero padding.
*/
string_key_len = (sizeof(uint64_t) * 2) * 2 + strlen("-") + 1;
string_key = (char*) malloc(string_key_len);
if (NULL == string_key) {
return NULL;
}
string_key[0] = '\0';
written_len = 0;
/* get a format string based on the length of an unsigned int. We
* want to have zero padding for sizeof(unsigned int) * 2
* characters -- when printing as a hex number, each byte is
* represented by 2 hex characters. Format will contain something
* that looks like %08lx, where the number 8 might be a different
* number if the system has a different sized long (8 would be for
* sizeof(int) == 4)).
*/
asprintf(&format, "%%0%dx", (int)(sizeof(unsigned int)) * 2);
/* print the first number */
int_ptr = (unsigned int*) &unique_key[0];
for (i = 0 ; i < sizeof(uint64_t) / sizeof(unsigned int) ; ++i) {
if (0 == int_ptr[i]) {
/* inject some energy */
for (j=0; j < sizeof(unsigned int); j++) {
int_ptr[i] |= j << j;
}
}
snprintf(string_key + written_len,
string_key_len - written_len,
format, int_ptr[i]);
written_len = strlen(string_key);
}
/* print the middle dash */
snprintf(string_key + written_len, string_key_len - written_len, "-");
written_len = strlen(string_key);
/* print the second number */
int_ptr = (unsigned int*) &unique_key[1];
for (i = 0 ; i < sizeof(uint64_t) / sizeof(unsigned int) ; ++i) {
if (0 == int_ptr[i]) {
/* inject some energy */
for (j=0; j < sizeof(unsigned int); j++) {
int_ptr[i] |= j << j;
}
}
snprintf(string_key + written_len,
string_key_len - written_len,
format, int_ptr[i]);
written_len = strlen(string_key);
}
free(format);
return string_key;
}
static pmix_status_t setup_app(char *nspace, pmix_list_t *ilist)
{
uint64_t unique_key[2];
char *string_key, *cs_env;
int fd_rand;
size_t bytes_read;
pmix_kval_t *kv;
/* put the number here - or else create an appropriate string. this just needs to
* eventually be a string variable
*/
if(-1 == (fd_rand = open("/dev/urandom", O_RDONLY))) {
transports_use_rand(unique_key);
} else {
bytes_read = read(fd_rand, (char *) unique_key, 16);
if(bytes_read != 16) {
transports_use_rand(unique_key);
}
close(fd_rand);
}
if (NULL == (string_key = transports_print(unique_key))) {
PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE);
return PMIX_ERR_OUT_OF_RESOURCE;
}
if (PMIX_SUCCESS != pmix_mca_base_var_env_name("pmix_precondition_transports", &cs_env)) {
PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE);
free(string_key);
return PMIX_ERR_OUT_OF_RESOURCE;
}
kv = PMIX_NEW(pmix_kval_t);
if (NULL == kv) {
free(string_key);
free(cs_env);
return PMIX_ERR_OUT_OF_RESOURCE;
}
kv->key = strdup(PMIX_SET_ENVAR);
kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t));
if (NULL == kv->value) {
free(string_key);
free(cs_env);
PMIX_RELEASE(kv);
return PMIX_ERR_OUT_OF_RESOURCE;
}
kv->value->type = PMIX_STRING;
if (0 > asprintf(&kv->value->data.string, "%s=%s", cs_env, string_key)) {
free(string_key);
free(cs_env);
PMIX_RELEASE(kv);
return PMIX_ERR_OUT_OF_RESOURCE;
}
pmix_list_append(ilist, &kv->super);
free(cs_env);
free(string_key);
return PMIX_SUCCESS;
}
static pmix_status_t setup_local_network(char *nspace,
pmix_info_t info[],
size_t ninfo)
{
return PMIX_SUCCESS;
}
static pmix_status_t setup_fork(const pmix_proc_t *peer, char ***env)
{
return PMIX_SUCCESS;
}
static void child_finalized(pmix_peer_t *peer)
{
}
static void local_app_finalized(char *nspace)
{
}

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

@ -0,0 +1,27 @@
/*
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_PNET_OPA_H
#define PMIX_PNET_OPA_H
#include <src/include/pmix_config.h>
#include "src/mca/pnet/pnet.h"
BEGIN_C_DECLS
/* the component must be visible data for the linker to find it */
PMIX_EXPORT extern pmix_pnet_base_component_t mca_pnet_opa_component;
extern pmix_pnet_module_t pmix_opa_module;
END_C_DECLS
#endif

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

@ -0,0 +1,84 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* 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) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire components just to query their version and parameters.
*/
#include <src/include/pmix_config.h>
#include "pmix_common.h"
#include "src/mca/pnet/pnet.h"
#include "pnet_opa.h"
static pmix_status_t component_open(void);
static pmix_status_t component_close(void);
static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
pmix_pnet_base_component_t mca_pnet_opa_component = {
.base = {
PMIX_PNET_BASE_VERSION_1_0_0,
/* Component name and version */
.pmix_mca_component_name = "opa",
PMIX_MCA_BASE_MAKE_VERSION(component,
PMIX_MAJOR_VERSION,
PMIX_MINOR_VERSION,
PMIX_RELEASE_VERSION),
/* Component open and close functions */
.pmix_mca_open_component = component_open,
.pmix_mca_close_component = component_close,
.pmix_mca_query_component = component_query,
},
.data = {
/* The component is checkpoint ready */
PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT
}
};
static int component_open(void)
{
return PMIX_SUCCESS;
}
static int component_query(pmix_mca_base_module_t **module, int *priority)
{
*priority = 10;
*module = (pmix_mca_base_module_t *)&pmix_opa_module;
return PMIX_SUCCESS;
}
static int component_close(void)
{
return PMIX_SUCCESS;
}

122
opal/mca/pmix/pmix2x/pmix/src/mca/pnet/pnet.h Обычный файл
Просмотреть файл

@ -0,0 +1,122 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015-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
*
* This interface is for use by PMIx servers to obtain network-related info
* such as security keys that need to be shared across applications, and to
* setup network support for applications prior to launch
*
* Available plugins may be defined at runtime via the typical MCA parameter
* syntax.
*/
#ifndef PMIX_PNET_H
#define PMIX_PNET_H
#include <src/include/pmix_config.h>
#include "src/class/pmix_list.h"
#include "src/mca/mca.h"
#include "src/mca/base/pmix_mca_base_var.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/include/pmix_globals.h"
BEGIN_C_DECLS
/****** MODULE DEFINITION ******/
/**
* Initialize the module. Returns an error if the module cannot
* run, success if it can and wants to be used.
*/
typedef pmix_status_t (*pmix_pnet_base_module_init_fn_t)(void);
/**
* Finalize the module. Tear down any allocated storage, disconnect
* from any system support (e.g., LDAP server)
*/
typedef void (*pmix_pnet_base_module_fini_fn_t)(void);
/**
* Provide an opportunity for the network to define values that
* are to be passed to an application. This can include security
* tokens required for application processes to communicate with
* each other
*/
typedef pmix_status_t (*pmix_pnet_base_module_setup_app_fn_t)(char *nspace, pmix_list_t *ilist);
/**
* Give the local network library an opportunity to setup address information
* for the application by passing in the layout type and a regex describing
* the layout */
typedef pmix_status_t (*pmix_pnet_base_module_setup_local_net_fn_t)(char *nspace,
pmix_info_t info[],
size_t ninfo);
/**
* Give the local network library an opportunity to add any envars to the
* environment of a local application process prior to fork/exec
*/
typedef pmix_status_t (*pmix_pnet_base_module_setup_fork_fn_t)(const pmix_proc_t *peer, char ***env);
/**
* Provide an opportunity for the local network library to cleanup when a
* local application process terminates
*/
typedef void (*pmix_pnet_base_module_child_finalized_fn_t)(pmix_peer_t *peer);
/**
* Provide an opportunity for the local network library to cleanup after
* all local clients for a given application have terminated
*/
typedef void (*pmix_pnet_base_module_local_app_finalized_fn_t)(char *nspace);
/**
* Base structure for a PNET module
*/
typedef struct {
char *name;
/* init/finalize */
pmix_pnet_base_module_init_fn_t init;
pmix_pnet_base_module_fini_fn_t finalize;
pmix_pnet_base_module_setup_app_fn_t setup_app;
pmix_pnet_base_module_setup_local_net_fn_t setup_local_network;
pmix_pnet_base_module_setup_fork_fn_t setup_fork;
pmix_pnet_base_module_child_finalized_fn_t child_finalized;
pmix_pnet_base_module_local_app_finalized_fn_t local_app_finalized;
} pmix_pnet_module_t;
/* declare the global APIs */
PMIX_EXPORT extern pmix_pnet_module_t pmix_pnet;
/*
* the standard component data structure
*/
struct pmix_pnet_base_component_t {
pmix_mca_base_component_t base;
pmix_mca_base_component_data_t data;
};
typedef struct pmix_pnet_base_component_t pmix_pnet_base_component_t;
/*
* Macro for use in components that are of type pnet
*/
#define PMIX_PNET_BASE_VERSION_1_0_0 \
PMIX_MCA_BASE_VERSION_1_0_0("pnet", 1, 0, 0)
END_C_DECLS
#endif

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

@ -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) 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$
@ -21,8 +21,8 @@
* $HEADER$
*
*/
#ifndef PMIX_BFROP_BASE_H_
#define PMIX_BFROP_BASE_H_
#ifndef PMIX_PSEC_BASE_H_
#define PMIX_PSEC_BASE_H_
#include <src/include/pmix_config.h>
@ -48,7 +48,7 @@ BEGIN_C_DECLS
*/
extern pmix_mca_base_framework_t pmix_psec_base_framework;
/**
* BFROP select function
* PSEC select function
*
* Cycle across available components and construct the list
* of active modules

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
*
* $COPYRIGHT$
@ -169,6 +169,10 @@ static pmix_status_t validate_cred(pmix_peer_t *peer,
if (PMIX_PROTOCOL_V2 == protocol) {
/* this is a tcp protocol, so the cred is actually the uid/gid
* passed upwards from the client */
if (NULL == cred) {
/* not allowed */
return PMIX_ERR_INVALID_CRED;
}
ln = len;
euid = 0;
gid = 0;

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

@ -144,7 +144,6 @@ static void lost_connection(pmix_peer_t *peer, pmix_status_t err)
static pmix_status_t send_msg(int sd, pmix_ptl_send_t *msg)
{
pmix_status_t ret = PMIX_SUCCESS;
struct iovec iov[2];
int iov_count;
ssize_t remain = msg->sdbytes, rc;

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

@ -222,15 +222,23 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
if (0 == strncmp(mca_ptl_tcp_component.super.uri, "tcp4", 4)) {
/* separate the IP address from the port */
p = strdup(mca_ptl_tcp_component.super.uri);
if (NULL == p) {
return PMIX_ERR_NOMEM;
}
p2 = strchr(&p[7], ':');
if (NULL == p2) {
free(p);
return PMIX_ERR_BAD_PARAM;
}
*p2 = '\0';
++p2;
host = strdup(&p[7]);
host = &p[7];
/* load the address */
in = (struct sockaddr_in*)&mca_ptl_tcp_component.connection;
in->sin_family = AF_INET;
in->sin_addr.s_addr = inet_addr(host);
if (in->sin_addr.s_addr == INADDR_NONE) {
free(p);
return PMIX_ERR_BAD_PARAM;
}
in->sin_port = htons(atoi(p2));
@ -238,26 +246,35 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
} else {
/* separate the IP address from the port */
p = strdup(mca_ptl_tcp_component.super.uri);
if (NULL == p) {
return PMIX_ERR_NOMEM;
}
p2 = strchr(&p[7], ':');
if (NULL == p2) {
free(p);
return PMIX_ERR_BAD_PARAM;
}
*p2 = '\0';
if (']' == p[strlen(p)-1]) {
p[strlen(p)-1] = '\0';
}
if ('[' == p[7]) {
host = strdup(&p[8]);
host = &p[8];
} else {
host = strdup(&p[7]);
host = &p[7];
}
/* load the address */
in6 = (struct sockaddr_in6*)&mca_ptl_tcp_component.connection;
in6->sin6_family = AF_INET6;
if (0 == inet_pton(AF_INET6, host, (void*)&in6->sin6_addr)) {
pmix_output (0, "ptl_tcp_parse_uri: Could not convert %s\n", host);
free(p);
return PMIX_ERR_BAD_PARAM;
}
in6->sin6_port = htons(atoi(p2));
len = sizeof(struct sockaddr_in6);
}
free(p);
/* establish the connection */
if (PMIX_SUCCESS != (rc = pmix_ptl_base_connect(&mca_ptl_tcp_component.connection, len, &sd))) {
@ -270,7 +287,6 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
if (PMIX_SUCCESS != (rc = send_connect_ack(sd))) {
PMIX_ERROR_LOG(rc);
CLOSE_THE_SOCKET(sd);
pmix_client_globals.myserver.sd = -1;
return rc;
}
@ -278,7 +294,6 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
if (PMIX_SUCCESS != (rc = recv_connect_ack(sd))) {
PMIX_ERROR_LOG(rc);
CLOSE_THE_SOCKET(sd);
pmix_client_globals.myserver.sd = -1;
return rc;
}

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

@ -12,7 +12,7 @@
* 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
@ -677,7 +677,7 @@ static void connection_handler(int sd, short args, void *cbdata)
pmix_peer_t *peer;
pmix_rank_t rank;
pmix_status_t rc;
char *msg, *mg, *sec, *cred = NULL;
char *msg, *mg, *sec;
char *nspace;
uint32_t len, u32;
size_t cnt, msglen, n;
@ -733,7 +733,7 @@ static void connection_handler(int sd, short args, void *cbdata)
/* extract the name of the sec module they used */
PMIX_STRNLEN(msglen, mg, cnt);
if (msglen < cnt) {
sec = msg;
sec = mg;
mg += strlen(sec) + 1;
cnt -= strlen(sec) + 1;
} else {
@ -758,21 +758,21 @@ static void connection_handler(int sd, short args, void *cbdata)
goto error;
}
/* convert it to host byte order */
len = ntohl(len);
pnd->len = ntohl(len);
/* if a credential is present, then create space and
* extract it for processing */
if (0 < len) {
cred = (char*)malloc(len);
if (NULL == cred) {
if (0 < pnd->len) {
pnd->cred = (char*)malloc(pnd->len);
if (NULL == pnd->cred) {
/* probably cannot send an error reply if we are out of memory */
free(msg);
CLOSE_THE_SOCKET(pnd->sd);
PMIX_RELEASE(pnd);
return;
}
memcpy(cred, mg, len);
mg += len;
cnt -= len;
memcpy(pnd->cred, mg, pnd->len);
mg += pnd->len;
cnt -= pnd->len;
}
/* get the request type */
@ -845,14 +845,7 @@ static void connection_handler(int sd, short args, void *cbdata)
++n;
/* pass along the bfrop, buffer_type, and sec fields so
* we can assign them once we create a peer object */
if (NULL != sec) {
pnd->psec = strdup(sec);
}
/* pass along the credential for later */
if (NULL != cred) {
pnd->cred = cred;
pnd->len = len;
}
pnd->psec = strdup(sec);
/* release the msg */
free(msg);
/* request an nspace for this requestor - it will
@ -963,7 +956,7 @@ static void connection_handler(int sd, short args, void *cbdata)
/* validate the connection */
if (PMIX_SUCCESS != (rc = pmix_psec.validate_connection((struct pmix_peer_t*)peer,
PMIX_PROTOCOL_V2, cred, len))) {
PMIX_PROTOCOL_V2, pnd->cred, pnd->len))) {
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
"validation of client connection failed");
info->proc_cnt--;

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