1
1

Merge pull request #6822 from ggouaillardet/topic/pmix_refresh

pmix/pmix4x: refresh to the latest PMIx master
Этот коммит содержится в:
Gilles Gouaillardet 2019-07-16 12:56:31 +09:00 коммит произвёл GitHub
родитель 0df0e5c364 4510711e95
Коммит 06c6325bc8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
53 изменённых файлов: 2219 добавлений и 664 удалений

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

@ -76,6 +76,45 @@ Master (not on release branches yet)
- Fix a bug when registering default event handlers
3.1.0 -- 17 Jan 2019
----------------------
**** THIS RELEASE MARKS THE STARTING POINT FOR FULL COMPLIANCE
**** WITH THE PMIX v3 STANDARD. ALL API BEHAVIORS AND ATTRIBUTE
**** DEFINITIONS MEET THE v3 STANDARD SPECIFICATIONS.
- Add a new, faster dstore GDS component 'ds21'
- Performance optimizations for the dstore GDS components.
- Plug miscellaneous memory leaks
- Silence an unnecessary warning message when checking connection
to a non-supporting server
- Ensure lost-connection events get delivered to default event
handlers
- Correctly handle cache refresh for queries
- Protect against race conditions between host and internal library
when dealing with async requests
- Cleanup tool operations and add support for connections to
remote servers. Initial support for debugger direct/indirect
launch verified with PRRTE. Cleanup setting of tmpdir options.
Drop rendezvous files when acting as a launcher
- Automatically store the server URI for easy access by client
- Provide MCA parameter to control TCP connect retry/timeout
- Update event notification system to properly evict oldest events
when more space is needed
- Fix a number of error paths
- Update IOF cache code to properly drop oldest message. Provide
MCA parameter for setting cache size.
- Handle setsockopt(SO_RCVTIMEO) not being supported
- Ensure that epilogs get run even when connections unexpectedly
terminate. Properly split epilog strings to process multiple
paths
- Pass the tool's command line to the server so it can be returned
in queries
- Add support for C11 atomics
- Support collection and forwarding of fabric-specific envars
- Improve handling of hwloc configure option
- Fix PMIx_server_generate_regex to preserve node ordering
- Fix a bug when registering default event handlers
3.0.2 -- 18 Sept 2018
----------------------
- Ensure we cleanup any active sensors when a peer departs. Allow the

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

@ -30,7 +30,7 @@ greek=a1
# command, or with the date (if "git describe" fails) in the form of
# "date<date>".
repo_rev=git99971222
repo_rev=git03a8b5da
# If tarball_version is not empty, it is used as the version string in
# the tarball filename, regardless of all other versions listed in
@ -44,7 +44,7 @@ tarball_version=
# The date when this release was created
date="Jun 27, 2019"
date="Jul 16, 2019"
# The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library

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

@ -191,7 +191,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[
[Link the output PMIx library to this extra lib (used in embedded mode)]))
AC_MSG_CHECKING([for extra lib])
AS_IF([test ! -z "$with_pmix_extra_lib"],
[AS_IF([test "$with_pmix_extra_lib" == "yes" || test "$with_pmix_extra_lib" == "no"],
[AS_IF([test "$with_pmix_extra_lib" = "yes" || test "$with_pmix_extra_lib" = "no"],
[AC_MSG_RESULT([ERROR])
AC_MSG_WARN([Invalid value for --with-extra-pmix-lib:])
AC_MSG_WARN([ $with_pmix_extra_lib])
@ -209,7 +209,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[
[Link any embedded components/tools that require it to the provided libtool lib (used in embedded mode)]))
AC_MSG_CHECKING([for extra ltlib])
AS_IF([test ! -z "$with_pmix_extra_ltlib"],
[AS_IF([test "$with_pmix_extra_ltlib" == "yes" || test "$with_pmix_extra_ltlib" == "no"],
[AS_IF([test "$with_pmix_extra_ltlib" = "yes" || test "$with_pmix_extra_ltlib" = "no"],
[AC_MSG_RESULT([ERROR])
AC_MSG_WARN([Invalid value for --with-pmix-extra-ltlib:])
AC_MSG_WARN([ $with_pmix_extra_ltlib])
@ -664,7 +664,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[
# -lrt might be needed for clock_gettime
PMIX_SEARCH_LIBS_CORE([clock_gettime], [rt])
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strsignal socketpair strncpy_s usleep statfs statvfs getpeereid getpeerucred strnlen posix_fallocate tcgetpgrp setpgid ptsname openpty])
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strsignal socketpair strncpy_s usleep statfs statvfs getpeereid getpeerucred strnlen posix_fallocate tcgetpgrp setpgid ptsname openpty setenv])
# On some hosts, htonl is a define, so the AC_CHECK_FUNC will get
# confused. On others, it's in the standard library, but stubbed with
@ -1245,7 +1245,7 @@ AC_MSG_CHECKING([if want to support dlopen of non-global namespaces])
AC_ARG_ENABLE([nonglobal-dlopen],
AC_HELP_STRING([--enable-nonglobal-dlopen],
[enable non-global dlopen (default: enabled)]))
if test "$enable_nonglobal_dlopen" == "no"; then
if test "$enable_nonglobal_dlopen" = "no"; then
AC_MSG_RESULT([no])
pmix_need_libpmix=0
else

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

@ -63,7 +63,7 @@ AC_DEFUN([_PMIX_HWLOC_EXTERNAL],[
if test "$with_hwloc" != "no"; then
AC_MSG_CHECKING([for hwloc in])
if test ! -z "$with_hwloc" && test "$with_hwloc" != "yes"; then
pmix_hwloc_dir=$with_hwloc
pmix_hwloc_dir=$with_hwloc/include
pmix_hwloc_standard_header_location=no
pmix_hwloc_standard_lib_location=no
AS_IF([test -z "$with_hwloc_libdir" || test "$with_hwloc_libdir" = "yes"],

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

@ -171,7 +171,7 @@ LT_PREREQ([2.2.6])
pmix_enable_shared="$enable_shared"
pmix_enable_static="$enable_static"
AS_IF([test ! -z "$enable_static" && test "$enable_static" == "yes"],
AS_IF([test ! -z "$enable_static" && test "$enable_static" = "yes"],
[CFLAGS="$CFLAGS -fPIC"])
AM_ENABLE_SHARED
@ -201,7 +201,6 @@ AS_IF([test "$pmix_debug" = "1"],
LT_INIT()
LT_LANG([C])
LT_LANG([C++])
############################################################################
# Setup the core

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

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2015 Intel, Inc. All rights reserved.
# Copyright (c) 2015-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Los Alamos National Security, LLC. All rights
# reserved
# Copyright (c) 2015 Cisco Systems, Inc.
@ -18,7 +18,7 @@ for file in $(git ls-files) ; do
# skip sym links, pdfs, etc. If any other file types should be
# skipped add the check here.
type=$(file -b --mime-type -h $file)
if test ${type::4} == "text" ; then
if test ${type::4} = "text" ; then
# Eliminate whitespace at the end of lines
perl -pi -e 's/\s*$/\n/' $file
fi

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

@ -268,14 +268,19 @@ typedef uint32_t pmix_rank_t;
#define PMIX_PARENT_ID "pmix.parent" // (pmix_proc_t*) identifier of the process that called PMIx_Spawn
// to launch this proc's application
#define PMIX_EXIT_CODE "pmix.exit.code" // (int) exit code returned when proc terminated
#define PMIX_NETWORK_COORDINATE "pmix.net.coord" // (pmix_coord_t*) Network coordinate of the specified process
#define PMIX_NETWORK_COORD_SYSTEM "pmix.net.coordsys" // (pmix_coord_system_t) Network coordinate system being employed to
// describe the specified network plane
#define PMIX_NETWORK_COORDINATE "pmix.net.coord" // (pmix_coord_t*) Network coordinate of the specified process in
// the given view type (e.g., logical vs physical)
#define PMIX_NETWORK_VIEW "pmix.net.view" // (pmix_coord_view_t) Requested view type (e.g., logical vs physical)
#define PMIX_NETWORK_DIMS "pmix.net.dims" // (uint32_t) Number of dimensions in the specified network plane/view
#define PMIX_NETWORK_PLANE "pmix.net.plane" // (char*) string ID of a network plane
#define PMIX_NETWORK_SWITCH "pmix.net.switch" // (char*) string ID of a network switch
#define PMIX_NETWORK_NIC "pmix.net.nic" // (char*) string ID of a NIC
#define PMIX_NETWORK_ENDPT "pmix.net.endpt" // (assigned) network endpt for process - type assigned by
// fabric provider
#define PMIX_NETWORK_SHAPE "pmix.net.shape" // (pmix_data_array_t*) number of interfaces (uint32_t) on each dimension of the
// specified network plane in the requested view
#define PMIX_NETWORK_SHAPE_STRING "pmix.net.shapestr" // (char*) network shape expressed as a string (e.g., "10x12x2")
/* size info */
#define PMIX_UNIV_SIZE "pmix.univ.size" // (uint32_t) #procs in this nspace
@ -1079,19 +1084,6 @@ typedef enum {
} pmix_group_operation_t;
/* define a structure for a proc's network coordinate */
typedef struct pmix_coord {
int x;
int y;
int z;
} pmix_coord_t;
/* define coordinate system values */
typedef uint8_t pmix_coord_system_t;
#define PMIX_COORD_CARTESIAN 0x00
#define PMIX_COORD_TOROID 0x01
#define PMIX_COORD_CYLINDRICAL 0x02
/* define some "hooks" external libraries can use to
* intercept memory allocation/release operations */
@ -1143,6 +1135,60 @@ static inline void* pmix_calloc(size_t n, size_t m)
(PMIX_CHECK_NSPACE((a)->nspace, (b)->nspace) && ((a)->rank == (b)->rank || (PMIX_RANK_WILDCARD == (a)->rank || PMIX_RANK_WILDCARD == (b)->rank)))
/**** PMIX COORD ****/
/* define coordinate system views */
typedef uint8_t pmix_coord_view_t;
#define PMIX_COORD_VIEW_UNDEF 0x00
#define PMIX_COORD_LOGICAL_VIEW 0x01
#define PMIX_COORD_PHYSICAL_VIEW 0x02
/* define a structure for a proc's network coordinate */
typedef struct pmix_coord {
pmix_coord_view_t view;
int *coord;
size_t dims;
} pmix_coord_t;
#define PMIX_COORD_CREATE(m, d, n) \
do { \
(m) = (pmix_coord_t*)pmix_calloc((n), sizeof(pmix_coord_t)); \
if (NULL != (m)) { \
(m)->view = PMIX_COORD_VIEW_UNDEF; \
(m)->dims = (d); \
(m)->coord = (int*)pmix_calloc((m)->dims, sizeof(int)); \
} \
} while(0)
#define PMIX_COORD_CONSTRUCT(m, d) \
do { \
(m)->view = PMIX_COORD_VIEW_UNDEF; \
(m)->coord = NULL; \
(m)->dims = 0; \
} while(0)
#define PMIX_COORD_DESTRUCT(m) \
do { \
(m)->view = PMIX_COORD_VIEW_UNDEF; \
if (NULL != (m)->coord) { \
pmix_free((m)->coord); \
(m)->coord = NULL; \
(m)->dims = 0; \
} \
} while(0)
#define PMIX_COORD_FREE(m, n) \
do { \
size_t _nc_; \
if (NULL != (m)) { \
for (_nc_ = 0; _nc_ < (n); _nc_++) { \
PMIX_COORD_DESTRUCT(&(m)[_nc_]); \
} \
free((m)); \
(m) = NULL; \
} \
} while(0)
/**** PMIX BYTE OBJECT ****/
typedef struct pmix_byte_object {
char *bytes;

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

@ -64,16 +64,20 @@ extern "C" {
typedef struct pmix_fabric_s {
/* user-supplied name for this fabric */
char *name;
/* revision - tracks how many times the
* fabric info has been updated. Used to detect
* that a change has occurred since the last
* time the data was accessed. Restricted to
* PMIx-internal use */
uint64_t revision;
/* PMIx server-defined object for internal use */
/* communication cost array - the number of vertices
* (nverts) equals the number of interfaces in the
* fabric. This equates to the number of columns & rows
* in the commcost array as the matrix is symmetric */
uint16_t **commcost;
uint32_t nverts;
/* object pointer for use by the PMIx server library */
void *module;
} pmix_fabric_t;
/* convenience macros to support pmix_fabric_t */
#define PMIX_FABRIC_CONSTRUCT(x) \
memset(x, 0, sizeof(pmix_fabric_t))
/* Register for access to fabric-related information, including
* communication cost matrix. This call must be made prior to
* requesting information from a fabric.
@ -83,9 +87,9 @@ typedef struct pmix_fabric_s {
* utilize this field
*
* directives - an optional array of values indicating desired
* behaviors and/or fabric to be accessed via
* the returned struct. If NULL, then the highest
* priority available fabric will return the struct
* behaviors and/or fabric to be accessed. If NULL,
* then the highest priority available fabric will
* be used
*
* ndirs - number of elements in the directives array
*
@ -106,62 +110,9 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_fabric(pmix_fabric_t *fabric,
*/
PMIX_EXPORT pmix_status_t PMIx_server_deregister_fabric(pmix_fabric_t *fabric);
/* Get the number of vertices in the provided fabric.
* To avoid blocking the caller, this function will
* always return immediately, returning a PMIX_ERR_RESOURCE_BUSY
* status if the matrix is in the process of being updated.
*
* fabric - pointer to the pmix_fabric_t struct provided
* to the registration function
*
* nverts - pointer to the location where the number of
* vertices is to be returned
*
* Return values include:
*
* PMIX_SUCCESS - indicates return of a valid value
* PMIX_ERR_RESOURCE_BUSY - matrix is being updated
* PMIX_ERR_FABRIC_UPDATED - fabric info has been updated since
* last call involving this pmix_fabric_t
*/
PMIX_EXPORT pmix_status_t PMIx_server_get_num_vertices(pmix_fabric_t *fabric,
uint32_t *nverts);
/* Obtain communication cost for messages transmitted from indicated
* source to destination across the provided fabric - i.e.,
* the value of the (src,dest) entry of that fabric's communication
* cost matrix. To avoid blocking the caller, this function will
* always return immediately, returning a PMIX_ERR_RESOURCE_BUSY
* status if the matrix is in the process of being updated.
*
* fabric - pointer to the pmix_fabric_t struct provided to
* the registration function
*
* src - the index of the originating vertex for the communication
*
* dest - the index of the destination vertex for the communication
*
* cost - pointer to the location where the cost is to be returned
*
* Return values include:
*
* PMIX_SUCCESS - indicates return of a valid value
* PMIX_ERR_BAD_PARAM - src and/or dest is out of bounds
* PMIX_ERR_RESOURCE_BUSY - matrix is being updated
* PMIX_ERR_FABRIC_UPDATED - fabric info has been updated since
* last call involving this pmix_fabric_t
*/
PMIX_EXPORT pmix_status_t PMIx_server_get_comm_cost(pmix_fabric_t *fabric,
uint32_t src, uint32_t dest,
uint16_t *cost);
/* Given a communication cost matrix index, return the corresponding
* vertex info in the provided fabric and the name of the node upon
/* Given a communication cost matrix index for a specified fabric,
* return the corresponding vertex info and the name of the node upon
* which it resides.
* If the PMIX_ERR_RESOURCE_BUSY or PMIX_ERR_FABRIC_UPDATED status is
* returned, then the caller should update their cost information
* before re-issuing this request to ensure accurate correlation
* between cost and LID
*
* fabric - pointer to the pmix_fabric_t struct provided to
* the registration function
@ -179,20 +130,14 @@ PMIX_EXPORT pmix_status_t PMIx_server_get_comm_cost(pmix_fabric_t *fabric,
*
* PMIX_SUCCESS - indicates return of a valid value
* PMIX_ERR_BAD_PARAM - provided index is out of bounds
* PMIX_ERR_RESOURCE_BUSY - matrix is being updated
* PMIX_ERR_FABRIC_UPDATED - fabric info has been updated since
* last call involving this pmix_fabric_t
*/
PMIX_EXPORT pmix_status_t PMIx_server_get_vertex_info(pmix_fabric_t *fabric,
uint32_t i, pmix_value_t *vertex,
char **nodename);
/* Given vertex info, return the corresponding communication cost matrix
* index and the name of the node upon which it resides.
* If the PMIX_ERR_RESOURCE_BUSY or PMIX_ERR_FABRIC_UPDATED status is
* returned, then the caller should update their cost information
* before re-issuing this request to ensure accurate correlation
* between cost and LID
/* Given vertex info and the name of the device upon which that
* vertex resides, return the corresponding communication cost matrix
* index
*
* fabric - pointer to the pmix_fabric_t struct provided to
* the registration function
@ -201,10 +146,6 @@ PMIX_EXPORT pmix_status_t PMIx_server_get_vertex_info(pmix_fabric_t *fabric,
*
* i - pointer to the location where the index is to be returned
*
* nodename - pointer to the location where the string nodename
* is to be returned. The caller is responsible for
* releasing the string when done
*
* Return values include:
*
* PMIX_SUCCESS - indicates return of a valid value
@ -214,8 +155,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_get_vertex_info(pmix_fabric_t *fabric,
* last call involving this pmix_fabric_t
*/
PMIX_EXPORT pmix_status_t PMIx_server_get_index(pmix_fabric_t *fabric,
pmix_value_t *vertex, uint32_t *i,
char **nodename);
pmix_value_t *vertex, uint32_t *i);
#if defined(c_plusplus) || defined(__cplusplus)
}

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

@ -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-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -42,6 +42,8 @@ sources =
nodist_headers =
EXTRA_DIST =
dist_pmixdata_DATA =
nobase_pmix_HEADERS =
pmixdir = $(pmixincludedir)/$(subdir)
# place to capture sources for backward compatibility libs
pmi1_sources =
@ -105,6 +107,11 @@ include tools/Makefile.include
include common/Makefile.include
include hwloc/Makefile.include
if WANT_INSTALL_HEADERS
nobase_pmix_HEADERS += $(headers)
endif
MAINTAINERCLEANFILES = Makefile.in config.h config.h.in
DISTCLEANFILES = Makefile
CLEANFILES = core.* *~

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

@ -16,7 +16,7 @@
* reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Intel, Inc. All rights reserved.
* Copyright (c) 2018-2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -52,7 +52,7 @@
#ifndef PMIX_SYS_ATOMIC_H
#define PMIX_SYS_ATOMIC_H 1
#include "pmix_config.h"
#include "src/include/pmix_config.h"
#include <stdbool.h>

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

@ -496,7 +496,9 @@ static pmix_status_t _getfn_fastpath(const pmix_proc_t *proc, const pmix_key_t k
for (n=0; n < ninfo; n++) {
if (0 == strncmp(info[n].key, PMIX_DATA_SCOPE, PMIX_MAX_KEYLEN)) {
cb->scope = info[n].value.data.scope;
break;
} else {
/* we cannot handle any other directives via this path */
return PMIX_ERR_NOT_SUPPORTED;
}
}
}
@ -561,11 +563,11 @@ static void _getnbfn(int fd, short flags, void *cbdata)
/* scan the incoming directives */
if (NULL != cb->info) {
for (n=0; n < cb->ninfo; n++) {
if (0 == strncmp(cb->info[n].key, PMIX_OPTIONAL, PMIX_MAX_KEYLEN)) {
if (PMIX_CHECK_KEY(&cb->info[n], PMIX_OPTIONAL)) {
optional = PMIX_INFO_TRUE(&cb->info[n]);
} else if (0 == strncmp(cb->info[n].key, PMIX_IMMEDIATE, PMIX_MAX_KEYLEN)) {
} else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_IMMEDIATE)) {
immediate = PMIX_INFO_TRUE(&cb->info[n]);
} else if (0 == strncmp(cb->info[n].key, PMIX_TIMEOUT, PMIX_MAX_KEYLEN)) {
} else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_TIMEOUT)) {
/* set a timer to kick us out if we don't
* have an answer within their window */
if (0 < cb->info[n].value.data.integer) {
@ -576,8 +578,16 @@ static void _getnbfn(int fd, short flags, void *cbdata)
pmix_event_evtimer_add(&cb->ev, &tv);
cb->timer_running = true;
}
} else if (0 == strncmp(cb->info[n].key, PMIX_DATA_SCOPE, PMIX_MAX_KEYLEN)) {
} else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_DATA_SCOPE)) {
cb->scope = cb->info[n].value.data.scope;
} else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_SESSION_INFO)) {
cb->level = PMIX_LEVEL_SESSION;
} else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_JOB_INFO)) {
cb->level = PMIX_LEVEL_JOB;
} else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_APP_INFO)) {
cb->level = PMIX_LEVEL_APP;
} else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_NODE_INFO)) {
cb->level = PMIX_LEVEL_NODE;
}
}
}

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

