1
1

Merge pull request #1994 from rhc54/topic/unify

Unify the PMIx2x components and minor cleanup of coll/sync
Этот коммит содержится в:
rhc54 2016-08-22 17:20:24 -05:00 коммит произвёл GitHub
родитель 17ca44b25e 639dbdb7ea
Коммит aa21013da3
23 изменённых файлов: 374 добавлений и 5115 удалений

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

@ -227,6 +227,8 @@ AC_DEFUN([OPAL_CHECK_PMI],[
AC_DEFUN([OPAL_CHECK_PMIX],[
OPAL_VAR_SCOPE_PUSH([opal_external_pmix_save_CPPFLAGS opal_external_pmix_save_LDFLAGS opal_external_pmix_save_LIBS])
AC_ARG_WITH([pmix],
[AC_HELP_STRING([--with-pmix(=DIR)],
[Build PMIx support. DIR can take one of three values: "internal", "external", or a valid directory name. "internal" (or no DIR value) forces Open MPI to use its internal copy of PMIx. "external" forces Open MPI to use an external installation of PMIx. Supplying a valid directory name also forces Open MPI to use an external installation of PMIx, and adds DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries. Note that Open MPI does not support --without-pmix.])])
@ -241,14 +243,38 @@ AC_DEFUN([OPAL_CHECK_PMIX],[
AS_IF([test -z "$with_pmix" || test "$with_pmix" = "yes" || test "$with_pmix" = "internal"],
[AC_MSG_RESULT([no])
opal_external_pmix_happy=no],
[AC_MSG_RESULT([yes])
# check for external pmix lib */
AS_IF([test "$with_pmix" = "external"],
[pmix_ext_install_dir=/usr],
[pmix_ext_install_dir=$with_pmix])
# Make sure we have the headers and libs in the correct location
OPAL_CHECK_WITHDIR([external-pmix], [$pmix_ext_install_dir/include], [pmix.h])
OPAL_CHECK_WITHDIR([external-libpmix], [$pmix_ext_install_dir/lib], [libpmix.*])
# check the version
opal_external_pmix_save_CPPFLAGS=$CPPFLAGS
opal_external_pmix_save_LDFLAGS=$LDFLAGS
opal_external_pmix_save_LIBS=$LIBS
LDFLAGS="-L$pmix_ext_install_dir/lib $LDFLAGS"
AC_SEARCH_LIBS([PMIx_Register_event_handler], [pmix],
[opal_external_pmix_version=2],
[opal_external_pmix_version=1])
AC_MSG_CHECKING([PMIx version])
AC_MSG_RESULT([$opal_external_pmix_version])
CPPFLAGS=$opal_external_pmix_save_CPPFLAGS
LDFLAGS=$opal_external_pmix_save_LDFLAGS
LIBS=$opal_external_pmix_save_LIBS
opal_external_pmix_CPPFLAGS="-I$pmix_ext_install_dir/include"
opal_external_pmix_LDFLAGS=-L$pmix_ext_install_dir/lib
opal_external_pmix_LIBS=-lpmix
opal_external_pmix_happy=yes])
OPAL_VAR_SCOPE_POP
])

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

@ -55,13 +55,13 @@ int mca_coll_sync_bcast(void *buff, int count,
struct ompi_communicator_t *comm,
mca_coll_base_module_t *module);
int mca_coll_sync_exscan(void *sbuf, void *rbuf, int count,
int mca_coll_sync_exscan(const void *sbuf, void *rbuf, int count,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
struct ompi_communicator_t *comm,
mca_coll_base_module_t *module);
int mca_coll_sync_gather(void *sbuf, int scount,
int mca_coll_sync_gather(const void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void *rbuf, int rcount,
struct ompi_datatype_t *rdtype,
@ -69,35 +69,35 @@ int mca_coll_sync_gather(void *sbuf, int scount,
struct ompi_communicator_t *comm,
mca_coll_base_module_t *module);
int mca_coll_sync_gatherv(void *sbuf, int scount,
int mca_coll_sync_gatherv(const void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void *rbuf, int *rcounts, int *disps,
void *rbuf, const int *rcounts, const int *disps,
struct ompi_datatype_t *rdtype,
int root,
struct ompi_communicator_t *comm,
mca_coll_base_module_t *module);
int mca_coll_sync_reduce(void *sbuf, void *rbuf, int count,
int mca_coll_sync_reduce(const void *sbuf, void *rbuf, int count,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
int root,
struct ompi_communicator_t *comm,
mca_coll_base_module_t *module);
int mca_coll_sync_reduce_scatter(void *sbuf, void *rbuf,
int *rcounts,
int mca_coll_sync_reduce_scatter(const void *sbuf, void *rbuf,
const int *rcounts,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
struct ompi_communicator_t *comm,
mca_coll_base_module_t *module);
int mca_coll_sync_scan(void *sbuf, void *rbuf, int count,
int mca_coll_sync_scan(const void *sbuf, void *rbuf, int count,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
struct ompi_communicator_t *comm,
mca_coll_base_module_t *module);
int mca_coll_sync_scatter(void *sbuf, int scount,
int mca_coll_sync_scatter(const void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void *rbuf, int rcount,
struct ompi_datatype_t *rdtype,
@ -105,7 +105,7 @@ int mca_coll_sync_scatter(void *sbuf, int scount,
struct ompi_communicator_t *comm,
mca_coll_base_module_t *module);
int mca_coll_sync_scatterv(void *sbuf, int *scounts, int *disps,
int mca_coll_sync_scatterv(const void *sbuf, const int *scounts, const int *disps,
struct ompi_datatype_t *sdtype,
void *rbuf, int rcount,
struct ompi_datatype_t *rdtype,

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

@ -29,7 +29,7 @@
* Accepts: - same arguments as MPI_Exscan()
* Returns: - MPI_SUCCESS or error code
*/
int mca_coll_sync_exscan(void *sbuf, void *rbuf, int count,
int mca_coll_sync_exscan(const void *sbuf, void *rbuf, int count,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
struct ompi_communicator_t *comm,

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

@ -29,7 +29,7 @@
* Accepts: - same arguments as MPI_Gather()
* Returns: - MPI_SUCCESS or error code
*/
int mca_coll_sync_gather(void *sbuf, int scount,
int mca_coll_sync_gather(const void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void *rbuf, int rcount,
struct ompi_datatype_t *rdtype,

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

@ -29,9 +29,9 @@
* Accepts: - same arguments as MPI_Gatherv()
* Returns: - MPI_SUCCESS or error code
*/
int mca_coll_sync_gatherv(void *sbuf, int scount,
int mca_coll_sync_gatherv(const void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void *rbuf, int *rcounts, int *disps,
void *rbuf, const int *rcounts, const int *disps,
struct ompi_datatype_t *rdtype, int root,
struct ompi_communicator_t *comm,
mca_coll_base_module_t *module)

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

@ -28,7 +28,7 @@
* Accepts: - same as MPI_Reduce()
* Returns: - MPI_SUCCESS or error code
*/
int mca_coll_sync_reduce(void *sbuf, void *rbuf, int count,
int mca_coll_sync_reduce(const void *sbuf, void *rbuf, int count,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
int root, struct ompi_communicator_t *comm,

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

@ -30,7 +30,7 @@
* Accepts: - same as MPI_Reduce_scatter()
* Returns: - MPI_SUCCESS or error code
*/
int mca_coll_sync_reduce_scatter(void *sbuf, void *rbuf, int *rcounts,
int mca_coll_sync_reduce_scatter(const void *sbuf, void *rbuf, const int *rcounts,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
struct ompi_communicator_t *comm,

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

@ -28,7 +28,7 @@
* Accepts: - same arguments as MPI_Scan()
* Returns: - MPI_SUCCESS or error code
*/
int mca_coll_sync_scan(void *sbuf, void *rbuf, int count,
int mca_coll_sync_scan(const void *sbuf, void *rbuf, int count,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
struct ompi_communicator_t *comm,

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

@ -29,7 +29,7 @@
* Accepts: - same arguments as MPI_Scatter()
* Returns: - MPI_SUCCESS or error code
*/
int mca_coll_sync_scatter(void *sbuf, int scount,
int mca_coll_sync_scatter(const void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void *rbuf, int rcount,
struct ompi_datatype_t *rdtype,

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

@ -29,8 +29,8 @@
* Accepts: - same arguments as MPI_Scatterv()
* Returns: - MPI_SUCCESS or error code
*/
int mca_coll_sync_scatterv(void *sbuf, int *scounts,
int *disps, struct ompi_datatype_t *sdtype,
int mca_coll_sync_scatterv(const void *sbuf, const int *scounts,
const int *disps, struct ompi_datatype_t *sdtype,
void *rbuf, int rcount,
struct ompi_datatype_t *rdtype, int root,
struct ompi_communicator_t *comm,

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

@ -43,31 +43,29 @@ AC_DEFUN([MCA_opal_pmix_ext114_CONFIG],[
AC_MSG_WARN([LIBRARY THIS LIBRARY MUST POINT TO THE SAME ONE USED ])
AC_MSG_WARN([TO BUILD PMIX OR ELSE UNPREDICTABLE BEHAVIOR MAY RESULT])
AC_MSG_ERROR([PLEASE CORRECT THE CONFIGURE COMMAND LINE AND REBUILD])])
external_WRAPPER_EXTRA_CPPFLAGS='-I${includedir}/openmpi/$opal_pmix_external_basedir/pmix -I${includedir}/openmpi/$opal_pmix_external_basedir/pmix/include'
# check for the 1.1.4 version by looking for a function
# which was later removed
AC_MSG_CHECKING([if external component is version 1.1.4])
OPAL_CHECK_PACKAGE([opal_pmix_ext114],
[pmix.h],
[pmix],
[PMIx_Register_errhandler],
[-lpmix],
[$pmix_ext_install_dir],
[$pmix_ext_install_dir/lib],
# check for the 1.1.4 version
AC_MSG_CHECKING([if external component is version 1.x])
AS_IF([test "$opal_external_pmix_version" = "1"],
[AC_MSG_RESULT([yes])
opal_pmix_external_114_happy=yes],
[AC_MSG_RESULT([no])
opal_pmix_external_114_happy=no])
AC_SUBST(opal_pmix_ext114_CPPFLAGS)
AC_SUBST(opal_pmix_ext114_LDFLAGS)
AC_SUBST(opal_pmix_ext114_LIBS)
AS_IF([test "$opal_pmix_external_114_happy" = "yes"],
[$1
# need to set the wrapper flags for static builds
pmix_ext114_WRAPPER_EXTRA_LDFLAGS="$opal_pmix_ext114_LDFLAGS"
pmix_ext114_WRAPPER_EXTRA_LIBS="$opal_pmix_ext114_LIBS"],
pmix_ext114_WRAPPER_EXTRA_LDFLAGS=$opal_external_pmix_LDFLAGS
pmix_ext114_WRAPPER_EXTRA_LIBS=$opal_external_pmix_LIBS],
[$2])],
[$2])
opal_pmix_ext114_CPPFLAGS=$opal_external_pmix_CPPFLAGS
opal_pmix_ext114_LDFLAGS=$opal_external_pmix_LDFLAGS
opal_pmix_ext114_LIBS=$opal_external_pmix_LIBS
AC_SUBST([opal_pmix_ext114_CPPFLAGS])
AC_SUBST([opal_pmix_ext114_LDFLAGS])
AC_SUBST([opal_pmix_ext114_LIBS])
])dnl

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

@ -29,7 +29,6 @@
#include "opal/mca/pmix/pmix.h"
#include "pmix_server.h"
#include "pmix_server.h"
#include "pmix/pmix_common.h"
BEGIN_C_DECLS

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

@ -1,46 +0,0 @@
#
# Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2014-2015 Mellanox Technologies, Inc.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
sources = \
pmix_ext20.h \
pmix_ext20_component.c \
pmix_ext20.c \
pmix_ext20_client.c \
pmix_ext20_server_south.c \
pmix_ext20_server_north.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_opal_pmix_ext20_DSO
component_noinst =
component_install = mca_pmix_ext20.la
else
component_noinst = libmca_pmix_ext20.la
component_install =
endif
mcacomponentdir = $(opallibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_pmix_ext20_la_SOURCES = $(sources)
mca_pmix_ext20_la_CFLAGS =
mca_pmix_ext20_la_CPPFLAGS = $(opal_pmix_ext20_CPPFLAGS)
mca_pmix_ext20_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext20_LDFLAGS)
mca_pmix_ext20_la_LIBADD = $(opal_pmix_ext20_LIBS)
noinst_LTLIBRARIES = $(component_noinst)
libmca_pmix_ext20_la_SOURCES =$(sources)
libmca_pmix_ext20_la_CFLAGS =
libmca_pmix_ext20_la_CPPFLAGS = $(opal_pmix_ext20_CPPFLAGS)
libmca_pmix_ext20_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext20_LDFLAGS)
libmca_pmix_ext20_la_LIBADD = $(opal_pmix_ext20_LIBS)

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

@ -1,88 +0,0 @@
# -*- 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) 2011-2013 Los Alamos National Security, LLC.
# All rights reserved.
# Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2014-2015 Mellanox Technologies, Inc.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_pmix_ext20_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_opal_pmix_ext20_CONFIG],[
AC_CONFIG_FILES([opal/mca/pmix/ext20/Makefile])
AC_REQUIRE([OPAL_CHECK_PMIX])
AS_IF([test "$opal_external_pmix_happy" = "yes"],
[AS_IF([test "$opal_event_external_support" != "yes"],
[AC_MSG_WARN([EXTERNAL PMIX SUPPORT REQUIRES USE OF EXTERNAL LIBEVENT])
AC_MSG_WARN([LIBRARY. THIS LIBRARY MUST POINT TO THE SAME ONE USED])
AC_MSG_WARN([TO BUILD PMIX OR ELSE UNPREDICTABLE BEHAVIOR MAY RESULT])
AC_MSG_ERROR([PLEASE CORRECT THE CONFIGURE COMMAND LINE AND REBUILD])])
AS_IF([test "$opal_hwloc_external_support" != "yes"],
[AC_MSG_WARN([EXTERNAL PMIX SUPPORT REQUIRES USE OF EXTERNAL HWLOC])
AC_MSG_WARN([LIBRARY THIS LIBRARY MUST POINT TO THE SAME ONE USED ])
AC_MSG_WARN([TO BUILD PMIX OR ELSE UNPREDICTABLE BEHAVIOR MAY RESULT])
AC_MSG_ERROR([PLEASE CORRECT THE CONFIGURE COMMAND LINE AND REBUILD])])
external_WRAPPER_EXTRA_CPPFLAGS='-I${includedir}/openmpi/$opal_pmix_external_basedir/pmix -I${includedir}/openmpi/$opal_pmix_external_basedir/pmix/include'
# check for the 2.0 series by looking for a function
# that was added in that series
AC_MSG_CHECKING([if external component is series 2.0])
OPAL_CHECK_PACKAGE([opal_pmix_ext20],
[pmix.h],
[pmix],
[PMIx_Register_event_handler],
[-lpmix],
[$pmix_ext_install_dir],
[$pmix_ext_install_dir/lib],
[AC_MSG_RESULT([yes])
opal_pmix_ext20_happy=yes],
[AC_MSG_RESULT([no])
opal_pmix_ext20_happy=no])
# if we have 2.0, then check further to see if we have
# the PMIx_Query_info function as that is even newer
AS_IF([test "$opal_pmix_ext20_happy" = "yes"],
[AC_MSG_CHECKING([if external component is series 2.0])
OPAL_CHECK_PACKAGE([opal_pmix_ext20],
[pmix.h],
[pmix],
[PMIx_Query_info_nb],
[-lpmix],
[$pmix_ext_install_dir],
[$pmix_ext_install_dir/lib],
[AC_MSG_RESULT([yes])
opal_pmix_query_happy=1],
[AC_MSG_RESULT([no])
opal_pmix_query_happy=0])])
AC_DEFINE_UNQUOTED([HAVE_PMIX_QUERY_FUNCTION], [$opal_pmix_query_happy],
[Whether or not the external library has the PMIx_Query_info function])
AC_SUBST(opal_pmix_ext20_CPPFLAGS)
AC_SUBST(opal_pmix_ext20_LDFLAGS)
AC_SUBST(opal_pmix_ext20_LIBS)
AS_IF([test "$opal_pmix_ext20_happy" = "yes"],
[$1],
[$2])],
[$2])
])dnl

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

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

@ -1,323 +0,0 @@
/*
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_PMIX_PMIX2X_H
#define MCA_PMIX_PMIX2X_H
#include "opal_config.h"
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#include "opal/class/opal_list.h"
#include "opal/mca/mca.h"
#include "opal/mca/event/event.h"
#include "opal/util/proc.h"
#include "opal/mca/pmix/pmix.h"
#include "pmix_server.h"
#include "pmix_common.h"
BEGIN_C_DECLS
typedef struct {
opal_pmix_base_component_t super;
opal_list_t jobids;
bool native_launch;
size_t evindex;
opal_list_t single_events;
opal_list_t multi_events;
opal_list_t default_events;
int cache_size;
opal_list_t cache;
} mca_pmix_ext20_component_t;
OPAL_DECLSPEC extern mca_pmix_ext20_component_t mca_pmix_ext20_component;
OPAL_DECLSPEC extern const opal_pmix_base_module_t opal_pmix_ext20_module;
/**** INTERNAL OBJECTS ****/
typedef struct {
opal_list_item_t super;
opal_jobid_t jobid;
char nspace[PMIX_MAX_NSLEN + 1];
} opal_ext20_jobid_trkr_t;
OBJ_CLASS_DECLARATION(opal_ext20_jobid_trkr_t);
typedef struct {
opal_list_item_t super;
size_t index;
int code;
opal_pmix_notification_fn_t handler;
} opal_ext20_single_event_t;
OBJ_CLASS_DECLARATION(opal_ext20_single_event_t);
typedef struct {
opal_list_item_t super;
size_t index;
int *codes;
size_t ncodes;
opal_pmix_notification_fn_t handler;
} opal_ext20_multi_event_t;
OBJ_CLASS_DECLARATION(opal_ext20_multi_event_t);
typedef struct {
opal_list_item_t super;
size_t index;
opal_pmix_notification_fn_t handler;
} opal_ext20_default_event_t;
OBJ_CLASS_DECLARATION(opal_ext20_default_event_t);
typedef struct {
opal_list_item_t super;
int status;
bool nondefault;
opal_process_name_t source;
pmix_data_range_t range;
opal_list_t *info;
opal_list_t results;
opal_ext20_single_event_t *sing;
opal_ext20_multi_event_t *multi;
opal_ext20_default_event_t *def;
opal_pmix_op_cbfunc_t final_cbfunc;
void *final_cbdata;
} opal_ext20_event_chain_t;
OBJ_CLASS_DECLARATION(opal_ext20_event_chain_t);
typedef struct {
opal_object_t super;
pmix_status_t status;
pmix_proc_t p;
pmix_proc_t *procs;
size_t nprocs;
pmix_proc_t *error_procs;
size_t nerror_procs;
pmix_info_t *info;
size_t ninfo;
pmix_app_t *apps;
size_t sz;
volatile bool active;
opal_pmix_op_cbfunc_t opcbfunc;
opal_pmix_modex_cbfunc_t mdxcbfunc;
opal_pmix_value_cbfunc_t valcbfunc;
opal_pmix_lookup_cbfunc_t lkcbfunc;
opal_pmix_spawn_cbfunc_t spcbfunc;
void *cbdata;
} ext20_opcaddy_t;
OBJ_CLASS_DECLARATION(ext20_opcaddy_t);
typedef struct {
opal_object_t super;
opal_list_t procs;
opal_list_t info;
opal_list_t apps;
pmix_op_cbfunc_t opcbfunc;
pmix_dmodex_response_fn_t dmdxfunc;
pmix_modex_cbfunc_t mdxcbfunc;
pmix_lookup_cbfunc_t lkupcbfunc;
pmix_spawn_cbfunc_t spwncbfunc;
pmix_info_cbfunc_t infocbfunc;
pmix_tool_connection_cbfunc_t toolcbfunc;
void *cbdata;
opal_pmix_release_cbfunc_t odmdxfunc;
void *ocbdata;
} ext20_opalcaddy_t;
OBJ_CLASS_DECLARATION(ext20_opalcaddy_t);
typedef struct {
opal_object_t super;
opal_event_t ev;
volatile bool active;
size_t id;
int status;
opal_process_name_t pname;
opal_jobid_t jobid;
const opal_process_name_t *source;
opal_pmix_data_range_t range;
bool nondefault;
size_t handler;
opal_list_t *event_codes;
opal_list_t *info;
opal_pmix_notification_fn_t evhandler;
opal_pmix_evhandler_reg_cbfunc_t cbfunc;
opal_pmix_op_cbfunc_t opcbfunc;
void *cbdata;
} ext20_threadshift_t;
OBJ_CLASS_DECLARATION(ext20_threadshift_t);
#define OPAL_PMIX_OPCD_THREADSHIFT(i, s, sr, if, nif, fn, cb, cd) \
do { \
ext20_opalcaddy_t *_cd; \
_cd = OBJ_NEW(ext20_opalcaddy_t); \
_cd->id = (i); \
_cd->status = (s); \
_cd->source = (sr); \
_cd->info = (i); \
_cd->evcbfunc = (cb); \
_cd->cbdata = (cd); \
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
-1, EV_WRITE, (fn), (_cd)); \
event_active(&((_cd)->ev), EV_WRITE, 1); \
} while(0)
#define OPAL_PMIX_OP_THREADSHIFT(e, fn, cb, cd) \
do { \
ext20_threadshift_t *_cd; \
_cd = OBJ_NEW(ext20_threadshift_t); \
_cd->handler = (e); \
_cd->opcbfunc = (cb); \
_cd->cbdata = (cd); \
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
-1, EV_WRITE, (fn), (_cd)); \
event_active(&((_cd)->ev), EV_WRITE, 1); \
} while(0)
#define OPAL_PMIX_THREADSHIFT(e, i, eh, fn, cb, cd) \
do { \
ext20_threadshift_t *_cd; \
_cd = OBJ_NEW(ext20_threadshift_t); \
_cd->event_codes = (e); \
_cd->info = (i); \
_cd->evhandler = (eh); \
_cd->cbfunc = (cb); \
_cd->cbdata = (cd); \
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
-1, EV_WRITE, (fn), (_cd)); \
event_active(&((_cd)->ev), EV_WRITE, 1); \
} while(0)
#define OPAL_PMIX_NOTIFY_THREADSHIFT(s, sr, r, i, fn, cb, cd) \
do { \
ext20_threadshift_t *_cd; \
_cd = OBJ_NEW(ext20_threadshift_t); \
_cd->status = (s); \
_cd->source = (sr); \
_cd->range = (r); \
_cd->info = (i); \
_cd->opcbfunc = (cb); \
_cd->cbdata = (cd); \
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
-1, EV_WRITE, (fn), (_cd)); \
event_active(&((_cd)->ev), EV_WRITE, 1); \
} while(0)
/**** CLIENT FUNCTIONS ****/
OPAL_MODULE_DECLSPEC int ext20_client_init(void);
OPAL_MODULE_DECLSPEC int ext20_client_finalize(void);
OPAL_MODULE_DECLSPEC int ext20_initialized(void);
OPAL_MODULE_DECLSPEC int ext20_abort(int flag, const char *msg,
opal_list_t *procs);
OPAL_MODULE_DECLSPEC int ext20_commit(void);
OPAL_MODULE_DECLSPEC int ext20_fence(opal_list_t *procs, int collect_data);
OPAL_MODULE_DECLSPEC int ext20_fencenb(opal_list_t *procs, int collect_data,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_put(opal_pmix_scope_t scope,
opal_value_t *val);
OPAL_MODULE_DECLSPEC int ext20_get(const opal_process_name_t *proc, const char *key,
opal_list_t *info, opal_value_t **val);
OPAL_MODULE_DECLSPEC int ext20_getnb(const opal_process_name_t *proc, const char *key,
opal_list_t *info,
opal_pmix_value_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_publish(opal_list_t *info);
OPAL_MODULE_DECLSPEC int ext20_publishnb(opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_lookup(opal_list_t *data, opal_list_t *info);
OPAL_MODULE_DECLSPEC int ext20_lookupnb(char **keys, opal_list_t *info,
opal_pmix_lookup_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_unpublish(char **keys, opal_list_t *info);
OPAL_MODULE_DECLSPEC int ext20_unpublishnb(char **keys, opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid);
OPAL_MODULE_DECLSPEC int ext20_spawnnb(opal_list_t *job_info, opal_list_t *apps,
opal_pmix_spawn_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_connect(opal_list_t *procs);
OPAL_MODULE_DECLSPEC int ext20_connectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_disconnect(opal_list_t *procs);
OPAL_MODULE_DECLSPEC int ext20_disconnectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_resolve_peers(const char *nodename, opal_jobid_t jobid,
opal_list_t *procs);
OPAL_MODULE_DECLSPEC int ext20_resolve_nodes(opal_jobid_t jobid, char **nodelist);
/**** COMMON FUNCTIONS ****/
OPAL_MODULE_DECLSPEC int ext20_store_local(const opal_process_name_t *proc,
opal_value_t *val);
/**** SERVER SOUTHBOUND FUNCTIONS ****/
OPAL_MODULE_DECLSPEC int ext20_server_init(opal_pmix_server_module_t *module,
opal_list_t *info);
OPAL_MODULE_DECLSPEC int ext20_server_finalize(void);
OPAL_MODULE_DECLSPEC int ext20_server_gen_regex(const char *input, char **regex);
OPAL_MODULE_DECLSPEC int ext20_server_gen_ppn(const char *input, char **ppn);
OPAL_MODULE_DECLSPEC int ext20_server_register_nspace(opal_jobid_t jobid,
int nlocalprocs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC void ext20_server_deregister_nspace(opal_jobid_t jobid,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_server_register_client(const opal_process_name_t *proc,
uid_t uid, gid_t gid,
void *server_object,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC void ext20_server_deregister_client(const opal_process_name_t *proc,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_server_setup_fork(const opal_process_name_t *proc, char ***env);
OPAL_MODULE_DECLSPEC int ext20_server_dmodex(const opal_process_name_t *proc,
opal_pmix_modex_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int ext20_server_notify_event(int status,
const opal_process_name_t *source,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
/**** COMPONENT UTILITY FUNCTIONS ****/
OPAL_MODULE_DECLSPEC void ext20_event_hdlr(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);
OPAL_MODULE_DECLSPEC pmix_status_t ext20_convert_opalrc(int rc);
OPAL_MODULE_DECLSPEC int ext20_convert_rc(pmix_status_t rc);
OPAL_MODULE_DECLSPEC opal_vpid_t ext20_convert_rank(int rank);
OPAL_MODULE_DECLSPEC pmix_rank_t ext20_convert_opalrank(opal_vpid_t vpid);
OPAL_MODULE_DECLSPEC opal_pmix_scope_t ext20_convert_scope(pmix_scope_t scope);
OPAL_MODULE_DECLSPEC pmix_scope_t ext20_convert_opalscope(opal_pmix_scope_t scope);
OPAL_MODULE_DECLSPEC pmix_data_range_t ext20_convert_opalrange(opal_pmix_data_range_t range);
OPAL_MODULE_DECLSPEC opal_pmix_data_range_t ext20_convert_range(pmix_data_range_t range);
OPAL_MODULE_DECLSPEC opal_pmix_persistence_t ext20_convert_persist(pmix_persistence_t scope);
OPAL_MODULE_DECLSPEC pmix_persistence_t ext20_convert_opalpersist(opal_pmix_persistence_t scope);
OPAL_MODULE_DECLSPEC void ext20_value_load(pmix_value_t *v,
opal_value_t *kv);
OPAL_MODULE_DECLSPEC int ext20_value_unload(opal_value_t *kv,
const pmix_value_t *v);
END_C_DECLS
#endif /* MCA_PMIX_EXTERNAL_H */

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

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

@ -1,131 +0,0 @@
/*
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Cisco Systems, 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 "opal_config.h"
#include "opal/constants.h"
#include "opal/class/opal_list.h"
#include "opal/util/proc.h"
#include "opal/mca/pmix/pmix.h"
#include "pmix_ext20.h"
/*
* Public string showing the pmix external component version number
*/
const char *opal_pmix_ext20_component_version_string =
"OPAL external pmix2.0 MCA component version " OPAL_VERSION;
/*
* Local function
*/
static int external_open(void);
static int external_close(void);
static int external_component_query(mca_base_module_t **module, int *priority);
static int external_register(void);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
mca_pmix_ext20_component_t mca_pmix_ext20_component = {
{
/* First, the mca_component_t struct containing meta information
about the component itself */
.base_version = {
/* Indicate that we are a pmix v1.1.0 component (which also
implies a specific MCA version) */
OPAL_PMIX_BASE_VERSION_2_0_0,
/* Component name and version */
.mca_component_name = "ext20",
MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION),
/* Component open and close functions */
.mca_open_component = external_open,
.mca_close_component = external_close,
.mca_query_component = external_component_query,
.mca_register_component_params = external_register,
},
/* Next the MCA v1.0.0 component meta data */
.base_data = {
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
},
.native_launch = false
};
static int external_register(void)
{
mca_pmix_ext20_component.cache_size = 256;
mca_base_component_var_register(&mca_pmix_ext20_component.super.base_version,
"cache_size", "Size of the ring buffer cache for events",
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_5,
MCA_BASE_VAR_SCOPE_CONSTANT,
&mca_pmix_ext20_component.cache_size);
return OPAL_SUCCESS;
}
static int external_open(void)
{
mca_pmix_ext20_component.evindex = 0;
OBJ_CONSTRUCT(&mca_pmix_ext20_component.jobids, opal_list_t);
OBJ_CONSTRUCT(&mca_pmix_ext20_component.single_events, opal_list_t);
OBJ_CONSTRUCT(&mca_pmix_ext20_component.multi_events, opal_list_t);
OBJ_CONSTRUCT(&mca_pmix_ext20_component.default_events, opal_list_t);
OBJ_CONSTRUCT(&mca_pmix_ext20_component.cache, opal_list_t);
return OPAL_SUCCESS;
}
static int external_close(void)
{
OPAL_LIST_DESTRUCT(&mca_pmix_ext20_component.jobids);
OPAL_LIST_DESTRUCT(&mca_pmix_ext20_component.single_events);
OPAL_LIST_DESTRUCT(&mca_pmix_ext20_component.multi_events);
OPAL_LIST_DESTRUCT(&mca_pmix_ext20_component.default_events);
OPAL_LIST_DESTRUCT(&mca_pmix_ext20_component.cache);
return OPAL_SUCCESS;
}
static int external_component_query(mca_base_module_t **module, int *priority)
{
char *t, *id;
/* see if a PMIx server is present */
if (NULL != (t = getenv("PMIX_SERVER_URI")) ||
NULL != (id = getenv("PMIX_ID"))) {
/* if PMIx is present, then we are a client and need to use it */
*priority = 100;
} else {
/* we could be a server, so we still need to be considered */
*priority = 5;
}
*module = (mca_base_module_t *)&opal_pmix_ext20_module;
return OPAL_SUCCESS;
}

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

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

@ -1,518 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/types.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "opal/dss/dss.h"
#include "opal/mca/event/event.h"
#include "opal/mca/hwloc/base/base.h"
#include "opal/runtime/opal.h"
#include "opal/runtime/opal_progress_threads.h"
#include "opal/util/argv.h"
#include "opal/util/error.h"
#include "opal/util/output.h"
#include "opal/util/proc.h"
#include "opal/util/show_help.h"
#include "opal/mca/pmix/base/base.h"
#include "pmix_ext20.h"
#include "pmix.h"
#include "pmix_server.h"
/**** S.O.U.T.H.B.O.U.N.D I.N.T.E.R.F.A.C.E.S ****/
/* These are the interfaces used by the OMPI/ORTE/OPAL layer to call
* down into the embedded PMIx server. */
extern pmix_server_module_t mymodule;
extern opal_pmix_server_module_t *host_module;
static char *dbgvalue=NULL;
static size_t errhdler_ref = 0;
#define PMIX_WAIT_FOR_COMPLETION(a) \
do { \
while ((a)) { \
usleep(10); \
} \
} while (0)
static void errreg_cbfunc (pmix_status_t status,
size_t errhandler_ref,
void *cbdata)
{
volatile bool *active = (volatile bool*)cbdata;
errhdler_ref = errhandler_ref;
opal_output_verbose(5, opal_pmix_base_framework.framework_output,
"PMIX server errreg_cbfunc - error handler registered status=%d, reference=%lu",
status, (unsigned long)errhandler_ref);
*active = false;
}
int ext20_server_init(opal_pmix_server_module_t *module,
opal_list_t *info)
{
pmix_status_t rc;
int dbg;
opal_value_t *kv;
pmix_info_t *pinfo;
size_t sz, n;
volatile bool active;
opal_ext20_jobid_trkr_t *job;
if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) {
asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg);
putenv(dbgvalue);
}
/* convert the list to an array of pmix_info_t */
if (NULL != info) {
sz = opal_list_get_size(info);
PMIX_INFO_CREATE(pinfo, sz);
n = 0;
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
ext20_value_load(&pinfo[n].value, kv);
++n;
}
} else {
sz = 0;
pinfo = NULL;
}
/* insert ourselves into our list of jobids - it will be the
* first, and so we'll check it first */
job = OBJ_NEW(opal_ext20_jobid_trkr_t);
(void)opal_snprintf_jobid(job->nspace, PMIX_MAX_NSLEN, OPAL_PROC_MY_NAME.jobid);
job->jobid = OPAL_PROC_MY_NAME.jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, pinfo, sz))) {
PMIX_INFO_FREE(pinfo, sz);
return ext20_convert_rc(rc);
}
PMIX_INFO_FREE(pinfo, sz);
/* record the host module */
host_module = module;
/* register the default event handler */
active = true;
PMIx_Register_event_handler(NULL, 0, NULL, 0, ext20_event_hdlr, errreg_cbfunc, (void*)&active);
PMIX_WAIT_FOR_COMPLETION(active);
return OPAL_SUCCESS;
}
static void fincb(pmix_status_t status, void *cbdata)
{
volatile bool *active = (volatile bool*)cbdata;
*active = false;
}
int ext20_server_finalize(void)
{
pmix_status_t rc;
volatile bool active;
/* deregister the default event handler */
active = true;
PMIx_Deregister_event_handler(errhdler_ref, fincb, (void*)&active);
PMIX_WAIT_FOR_COMPLETION(active);
rc = PMIx_server_finalize();
return ext20_convert_rc(rc);
}
int ext20_server_gen_regex(const char *input, char **regex)
{
pmix_status_t rc;
rc = PMIx_generate_regex(input, regex);
return ext20_convert_rc(rc);
}
int ext20_server_gen_ppn(const char *input, char **ppn)
{
pmix_status_t rc;
rc = PMIx_generate_ppn(input, ppn);
return ext20_convert_rc(rc);
}
static void opcbfunc(pmix_status_t status, void *cbdata)
{
ext20_opcaddy_t *op = (ext20_opcaddy_t*)cbdata;
if (NULL != op->opcbfunc) {
op->opcbfunc(ext20_convert_rc(status), op->cbdata);
}
if (op->active) {
op->status = status;
op->active = false;
} else {
OBJ_RELEASE(op);
}
}
static void _reg_nspace(int sd, short args, void *cbdata)
{
ext20_threadshift_t *cd = (ext20_threadshift_t*)cbdata;
opal_value_t *kv, *k2;
pmix_info_t *pinfo = NULL, *pmap;
size_t sz, szmap, m, n;
char nspace[PMIX_MAX_NSLEN];
pmix_status_t rc;
opal_list_t *pmapinfo;
opal_ext20_jobid_trkr_t *job;
ext20_opcaddy_t op;
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
/* convert the jobid */
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, cd->jobid);
/* store this job in our list of known nspaces */
job = OBJ_NEW(opal_ext20_jobid_trkr_t);
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
job->jobid = cd->jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
/* convert the list to an array of pmix_info_t */
if (NULL != cd->info) {
sz = opal_list_get_size(cd->info);
PMIX_INFO_CREATE(pinfo, sz);
n = 0;
OPAL_LIST_FOREACH(kv, cd->info, opal_value_t) {
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
if (0 == strcmp(kv->key, OPAL_PMIX_PROC_DATA)) {
pinfo[n].value.type = PMIX_DATA_ARRAY;
/* the value contains a list of values - convert
* that list to another array */
pmapinfo = (opal_list_t*)kv->data.ptr;
szmap = opal_list_get_size(pmapinfo);
PMIX_INFO_CREATE(pmap, szmap);
pinfo[n].value.data.darray.type = PMIX_INFO;
pinfo[n].value.data.darray.array = (struct pmix_info_t*)pmap;
pinfo[n].value.data.darray.size = szmap;
m = 0;
OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) {
(void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN);
ext20_value_load(&pmap[m].value, k2);
++m;
}
} else {
ext20_value_load(&pinfo[n].value, kv);
}
++n;
}
} else {
sz = 0;
pinfo = NULL;
}
OBJ_CONSTRUCT(&op, ext20_opcaddy_t);
op.active = true;
rc = PMIx_server_register_nspace(nspace, cd->status, pinfo, sz,
opcbfunc, (void*)&op);
if (PMIX_SUCCESS == rc) {
PMIX_WAIT_FOR_COMPLETION(op.active);
} else {
op.status = rc;
}
/* ensure we execute the cbfunc so the caller doesn't hang */
if (NULL != cd->opcbfunc) {
cd->opcbfunc(ext20_convert_rc(op.status), cd->cbdata);
}
if (NULL != pinfo) {
PMIX_INFO_FREE(pinfo, sz);
}
OBJ_DESTRUCT(&op);
OBJ_RELEASE(cd);
}
int ext20_server_register_nspace(opal_jobid_t jobid,
int nlocalprocs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
ext20_threadshift_t *cd;
/* we must threadshift this request as it touches
* shared lists of objects */
cd = OBJ_NEW(ext20_threadshift_t);
cd->jobid = jobid;
cd->status = nlocalprocs;
cd->info = info;
cd->opcbfunc = cbfunc;
cd->cbdata = cbdata;
/* if the cbfunc is NULL, then the caller is in an event
* and we can directly call the processing function */
if (NULL == cbfunc) {
_reg_nspace(0, 0, cd);
} else {
event_assign(&cd->ev, opal_pmix_base.evbase,
-1, EV_WRITE, _reg_nspace, cd);
event_active(&cd->ev, EV_WRITE, 1);
}
return OPAL_SUCCESS;
}
static void tdcbfunc(pmix_status_t status, void *cbdata)
{
ext20_threadshift_t *cd = (ext20_threadshift_t*)cbdata;
if (NULL != cd->opcbfunc) {
cd->opcbfunc(ext20_convert_rc(status), cd->cbdata);
}
if (cd->active) {
cd->active = false;
} else {
OBJ_RELEASE(cd);
}
}
static void _dereg_nspace(int sd, short args, void *cbdata)
{
ext20_threadshift_t *cd = (ext20_threadshift_t*)cbdata;
opal_ext20_jobid_trkr_t *jptr;
/* if we don't already have it, we can ignore this */
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (jptr->jobid == cd->jobid) {
/* found it - tell the server to deregister */
cd->active = true;
PMIx_server_deregister_nspace(jptr->nspace, tdcbfunc, cd);
PMIX_WAIT_FOR_COMPLETION(cd->active);
OBJ_RELEASE(cd);
/* now get rid of it from our list */
opal_list_remove_item(&mca_pmix_ext20_component.jobids, &jptr->super);
OBJ_RELEASE(jptr);
return;
}
}
/* must release the caller */
tdcbfunc(PMIX_ERR_NOT_FOUND, cd);
}
void ext20_server_deregister_nspace(opal_jobid_t jobid,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
ext20_threadshift_t *cd;
/* we must threadshift this request as it touches
* shared lists of objects */
cd = OBJ_NEW(ext20_threadshift_t);
cd->jobid = jobid;
cd->opcbfunc = cbfunc;
cd->cbdata = cbdata;
if (NULL == cbfunc) {
_dereg_nspace(0, 0, cd);
} else {
event_assign(&cd->ev, opal_pmix_base.evbase,
-1, EV_WRITE, _dereg_nspace, cd);
event_active(&cd->ev, EV_WRITE, 1);
}
}
int ext20_server_register_client(const opal_process_name_t *proc,
uid_t uid, gid_t gid,
void *server_object,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
pmix_status_t rc;
pmix_proc_t p;
ext20_opcaddy_t op;
/* convert the jobid */
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
p.rank = ext20_convert_opalrank(proc->vpid);
OBJ_CONSTRUCT(&op, ext20_opcaddy_t);
op.active = true;
rc = PMIx_server_register_client(&p, uid, gid, server_object,
opcbfunc, (void*)&op);
if (PMIX_SUCCESS == rc) {
PMIX_WAIT_FOR_COMPLETION(op.active);
rc = op.status;
}
OBJ_DESTRUCT(&op);
return ext20_convert_rc(rc);
}
static void _dereg_client(int sd, short args, void *cbdata)
{
ext20_threadshift_t *cd = (ext20_threadshift_t*)cbdata;
opal_ext20_jobid_trkr_t *jptr;
pmix_proc_t p;
/* if we don't already have it, we can ignore this */
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (jptr->jobid == cd->source->jobid) {
/* found it - tell the server to deregister */
(void)strncpy(p.nspace, jptr->nspace, PMIX_MAX_NSLEN);
p.rank = ext20_convert_opalrank(cd->source->vpid);
cd->active = true;
PMIx_server_deregister_client(&p, tdcbfunc, (void*)cd);
PMIX_WAIT_FOR_COMPLETION(cd->active);
break;
}
}
OBJ_RELEASE(cd);
}
/* tell the local PMIx server to cleanup this client as it is
* done executing */
void ext20_server_deregister_client(const opal_process_name_t *proc,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
ext20_threadshift_t *cd;
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
cd = OBJ_NEW(ext20_threadshift_t);
cd->source = proc;
cd->opcbfunc = cbfunc;
cd->cbdata = cbdata;
if (NULL == cbfunc) {
_dereg_client(0, 0, cd);
} else {
event_assign(&cd->ev, opal_pmix_base.evbase,
-1, EV_WRITE, _dereg_client, cd);
event_active(&cd->ev, EV_WRITE, 1);
}
}
/* have the local PMIx server setup the environment for this client */
int ext20_server_setup_fork(const opal_process_name_t *proc, char ***env)
{
pmix_status_t rc;
pmix_proc_t p;
/* convert the jobid */
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
p.rank = ext20_convert_opalrank(proc->vpid);
rc = PMIx_server_setup_fork(&p, env);
return ext20_convert_rc(rc);
}
/* this is the call back up from the embedded PMIx server that
* will contain the returned data. Note that the embedded server
* "owns" the data and will free it upon return from this function */
static void dmdx_response(pmix_status_t status, char *data, size_t sz, void *cbdata)
{
int rc;
ext20_opcaddy_t *op = (ext20_opcaddy_t*)cbdata;
rc = ext20_convert_rc(status);
if (NULL != op->mdxcbfunc) {
op->mdxcbfunc(rc, data, sz, op->cbdata, NULL, NULL);
}
OBJ_RELEASE(op);
}
/* request modex data for a local proc from the PMIx server */
int ext20_server_dmodex(const opal_process_name_t *proc,
opal_pmix_modex_cbfunc_t cbfunc, void *cbdata)
{
ext20_opcaddy_t *op;
pmix_status_t rc;
/* setup the caddy */
op = OBJ_NEW(ext20_opcaddy_t);
op->mdxcbfunc = cbfunc;
op->cbdata = cbdata;
/* convert the jobid */
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
op->p.rank = ext20_convert_opalrank(proc->vpid);
/* find the internally-cached data for this proc */
rc = PMIx_server_dmodex_request(&op->p, dmdx_response, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
}
return ext20_convert_rc(rc);
}
/* tell the PMIx server to notify its local clients of an event */
int ext20_server_notify_event(int status,
const opal_process_name_t *source,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{
opal_value_t *kv;
pmix_info_t *pinfo;
size_t sz, n;
pmix_status_t rc;
ext20_opcaddy_t *op;
/* convert the list to an array of pmix_info_t */
if (NULL != info) {
sz = opal_list_get_size(info);
PMIX_INFO_CREATE(pinfo, sz);
n = 0;
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
ext20_value_load(&pinfo[n].value, kv);
}
} else {
sz = 0;
pinfo = NULL;
}
/* setup the caddy */
op = OBJ_NEW(ext20_opcaddy_t);
op->info = pinfo;
op->sz = sz;
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
/* convert the jobid */
if (NULL == source) {
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, OPAL_JOBID_INVALID);
op->p.rank = ext20_convert_opalrank(OPAL_VPID_INVALID);
} else {
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, source->jobid);
op->p.rank = ext20_convert_opalrank(source->vpid);
}
rc = ext20_convert_opalrc(status);
/* the range is irrelevant here as the server is passing
* the event down to its local clients */
rc = PMIx_Notify_event(rc, &op->p, PMIX_RANGE_LOCAL,
pinfo, sz, opcbfunc, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
}
return ext20_convert_rc(rc);
}

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

@ -42,12 +42,12 @@ mca_pmix_pmix2x_la_CPPFLAGS = \
-I$(srcdir)/pmix/include $(opal_pmix_pmix2x_CPPFLAGS)
mca_pmix_pmix2x_la_LDFLAGS = -module -avoid-version $(opal_pmix_pmix2x_LDFLAGS)
mca_pmix_pmix2x_la_LIBADD = $(opal_pmix_pmix2x_LIBS)
mca_pmix_pmix2x_la_DEPENDENCIES = $(mca_pmix_pmix2x_la_LIBADD)
mca_pmix_pmix2x_la_DEPENDENCIES = $(opal_pmix_pmix2x_DEPENDENCIES)
noinst_LTLIBRARIES = $(component_noinst)
libmca_pmix_pmix2x_la_SOURCES =$(sources)
libmca_pmix_pmix2x_la_CFLAGS = $(opal_pmix_pmix2x_CFLAGS)
libmca_pmix_pmix2x_la_CPPFLAGS = -I$(srcdir)/pmix/include $(opal_pmix_pmix2x_CPPFLAGS)
libmca_pmix_pmix2x_la_CPPFLAGS = $(opal_pmix_pmix2x_CPPFLAGS)
libmca_pmix_pmix2x_la_LDFLAGS = -module -avoid-version $(opal_pmix_pmix2x_LDFLAGS)
libmca_pmix_pmix2x_la_LIBADD = $(opal_pmix_pmix2x_LIBS)
libmca_pmix_pmix2x_la_DEPENDENCIES = $(mca_pmix_pmix2x_la_LIBADD)
libmca_pmix_pmix2x_la_DEPENDENCIES = $(opal_pmix_pmix2x_DEPENDENCIES)

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

@ -28,6 +28,8 @@
AC_DEFUN([MCA_opal_pmix_pmix2x_CONFIG],[
AC_CONFIG_FILES([opal/mca/pmix/pmix2x/Makefile])
AC_REQUIRE([OPAL_CHECK_PMIX])
OPAL_VAR_SCOPE_PUSH([PMIX_VERSION opal_pmix_pmix2x_save_CPPFLAGS opal_pmix_pmix2x_save_LDFLAGS opal_pmix_pmix2x_save_LIBS opal_pmix_pmix2x_basedir opal_pmix_pmix2x_save_cflags])
PMIX_VERSION=
@ -52,28 +54,44 @@ AC_DEFUN([MCA_opal_pmix_pmix2x_CONFIG],[
[$opal_pmix_pmix2x_args $opal_subdir_args 'CFLAGS=$CFLAGS' 'CPPFLAGS=$CPPFLAGS'],
[opal_pmix_pmix2x_happy=1], [opal_pmix_pmix2x_happy=0])
AS_IF([test $opal_pmix_pmix2x_happy -eq 1],
[PMIX_VERSION="internal v`$srcdir/$opal_pmix_pmix2x_basedir/pmix/config/pmix_get_version.sh $srcdir/$opal_pmix_pmix2x_basedir/pmix/VERSION`"
# Build flags for our Makefile.am
opal_pmix_pmix2x_LIBS='$(OPAL_TOP_BUILDDIR)/'"$opal_pmix_pmix2x_basedir"'/pmix/src/libpmix.la'
opal_pmix_pmix2x_CPPFLAGS='-I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix2x/pmix/include/pmix -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix2x/pmix/include -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix2x/pmix -I$(OPAL_TOP_SRCDIR)/opal/mca/pmix/pmix2x/pmix'
AC_SUBST([opal_pmix_pmix2x_LIBS])
AC_SUBST([opal_pmix_pmix2x_CPPFLAGS])])
CFLAGS=$opal_pmix_pmix2x_save_CFLAGS
CPPFLAGS=$opal_pmix_pmix2x_save_CPPFLAGS
LDFLAGS=$opal_pmix_pmix2x_save_LDFLAGS
LIBS=$opal_pmix_pmix2x_save_LIBS
# If we are not building the internal pmix, then indicate that
# this component should not be built. NOTE: we still did all the
# If we are not building the internal pmix, then check to see
# if we are linking to an external v2.x library. If not, then
# do not use this component. NOTE: we still did all the
# above configury so that all the proper GNU Autotools
# infrastructure is setup properly (e.g., w.r.t. SUBDIRS=pmix in
# this directory's Makefile.am, we still need the Autotools "make
# distclean" infrastructure to work properly).
AC_MSG_CHECKING([if v2.x component is to be used])
AS_IF([test "$opal_external_pmix_happy" = "yes"],
[AC_MSG_WARN([using an external pmix; disqualifying this component])
opal_pmix_pmix2x_happy=0])
[AS_IF([test "$opal_external_pmix_version" = "2"],
[AC_MSG_RESULT([yes - using an external v2.x library])
# Build flags for our Makefile.am
opal_pmix_pmix2x_CPPFLAGS=$opal_external_pmix_CPPFLAGS
opal_pmix_pmix2x_LDFLAGS=$opal_external_pmix_LDFLAGS
opal_pmix_pmix2x_LIBS=$opal_external_pmix_LIBS
opal_pmix_pmix2x_DEPENDENCIES=
# setup wrapper flags
pmix_pmix2x_WRAPPER_EXTRA_LDFLAGS=$opal_external_pmix_LDFLAGS
pmix_pmix2x_WRAPPER_EXTRA_LIBS=$opal_external_pmix_LIBS],
[AC_MSG_RESULT([no - using an external v1.x pmix; disqualifying this component])
opal_pmix_pmix2x_happy=0])],
[AC_MSG_RESULT([yes - using the internal v2.x library])
PMIX_VERSION="internal v`$srcdir/$opal_pmix_pmix2x_basedir/pmix/config/pmix_get_version.sh $srcdir/$opal_pmix_pmix2x_basedir/pmix/VERSION`"
# Build flags for our Makefile.am
opal_pmix_pmix2x_LDFLAGS=
opal_pmix_pmix2x_LIBS='$(OPAL_TOP_BUILDDIR)/'"$opal_pmix_pmix2x_basedir"'/pmix/src/libpmix.la'
opal_pmix_pmix2x_CPPFLAGS='-I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix2x/pmix/include -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix2x/pmix -I$(OPAL_TOP_SRCDIR)/opal/mca/pmix/pmix2x/pmix/include -I$(OPAL_TOP_SRCDIR)/opal/mca/pmix/pmix2x/pmix'
opal_pmix_pmix2x_DEPENDENCIES='$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix2x/pmix/src/libpmix.la'])
AC_SUBST([opal_pmix_pmix2x_LIBS])
AC_SUBST([opal_pmix_pmix2x_CPPFLAGS])
AC_SUBST([opal_pmix_pmix2x_LDFLAGS])
AC_SUBST([opal_pmix_pmix2x_DEPENDENCIES])
AS_IF([test $opal_pmix_pmix2x_happy -eq 1],
[$1],