@ -1072,6 +1072,8 @@ void pmix_attributes_print_headers(char ***ans, char *level)
left = PMIX_PRINT_NAME_COLUMN_WIDTH + PMIX_PRINT_STRING_COLUMN_WIDTH + PMIX_PRINT_TYPE_COLUMN_WIDTH +
((PMIX_PRINT_ATTR_COLUMN_WIDTH-PMIX_PRINT_NAME_COLUMN_WIDTH-PMIX_PRINT_STRING_COLUMN_WIDTH-PMIX_PRINT_TYPE_COLUMN_WIDTH)/2) - 3 - strlen("DESCRIPTION")/2;
memcpy(&line[left], "DESCRIPTION", strlen("DESCRIPTION"));
left += strlen("DESCRIPTION") + 1;
line[left] = '\0';
pmix_argv_append_nosize(ans, line);
/* print the dashes under the column headers */

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

@ -146,6 +146,7 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
pmix_list_t results;
pmix_kval_t *kv, *kvnxt;
pmix_proc_t proc;
bool rank_given;
PMIX_ACQUIRE_THREAD(&pmix_global_lock);
@ -193,6 +194,7 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
memset(proc.nspace, 0, PMIX_MAX_NSLEN+1);
proc.rank = PMIX_RANK_INVALID;
for (n=0; n < nqueries; n++) {
rank_given = false;
/* check for requests to report supported attributes */
if (0 == strcmp(queries[n].keys[0], PMIX_QUERY_ATTRIBUTE_SUPPORT)) {
cd = PMIX_NEW(pmix_query_caddy_t);
@ -216,37 +218,41 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
} else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_PROCID)) {
PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.proc->nspace);
proc.rank = queries[n].qualifiers[p].value.data.proc->rank;
rank_given = true;
} else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_NSPACE)) {
PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.string);
} else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_RANK)) {
proc.rank = queries[n].qualifiers[p].value.data.rank;
} else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_HOSTNAME)) {
if (0 != strcmp(queries[n].qualifiers[p].value.data.string, pmix_globals.hostname)) {
/* asking about a different host, so ask for the info */
PMIX_LIST_DESTRUCT(&results);
goto query;
}
rank_given = true;
}
}
/* we get here if a refresh isn't required - first try a local
* "get" on the data to see if we already have it */
PMIX_CONSTRUCT(&cb, pmix_cb_t);
cb.copy = false;
/* set the proc */
if (PMIX_RANK_INVALID == proc.rank &&
0 == strlen(proc.nspace)) {
/* use our id */
cb.proc = &pmix_globals.myid;
} else {
if (0 == strlen(proc.nspace)) {
/* use our nspace */
PMIX_LOAD_NSPACE(cb.proc->nspace, pmix_globals.myid.nspace);
}
if (PMIX_RANK_INVALID == proc.rank) {
/* user the wildcard rank */
proc.rank = PMIX_RANK_WILDCARD;
}
/* if they are querying about node or app values not directly
* associated with a proc (i.e., they didn't specify the proc),
* then we obtain those by leaving the proc info as undefined */
if (!rank_given) {
proc.rank = PMIX_RANK_UNDEF;
cb.proc = &proc;
} else {
/* set the proc */
if (PMIX_RANK_INVALID == proc.rank &&
0 == strlen(proc.nspace)) {
/* use our id */
cb.proc = &pmix_globals.myid;
} else {
if (0 == strlen(proc.nspace)) {
/* use our nspace */
PMIX_LOAD_NSPACE(cb.proc->nspace, pmix_globals.myid.nspace);
}
if (PMIX_RANK_INVALID == proc.rank) {
/* user the wildcard rank */
proc.rank = PMIX_RANK_WILDCARD;
}
cb.proc = &proc;
}
}
for (p=0; NULL != queries[n].keys[p]; p++) {
cb.key = queries[n].keys[p];

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

@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
@ -47,6 +47,6 @@ headers += \
endif ! PMIX_EMBEDDED_MODE
if WANT_INSTALL_HEADERS
nodist_headers += \
nobase_pmix_HEADERS += \
include/pmix_config.h
endif

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

@ -308,6 +308,7 @@ static void cbcon(pmix_cb_t *p)
PMIX_CONSTRUCT(&p->kvs, pmix_list_t);
p->copy = false;
p->timer_running = false;
p->level = PMIX_LEVEL_UNDEF;
}
static void cbdes(pmix_cb_t *p)
{
@ -365,6 +366,7 @@ static void qdes(pmix_query_caddy_t *p)
PMIX_PROC_FREE(p->targets, p->ntargets);
PMIX_INFO_FREE(p->info, p->ninfo);
PMIX_LIST_DESTRUCT(&p->results);
PMIX_QUERY_FREE(p->queries, p->nqueries);
}
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_query_caddy_t,
pmix_object_t,

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

@ -133,6 +133,16 @@ typedef enum {
PMIX_COLLECT_MAX
} pmix_collect_t;
/* define a set of flags indicating the level
* of information being stored/requested */
typedef enum {
PMIX_LEVEL_UNDEF,
PMIX_LEVEL_SESSION,
PMIX_LEVEL_JOB,
PMIX_LEVEL_APP,
PMIX_LEVEL_NODE
} pmix_level_t;
/**** PEER STRUCTURES ****/
/* clients can only talk to their server, and servers are
@ -406,6 +416,7 @@ typedef struct {
pmix_list_t kvs;
bool copy;
bool timer_running;
pmix_level_t level;
} pmix_cb_t;
PMIX_CLASS_DECLARATION(pmix_cb_t);

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

@ -16,7 +16,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -339,8 +339,8 @@ static int component_find_check (pmix_mca_base_framework_t *framework, char **re
}
if (!found) {
char h[MAXHOSTNAMELEN];
gethostname(h, sizeof(h));
char h[PMIX_MAXHOSTNAMELEN] = {0};
gethostname(h, sizeof(h)-1);
pmix_show_help("help-pmix-mca-base.txt",
"find-available:not-valid", true,
h, framework->framework_name, requested_component_names[i]);

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

@ -13,7 +13,7 @@
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -68,7 +68,7 @@ int pmix_mca_base_open(void)
{
char *value;
pmix_output_stream_t lds;
char hostname[64];
char hostname[PMIX_MAXHOSTNAMELEN] = {0};
int var_id;
int rc;
@ -155,7 +155,7 @@ int pmix_mca_base_open(void)
} else {
set_defaults(&lds);
}
gethostname(hostname, 64);
gethostname(hostname, PMIX_MAXHOSTNAMELEN-1);
rc = asprintf(&lds.lds_prefix, "[%s:%05d] ", hostname, getpid());
if (0 > rc) {
return PMIX_ERR_OUT_OF_RESOURCE;

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

@ -421,6 +421,7 @@ pmix_status_t pmix_bfrops_base_copy_darray(pmix_data_array_t **dest,
pmix_query_t *pq, *sq;
pmix_envar_t *pe, *se;
pmix_regattr_t *pr, *sr;
pmix_coord_t *pc, *sc;
if (PMIX_DATA_ARRAY != type) {
return PMIX_ERR_BAD_PARAM;
@ -844,7 +845,21 @@ pmix_status_t pmix_bfrops_base_copy_darray(pmix_data_array_t **dest,
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_coord_t));
pc = (pmix_coord_t*)p->array;
sc = (pmix_coord_t*)src->array;
for (n=0; n < src->size; n++) {
pc[n].view = sc[n].view;
pc[n].dims = sc[n].dims;
if (0 < pc[n].dims) {
pc[n].coord = (int*)malloc(pc[n].dims * sizeof(int));
if (NULL == pc[n].coord) {
free(p->array);
free(p);
return PMIX_ERR_NOMEM;
}
memcpy(pc[n].coord, sc[n].coord, pc[n].dims * sizeof(int));
}
}
break;
case PMIX_REGATTR:
PMIX_REGATTR_CREATE(p->array, src->size);
@ -924,11 +939,26 @@ pmix_status_t pmix_bfrops_base_copy_coord(pmix_coord_t **dest,
pmix_coord_t *src,
pmix_data_type_t type)
{
pmix_coord_t *d;
if (PMIX_COORD != type) {
return PMIX_ERR_BAD_PARAM;
}
*dest = (pmix_coord_t*)malloc(sizeof(pmix_coord_t));
memcpy(*dest, src, sizeof(pmix_coord_t));
d = (pmix_coord_t*)malloc(sizeof(pmix_coord_t));
if (NULL == d) {
return PMIX_ERR_NOMEM;
}
d->view = src->view;
d->dims = src->dims;
if (0 < d->dims) {
d->coord = (int*)malloc(d->dims * sizeof(int));
if (NULL == d->coord) {
free(d);
return PMIX_ERR_NOMEM;
}
memcpy(d->coord, src->coord, d->dims * sizeof(int));
}
*dest = d;
return PMIX_SUCCESS;
}

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

@ -1248,18 +1248,18 @@ pmix_status_t pmix_bfrops_base_pack_coord(pmix_pointer_array_t *regtypes,
return PMIX_ERR_BAD_PARAM;
}
for (i=0; i < num_vals; ++i) {
/* pack the x-coord */
PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].x, 1, PMIX_INT, regtypes);
/* pack the view */
PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].view, 1, PMIX_UINT8, regtypes);
if (PMIX_SUCCESS != ret) {
return ret;
}
/* pack the y-coord */
PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].y, 1, PMIX_INT, regtypes);
/* pack the number of dimensions */
PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].dims, 1, PMIX_SIZE, regtypes);
if (PMIX_SUCCESS != ret) {
return ret;
}
/* pack the z-coord */
PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].z, 1, PMIX_INT, regtypes);
/* pack the array of coordinates */
PMIX_BFROPS_PACK_TYPE(ret, buffer, ptr[i].coord, ptr[i].dims, PMIX_INT, regtypes);
if (PMIX_SUCCESS != ret) {
return ret;
}

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

@ -936,6 +936,7 @@ int pmix_bfrops_base_print_status(char **output, char *prefix,
char *prefx;
int rc;
pmix_regattr_t *r;
char *tp;
if (PMIX_VALUE != type) {
return PMIX_ERR_BAD_PARAM;
@ -1086,8 +1087,17 @@ int pmix_bfrops_base_print_status(char **output, char *prefix,
break;
case PMIX_COORD:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_COORD\tx-axis: %d\ty-axis: %d\tz-axis: %d",
prefx, src->data.coord->x, src->data.coord->y, src->data.coord->z);
if (PMIX_COORD_VIEW_UNDEF == src->data.coord->view) {
tp = "UNDEF";
} else if (PMIX_COORD_LOGICAL_VIEW == src->data.coord->view) {
tp = "LOGICAL";
} else if (PMIX_COORD_PHYSICAL_VIEW == src->data.coord->view) {
tp = "PHYSICAL";
} else {
tp = "UNRECOGNIZED";
}
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_COORD\tView: %s\tDims: %lu",
prefx, tp, (unsigned long)src->data.coord->dims);
break;
case PMIX_REGATTR:
@ -1842,6 +1852,7 @@ pmix_status_t pmix_bfrops_base_print_coord(char **output, char *prefix,
{
char *prefx;
int ret;
char *tp;
if (PMIX_COORD != type) {
return PMIX_ERR_BAD_PARAM;
@ -1855,8 +1866,17 @@ pmix_status_t pmix_bfrops_base_print_coord(char **output, char *prefix,
prefx = prefix;
}
ret = asprintf(output, "%sData type: PMIX_COORD\tx-axis: %d\ty-axis: %d\tz-axis: %d",
prefx, src->x, src->y, src->z);
if (PMIX_COORD_VIEW_UNDEF == src->view) {
tp = "UNDEF";
} else if (PMIX_COORD_LOGICAL_VIEW == src->view) {
tp = "LOGICAL";
} else if (PMIX_COORD_PHYSICAL_VIEW == src->view) {
tp = "PHYSICAL";
} else {
tp = "UNRECOGNIZED";
}
ret = asprintf(output, "%sData type: PMIX_COORD\tView: %s\tDims: %lu",
prefx, tp, (unsigned long)src->dims);
if (prefx != prefix) {
free(prefx);
}

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

@ -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-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -31,13 +31,112 @@
#include "src/mca/bfrops/base/base.h"
static const char* basic_type_string(pmix_data_type_t type)
{
switch(type) {
case PMIX_BOOL:
return "PMIX_BOOL";
case PMIX_BYTE:
return "PMIX_BYTE";
case PMIX_STRING:
return "PMIX_STRING";
case PMIX_SIZE:
return "PMIX_SIZE";
case PMIX_PID:
return "PMIX_PID";
case PMIX_INT:
return "PMIX_INT";
case PMIX_INT8:
return "PMIX_INT8";
case PMIX_INT16:
return "PMIX_INT16";
case PMIX_INT32:
return "PMIX_INT32";
case PMIX_INT64:
return "PMIX_INT64";
case PMIX_UINT:
return "PMIX_UINT";
case PMIX_UINT8:
return "PMIX_UINT8";
case PMIX_UINT16:
return "PMIX_UINT16";
case PMIX_UINT32:
return "PMIX_UINT32";
case PMIX_UINT64:
return "PMIX_UINT64";
case PMIX_FLOAT:
return "PMIX_FLOAT";
case PMIX_DOUBLE:
return "PMIX_DOUBLE";
case PMIX_TIMEVAL:
return "PMIX_TIMEVAL";
case PMIX_TIME:
return "PMIX_TIME";
case PMIX_STATUS:
return "PMIX_STATUS";
case PMIX_VALUE:
return "PMIX_VALUE";
case PMIX_PROC:
return "PMIX_PROC";
case PMIX_APP:
return "PMIX_APP";
case PMIX_INFO:
return "PMIX_INFO";
case PMIX_PDATA:
return "PMIX_PDATA";
case PMIX_BUFFER:
return "PMIX_BUFFER";
case PMIX_BYTE_OBJECT:
return "PMIX_BYTE_OBJECT";
case PMIX_KVAL:
return "PMIX_KVAL";
case PMIX_PERSIST:
return "PMIX_PERSIST";
case PMIX_POINTER:
return "PMIX_POINTER";
case PMIX_SCOPE:
return "PMIX_SCOPE";
case PMIX_DATA_RANGE:
return "PMIX_DATA_RANGE";
case PMIX_COMMAND:
return "PMIX_COMMAND";
case PMIX_INFO_DIRECTIVES:
return "PMIX_INFO_DIRECTIVES";
case PMIX_DATA_TYPE:
return "PMIX_DATA_TYPE";
case PMIX_PROC_STATE:
return "PMIX_PROC_STATE";
case PMIX_PROC_INFO:
return "PMIX_PROC_INFO";
case PMIX_DATA_ARRAY:
return "PMIX_DATA_ARRAY";
case PMIX_PROC_RANK:
return "PMIX_PROC_RANK";
case PMIX_QUERY:
return "PMIX_QUERY";
case PMIX_COMPRESSED_STRING:
return "PMIX_COMPRESSED_STRING";
case PMIX_ALLOC_DIRECTIVE:
return "PMIX_ALLOC_DIRECTIVE";
case PMIX_IOF_CHANNEL:
return "PMIX_IOF_CHANNEL";
case PMIX_ENVAR:
return "PMIX_ENVAR";
case PMIX_COORD:
return "PMIX_COORD";
case PMIX_REGATTR:
return "PMIX_REGATTR";
default:
return "NOT INITIALIZED";
}
}
PMIX_EXPORT const char* PMIx_Data_type_string(pmix_data_type_t type)
{
pmix_bfrops_base_active_module_t *active;
char *reply;
if (!pmix_bfrops_globals.initialized) {
return "NOT INITIALIZED";
return basic_type_string(type);
}
PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {

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

@ -1470,23 +1470,26 @@ pmix_status_t pmix_bfrops_base_unpack_coord(pmix_pointer_array_t *regtypes,
n = *num_vals;
for (i = 0; i < n; ++i) {
/* unpack the x-axis */
/* unpack the view */
m=1;
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].x, &m, PMIX_INT, regtypes);
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].view, &m, PMIX_UINT8, regtypes);
if (PMIX_SUCCESS != ret) {
return ret;
}
/* unpack the y-coord */
/* unpack the dims */
m=1;
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].y, &m, PMIX_INT, regtypes);
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].dims, &m, PMIX_SIZE, regtypes);
if (PMIX_SUCCESS != ret) {
return ret;
}
/* unpack the z-coord */
m=1;
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].z, &m, PMIX_INT, regtypes);
if (PMIX_SUCCESS != ret) {
return ret;
if (0 < ptr[i].dims) {
ptr[i].coord = (int*)malloc(ptr[i].dims * sizeof(int));
/* unpack the coords */
m=ptr[i].dims;
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].coord, &m, PMIX_INT, regtypes);
if (PMIX_SUCCESS != ret) {
return ret;
}
}
}
return PMIX_SUCCESS;

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2019 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.
@ -431,10 +431,15 @@ pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src)
memcpy(&p->data.status, &src->data.status, sizeof(pmix_status_t));
break;
case PMIX_PROC:
memcpy(&p->data.proc, &src->data.proc, sizeof(pmix_proc_t));
/* create the storage */
p->data.proc = (pmix_proc_t*)malloc(sizeof(pmix_proc_t));
if (NULL == p->data.proc) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.proc, src->data.proc, sizeof(pmix_proc_t));
break;
case PMIX_PROC_RANK:
memcpy(&p->data.proc, &src->data.rank, sizeof(pmix_rank_t));
memcpy(&p->data.rank, &src->data.rank, sizeof(pmix_rank_t));
break;
case PMIX_BYTE_OBJECT:
case PMIX_COMPRESSED_STRING:
@ -653,7 +658,12 @@ pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src)
p1 = (pmix_info_t*)p->data.darray->array;
s1 = (pmix_info_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type);
PMIX_LOAD_KEY(p1[n].key, s1[n].key);
rc = pmix_value_xfer(&p1[n].value, &s1[n].value);
if (PMIX_SUCCESS != rc) {
PMIX_INFO_FREE(p1, src->data.darray->size);
return rc;
}
}
break;
case PMIX_PDATA:
@ -664,7 +674,13 @@ pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src)
pd = (pmix_pdata_t*)p->data.darray->array;
sd = (pmix_pdata_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value.data.flag, sd[n].value.type);
memcpy(&pd[n].proc, &sd[n].proc, sizeof(pmix_proc_t));
PMIX_LOAD_KEY(pd[n].key, sd[n].key);
rc = pmix_value_xfer(&pd[n].value, &sd[n].value);
if (PMIX_SUCCESS != rc) {
PMIX_INFO_FREE(pd, src->data.darray->size);
return rc;
}
}
break;
case PMIX_BUFFER:

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

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

@ -57,6 +57,7 @@ bool pmix_compress_zlib_compress_block(char *instring,
size_t len, outlen;
uint8_t *tmp, *ptr;
uint32_t inlen;
int rc;
/* set default output */
*outbytes = NULL;
@ -69,7 +70,6 @@ bool pmix_compress_zlib_compress_block(char *instring,
/* get an upper bound on the required output storage */
len = deflateBound(&strm, inlen);
if (NULL == (tmp = (uint8_t*)malloc(len))) {
*outbytes = NULL;
return false;
}
strm.next_in = (uint8_t*)instring;
@ -80,8 +80,12 @@ bool pmix_compress_zlib_compress_block(char *instring,
strm.avail_out = len;
strm.next_out = tmp;
deflate (&strm, Z_FINISH);
rc = deflate (&strm, Z_FINISH);
deflateEnd (&strm);
if (Z_OK != rc) {
free(tmp);
return false;
}
/* allocate 4 bytes beyond the size reqd by zlib so we
* can pass the size of the uncompressed string to the

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

@ -504,6 +504,7 @@ pmix_status_t pmix_pfexec_base_setup_child(pmix_pfexec_child_t *child)
if (fd != fileno(stdin)) {
ret = dup2(fd, fileno(stdin));
if (ret < 0) {
close(fd);
return PMIX_ERR_SYS_OTHER;
}
}

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

@ -1,5 +1,6 @@
#
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -17,7 +18,7 @@ libmca_pif_la_SOURCES += $(headers)
# Conditionally install the header files
if WANT_INSTALL_HEADERS
pmixdir = $(pmixincludedir)/pmix/mca/pif
pmixdir = $(pmixincludedir)/$(subdir)
nobase_pmix_HEADERS = $(headers)
endif

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

@ -104,8 +104,8 @@ static int if_linux_ipv6_open(void)
addrbyte[8], addrbyte[9], addrbyte[10], addrbyte[11],
addrbyte[12], addrbyte[13], addrbyte[14], addrbyte[15], scope);
/* we don't want any other scope less than link-local */
if (scope < 0x20) {
/* Only interested in global (0x00) scope */
if (scope != 0x00) {
pmix_output_verbose(1, pmix_pif_base_framework.framework_output,
"skipping interface %2x%2x:%2x%2x:%2x%2x:%2x%2x:%2x%2x:%2x%2x:%2x%2x:%2x%2x scope %x\n",
addrbyte[0], addrbyte[1], addrbyte[2], addrbyte[3],

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

@ -623,6 +623,16 @@ static pmix_status_t process_maps(char *nspace, char *nregex, char *pregex)
return rc;
}
/* bozo check */
if (pmix_argv_count(nodes) != pmix_argv_count(procs)) {
rc = PMIX_ERR_BAD_PARAM;
PMIX_ERROR_LOG(rc);
pmix_argv_free(nodes);
pmix_argv_free(procs);
PMIX_RELEASE_THREAD(&pmix_pnet_globals.lock);
return rc;
}
/* see if we already know about this job */
job = NULL;
if (0 < pmix_list_get_size(&pmix_pnet_globals.jobs)) {

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

@ -162,17 +162,6 @@ typedef pmix_status_t (*pmix_pnet_base_module_register_fabric_fn_t)(pmix_fabric_
/* Deregister the fabric, giving the associated module a chance to cleanup */
typedef pmix_status_t (*pmix_pnet_base_deregister_fabric_fn_t)(pmix_fabric_t *fabric);
/* Get the number of vertices in the fabric */
typedef pmix_status_t (*pmix_pnet_base_module_get_num_verts_fn_t)(pmix_fabric_t *fabric,
uint32_t *nverts);
/* Get the cost of communicating from the src to the dest
* index - i.e., return the [src,dest] location in the
* communication cost array */
typedef pmix_status_t (*pmix_pnet_base_module_get_cost_fn_t)(pmix_fabric_t *fabric,
uint32_t src, uint32_t dest,
uint16_t *cost);
/* Get the identifier and nodename corresponding to the provided
* index of the communication cost array - caller must provide
* the address of an allocated pmix_value_t structure */
@ -182,11 +171,9 @@ typedef pmix_status_t (*pmix_pnet_base_module_get_vertex_fn_t)(pmix_fabric_t *fa
char **nodename);
/* Get the index in the communication cost array corresponding
* to the provided identifier and the node upon which it resides */
* to the provided identifier(s) */
typedef pmix_status_t (*pmix_pnet_base_module_get_index_fn_t)(pmix_fabric_t *fabric,
pmix_value_t *identifier,
uint32_t *i,
char **nodename);
pmix_value_t *vertex, uint32_t *i);
/**
* Base structure for a PNET module. Each component should malloc a
* copy of the module structure for each fabric plane they support.
@ -208,8 +195,6 @@ typedef struct {
pmix_pnet_base_module_deliver_inventory_fn_t deliver_inventory;
pmix_pnet_base_module_register_fabric_fn_t register_fabric;
pmix_pnet_base_deregister_fabric_fn_t deregister_fabric;
pmix_pnet_base_module_get_num_verts_fn_t get_num_vertices;
pmix_pnet_base_module_get_cost_fn_t get_cost;
pmix_pnet_base_module_get_vertex_fn_t get_vertex;
pmix_pnet_base_module_get_index_fn_t get_index;
} pmix_pnet_module_t;

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

@ -746,6 +746,7 @@ static pmix_status_t setup_local_network(pmix_namespace_t *nptr,
"pnet:tcp:setup_local_network");
if (NULL != info) {
idkey = strdup("default");
for (n=0; n < ninfo; n++) {
/* look for my key */
if (0 == strncmp(info[n].key, PMIX_TCP_SETUP_APP_KEY, PMIX_MAX_KEYLEN)) {
@ -875,8 +876,8 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs,
pmix_inventory_cbfunc_t cbfunc, void *cbdata)
{
pmix_inventory_rollup_t *cd = (pmix_inventory_rollup_t*)cbdata;
char *prefix, myhost[PMIX_MAXHOSTNAMELEN];
char myconnhost[PMIX_MAXHOSTNAMELEN];
char *prefix, myhost[PMIX_MAXHOSTNAMELEN] = {0};
char myconnhost[PMIX_MAXHOSTNAMELEN] = {0};
char name[32], uri[2048];
struct sockaddr_storage my_ss;
char *foo;
@ -893,7 +894,7 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs,
/* setup the bucket - we will pass the results as a blob */
PMIX_CONSTRUCT(&bucket, pmix_buffer_t);
/* add our hostname */
gethostname(myhost, sizeof(myhost));
gethostname(myhost, sizeof(myhost)-1);
foo = &myhost[0];
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, &foo, 1, PMIX_STRING);
if (PMIX_SUCCESS != rc) {
@ -928,11 +929,11 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs,
if (AF_INET == my_ss.ss_family) {
prefix = "tcp4://";
inet_ntop(AF_INET, &((struct sockaddr_in*) &my_ss)->sin_addr,
myconnhost, PMIX_MAXHOSTNAMELEN);
myconnhost, PMIX_MAXHOSTNAMELEN-1);
} else if (AF_INET6 == my_ss.ss_family) {
prefix = "tcp6://";
inet_ntop(AF_INET6, &((struct sockaddr_in6*) &my_ss)->sin6_addr,
myconnhost, PMIX_MAXHOSTNAMELEN);
myconnhost, PMIX_MAXHOSTNAMELEN-1);
} else {
continue;
}

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

@ -68,18 +68,13 @@ static pmix_status_t register_fabric(pmix_fabric_t *fabric,
const pmix_info_t directives[],
size_t ndirs);
static pmix_status_t deregister_fabric(pmix_fabric_t *fabric);
static pmix_status_t get_num_verts(pmix_fabric_t *fabric, uint32_t *nverts);
static pmix_status_t get_cost(pmix_fabric_t *fabric,
uint32_t src, uint32_t dest,
uint16_t *cost);
static pmix_status_t get_vertex(pmix_fabric_t *fabric,
uint32_t i,
pmix_value_t *identifier,
char **nodename);
static pmix_status_t get_index(pmix_fabric_t *fabric,
pmix_value_t *identifier,
uint32_t *i,
char **nodename);
uint32_t *i);
pmix_pnet_module_t pmix_test_module = {
.name = "test",
.init = test_init,
@ -94,8 +89,6 @@ pmix_pnet_module_t pmix_test_module = {
.deliver_inventory = deliver_inventory,
.register_fabric = register_fabric,
.deregister_fabric = deregister_fabric,
.get_num_vertices = get_num_verts,
.get_cost = get_cost,
.get_vertex = get_vertex,
.get_index = get_index
};
@ -134,20 +127,13 @@ typedef struct {
pmix_list_item_t super;
char *name;
int index;
void *left; // switch to the left of this one in the ring
pnet_nic_t leftport;
void *right; // switch to the right of this one in the ring
pnet_nic_t rightport;
void *plane;
pmix_list_t ports; // NICs included in the switch
} pnet_switch_t;
static void scon(pnet_switch_t *p)
{
p->name = NULL;
p->index = -1;
p->left = NULL;
p->right = NULL;
PMIX_CONSTRUCT(&p->leftport, pnet_nic_t);
PMIX_CONSTRUCT(&p->rightport, pnet_nic_t);
p->plane = NULL;
PMIX_CONSTRUCT(&p->ports, pmix_list_t);
}
static void sdes(pnet_switch_t *p)
@ -155,8 +141,6 @@ static void sdes(pnet_switch_t *p)
if (NULL != p->name) {
free(p->name);
}
PMIX_DESTRUCT(&p->leftport);
PMIX_DESTRUCT(&p->rightport);
PMIX_LIST_DESTRUCT(&p->ports);
}
static PMIX_CLASS_INSTANCE(pnet_switch_t,
@ -238,7 +222,7 @@ static char **myvalues = NULL;
static pmix_status_t test_init(void)
{
int n, m, r, ns, nplane, nnodes, nports;
int n, r, ns, nplane, nnodes, nports;
uint64_t n64, m64;
char **system=NULL, **ptr;
pnet_plane_t *p;
@ -328,13 +312,7 @@ static pmix_status_t test_init(void)
rc = PMIX_ERR_NOMEM;
goto cleanup;
}
/* setup the ports on the switches */
nports = nnodes / p->nswitches;
/* if it didn't divide evenly, then we have to add
* one to each switch to ensure we have enough ports */
if (0 != nnodes % p->nswitches) {
++nports;
}
p->index = nplane;
for (n=0; n < p->nswitches; n++) {
s = PMIX_NEW(pnet_switch_t);
if (0 > asprintf(&s->name, "%s:switch%03d", p->name, n)) {
@ -342,85 +320,30 @@ static pmix_status_t test_init(void)
goto cleanup;
}
s->index = n;
s->plane = p;
pmix_list_append(&p->switches, &s->super);
if (0 > asprintf(&s->leftport.name, "%s:port000", s->name)) {
rc = PMIX_ERR_NOMEM;
goto cleanup;
}
if (0 > asprintf(&s->rightport.name, "%s:port%03d", s->name, nports+1)) {
rc = PMIX_ERR_NOMEM;
goto cleanup;
}
for (m=0; m < nports; m++) {
nic = PMIX_NEW(pnet_nic_t);
if (0 > asprintf(&nic->name, "%s:port%03d", s->name, m+1)) {
rc = PMIX_ERR_NOMEM;
goto cleanup;
}
nic->s = s;
nic->plane = p;
pmix_list_append(&s->ports, &nic->super);
}
}
/* link the switch ring - first nic on each switch connects
* to the left, last nic on each switch connects to
* the right */
s = (pnet_switch_t*)pmix_list_get_first(&p->switches);
s->left = pmix_list_get_last(&p->switches);
s->right = pmix_list_get_next(&s->super);
/* setup his NICs to point to the right place */
s2 = (pnet_switch_t*)s->left;
s->leftport.link = &s2->rightport;
s2->rightport.link = &s->leftport;
s2 = (pnet_switch_t*)s->right;
s->rightport.link = &s2->leftport;
s2->leftport.link = &s->rightport;
/* progress the search */
s = (pnet_switch_t*)pmix_list_get_next(&s->super);
while (s != (pnet_switch_t*)pmix_list_get_last(&p->switches)) {
s->left = pmix_list_get_prev(&s->super);
s->right = pmix_list_get_next(&s->super);
/* setup his NICs to point to the right place */
s2 = (pnet_switch_t*)s->left;
s->leftport.link = &s2->rightport;
s2->rightport.link = &s->leftport;
s2 = (pnet_switch_t*)s->right;
s->rightport.link = &s2->leftport;
s2->leftport.link = &s->rightport;
s2->left = s;
/* progress the search */
s = (pnet_switch_t*)pmix_list_get_next(&s->super);
}
/* s now points to the last item on the list */
s->right = pmix_list_get_first(&p->switches);
s2 = (pnet_switch_t*)s->left;
s->leftport.link = &s2->rightport;
s2->rightport.link = &s->leftport;
s2 = (pnet_switch_t*)s->right;
s->rightport.link = &s2->leftport;
s2->leftport.link = &s->rightport;
/* now cycle across the nodes and setup their connections
* to the switches */
if (p->dense) {
/* setup the ports on the switches */
nports = nnodes / p->nswitches;
/* if it didn't divide evenly, then we have to add
* one to each switch to ensure we have enough ports */
if (0 != nnodes % p->nswitches) {
++nports;
}
/* connect each successive node to the same switch
* until that switch is full - then move to the next */
s = (pnet_switch_t*)pmix_list_get_first(&p->switches);
nic = (pnet_nic_t*)pmix_list_get_first(&s->ports);
n = 0;
ns = pmix_list_get_size(&s->ports);
ns = nports;
PMIX_LIST_FOREACH(node, &mynodes, pnet_node_t) {
nic2 = PMIX_NEW(pnet_nic_t);
if (0 > asprintf(&nic2->name, "%s:nic%03d", node->name, n)) {
if (0 > asprintf(&nic2->name, "%s:nic.%s.0", node->name, p->name)) {
rc = PMIX_ERR_NOMEM;
goto cleanup;
}
++n;
--ns;
nic2->node = node;
nic2->s = s;
@ -428,13 +351,55 @@ static pmix_status_t test_init(void)
nic2->index = pmix_pointer_array_add(&mynics, nic2);
PMIX_RETAIN(nic2);
pmix_list_append(&node->nics, &nic2->super);
/* create a corresponding link on the switch */
nic = PMIX_NEW(pnet_nic_t);
if (0 > asprintf(&nic->name, "%s:nic.0", s->name)) {
rc = PMIX_ERR_NOMEM;
goto cleanup;
}
pmix_list_append(&s->ports, &nic->super);
nic2->link = nic;
nic->link = nic2;
if (0 == ns) {
/* move to the next switch */
s = (pnet_switch_t*)pmix_list_get_next(&s->super);
if (NULL == s || (pnet_switch_t*)pmix_list_get_end(&p->switches) == s) {
s = (pnet_switch_t*)pmix_list_get_first(&p->switches);
}
nic = (pnet_nic_t*)pmix_list_get_first(&s->ports);
ns = pmix_list_get_size(&s->ports);
ns = nports;
}
}
} else {
/* connect the nodes to the switches in a round-robin manner */
s = (pnet_switch_t*)pmix_list_get_first(&p->switches);
PMIX_LIST_FOREACH(node, &mynodes, pnet_node_t) {
nic2 = PMIX_NEW(pnet_nic_t);
if (0 > asprintf(&nic2->name, "%s:nic.%s.0", node->name, p->name)) {
rc = PMIX_ERR_NOMEM;
goto cleanup;
}
--ns;
nic2->node = node;
nic2->s = s;
nic2->plane = p;
nic2->index = pmix_pointer_array_add(&mynics, nic2);
PMIX_RETAIN(nic2);
pmix_list_append(&node->nics, &nic2->super);
/* create a corresponding link on the switch */
nic = PMIX_NEW(pnet_nic_t);
if (0 > asprintf(&nic->name, "%s:nic.0", s->name)) {
rc = PMIX_ERR_NOMEM;
goto cleanup;
}
pmix_list_append(&s->ports, &nic->super);
nic2->link = nic;
nic->link = nic2;
/* move to the next switch */
s = (pnet_switch_t*)pmix_list_get_next(&s->super);
/* if we are at the end, rotate around to the first */
if (NULL == s || (pnet_switch_t*)pmix_list_get_end(&p->switches) == s) {
s = (pnet_switch_t*)pmix_list_get_first(&p->switches);
}
}
}
@ -538,6 +503,10 @@ static pmix_status_t allocate(pmix_namespace_t *nptr,
pmix_rank_t rank;
pnet_node_t *nd, *nd2;
uint32_t *u32;
pnet_nic_t *nic;
pnet_plane_t *pln;
pnet_switch_t *sw;
pmix_coord_t *coords;
pmix_output_verbose(2, pmix_pnet_base_framework.framework_output,
"pnet:test:allocate for nspace %s",
@ -569,7 +538,6 @@ static pmix_status_t allocate(pmix_namespace_t *nptr,
NULL == info[n].value.data.darray ||
PMIX_INFO != info[n].value.data.darray->type ||
NULL == info[n].value.data.darray->array) {
pmix_output(0, "NOTHING IN ARRAY");
requests = NULL;
nreqs = 0;
} else {
@ -757,12 +725,12 @@ static pmix_status_t allocate(pmix_namespace_t *nptr,
* and the remaining elements being the assigned
* endpoints for that proc in priority order */
PMIX_LOAD_KEY(iptr[m].key, PMIX_PROC_DATA);
PMIX_DATA_ARRAY_CREATE(d2, 2, PMIX_INFO);
PMIX_DATA_ARRAY_CREATE(d2, 3, PMIX_INFO);
iptr[m].value.type = PMIX_DATA_ARRAY;
iptr[m].value.data.darray = d2;
ip2 = (pmix_info_t*)d2->array;
/* start with the rank */
rank = m;
rank = strtoul(locals[m], NULL, 10);
PMIX_INFO_LOAD(&ip2[0], PMIX_RANK, &rank, PMIX_PROC_RANK);
/* the second element in this array will itself
* be a data array of endpts */
@ -774,6 +742,36 @@ static pmix_status_t allocate(pmix_namespace_t *nptr,
for (p=0; p < q; p++) {
u32[p] = 3180 + (m * 4) + p;
}
/* the third element will also be a data array
* containing the network coordinates of the proc
* for each NIC - note that the NIC is the true
* "holder" of the coordinate, but we pass it for
* each proc for ease of lookup. The coordinate is
* expressed in LOGICAL view (i.e., as x,y,z) where
* the z-coordinate is the number of the plane, the
* y-coordinate is the index of the switch in that plane
* to which the NIC is connected, and the x-coord is
* the index of the port on that switch.
*
* Thus, two procs that share the same y,z-coords are
* on the same switch. */
PMIX_DATA_ARRAY_CREATE(d3, q, PMIX_COORD);
PMIX_LOAD_KEY(ip2[2].key, PMIX_NETWORK_COORDINATE);
ip2[2].value.type = PMIX_DATA_ARRAY;
ip2[2].value.data.darray = d3;
coords = (pmix_coord_t*)d3->array;
nic = (pnet_nic_t*)pmix_list_get_first(&nd->nics);
for (p=0; p < q; p++) {
coords[p].view = PMIX_COORD_LOGICAL_VIEW;
coords[p].dims = 3;
coords[p].coord = (int*)malloc(3 * sizeof(int));
pln = (pnet_plane_t*)nic->plane;
coords[p].coord[0] = pln->index;
sw = (pnet_switch_t*)nic->s;
coords[p].coord[1] = sw->index;
coords[p].coord[2] = nic->index;
nic = (pnet_nic_t*)pmix_list_get_next(&nic->super);
}
}
pmix_argv_free(locals);
locals = NULL;
@ -837,7 +835,7 @@ static pmix_status_t setup_local_network(pmix_namespace_t *nptr,
pmix_info_t *iptr;
pmix_output_verbose(2, pmix_pnet_base_framework.framework_output,
"pnet:test:setup_local_network");
"pnet:test:setup_local_network with %lu info", (unsigned long)ninfo);
if (NULL != info) {
for (n=0; n < ninfo; n++) {
@ -880,7 +878,7 @@ static pmix_status_t setup_local_network(pmix_namespace_t *nptr,
iptr = (pmix_info_t*)kv->value->data.darray->array;
nvals = kv->value->data.darray->size;
/* each element in this array is itself an array containing
* the rank and the endpts assigned to that rank. This is
* the rank and the endpts and coords assigned to that rank. This is
* precisely the data we need to cache for the job, so
* just do so) */
PMIX_GDS_CACHE_JOB_INFO(rc, pmix_globals.mypeer, nptr, iptr, nvals);
@ -1007,7 +1005,8 @@ static pmix_status_t register_fabric(pmix_fabric_t *fabric,
/* pass to the user-level object */
fabric->module = ft;
fabric->revision = p->revision;
fabric->commcost = p->costmatrix;
fabric->nverts = p->nverts;
return PMIX_SUCCESS;
}
@ -1015,63 +1014,8 @@ static pmix_status_t register_fabric(pmix_fabric_t *fabric,
static pmix_status_t deregister_fabric(pmix_fabric_t *fabric)
{
fabric->module = NULL;
return PMIX_SUCCESS;
}
static pmix_status_t get_num_verts(pmix_fabric_t *fabric, uint32_t *nverts)
{
pmix_pnet_fabric_t *ft = (pmix_pnet_fabric_t*)fabric->module;
pnet_plane_t *p = (pnet_plane_t*)ft->payload;
int rc;
rc = pmix_atomic_trylock(&p->atomlock);
if (0 != rc) {
return PMIX_ERR_RESOURCE_BUSY;
}
/* if fabric data has been updated since the last time
* this was accessed, let them know */
if (fabric->revision != p->revision) {
/* update the revision */
fabric->revision = p->revision;
pmix_atomic_unlock(&p->atomlock);
return PMIX_FABRIC_UPDATED;
}
/* this component only looks at node-resident NICs as
* we assume switch-to-switch is done over dedicated
* ports in a ring topology */
*nverts = p->nverts;
pmix_atomic_unlock(&p->atomlock);
return PMIX_SUCCESS;
}
static pmix_status_t get_cost(pmix_fabric_t *fabric,
uint32_t src, uint32_t dest,
uint16_t *cost)
{
pmix_pnet_fabric_t *ft = (pmix_pnet_fabric_t*)fabric->module;
pnet_plane_t *p = (pnet_plane_t*)ft->payload;
int rc;
rc = pmix_atomic_trylock(&p->atomlock);
if (0 != rc) {
return PMIX_ERR_RESOURCE_BUSY;
}
/* if fabric data has been updated since the last time
* this was accessed, let them know */
if (fabric->revision != p->revision) {
/* update the revision */
fabric->revision = p->revision;
pmix_atomic_unlock(&p->atomlock);
return PMIX_FABRIC_UPDATED;
}
if (src >= p->nverts || dest >= p->nverts) {
pmix_atomic_unlock(&p->atomlock);
return PMIX_ERR_BAD_PARAM;
}
*cost = p->costmatrix[src][dest];
pmix_atomic_unlock(&p->atomlock);
fabric->commcost = NULL;
fabric->nverts = 0;
return PMIX_SUCCESS;
}
@ -1098,14 +1042,6 @@ static pmix_status_t get_vertex(pmix_fabric_t *fabric,
if (0 != rc) {
return PMIX_ERR_RESOURCE_BUSY;
}
/* if fabric data has been updated since the last time
* this was accessed, let them know */
if (fabric->revision != p->revision) {
/* update the revision */
fabric->revision = p->revision;
pmix_atomic_unlock(&p->atomlock);
return PMIX_FABRIC_UPDATED;
}
if (i >= p->nverts) {
pmix_atomic_unlock(&p->atomlock);
return PMIX_ERR_BAD_PARAM;
@ -1140,12 +1076,10 @@ static pmix_status_t get_vertex(pmix_fabric_t *fabric,
static pmix_status_t get_index(pmix_fabric_t *fabric,
pmix_value_t *identifier,
uint32_t *i,
char **nodename)
uint32_t *i)
{
pmix_pnet_fabric_t *ft = (pmix_pnet_fabric_t*)fabric->module;
pnet_plane_t *p = (pnet_plane_t*)ft->payload;
pnet_node_t *node;
pnet_nic_t *nic;
int rc, m;
pmix_status_t ret;
@ -1161,14 +1095,6 @@ static pmix_status_t get_index(pmix_fabric_t *fabric,
if (0 != rc) {
return PMIX_ERR_RESOURCE_BUSY;
}
/* if fabric data has been updated since the last time
* this was accessed, let them know */
if (fabric->revision != p->revision) {
/* update the revision */
fabric->revision = p->revision;
pmix_atomic_unlock(&p->atomlock);
return PMIX_FABRIC_UPDATED;
}
/* see what they gave us */
if (PMIX_DATA_ARRAY == identifier->type) {
@ -1194,8 +1120,6 @@ static pmix_status_t get_index(pmix_fabric_t *fabric,
}
if (0 == strcmp(nc, nic->name)) {
*i = m;
node = (pnet_node_t*)nic->node;
*nodename = strdup(node->name);
ret = PMIX_SUCCESS;
goto cleanup;
}
@ -1205,13 +1129,6 @@ static pmix_status_t get_index(pmix_fabric_t *fabric,
/* they gave us the vertex number - in our case,
* that is the NIC id */
*i = identifier->data.uint32;
nic = (pnet_nic_t*)pmix_pointer_array_get_item(&mynics, *i);
if (NULL == nic) {
ret = PMIX_ERR_NOT_FOUND;
goto cleanup;
}
node = (pnet_node_t*)nic->node;
*nodename = strdup(node->name);
ret = PMIX_SUCCESS;
} else {
ret = PMIX_ERR_BAD_PARAM;

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

@ -11,8 +11,8 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -131,7 +131,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
char *p = NULL, *p2, *server_nspace = NULL, *rendfile = NULL;
int sd, rc;
size_t n;
char myhost[PMIX_MAXHOSTNAMELEN];
char myhost[PMIX_MAXHOSTNAMELEN] = {0};
bool system_level = false;
bool system_level_only = false;
bool reconnect = false;
@ -416,7 +416,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
/* mark that we are using the V2 protocol */
pmix_globals.mypeer->protocol = PMIX_PROTOCOL_V2;
gethostname(myhost, sizeof(myhost));
gethostname(myhost, sizeof(myhost)-1);
/* if we were given a URI via MCA param, then look no further */
if (NULL != suri) {
/* if the string starts with "file:", then they are pointing
@ -1354,6 +1354,31 @@ static pmix_status_t recv_connect_ack(int sd, uint8_t myflag)
return PMIX_ERR_UNREACH;
}
}
#if defined(TCP_NODELAY)
int optval;
optval = 1;
if (setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char *)&optval, sizeof(optval)) < 0) {
opal_backtrace_print(stderr, NULL, 1);
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
"[%s:%d] setsockopt(TCP_NODELAY) failed: %s (%d)",
__FILE__, __LINE__,
strerror(pmix_socket_errno),
pmix_socket_errno);
}
#endif
#if defined(SO_NOSIGPIPE)
/* Some BSD flavors generate EPIPE when we write to a disconnected peer. We need
* the prevent this signal to be able to trap socket shutdown and cleanly release
* the endpoint.
*/
int optval2 = 1;
if (setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, (char *)&optval2, sizeof(optval2)) < 0) {
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
"[%s:%d] setsockopt(SO_NOSIGPIPE) failed: %s (%d)",
__FILE__, __LINE__,
strerror(pmix_socket_errno), pmix_socket_errno);
}
#endif
return PMIX_SUCCESS;
}

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

@ -376,8 +376,8 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
bool session_tool = false;
bool system_tool = false;
pmix_socklen_t addrlen;
char *prefix, myhost[PMIX_MAXHOSTNAMELEN];
char myconnhost[PMIX_MAXHOSTNAMELEN];
char *prefix, myhost[PMIX_MAXHOSTNAMELEN] = {0};
char myconnhost[PMIX_MAXHOSTNAMELEN] = {0};
int myport;
pmix_kval_t *urikv;
@ -643,17 +643,17 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
goto sockerror;
}
gethostname(myhost, sizeof(myhost));
gethostname(myhost, sizeof(myhost)-1);
if (AF_INET == mca_ptl_tcp_component.connection.ss_family) {
prefix = "tcp4://";
myport = ntohs(((struct sockaddr_in*) &mca_ptl_tcp_component.connection)->sin_port);
inet_ntop(AF_INET, &((struct sockaddr_in*) &mca_ptl_tcp_component.connection)->sin_addr,
myconnhost, PMIX_MAXHOSTNAMELEN);
myconnhost, PMIX_MAXHOSTNAMELEN-1);
} else if (AF_INET6 == mca_ptl_tcp_component.connection.ss_family) {
prefix = "tcp6://";
myport = ntohs(((struct sockaddr_in6*) &mca_ptl_tcp_component.connection)->sin6_port);
inet_ntop(AF_INET6, &((struct sockaddr_in6*) &mca_ptl_tcp_component.connection)->sin6_addr,
myconnhost, PMIX_MAXHOSTNAMELEN);
myconnhost, PMIX_MAXHOSTNAMELEN-1);
} else {
goto sockerror;
}

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

@ -103,7 +103,7 @@ int pmix_rte_init(pmix_proc_type_t type,
int ret, debug_level;
char *error = NULL, *evar;
size_t n;
char hostname[PMIX_MAXHOSTNAMELEN];
char hostname[PMIX_MAXHOSTNAMELEN] = {0};
if( ++pmix_initialized != 1 ) {
if( pmix_initialized < 1 ) {
@ -164,7 +164,7 @@ int pmix_rte_init(pmix_proc_type_t type,
}
/* setup the globals structure */
gethostname(hostname, PMIX_MAXHOSTNAMELEN);
gethostname(hostname, PMIX_MAXHOSTNAMELEN-1);
pmix_globals.hostname = strdup(hostname);
pmix_globals.pid = getpid();
memset(&pmix_globals.myid.nspace, 0, PMIX_MAX_NSLEN+1);

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

@ -63,6 +63,11 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_fabric(pmix_fabric_t *fabric,
pmix_pnet_base_active_module_t *active;
pmix_status_t rc;
/* ensure our fields of the fabric object are initialized */
fabric->commcost = NULL;
fabric->nverts = 0;
fabric->module = NULL;
PMIX_ACQUIRE_THREAD(&pmix_pnet_globals.lock);
if (0 == pmix_list_get_size(&pmix_pnet_globals.actives)) {
@ -108,50 +113,6 @@ PMIX_EXPORT pmix_status_t PMIx_server_deregister_fabric(pmix_fabric_t *fabric)
return rc;
}
PMIX_EXPORT pmix_status_t PMIx_server_get_num_vertices(pmix_fabric_t *fabric,
uint32_t *nverts)
{
pmix_status_t ret;
pmix_pnet_fabric_t *ft;
pmix_pnet_module_t *module;
if (NULL == fabric || NULL == fabric->module) {
return PMIX_ERR_BAD_PARAM;
}
ft = (pmix_pnet_fabric_t*)fabric->module;
module = (pmix_pnet_module_t*)ft->module;
if (NULL == module->get_num_vertices) {
return PMIX_ERR_NOT_SUPPORTED;
}
ret = module->get_num_vertices(fabric, nverts);
return ret;
}
PMIX_EXPORT pmix_status_t PMIx_server_get_comm_cost(pmix_fabric_t *fabric,
uint32_t src, uint32_t dest,
uint16_t *cost)
{
pmix_status_t ret;
pmix_pnet_fabric_t *ft;
pmix_pnet_module_t *module;
if (NULL == fabric || NULL == fabric->module) {
return PMIX_ERR_BAD_PARAM;
}
ft = (pmix_pnet_fabric_t*)fabric->module;
module = (pmix_pnet_module_t*)ft->module;
if (NULL == module->get_cost) {
return PMIX_ERR_NOT_SUPPORTED;
}
ret = module->get_cost(fabric, src, dest, cost);
return ret;
}
PMIX_EXPORT pmix_status_t PMIx_server_get_vertex_info(pmix_fabric_t *fabric,
uint32_t i, pmix_value_t *vertex,
char **nodename)
@ -176,8 +137,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_get_vertex_info(pmix_fabric_t *fabric,
}
PMIX_EXPORT pmix_status_t PMIx_server_get_index(pmix_fabric_t *fabric,
pmix_value_t *vertex, uint32_t *i,
char **nodename)
pmix_value_t *vertex, uint32_t *i)
{
pmix_status_t ret;
pmix_pnet_fabric_t *ft;
@ -193,7 +153,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_get_index(pmix_fabric_t *fabric,
return PMIX_ERR_NOT_SUPPORTED;
}
ret = module->get_index(fabric, vertex, i, nodename);
ret = module->get_index(fabric, vertex, i);
return ret;
}

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

@ -918,10 +918,15 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd,
/* see if we are to collect data or enforce a timeout - we don't internally care
* about any other directives */
for (n=0; n < ninfo; n++) {
if (0 == strcmp(info[n].key, PMIX_COLLECT_DATA)) {
collect_data = true;
} else if (0 == strncmp(info[n].key, PMIX_TIMEOUT, PMIX_MAX_KEYLEN)) {
tv.tv_sec = info[n].value.data.uint32;
if (PMIX_CHECK_KEY(&info[n], PMIX_COLLECT_DATA)) {
collect_data = PMIX_INFO_TRUE(&info[n]);
} else if (PMIX_CHECK_KEY(&info[n], PMIX_TIMEOUT)) {
PMIX_VALUE_GET_NUMBER(rc, &info[n].value, tv.tv_sec, uint32_t);
if (PMIX_SUCCESS != rc) {
PMIX_PROC_FREE(procs, nprocs);
PMIX_INFO_FREE(info, ninfo);
return rc;
}
}
}
}
@ -3087,7 +3092,7 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer,
cnt = 0; // track how many infos are cleanup related
for (n=0; n < cd->ninfo; n++) {
if (0 == strncmp(cd->info[n].key, PMIX_REGISTER_CLEANUP, PMIX_MAX_KEYLEN)) {
if (PMIX_CHECK_KEY(&cd->info[n], PMIX_REGISTER_CLEANUP)) {
++cnt;
if (PMIX_STRING != cd->info[n].value.type ||
NULL == cd->info[n].value.data.string) {
@ -3103,7 +3108,7 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer,
}
cf->path = strdup(cd->info[n].value.data.string);
pmix_list_append(&cachefiles, &cf->super);
} else if (0 == strncmp(cd->info[n].key, PMIX_REGISTER_CLEANUP_DIR, PMIX_MAX_KEYLEN)) {
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_REGISTER_CLEANUP_DIR)) {
++cnt;
if (PMIX_STRING != cd->info[n].value.type ||
NULL == cd->info[n].value.data.string) {
@ -3119,10 +3124,10 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer,
}
cdir->path = strdup(cd->info[n].value.data.string);
pmix_list_append(&cachedirs, &cdir->super);
} else if (0 == strncmp(cd->info[n].key, PMIX_CLEANUP_RECURSIVE, PMIX_MAX_KEYLEN)) {
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_CLEANUP_RECURSIVE)) {
recurse = PMIX_INFO_TRUE(&cd->info[n]);
++cnt;
} else if (0 == strncmp(cd->info[n].key, PMIX_CLEANUP_IGNORE, PMIX_MAX_KEYLEN)) {
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_CLEANUP_IGNORE)) {
if (PMIX_STRING != cd->info[n].value.type ||
NULL == cd->info[n].value.data.string) {
/* return an error */
@ -3138,7 +3143,7 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer,
cf->path = strdup(cd->info[n].value.data.string);
pmix_list_append(&ignorefiles, &cf->super);
++cnt;
} else if (0 == strncmp(cd->info[n].key, PMIX_CLEANUP_LEAVE_TOPDIR, PMIX_MAX_KEYLEN)) {
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_CLEANUP_LEAVE_TOPDIR)) {
leave_topdir = PMIX_INFO_TRUE(&cd->info[n]);
++cnt;
}
@ -3556,8 +3561,7 @@ pmix_status_t pmix_server_iofreg(pmix_peer_t *peer,
continue;
}
/* do we already have this source for this peer? */
if (0 == strncmp(cd->procs[n].nspace, req->pname.nspace, PMIX_MAX_NSLEN) &&
(PMIX_RANK_WILDCARD == req->pname.rank || cd->procs[n].rank == req->pname.rank)) {
if (PMIX_CHECK_PROCID(&cd->procs[n], &req->pname)) {
match = true;
if ((req->channels & cd->channels) != cd->channels) {
/* this is a channel update */

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

@ -13,7 +13,7 @@
# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# Copyright (c) 2017-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -30,7 +30,7 @@ headers += \
threads/threads.h \
threads/tsd.h \
threads/wait_sync.h \
threads/thread_usage.h
threads/thread_usage.h
sources += \
threads/mutex.c \

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

@ -26,7 +26,7 @@
#if !defined(PMIX_THREAD_USAGE_H)
#define PMIX_THREAD_USAGE_H
#include "pmix_config.h"
#include "src/include/pmix_config.h"
#include "src/atomics/sys/atomic.h"
#include "src/include/prefetch.h"

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

@ -818,7 +818,7 @@ pmix_status_t pmix_tool_init_info(void)
pmix_kval_t *kptr;
pmix_status_t rc;
pmix_proc_t wildcard;
char hostname[PMIX_MAX_NSLEN];
char hostname[PMIX_MAXHOSTNAMELEN] = {0};
pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
wildcard.rank = PMIX_RANK_WILDCARD;
@ -1056,9 +1056,9 @@ pmix_status_t pmix_tool_init_info(void)
/* hostname */
if (NULL != pmix_globals.hostname) {
pmix_strncpy(hostname, pmix_globals.hostname, PMIX_MAX_NSLEN);
pmix_strncpy(hostname, pmix_globals.hostname, PMIX_MAXHOSTNAMELEN);
} else {
gethostname(hostname, PMIX_MAX_NSLEN);
gethostname(hostname, PMIX_MAXHOSTNAMELEN-1);
}
kptr = PMIX_NEW(pmix_kval_t);
kptr->key = strdup(PMIX_HOSTNAME);

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

@ -125,7 +125,7 @@ PMIX_CLASS_INSTANCE(pmix_output_stream_t, pmix_object_t, construct, destruct);
bool pmix_output_init(void)
{
int i;
char hostname[PMIX_MAXHOSTNAMELEN];
char hostname[PMIX_MAXHOSTNAMELEN] = {0};
char *str;
if (initialized) {
@ -176,7 +176,7 @@ bool pmix_output_init(void)
} else {
verbose.lds_want_stderr = true;
}
gethostname(hostname, sizeof(hostname));
gethostname(hostname, sizeof(hostname)-1);
hostname[sizeof(hostname)-1] = '\0';
if (0 > asprintf(&verbose.lds_prefix, "[%s:%05d] ", hostname, getpid())) {
return PMIX_ERR_NOMEM;
@ -256,7 +256,7 @@ bool pmix_output_switch(int output_id, bool enable)
void pmix_output_reopen_all(void)
{
char *str;
char hostname[PMIX_MAXHOSTNAMELEN];
char hostname[PMIX_MAXHOSTNAMELEN] = {0};
str = getenv("PMIX_OUTPUT_STDERR_FD");
if (NULL != str) {

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

@ -12,8 +12,10 @@
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -30,10 +32,12 @@
#include <string.h>
#include "src/util/printf.h"
#include "src/util/error.h"
#include "src/util/argv.h"
#include "src/util/pmix_environ.h"
#define PMIX_DEFAULT_TMPDIR "/tmp"
#define PMIX_MAX_ENVAR_LENGTH 100000
/*
* Merge two environ-like char arrays, ensuring that there are no
@ -74,7 +78,7 @@ char **pmix_environ_merge(char **minor, char **major)
pmix_setenv(minor[i], NULL, false, &ret);
} else {
/* strdup minor[i] in case it's a constat string */
/* strdup minor[i] in case it's a constant string */
name = strdup(minor[i]);
value = name + (value - minor[i]);
@ -99,9 +103,60 @@ char **pmix_environ_merge(char **minor, char **major)
int i;
char *newvalue, *compare;
size_t len;
bool valid;
/* Check the bozo case */
if( NULL == env ) {
return PMIX_ERR_BAD_PARAM;
}
if (NULL != value) {
/* check the string for unacceptable length - i.e., ensure
* it is NULL-terminated */
valid = false;
for (i=0; i < PMIX_MAX_ENVAR_LENGTH; i++) {
if ('\0' == value[i]) {
valid = true;
break;
}
}
if (!valid) {
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return PMIX_ERR_BAD_PARAM;
}
}
/* If this is the "environ" array, use putenv or setenv */
if (*env == environ) {
/* THIS IS POTENTIALLY A MEMORY LEAK! But I am doing it
because so that we don't violate the law of least
astonishmet for PMIX developers (i.e., those that don't
check the return code of pmix_setenv() and notice that we
returned an error if you passed in the real environ) */
#if defined (HAVE_SETENV)
if (NULL == value) {
/* this is actually an unsetenv request */
unsetenv(name);
} else {
setenv(name, value, overwrite);
}
#else
/* Make the new value */
if (NULL == value) {
i = asprintf(&newvalue, "%s=", name);
} else {
i = asprintf(&newvalue, "%s=%s", name, value);
}
if (NULL == newvalue || 0 > i) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
putenv(newvalue);
/* cannot free it as putenv doesn't copy the value */
#endif
return PMIX_SUCCESS;
}
/* Make the new value */
if (NULL == value) {
i = asprintf(&newvalue, "%s=", name);
} else {
@ -111,28 +166,13 @@ char **pmix_environ_merge(char **minor, char **major)
return PMIX_ERR_OUT_OF_RESOURCE;
}
/* Check the bozo case */
if( NULL == env ) {
return PMIX_ERR_BAD_PARAM;
} else if (NULL == *env) {
if (NULL == *env) {
i = 0;
pmix_argv_append(&i, env, newvalue);
free(newvalue);
return PMIX_SUCCESS;
}
/* If this is the "environ" array, use putenv */
if( *env == environ ) {
/* THIS IS POTENTIALLY A MEMORY LEAK! But I am doing it
because so that we don't violate the law of least
astonishmet for PMIX developers (i.e., those that don't
check the return code of pmix_setenv() and notice that we
returned an error if you passed in the real environ) */
putenv(newvalue);
return PMIX_SUCCESS;
}
/* Make something easy to compare to */
i = asprintf(&compare, "%s=", name);

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

@ -105,7 +105,7 @@ void cli_disconnect(cli_info_t *cli)
}
if( NULL == cli->ev ){
TEST_ERROR(("Bad ev = NULL of rank = %d ", cli->sd, cli_rank(cli)));
TEST_ERROR(("Bad ev = NULL of rank = %d ", cli_rank(cli)));
test_abort = true;
} else {
TEST_VERBOSE(("remove event of rank %d from event queue", cli_rank(cli)));

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

@ -25,7 +25,8 @@ headers = simptest.h
noinst_PROGRAMS = simptest simpclient simppub simpdyn simpft simpdmodex \
test_pmix simptool simpdie simplegacy simptimeout \
gwtest gwclient stability quietclient simpjctrl simpio simpsched
gwtest gwclient stability quietclient simpjctrl simpio simpsched \
simpcoord
simptest_SOURCES = \
simptest.c
@ -134,3 +135,9 @@ simpsched_SOURCES = \
simpsched_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
simpsched_LDADD = \
$(top_builddir)/src/libpmix.la
simpcoord_SOURCES = \
simpcoord.c
simpcoord_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
simpcoord_LDADD = \
$(top_builddir)/src/libpmix.la

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

@ -13,7 +13,7 @@
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.

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

@ -0,0 +1,426 @@
/*
* 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-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include <src/include/pmix_config.h>
#include <pmix.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include "src/class/pmix_object.h"
#include "src/util/output.h"
#include "src/util/printf.h"
#define MAXCNT 1
static volatile bool completed = false;
static pmix_proc_t myproc;
static void notification_fn(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, "Client %s:%d NOTIFIED with status %s", myproc.nspace, myproc.rank, PMIx_Error_string(status));
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata);
}
completed = true;
}
static void errhandler_reg_callbk(pmix_status_t status,
size_t errhandler_ref,
void *cbdata)
{
volatile bool *active = (volatile bool*)cbdata;
pmix_output(0, "Client: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu",
status, (unsigned long)errhandler_ref);
*active = false;
}
static void opcbfunc(pmix_status_t status, void *cbdata)
{
volatile bool *active = (volatile bool*)cbdata;
*active = false;
}
/* this is an event notification function that we explicitly request
* be called when the PMIX_MODEL_DECLARED notification is issued.
* We could catch it in the general event notification function and test
* the status to see if the status matched, but it often is simpler
* to declare a use-specific notification callback point. In this case,
* we are asking to know whenever a model is declared as a means
* of testing server self-notification */
static void model_callback(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)
{
size_t n;
/* just let us know it was received */
fprintf(stderr, "%s:%d Model event handler called with status %d(%s)\n",
myproc.nspace, myproc.rank, status, PMIx_Error_string(status));
for (n=0; n < ninfo; n++) {
if (PMIX_STRING == info[n].value.type) {
fprintf(stderr, "%s:%d\t%s:\t%s\n",
myproc.nspace, myproc.rank,
info[n].key, info[n].value.data.string);
}
}
/* we must NOT tell the event handler state machine that we
* are the last step as that will prevent it from notifying
* anyone else that might be listening for declarations */
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata);
}
}
/* event handler registration is done asynchronously */
static void model_registration_callback(pmix_status_t status,
size_t evhandler_ref,
void *cbdata)
{
volatile bool *active = (volatile bool*)cbdata;
fprintf(stderr, "simpclient EVENT HANDLER REGISTRATION RETURN STATUS %d, ref=%lu\n",
status, (unsigned long)evhandler_ref);
*active = false;
}
int main(int argc, char **argv)
{
int rc;
pmix_value_t value;
pmix_value_t *val = &value;
char *tmp;
pmix_proc_t proc;
uint32_t nprocs, n, *u32;
int cnt, j;
bool doabort = false;
volatile bool active;
pmix_info_t info, *iptr;
size_t ninfo, m;
pmix_status_t code;
pmix_coord_t *coords;
if (1 < argc) {
if (0 == strcmp("-abort", argv[1])) {
doabort = true;
}
}
/* init us and declare we are a test programming model */
PMIX_INFO_CREATE(iptr, 2);
PMIX_INFO_LOAD(&iptr[0], PMIX_PROGRAMMING_MODEL, "TEST", PMIX_STRING);
PMIX_INFO_LOAD(&iptr[1], PMIX_MODEL_LIBRARY_NAME, "PMIX", PMIX_STRING);
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, iptr, 2))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Init failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
exit(rc);
}
PMIX_INFO_FREE(iptr, 2);
pmix_output(0, "Client ns %s rank %d: Running", myproc.nspace, myproc.rank);
/* test something */
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Get failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
exit(rc);
}
PMIX_VALUE_RELEASE(val);
/* test something */
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_SERVER_URI, NULL, 0, &val))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Get failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
exit(rc);
}
pmix_output(0, "CLIENT SERVER URI: %s", val->data.string);
PMIX_VALUE_RELEASE(val);
/* register a handler specifically for when models declare */
active = true;
ninfo = 1;
PMIX_INFO_CREATE(iptr, ninfo);
PMIX_INFO_LOAD(&iptr[0], PMIX_EVENT_HDLR_NAME, "SIMPCLIENT-MODEL", PMIX_STRING);
code = PMIX_MODEL_DECLARED;
PMIx_Register_event_handler(&code, 1, iptr, ninfo,
model_callback, model_registration_callback, (void*)&active);
while (active) {
usleep(10);
}
PMIX_INFO_FREE(iptr, ninfo);
/* register our errhandler */
active = true;
PMIx_Register_event_handler(NULL, 0, NULL, 0,
notification_fn, errhandler_reg_callbk, (void*)&active);
while (active) {
usleep(10);
}
/* get our universe size */
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
goto done;
}
nprocs = val->data.uint32;
PMIX_VALUE_RELEASE(val);
pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs);
/* get our assigned network endpts */
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_NETWORK_ENDPT, NULL, 0, &val))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Get network endpt failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
goto done;
}
pmix_output(0, "Client %s:%d was assigned %lu endpts",
myproc.nspace, myproc.rank,
(unsigned long)val->data.darray->size);
u32 = (uint32_t*)val->data.darray->array;
ninfo = val->data.darray->size;
{
char **foo = NULL;
for (n=0; n < ninfo; n++) {
asprintf(&tmp, "%d", u32[n]);
pmix_argv_append_nosize(&foo, tmp);
free(tmp);
}
tmp = pmix_argv_join(foo, ',');
pmix_argv_free(foo);
pmix_output(0, "ASSIGNED ENDPTS: %s", tmp);
free(tmp);
}
/* get our assigned network coordinates */
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_NETWORK_COORDINATE, NULL, 0, &val))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Get network endpt failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
goto done;
}
pmix_output(0, "Client %s:%d was assigned %lu coordinates",
myproc.nspace, myproc.rank,
(unsigned long)val->data.darray->size);
coords = (pmix_coord_t*)val->data.darray->array;
ninfo = val->data.darray->size;
for (m=0; m < ninfo; m++) {
char **foo = NULL;
char *view;
for (n=0; n < coords[m].dims; n++) {
asprintf(&tmp, "%d", coords[m].coord[n]);
pmix_argv_append_nosize(&foo, tmp);
free(tmp);
}
tmp = pmix_argv_join(foo, ',');
pmix_argv_free(foo);
if (PMIX_COORD_LOGICAL_VIEW == coords[m].view) {
view = "LOGICAL";
} else {
view = "PHYSICAL";
}
pmix_output(0, "COORD[%d] VIEW %s: %s", (int)m, view, tmp);
free(tmp);
}
/* put a few values */
(void)asprintf(&tmp, "%s-%d-internal", myproc.nspace, myproc.rank);
value.type = PMIX_UINT32;
value.data.uint32 = 1234;
if (PMIX_SUCCESS != (rc = PMIx_Store_internal(&myproc, tmp, &value))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Store_internal failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
goto done;
}
for (cnt=0; cnt < MAXCNT; cnt++) {
(void)asprintf(&tmp, "%s-%d-local-%d", myproc.nspace, myproc.rank, cnt);
value.type = PMIX_UINT64;
value.data.uint64 = 1234;
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_LOCAL, tmp, &value))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Put internal failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
goto done;
}
(void)asprintf(&tmp, "%s-%d-remote-%d", myproc.nspace, myproc.rank, cnt);
value.type = PMIX_STRING;
value.data.string = "1234";
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, tmp, &value))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Put internal failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
goto done;
}
if (PMIX_SUCCESS != (rc = PMIx_Commit())) {
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Commit failed: %s",
myproc.nspace, myproc.rank, cnt, PMIx_Error_string(rc));
goto done;
}
/* call fence to ensure the data is received */
PMIX_PROC_CONSTRUCT(&proc);
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) {
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Fence failed: %s",
myproc.nspace, myproc.rank, cnt, PMIx_Error_string(rc));
goto done;
}
/* check the returned data */
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
for (j=0; j <= cnt; j++) {
for (n=0; n < nprocs; n++) {
proc.rank = n;
(void)asprintf(&tmp, "%s-%d-local-%d", myproc.nspace, n, j);
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) {
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed: %s",
myproc.nspace, myproc.rank, j, tmp, PMIx_Error_string(rc));
continue;
}
if (NULL == val) {
pmix_output(0, "Client ns %s rank %d: NULL value returned",
myproc.nspace, myproc.rank);
break;
}
if (PMIX_UINT64 != val->type) {
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong type: %d", myproc.nspace, myproc.rank, j, tmp, val->type);
PMIX_VALUE_RELEASE(val);
free(tmp);
continue;
}
if (1234 != val->data.uint64) {
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong value: %d", myproc.nspace, myproc.rank, j, tmp, (int)val->data.uint64);
PMIX_VALUE_RELEASE(val);
free(tmp);
continue;
}
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned correct", myproc.nspace, myproc.rank, j, tmp);
PMIX_VALUE_RELEASE(val);
free(tmp);
if (n != myproc.rank) {
(void)asprintf(&tmp, "%s-%d-remote-%d", proc.nspace, n, j);
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) {
/* this data should _not_ be found as we are on the same node
* and the data was "put" with a PMIX_REMOTE scope */
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned correct", myproc.nspace, myproc.rank, j, tmp);
continue;
}
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned remote data for a local proc",
myproc.nspace, myproc.rank, j, tmp);
PMIX_VALUE_RELEASE(val);
free(tmp);
}
}
}
}
/* now get the data blob for myself */
pmix_output(0, "Client ns %s rank %d testing internal modex blob",
myproc.nspace, myproc.rank);
if (PMIX_SUCCESS == (rc = PMIx_Get(&myproc, NULL, NULL, 0, &val))) {
if (PMIX_DATA_ARRAY != val->type) {
pmix_output(0, "Client ns %s rank %d did not return an array for its internal modex blob",
myproc.nspace, myproc.rank);
PMIX_VALUE_RELEASE(val);
} else if (PMIX_INFO != val->data.darray->type) {
pmix_output(0, "Client ns %s rank %d returned an internal modex array of type %s instead of PMIX_INFO",
myproc.nspace, myproc.rank, PMIx_Data_type_string(val->data.darray->type));
PMIX_VALUE_RELEASE(val);
} else if (0 == val->data.darray->size) {
pmix_output(0, "Client ns %s rank %d returned an internal modex array of zero length",
myproc.nspace, myproc.rank);
PMIX_VALUE_RELEASE(val);
} else {
pmix_info_t *iptr = (pmix_info_t*)val->data.darray->array;
for (n=0; n < val->data.darray->size; n++) {
pmix_output(0, "\tKey: %s", iptr[n].key);
}
PMIX_VALUE_RELEASE(val);
}
} else {
pmix_output(0, "Client ns %s rank %d internal modex blob FAILED with error %s(%d)",
myproc.nspace, myproc.rank, PMIx_Error_string(rc), rc);
}
/* log something */
PMIX_INFO_CONSTRUCT(&info);
PMIX_INFO_LOAD(&info, PMIX_LOG_STDERR, "test log msg", PMIX_STRING);
active = true;
rc = PMIx_Log_nb(&info, 1, NULL, 0, opcbfunc, (void*)&active);
if (PMIX_SUCCESS != rc) {
pmix_output(0, "Client ns %s rank %d - log_nb returned %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
} else {
while (active) {
usleep(10);
}
}
PMIX_INFO_DESTRUCT(&info);
/* if requested and our rank is 0, call abort */
if (doabort) {
if (0 == myproc.rank) {
PMIx_Abort(PMIX_ERR_PROC_REQUESTED_ABORT, "CALLING ABORT", NULL, 0);
} else {
while(!completed) {
usleep(10);
}
}
}
done:
/* finalize us */
pmix_output(0, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %s\n",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
} else {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);
}
fflush(stderr);
return(rc);
}

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

@ -76,14 +76,11 @@ static void setup_cbfunc(pmix_status_t status,
mycaddy_t *mq = (mycaddy_t*)provided_cbdata;
size_t n;
/* print out what came back */
pmix_output(0, "SETUP_APP RETURNED %d INFO", (int)ninfo);
/* transfer it to the caddy for return to the main thread */
if (0 < ninfo) {
PMIX_INFO_CREATE(mq->info, ninfo);
mq->ninfo = ninfo;
for (n=0; n < ninfo; n++) {
fprintf(stderr, "Key %s Type %s(%d)\n", info[n].key, PMIx_Data_type_string(info[n].value.type), info[n].value.type);
PMIX_INFO_XFER(&mq->info[n], &info[n]);
}
}
@ -102,8 +99,7 @@ int main(int argc, char **argv)
pmix_info_t *info, *iptr;
pmix_status_t rc;
pmix_fabric_t myfabric;
uint32_t nverts, n32, m32;
uint16_t cost;
uint32_t n32, m32;
pmix_value_t val;
size_t ninfo;
int exit_code=0;
@ -120,7 +116,11 @@ int main(int argc, char **argv)
exit(1);
}
fprintf(stderr, "Testing version %s\n", PMIx_Get_version());
fprintf(stderr, "PID: %lu Testing version %s\n", (unsigned long)getpid(), PMIx_Get_version());
/* set a known network configuration for the pnet/test component */
putenv("PMIX_MCA_pnet_test_nverts=nodes:5;plane:d:3");
putenv("PMIX_MCA_pnet=test");
ninfo = 1;
PMIX_INFO_CREATE(info, ninfo);
@ -138,24 +138,17 @@ int main(int argc, char **argv)
goto cleanup;
}
/* get the number of vertices in the fabric */
rc = PMIx_server_get_num_vertices(&myfabric, &nverts);
if (PMIX_SUCCESS != rc) {
fprintf(stderr, "Fabric get_num_vertices failed with error: %s\n", PMIx_Error_string(rc));
goto cleanup;
}
fprintf(stderr, "Number of fabric vertices: %u\n", nverts);
fprintf(stderr, "Number of fabric vertices: %u\n", myfabric.nverts);
for (n32=0; n32 < nverts; n32++) {
for (n32=0; n32 < myfabric.nverts; n32++) {
fprintf(stderr, "%u:", n32);
for (m32=0; m32 < nverts; m32++) {
rc = PMIx_server_get_comm_cost(&myfabric, n32, m32, &cost);
fprintf(stderr, " %u", cost);
for (m32=0; m32 < myfabric.nverts; m32++) {
fprintf(stderr, " %u", myfabric.commcost[n32][m32]);
}
fprintf(stderr, "\n");
}
rc = PMIx_server_get_vertex_info(&myfabric, nverts/2, &val, &nodename);
rc = PMIx_server_get_vertex_info(&myfabric, myfabric.nverts/2, &val, &nodename);
if (PMIX_SUCCESS != rc) {
fprintf(stderr, "Fabric get vertex info failed with error: %s\n", PMIx_Error_string(rc));
goto cleanup;
@ -164,7 +157,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Fabric get vertex info returned wrong type: %s\n", PMIx_Data_type_string(val.type));
goto cleanup;
}
fprintf(stderr, "Vertex info for index %u on node %s:\n", nverts/2, nodename);
fprintf(stderr, "Vertex info for index %u on node %s:\n", myfabric.nverts/2, nodename);
info = (pmix_info_t*)val.data.darray->array;
for (n=0; n < val.data.darray->size; n++) {
fprintf(stderr, "\t%s:\t%s\n", info[n].key, info[n].value.data.string);
@ -177,12 +170,12 @@ int main(int argc, char **argv)
val.type = PMIX_DATA_ARRAY;
PMIX_DATA_ARRAY_CREATE(val.data.darray, 1, PMIX_INFO);
val.data.darray->array = info;
rc = PMIx_server_get_index(&myfabric, &val, &n32, &nodename);
rc = PMIx_server_get_index(&myfabric, &val, &n32);
if (PMIX_SUCCESS != rc) {
fprintf(stderr, "Fabric get index failed with error: %s\n", PMIx_Error_string(rc));
goto cleanup;
}
fprintf(stderr, "Index %u on host %s\n", n32, nodename);
fprintf(stderr, "Index %u for NIC %s\n", n32, "test002:nic002");
/* setup an application */
PMIX_INFO_CREATE(iptr, 4);
@ -217,7 +210,7 @@ int main(int argc, char **argv)
/* setup the local subsystem */
DEBUG_CONSTRUCT_LOCK(&lock);
if (PMIX_SUCCESS != (rc = PMIx_server_setup_local_support("SIMPSCHED", cd.info, cd.ninfo,
if (PMIX_SUCCESS != (rc = PMIx_server_setup_local_support("SIMPSCHED", cd.info, cd.ninfo,
local_cbfunc, &lock))) {
pmix_output(0, "[%s:%d] PMIx_server_setup_local_support failed: %s", __FILE__, __LINE__, PMIx_Error_string(rc));
DEBUG_DESTRUCT_LOCK(&lock);

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

@ -198,6 +198,8 @@ static pmix_event_t handler;
static pmix_list_t children;
static bool istimeouttest = false;
static mylock_t globallock;
static bool nettest = false;
static bool arrays = false;
static void set_namespace(int nprocs, char *ranks, char *nspace,
pmix_op_cbfunc_t cbfunc, myxfer_t *x);
@ -229,8 +231,6 @@ static void dlcbfunc(int sd, short flags, void *cbdata)
{
myxfer_t *x = (myxfer_t*)cbdata;
pmix_output(0, "INVENTORY READY FOR DELIVERY");
PMIx_server_deliver_inventory(x->info, x->ninfo, NULL, 0, opcbfunc, (void*)x);
}
@ -244,8 +244,6 @@ static void infocbfunc(pmix_status_t status,
myxfer_t *x;
size_t n;
pmix_output(0, "INVENTORY RECEIVED");
/* we don't have any place to send this, so for test
* purposes only, let's push it back down for processing.
* Note: it must be thread-shifted first as we are in
@ -266,6 +264,32 @@ static void infocbfunc(pmix_status_t status,
DEBUG_WAKEUP_THREAD(lock);
}
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 *x = (myxfer_t*)provided_cbdata;
size_t n;
/* transfer it to the caddy for return to the main thread */
if (0 < ninfo) {
PMIX_INFO_CREATE(x->info, ninfo);
x->ninfo = ninfo;
for (n=0; n < ninfo; n++) {
PMIX_INFO_XFER(&x->info[n], &info[n]);
}
}
/* let the library release the data and cleanup from
* the operation */
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
DEBUG_WAKEUP_THREAD(&x->lock);
}
/* this is an event notification function that we explicitly request
* be called when the PMIX_MODEL_DECLARED notification is issued.
* We could catch it in the general event notification function and test
@ -407,11 +431,25 @@ int main(int argc, char **argv)
fprintf(stderr, " -u Enable legacy usock support\n");
fprintf(stderr, " -hwloc Test hwloc support\n");
fprintf(stderr, " -hwloc-file FILE Use file to import topology\n");
fprintf(stderr, " -net-test Test network endpt assignments\n");
fprintf(stderr, " -arrays Use the job session array to pass registration info\n");
exit(0);
} else if (0 == strcmp("-net-test", argv[n]) ||
0 == strcmp("--net-test", argv[n])) {
/* test network support */
nettest = true;
} else if (0 == strcmp("-arrays", argv[n]) ||
0 == strcmp("--arrays", argv[n])) {
/* test network support */
arrays = true;
}
}
if (NULL == executable) {
executable = strdup("./simpclient");
if (nettest) {
executable = strdup("./simpcoord");
} else {
executable = strdup("./simpclient");
}
}
/* check for executable existence and permissions */
if (0 != access(executable, X_OK)) {
@ -465,7 +503,7 @@ int main(int argc, char **argv)
PMIX_INFO_CREATE(info, ninfo);
PMIX_INFO_LOAD(&info[0], PMIX_SERVER_TOOL_SUPPORT, NULL, PMIX_BOOL);
PMIX_INFO_LOAD(&info[1], PMIX_SERVER_GATEWAY, NULL, PMIX_BOOL);
PMIX_INFO_LOAD(&info[1], PMIX_SERVER_SCHEDULER, NULL, PMIX_BOOL);
#if PMIX_HAVE_HWLOC
if (hwloc) {
if (NULL != hwloc_file) {
@ -478,11 +516,20 @@ int main(int argc, char **argv)
#endif
}
#endif
if (nettest) {
/* set a known network configuration for the pnet/test component */
putenv("PMIX_MCA_pnet_test_nverts=nodes:5;plane:d:3;plane:s:2;plane:d:5");
putenv("PMIX_MCA_pnet=test");
}
if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, info, ninfo))) {
fprintf(stderr, "Init failed with error %d\n", rc);
return rc;
}
PMIX_INFO_FREE(info, ninfo);
if (nettest) {
unsetenv("PMIX_MCA_pnet");
unsetenv("PMIX_MCA_pnet_test_nverts");
}
/* register the default errhandler */
DEBUG_CONSTRUCT_LOCK(&mylock);
@ -706,18 +753,83 @@ int main(int argc, char **argv)
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];
char *regex, *ppn, *rks;
int n, m, k;
pmix_data_array_t *array;
pmix_info_t *info;
pmix_info_t *info, *iptr, *ip;
myxfer_t cd, lock;
pmix_status_t rc;
gethostname(hostname, sizeof(hostname));
x->ninfo = 16 + nprocs;
if (arrays) {
x->ninfo = 15 + nprocs;
} else {
x->ninfo = 16 + nprocs;
}
PMIX_INFO_CREATE(x->info, x->ninfo);
n = 0;
PMIx_generate_regex("test000,test001,test002", &regex);
PMIx_generate_ppn("0;1;2", &ppn);
if (arrays) {
(void)strncpy(x->info[n].key, PMIX_JOB_INFO_ARRAY, PMIX_MAX_KEYLEN);
x->info[n].value.type = PMIX_DATA_ARRAY;
PMIX_DATA_ARRAY_CREATE(x->info[n].value.data.darray, 2, PMIX_INFO);
iptr = (pmix_info_t*)x->info[n].value.data.darray->array;
(void)strncpy(iptr[0].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN);
iptr[0].value.type = PMIX_STRING;
iptr[0].value.data.string = regex;
(void)strncpy(iptr[1].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN);
iptr[1].value.type = PMIX_STRING;
iptr[1].value.data.string = ppn;
++n;
} else {
(void)strncpy(x->info[n].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN);
x->info[n].value.type = PMIX_STRING;
x->info[n].value.data.string = regex;
++n;
/* if we have some empty nodes, then fill their spots */
(void)strncpy(x->info[n].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN);
x->info[n].value.type = PMIX_STRING;
x->info[n].value.data.string = ppn;
++n;
}
/* we have the required info to run setup_app, so do that now */
PMIX_INFO_CREATE(iptr, 4);
PMIX_INFO_XFER(&iptr[0], &x->info[0]);
PMIX_INFO_XFER(&iptr[1], &x->info[1]);
PMIX_INFO_LOAD(&iptr[2], PMIX_SETUP_APP_ENVARS, NULL, PMIX_BOOL);
PMIX_LOAD_KEY(iptr[3].key, PMIX_ALLOC_NETWORK);
iptr[3].value.type = PMIX_DATA_ARRAY;
PMIX_DATA_ARRAY_CREATE(iptr[3].value.data.darray, 2, PMIX_INFO);
ip = (pmix_info_t*)iptr[3].value.data.darray->array;
asprintf(&rks, "%s.net", nspace);
PMIX_INFO_LOAD(&ip[0], PMIX_ALLOC_NETWORK_ID, rks, PMIX_STRING);
free(rks);
PMIX_INFO_LOAD(&ip[1], PMIX_ALLOC_NETWORK_SEC_KEY, NULL, PMIX_BOOL);
PMIX_CONSTRUCT(&cd, myxfer_t);
if (PMIX_SUCCESS != (rc = PMIx_server_setup_application(nspace, iptr, 4,
setup_cbfunc, &cd))) {
pmix_output(0, "[%s:%d] PMIx_server_setup_application failed: %s", __FILE__, __LINE__, PMIx_Error_string(rc));
DEBUG_DESTRUCT_LOCK(&cd.lock);
} else {
DEBUG_WAIT_THREAD(&cd.lock);
}
/* use the results to setup the local subsystems */
PMIX_CONSTRUCT(&lock, myxfer_t);
if (PMIX_SUCCESS != (rc = PMIx_server_setup_local_support(nspace, cd.info, cd.ninfo,
opcbfunc, &lock))) {
pmix_output(0, "[%s:%d] PMIx_server_setup_local_support failed: %s", __FILE__, __LINE__, PMIx_Error_string(rc));
} else {
DEBUG_WAIT_THREAD(&lock.lock);
}
PMIX_DESTRUCT(&lock);
PMIX_DESTRUCT(&cd);
(void)strncpy(x->info[n].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN);
x->info[n].value.type = PMIX_UINT32;
x->info[n].value.data.uint32 = nprocs;
@ -738,18 +850,6 @@ static void set_namespace(int nprocs, char *ranks, char *nspace,
x->info[n].value.data.string = strdup(ranks);
++n;
PMIx_generate_regex(hostname, &regex);
(void)strncpy(x->info[n].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN);
x->info[n].value.type = PMIX_STRING;
x->info[n].value.data.string = regex;
++n;
PMIx_generate_ppn(ranks, &ppn);
(void)strncpy(x->info[n].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN);
x->info[n].value.type = PMIX_STRING;
x->info[n].value.data.string = ppn;
++n;
(void)strncpy(x->info[n].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN);
x->info[n].value.type = PMIX_UINT32;
x->info[n].value.data.uint32 = nprocs;
@ -860,8 +960,6 @@ static void errhandler_reg_callbk (pmix_status_t status,
{
mylock_t *lock = (mylock_t*)cbdata;
pmix_output(0, "SERVER: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu",
status, (unsigned long)errhandler_ref);
lock->status = status;
DEBUG_WAKEUP_THREAD(lock);
}
@ -874,8 +972,6 @@ static pmix_status_t connected(const pmix_proc_t *proc, void *server_object,
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 WAKEUP %d",
proc->nspace, proc->rank, wakeup);
return PMIX_OPERATION_SUCCEEDED;
}
@ -951,7 +1047,6 @@ static pmix_status_t fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
{
pmix_shift_caddy_t *scd;
pmix_output(0, "SERVER: FENCENB");
scd = PMIX_NEW(pmix_shift_caddy_t);
scd->status = PMIX_SUCCESS;
scd->data = data;
@ -969,8 +1064,6 @@ static pmix_status_t dmodex_fn(const pmix_proc_t *proc,
{
pmix_shift_caddy_t *scd;
pmix_output(0, "SERVER: DMODEX");
/* if this is a timeout test, then do nothing */
if (istimeouttest) {
return PMIX_SUCCESS;
@ -993,8 +1086,6 @@ static pmix_status_t publish_fn(const pmix_proc_t *proc,
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);
@ -1035,8 +1126,6 @@ static pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys,
pmix_status_t ret = PMIX_ERR_NOT_FOUND;
lkobj_t *lk;
pmix_output(0, "SERVER: LOOKUP");
PMIX_CONSTRUCT(&results, pmix_list_t);
for (n=0; NULL != keys[n]; n++) {
@ -1086,8 +1175,6 @@ static pmix_status_t unpublish_fn(const pmix_proc_t *proc, char **keys,
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)) {
@ -1119,8 +1206,6 @@ static pmix_status_t spawn_fn(const pmix_proc_t *proc,
pmix_proc_t *pptr;
bool spawned;
pmix_output(0, "SERVER: SPAWN");
/* check the job info for parent and spawned keys */
for (n=0; n < ninfo; n++) {
if (0 == strncmp(job_info[n].key, PMIX_PARENT_ID, PMIX_MAX_KEYLEN)) {
@ -1154,8 +1239,6 @@ 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 */
@ -1169,8 +1252,6 @@ 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");
return PMIX_OPERATION_SUCCEEDED;
}
@ -1193,7 +1274,6 @@ static pmix_status_t notify_event(pmix_status_t code,
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_output(0, "SERVER: NOTIFY EVENT");
return PMIX_OPERATION_SUCCEEDED;
}
@ -1222,8 +1302,6 @@ static pmix_status_t query_fn(pmix_proc_t *proct,
pmix_info_t *info;
query_data_t qd;
pmix_output(0, "SERVER: QUERY");
if (NULL == cbfunc) {
return PMIX_ERROR;
}
@ -1251,8 +1329,6 @@ static void tool_connect_fn(pmix_info_t *info, size_t ninfo,
{
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;
@ -1280,8 +1356,6 @@ static void log_fn(const pmix_proc_t *client,
{
mylog_t *lg = (mylog_t *)malloc(sizeof(mylog_t));
pmix_output(0, "SERVER: LOG");
lg->cbfunc = cbfunc;
lg->cbdata = cbdata;
PMIX_THREADSHIFT(lg, foobar);

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

@ -301,9 +301,9 @@ typedef struct {
} \
if (PMIX_SUCCESS == rc) { \
if( PMIX_SUCCESS != cbdata.status ){ \
if( !( (cbdata.status == PMIX_ERR_NOT_FOUND || cbdata.status == PMIX_ERR_PROC_ENTRY_NOT_FOUND) && ok_notfnd ) ){ \
TEST_ERROR(("%s:%d: PMIx_Get_nb failed: %d from %s:%d, key=%s", \
my_nspace, my_rank, rc, my_nspace, r)); \
if( !( (cbdata.status == PMIX_ERR_NOT_FOUND || cbdata.status == PMIX_ERR_PROC_ENTRY_NOT_FOUND) && ok_notfnd ) ){ \
TEST_ERROR(("%s:%d: PMIx_Get_nb failed: %d from %s:%d, key=%s", \
my_nspace, my_rank, rc, my_nspace, r, key)); \
} \
rc = PMIX_ERROR; \
} else if (NULL == val) { \

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -38,7 +38,7 @@ static void timeout_errhandler(size_t evhdlr_registration_id,
void *cbdata)
{
TEST_ERROR(("timeout errhandler called for error status = %d ninfo = %d",
status, ninfo));
status, (int)ninfo));
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata);
}
@ -58,7 +58,7 @@ static void errhandler_reg_callbk1 (pmix_status_t status,
size_t *ref = (size_t*) cbdata;
*ref = errhandler_ref;
TEST_VERBOSE(("PMIX client ERRHANDLER REGISTRATION CALLED WITH STATUS %d, ref=%lu",
status, *ref, (unsigned long)errhandler_ref));
status, (unsigned long)errhandler_ref));
}

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

@ -187,7 +187,7 @@ static void server_unpack_procs(char *buf, size_t size)
char *nspace;
while ((size_t)(ptr - buf) < size) {
ns_count = (size_t)*ptr;
ns_count = *(size_t *)ptr;
ptr += sizeof(size_t);
for (i = 0; i < ns_count; i++) {
@ -195,16 +195,16 @@ static void server_unpack_procs(char *buf, size_t size)
size_t ltasks, ntasks;
int server_id;
server_id = *ptr;
server_id = *(int *)ptr;
ptr += sizeof(int);
nspace = ptr;
ptr += PMIX_MAX_NSLEN+1;
ntasks = (size_t)*ptr;
ntasks = *(size_t *)ptr;
ptr += sizeof(size_t);
ltasks = (size_t)*ptr;
ltasks = *(size_t *)ptr;
ptr += sizeof(size_t);
PMIX_LIST_FOREACH(tmp, server_nspace, server_nspace_t) {
@ -226,7 +226,7 @@ static void server_unpack_procs(char *buf, size_t size)
}
size_t i;
for (i = 0; i < ltasks; i++) {
int rank = (int)*ptr;
int rank = *(int *)ptr;
ptr += sizeof(int);
if (ns_item->task_map[rank] >= 0) {
continue;
@ -505,8 +505,8 @@ static void server_read_cb(int fd, short event, void *arg)
switch(msg_hdr.cmd) {
case CMD_BARRIER_REQUEST:
barrier_cnt++;
TEST_VERBOSE(("CMD_BARRIER_REQ req from %d cnt %d", msg_hdr.src_id,
barrier_cnt));
TEST_VERBOSE(("CMD_BARRIER_REQ req from %d cnt %lu", msg_hdr.src_id,
(unsigned long)barrier_cnt));
if (pmix_list_get_size(server_list) == barrier_cnt) {
barrier_cnt = 0; /* reset barrier counter */
server_info_t *tmp_server;
@ -535,8 +535,8 @@ static void server_read_cb(int fd, short event, void *arg)
msg_buf = NULL;
}
TEST_VERBOSE(("CMD_FENCE_CONTRIB req from %d cnt %d size %d",
msg_hdr.src_id, contrib_cnt, msg_hdr.size));
TEST_VERBOSE(("CMD_FENCE_CONTRIB req from %d cnt %lu size %d",
msg_hdr.src_id, (unsigned long)contrib_cnt, msg_hdr.size));
if (pmix_list_get_size(server_list) == contrib_cnt) {
server_info_t *tmp_server;
PMIX_LIST_FOREACH(tmp_server, server_list, server_info_t) {
@ -547,8 +547,8 @@ static void server_read_cb(int fd, short event, void *arg)
resp_hdr.size = fence_buf_offset;
server_send_msg(&resp_hdr, fence_buf, fence_buf_offset);
}
TEST_VERBOSE(("CMD_FENCE_CONTRIB complete, size %d",
fence_buf_offset));
TEST_VERBOSE(("CMD_FENCE_CONTRIB complete, size %lu",
(unsigned long)fence_buf_offset));
if (fence_buf) {
free(fence_buf);
fence_buf = NULL;
@ -651,13 +651,13 @@ static void server_unpack_dmdx(char *buf, int *sender, pmix_proc_t *proc)
{
char *ptr = buf;
*sender = (int)*ptr;
*sender = *(int *)ptr;
ptr += sizeof(int);
memcpy(proc->nspace, ptr, PMIX_MAX_NSLEN +1);
ptr += PMIX_MAX_NSLEN +1;
proc->rank = (int)*ptr;
proc->rank = *(int *)ptr;
ptr += sizeof(int);
}
@ -671,8 +671,8 @@ static void _dmdx_cb(int status, char *data, size_t sz, void *cbdata)
msg_hdr.src_id = my_server_id;
msg_hdr.size = sz;
msg_hdr.dst_id = *sender_id;
TEST_VERBOSE(("srv #%d: DMDX RESPONSE: receiver=%d, size=%d,",
my_server_id, *sender_id, sz));
TEST_VERBOSE(("srv #%d: DMDX RESPONSE: receiver=%d, size=%lu,",
my_server_id, *sender_id, (unsigned long)sz));
free(sender_id);
server_send_msg(&msg_hdr, data, sz);