Roll to track PMIx master
Signed-off-by: Ralph Castain <rhc@open-mpi.org>
Этот коммит содержится в:
родитель
79fc9d54dc
Коммит
2c723f4338
@ -30,7 +30,7 @@ greek=
|
||||
# command, or with the date (if "git describe" fails) in the form of
|
||||
# "date<date>".
|
||||
|
||||
repo_rev=git19a63db
|
||||
repo_rev=git3920e33
|
||||
|
||||
# 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="Aug 23, 2017"
|
||||
date="Sep 01, 2017"
|
||||
|
||||
# The shared library version of each of PMIx's public libraries.
|
||||
# These versions are maintained in accordance with the "Library
|
||||
|
@ -348,7 +348,8 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
|
||||
PMIX_ACQUIRE_THREAD(&pmix_global_lock);
|
||||
|
||||
if (0 < pmix_globals.init_cntr || PMIX_PROC_IS_SERVER) {
|
||||
if (0 < pmix_globals.init_cntr ||
|
||||
(NULL != pmix_globals.mypeer && PMIX_PROC_IS_SERVER(pmix_globals.mypeer))) {
|
||||
/* since we have been called before, the nspace and
|
||||
* rank should be known. So return them here if
|
||||
* requested */
|
||||
@ -446,17 +447,17 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
pmix_globals.mypeer->info->pname.nspace = strdup(proc->nspace);
|
||||
pmix_globals.mypeer->info->pname.rank = proc->rank;
|
||||
|
||||
/* select our bfrops compat module - the selection will be based
|
||||
/* select our psec compat module - the selection will be based
|
||||
* on the corresponding envars that should have been passed
|
||||
* to us at launch */
|
||||
evar = getenv("PMIX_BFROPS_MODE");
|
||||
pmix_globals.mypeer->nptr->compat.bfrops = pmix_bfrops_base_assign_module(evar);
|
||||
if (NULL == pmix_globals.mypeer->nptr->compat.bfrops) {
|
||||
evar = getenv("PMIX_SECURITY_MODE");
|
||||
pmix_globals.mypeer->nptr->compat.psec = pmix_psec_base_assign_module(evar);
|
||||
if (NULL == pmix_globals.mypeer->nptr->compat.psec) {
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
/* the server will be using the same */
|
||||
pmix_client_globals.myserver->nptr->compat.bfrops = pmix_globals.mypeer->nptr->compat.bfrops;
|
||||
pmix_client_globals.myserver->nptr->compat.psec = pmix_globals.mypeer->nptr->compat.psec;
|
||||
|
||||
/* set the buffer type - the selection will be based
|
||||
* on the corresponding envars that should have been passed
|
||||
@ -473,26 +474,17 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
/* the server will be using the same */
|
||||
pmix_client_globals.myserver->nptr->compat.type = pmix_globals.mypeer->nptr->compat.type;
|
||||
|
||||
|
||||
/* select our psec compat module - the selection will be based
|
||||
* on the corresponding envars that should have been passed
|
||||
* to us at launch */
|
||||
evar = getenv("PMIX_SECURITY_MODE");
|
||||
pmix_globals.mypeer->nptr->compat.psec = pmix_psec_base_assign_module(evar);
|
||||
if (NULL == pmix_globals.mypeer->nptr->compat.psec) {
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
/* the server will be using the same */
|
||||
pmix_client_globals.myserver->nptr->compat.psec = pmix_globals.mypeer->nptr->compat.psec;
|
||||
|
||||
/* select the gds compat module we will use to interact with
|
||||
* our server- the selection will be based
|
||||
* on the corresponding envars that should have been passed
|
||||
* to us at launch */
|
||||
evar = getenv("PMIX_GDS_MODULE");
|
||||
PMIX_INFO_LOAD(&ginfo, PMIX_GDS_MODULE, evar, PMIX_STRING);
|
||||
pmix_client_globals.myserver->nptr->compat.gds = pmix_gds_base_assign_module(&ginfo, 1);
|
||||
if (NULL != evar) {
|
||||
PMIX_INFO_LOAD(&ginfo, PMIX_GDS_MODULE, evar, PMIX_STRING);
|
||||
pmix_client_globals.myserver->nptr->compat.gds = pmix_gds_base_assign_module(&ginfo, 1);
|
||||
} else {
|
||||
pmix_client_globals.myserver->nptr->compat.gds = pmix_gds_base_assign_module(NULL, 0);
|
||||
}
|
||||
if (NULL == pmix_client_globals.myserver->nptr->compat.gds) {
|
||||
PMIX_INFO_DESTRUCT(&ginfo);
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
@ -1080,7 +1072,7 @@ static void _commitfn(int sd, short args, void *cbdata)
|
||||
}
|
||||
|
||||
/* if we are a server, or we aren't connected, don't attempt to send */
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_SUCCESS; // not an error
|
||||
}
|
||||
|
@ -427,6 +427,8 @@ static void infocb(pmix_status_t status,
|
||||
rc = PMIX_ERR_NOMEM;
|
||||
PMIX_VALUE_FREE(kv, 1);
|
||||
kv = NULL;
|
||||
} else {
|
||||
rc = PMIX_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
rc = pmix_value_xfer(kv, &info[0].value);
|
||||
@ -532,7 +534,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
* ask server
|
||||
*/
|
||||
goto request;
|
||||
} else {
|
||||
} else if (NULL != cb->key) {
|
||||
/* if immediate was given, then we are being directed to
|
||||
* check with the server even though the caller is looking for
|
||||
* job-level info. In some cases, a server may elect not
|
||||
@ -557,6 +559,8 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
}
|
||||
/* we should have had this info, so respond with the error */
|
||||
goto respond;
|
||||
} else {
|
||||
goto respond;
|
||||
}
|
||||
}
|
||||
rc = process_values(&val, cb);
|
||||
@ -603,8 +607,8 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
/* if we got here, then we don't have the data for this proc. If we
|
||||
* are a server, or we are a client and not connected, then there is
|
||||
* nothing more we can do */
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type ||
|
||||
(PMIX_PROC_SERVER != pmix_globals.proc_type && !pmix_globals.connected)) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) ||
|
||||
(!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !pmix_globals.connected)) {
|
||||
rc = PMIX_ERR_NOT_FOUND;
|
||||
goto respond;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ PMIX_EXPORT pmix_status_t PMIx_Job_control_nb(const pmix_proc_t targets[], size_
|
||||
}
|
||||
|
||||
/* if we aren't connected, don't attempt to send */
|
||||
if (!PMIX_PROC_IS_SERVER && !pmix_globals.connected) {
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !pmix_globals.connected) {
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_UNREACH;
|
||||
}
|
||||
@ -124,7 +124,7 @@ PMIX_EXPORT pmix_status_t PMIx_Job_control_nb(const pmix_proc_t targets[], size_
|
||||
|
||||
/* if we are the server, then we just issue the request and
|
||||
* return the response */
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
if (NULL == pmix_host_server.job_control) {
|
||||
/* nothing we can do */
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
@ -226,7 +226,7 @@ PMIX_EXPORT pmix_status_t PMIx_Process_monitor_nb(const pmix_info_t *monitor, pm
|
||||
}
|
||||
|
||||
/* if we aren't connected, don't attempt to send */
|
||||
if (!PMIX_PROC_IS_SERVER && !pmix_globals.connected) {
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !pmix_globals.connected) {
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_UNREACH;
|
||||
}
|
||||
@ -234,7 +234,7 @@ PMIX_EXPORT pmix_status_t PMIx_Process_monitor_nb(const pmix_info_t *monitor, pm
|
||||
|
||||
/* if we are the server, then we just issue the request and
|
||||
* return the response */
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
if (NULL == pmix_host_server.monitor) {
|
||||
/* nothing we can do */
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
|
@ -74,7 +74,7 @@ PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata,
|
||||
}
|
||||
|
||||
/* if we aren't connected, don't attempt to send */
|
||||
if (!PMIX_PROC_IS_SERVER && !pmix_globals.connected) {
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !pmix_globals.connected) {
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_UNREACH;
|
||||
}
|
||||
@ -86,7 +86,7 @@ PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata,
|
||||
|
||||
/* if we are the server, then we just log and
|
||||
* return the response */
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
if (NULL == pmix_host_server.log) {
|
||||
/* nothing we can do */
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
|
@ -116,7 +116,7 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
|
||||
}
|
||||
|
||||
/* if we aren't connected, don't attempt to send */
|
||||
if (!PMIX_PROC_IS_SERVER && !pmix_globals.connected) {
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !pmix_globals.connected) {
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_UNREACH;
|
||||
}
|
||||
@ -128,7 +128,7 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
|
||||
|
||||
/* if we are the server, then we just issue the query and
|
||||
* return the response */
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
if (NULL == pmix_host_server.query) {
|
||||
/* nothing we can do */
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
@ -198,7 +198,7 @@ PMIX_EXPORT pmix_status_t PMIx_Allocation_request_nb(pmix_alloc_directive_t dire
|
||||
|
||||
/* if we are the server, then we just issue the request and
|
||||
* return the response */
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
if (NULL == pmix_host_server.allocate) {
|
||||
/* nothing we can do */
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
|
@ -54,14 +54,14 @@ PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status,
|
||||
}
|
||||
|
||||
/* if we aren't connected, don't attempt to send */
|
||||
if (!PMIX_PROC_IS_SERVER && !pmix_globals.connected) {
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !pmix_globals.connected) {
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_UNREACH;
|
||||
}
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
|
||||
|
||||
if (PMIX_PROC_IS_SERVER) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
rc = pmix_server_notify_client_of_event(status, source, range,
|
||||
info, ninfo,
|
||||
cbfunc, cbdata);
|
||||
@ -800,8 +800,10 @@ static void _notify_client_event(int sd, short args, void *cbdata)
|
||||
PMIX_ACQUIRE_OBJECT(cd);
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
"pmix_server: _notify_client_event notifying clients of event %s",
|
||||
PMIx_Error_string(cd->status));
|
||||
"pmix_server: _notify_client_event notifying clients of event %s range %s type %s",
|
||||
PMIx_Error_string(cd->status),
|
||||
PMIx_Data_range_string(cd->range),
|
||||
cd->nondefault ? "NONDEFAULT" : "OPEN");
|
||||
|
||||
/* we cannot know if everyone who wants this notice has had a chance
|
||||
* to register for it - the notice may be coming too early. So cache
|
||||
@ -1103,7 +1105,7 @@ void pmix_event_timeout_cb(int fd, short flags, void *arg)
|
||||
pmix_list_remove_item(&pmix_globals.cached_events, &ch->super);
|
||||
|
||||
/* process this event thru the regular channels */
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
pmix_server_notify_client_of_event(ch->status, &ch->source,
|
||||
ch->range, ch->info, ch->ninfo,
|
||||
ch->final_cbfunc, ch->final_cbdata);
|
||||
|
@ -297,8 +297,10 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer)
|
||||
|
||||
/* if we are a client, and we haven't already registered a handler of this
|
||||
* type with our server, or if we have directives, then we need to notify
|
||||
* the server */
|
||||
if (!PMIX_PROC_IS_SERVER && pmix_globals.connected &&
|
||||
* the server - however, don't do this for a v1 server as the event
|
||||
* notification system there doesn't work */
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && pmix_globals.connected &&
|
||||
!PMIX_PROC_IS_V1(pmix_client_globals.myserver) &&
|
||||
(need_register || 0 < pmix_list_get_size(xfer))) {
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
"pmix: _add_hdlr sending to server");
|
||||
@ -318,8 +320,7 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer)
|
||||
|
||||
/* if we are a server and are registering for events, then we only contact
|
||||
* our host if we want environmental events */
|
||||
|
||||
if (PMIX_PROC_IS_SERVER && cd->enviro &&
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && cd->enviro &&
|
||||
NULL != pmix_host_server.register_events) {
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
"pmix: _add_hdlr registering with server");
|
||||
@ -823,7 +824,7 @@ static void dereg_event_hdlr(int sd, short args, void *cbdata)
|
||||
|
||||
/* if I am not the server, and I am connected, then I need
|
||||
* to notify the server to remove my registration */
|
||||
if (!PMIX_PROC_IS_SERVER && pmix_globals.connected) {
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && pmix_globals.connected) {
|
||||
msg = PMIX_NEW(pmix_buffer_t);
|
||||
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
|
||||
msg, &cmd, 1, PMIX_COMMAND);
|
||||
|
@ -117,6 +117,7 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_rank_info_t,
|
||||
|
||||
static void pcon(pmix_peer_t *p)
|
||||
{
|
||||
p->proc_type = PMIX_PROC_UNDEF;
|
||||
p->finalized = false;
|
||||
p->info = NULL;
|
||||
p->proc_cnt = 0;
|
||||
|
@ -33,13 +33,13 @@
|
||||
|
||||
#include <pmix_common.h>
|
||||
|
||||
#include "src/mca/bfrops/bfrops.h"
|
||||
#include "src/class/pmix_hash_table.h"
|
||||
#include "src/class/pmix_list.h"
|
||||
#include "src/class/pmix_ring_buffer.h"
|
||||
#include "src/event/pmix_event.h"
|
||||
#include "src/threads/threads.h"
|
||||
|
||||
#include "src/mca/bfrops/bfrops.h"
|
||||
#include "src/mca/gds/gds.h"
|
||||
#include "src/mca/psec/psec.h"
|
||||
#include "src/mca/ptl/ptl.h"
|
||||
@ -104,20 +104,6 @@ typedef enum {
|
||||
PMIX_COLLECT_MAX
|
||||
} pmix_collect_t;
|
||||
|
||||
/* define a process type */
|
||||
typedef enum {
|
||||
PMIX_PROC_UNDEF,
|
||||
PMIX_PROC_CLIENT,
|
||||
PMIX_PROC_SERVER,
|
||||
PMIX_PROC_TOOL
|
||||
} pmix_proc_type_t;
|
||||
|
||||
/* defins some convenience macros for testing proc type */
|
||||
#define PMIX_PROC_IS_CLIENT (PMIX_PROC_CLIENT == pmix_globals.proc_type)
|
||||
#define PMIX_PROC_IS_SERVER (PMIX_PROC_SERVER == pmix_globals.proc_type)
|
||||
#define PMIX_PROC_IS_TOOL (PMIX_PROC_TOOL == pmix_globals.proc_type)
|
||||
|
||||
|
||||
/**** PEER STRUCTURES ****/
|
||||
|
||||
/* clients can only talk to their server, and servers are
|
||||
@ -181,6 +167,7 @@ typedef struct pmix_peer_t {
|
||||
pmix_object_t super;
|
||||
pmix_nspace_t *nptr; // point to the nspace object for this process
|
||||
pmix_rank_info_t *info;
|
||||
pmix_proc_type_t proc_type;
|
||||
int proc_cnt;
|
||||
int index; // index into the local clients array on the server
|
||||
int sd;
|
||||
@ -369,7 +356,6 @@ typedef struct {
|
||||
int init_cntr; // #times someone called Init - #times called Finalize
|
||||
pmix_proc_t myid;
|
||||
pmix_peer_t *mypeer; // my own peer object
|
||||
pmix_proc_type_t proc_type;
|
||||
uid_t uid; // my effective uid
|
||||
gid_t gid; // my effective gid
|
||||
int pindex;
|
||||
|
@ -158,6 +158,53 @@ PMIX_EXPORT extern pmix_bfrops_globals_t pmix_bfrops_globals;
|
||||
#error Unsupported pid_t size!
|
||||
#endif
|
||||
|
||||
/* Unpack generic size macros */
|
||||
#define PMIX_BFROP_UNPACK_SIZE_MISMATCH(unpack_type, remote_type, ret) \
|
||||
do { \
|
||||
switch(remote_type) { \
|
||||
case PMIX_UINT8: \
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint8_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_INT8: \
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int8_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_UINT16: \
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint16_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_INT16: \
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int16_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_UINT32: \
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint32_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_INT32: \
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int32_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_UINT64: \
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint64_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_INT64: \
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int64_t, remote_type); \
|
||||
break; \
|
||||
default: \
|
||||
ret = PMIX_ERR_NOT_FOUND; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* NOTE: do not need to deal with endianness here, as the unpacking of
|
||||
the underling sender-side type will do that for us. Repeat: the
|
||||
data in tmpbuf[] is already in host byte order. */
|
||||
#define PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, tmptype, tmpbfroptype) \
|
||||
do { \
|
||||
int32_t i; \
|
||||
tmptype *tmpbuf = (tmptype*)malloc(sizeof(tmptype) * (*num_vals)); \
|
||||
ret = unpack_gentype(buffer, tmpbuf, num_vals, tmpbfroptype); \
|
||||
for (i = 0 ; i < *num_vals ; ++i) { \
|
||||
((unpack_type*) dest)[i] = (unpack_type)(tmpbuf[i]); \
|
||||
} \
|
||||
free(tmpbuf); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
* Internal struct used for holding registered bfrop functions
|
||||
@ -599,8 +646,6 @@ PMIX_EXPORT char* pmix_bfrop_buffer_extend(pmix_buffer_t *bptr, size_t bytes_to_
|
||||
|
||||
PMIX_EXPORT bool pmix_bfrop_too_small(pmix_buffer_t *buffer, size_t bytes_reqd);
|
||||
|
||||
PMIX_EXPORT pmix_bfrop_type_info_t* pmix_bfrop_find_type(pmix_data_type_t type);
|
||||
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type);
|
||||
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type);
|
||||
|
@ -861,11 +861,20 @@ pmix_status_t pmix_bfrops_base_copy_array(pmix_info_array_t **dest,
|
||||
pmix_info_t *d1, *s1;
|
||||
|
||||
*dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
|
||||
if (NULL == (*dest)) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
(*dest)->size = src->size;
|
||||
(*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t));
|
||||
d1 = (pmix_info_t*)(*dest)->array;
|
||||
s1 = (pmix_info_t*)src->array;
|
||||
memcpy(d1, s1, src->size * sizeof(pmix_info_t));
|
||||
if (0 < src->size) {
|
||||
(*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t));
|
||||
if (NULL == (*dest)->array) {
|
||||
free(*dest);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
d1 = (pmix_info_t*)(*dest)->array;
|
||||
s1 = (pmix_info_t*)src->array;
|
||||
memcpy(d1, s1, src->size * sizeof(pmix_info_t));
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
/*******************/
|
||||
|
@ -1042,7 +1042,6 @@ pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t
|
||||
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, sizeof(tmp)))) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
tmp = pmix_htons(type);
|
||||
memcpy(dst, &tmp, sizeof(tmp));
|
||||
buffer->pack_ptr += sizeof(tmp);
|
||||
|
@ -48,6 +48,7 @@
|
||||
|
||||
/* Instantiate the global vars */
|
||||
pmix_bfrops_globals_t pmix_bfrops_globals = {{{0}}};
|
||||
int pmix_bfrops_base_output = 0;
|
||||
|
||||
static int pmix_bfrop_register(pmix_mca_base_register_flag_t flags)
|
||||
{
|
||||
@ -96,12 +97,16 @@ static pmix_status_t pmix_bfrop_close(void)
|
||||
|
||||
static pmix_status_t pmix_bfrop_open(pmix_mca_base_open_flag_t flags)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
|
||||
/* initialize globals */
|
||||
pmix_bfrops_globals.initialized = true;
|
||||
PMIX_CONSTRUCT(&pmix_bfrops_globals.actives, pmix_list_t);
|
||||
|
||||
/* Open up all available components */
|
||||
return pmix_mca_base_framework_components_open(&pmix_bfrops_base_framework, flags);
|
||||
rc = pmix_mca_base_framework_components_open(&pmix_bfrops_base_framework, flags);
|
||||
pmix_bfrops_base_output = pmix_bfrops_base_framework.framework_output;
|
||||
return rc;
|
||||
}
|
||||
|
||||
PMIX_MCA_BASE_FRAMEWORK_DECLARE(pmix, bfrops, "PMIx Buffer Operations",
|
||||
|
@ -70,7 +70,8 @@ pmix_status_t pmix_bfrops_base_pack_buffer(pmix_pointer_array_t *regtypes,
|
||||
pmix_status_t rc;
|
||||
pmix_bfrop_type_info_t *info;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrops_base_pack_buffer( %p, %p, %lu, %d )\n",
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrops_base_pack_buffer( %p, %p, %lu, %d )\n",
|
||||
(void*)buffer, src, (long unsigned int)num_vals, (int)type);
|
||||
|
||||
/* Pack the declared data type */
|
||||
@ -130,7 +131,8 @@ static pmix_status_t pack_gentype(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t i;
|
||||
bool *s = (bool*)src;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrops_base_pack_bool * %d\n", num_vals);
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrops_base_pack_bool * %d\n", num_vals);
|
||||
|
||||
/* check to see if buffer needs extending */
|
||||
if (NULL == (dst = (uint8_t*)pmix_bfrop_buffer_extend(buffer, num_vals))) {
|
||||
@ -215,7 +217,8 @@ pmix_status_t pmix_bfrops_base_pack_byte(pmix_buffer_t *buffer, const void *src,
|
||||
{
|
||||
char *dst;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrops_base_pack_byte * %d\n", num_vals);
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrops_base_pack_byte * %d\n", num_vals);
|
||||
|
||||
/* check to see if buffer needs extending */
|
||||
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals))) {
|
||||
@ -242,7 +245,8 @@ pmix_status_t pmix_bfrops_base_pack_int16(pmix_buffer_t *buffer, const void *src
|
||||
uint16_t tmp, *srctmp = (uint16_t*) src;
|
||||
char *dst;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrops_base_pack_int16 * %d\n", num_vals);
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrops_base_pack_int16 * %d\n", num_vals);
|
||||
|
||||
/* check to see if buffer needs extending */
|
||||
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals*sizeof(tmp)))) {
|
||||
@ -270,7 +274,8 @@ pmix_status_t pmix_bfrops_base_pack_int32(pmix_buffer_t *buffer, const void *src
|
||||
uint32_t tmp, *srctmp = (uint32_t*) src;
|
||||
char *dst;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrops_base_pack_int32 * %d\n", num_vals);
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrops_base_pack_int32 * %d\n", num_vals);
|
||||
|
||||
/* check to see if buffer needs extending */
|
||||
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals*sizeof(tmp)))) {
|
||||
@ -298,7 +303,8 @@ pmix_status_t pmix_bfrops_base_pack_int64(pmix_buffer_t *buffer, const void *src
|
||||
char *dst;
|
||||
size_t bytes_packed = num_vals * sizeof(tmp);
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrops_base_pack_int64 * %d\n", num_vals);
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrops_base_pack_int64 * %d\n", num_vals);
|
||||
|
||||
/* check to see if buffer needs extending */
|
||||
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, bytes_packed))) {
|
||||
|
@ -33,53 +33,6 @@
|
||||
#include "src/mca/bfrops/bfrops_types.h"
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
|
||||
/* Unpack generic size macros */
|
||||
#define UNPACK_SIZE_MISMATCH(unpack_type, remote_type, ret) \
|
||||
do { \
|
||||
switch(remote_type) { \
|
||||
case PMIX_UINT8: \
|
||||
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint8_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_INT8: \
|
||||
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int8_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_UINT16: \
|
||||
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint16_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_INT16: \
|
||||
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int16_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_UINT32: \
|
||||
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint32_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_INT32: \
|
||||
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int32_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_UINT64: \
|
||||
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint64_t, remote_type); \
|
||||
break; \
|
||||
case PMIX_INT64: \
|
||||
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int64_t, remote_type); \
|
||||
break; \
|
||||
default: \
|
||||
ret = PMIX_ERR_NOT_FOUND; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* NOTE: do not need to deal with endianness here, as the unpacking of
|
||||
the underling sender-side type will do that for us. Repeat: the
|
||||
data in tmpbuf[] is already in host byte order. */
|
||||
#define UNPACK_SIZE_MISMATCH_FOUND(unpack_type, tmptype, tmpbfroptype) \
|
||||
do { \
|
||||
int32_t i; \
|
||||
tmptype *tmpbuf = (tmptype*)malloc(sizeof(tmptype) * (*num_vals)); \
|
||||
ret = unpack_gentype(buffer, tmpbuf, num_vals, tmpbfroptype); \
|
||||
for (i = 0 ; i < *num_vals ; ++i) { \
|
||||
((unpack_type*) dest)[i] = (unpack_type)(tmpbuf[i]); \
|
||||
} \
|
||||
free(tmpbuf); \
|
||||
} while (0)
|
||||
|
||||
|
||||
static pmix_status_t pmix_bfrops_base_unpack_buffer(pmix_pointer_array_t *regtypes,
|
||||
pmix_buffer_t *buffer,
|
||||
@ -90,7 +43,7 @@ static pmix_status_t pmix_bfrops_base_unpack_buffer(pmix_pointer_array_t *regtyp
|
||||
pmix_data_type_t local_type;
|
||||
pmix_bfrop_type_info_t *info;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrops_base_unpack_buffer( %p, %p, %lu, %d )\n",
|
||||
(void*)buffer, dst, (long unsigned int)*num_vals, (int)type);
|
||||
|
||||
@ -103,7 +56,6 @@ static pmix_status_t pmix_bfrops_base_unpack_buffer(pmix_pointer_array_t *regtyp
|
||||
/* if the data types don't match, then return an error */
|
||||
if (type != local_type) {
|
||||
pmix_output(0, "PMIX bfrop:unpack: got type %d when expecting type %d", local_type, type);
|
||||
assert(0);
|
||||
return PMIX_ERR_PACK_MISMATCH;
|
||||
}
|
||||
}
|
||||
@ -135,7 +87,7 @@ pmix_status_t pmix_bfrops_base_unpack(pmix_pointer_array_t *regtypes,
|
||||
* so return an appropriate error
|
||||
*/
|
||||
if (0 == *num_vals) {
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: inadequate space ( %p, %p, %lu, %d )\n",
|
||||
(void*)buffer, dst, (long unsigned int)*num_vals, (int)type);
|
||||
return PMIX_ERR_UNPACK_INADEQUATE_SPACE;
|
||||
@ -170,7 +122,7 @@ pmix_status_t pmix_bfrops_base_unpack(pmix_pointer_array_t *regtypes,
|
||||
* the end of the buffer, which isn't necessarily an error */
|
||||
return rc;
|
||||
}
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: found %d values for %d provided storage",
|
||||
local_num, *num_vals);
|
||||
|
||||
@ -181,7 +133,7 @@ pmix_status_t pmix_bfrops_base_unpack(pmix_pointer_array_t *regtypes,
|
||||
*/
|
||||
if (local_num > *num_vals) {
|
||||
local_num = *num_vals;
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: inadequate space ( %p, %p, %lu, %d )\n",
|
||||
(void*)buffer, dst, (long unsigned int)*num_vals, (int)type);
|
||||
ret = PMIX_ERR_UNPACK_INADEQUATE_SPACE;
|
||||
@ -240,7 +192,7 @@ static pmix_status_t unpack_gentype(pmix_buffer_t *buffer, void *dest,
|
||||
uint8_t *src;
|
||||
bool *dst;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack_bool * %d\n", (int)*num_vals);
|
||||
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -286,7 +238,7 @@ pmix_status_t pmix_bfrops_base_unpack_int(pmix_buffer_t *buffer, void *dest,
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(int, remote_type, ret);
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH(int, remote_type, ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -312,7 +264,7 @@ pmix_status_t pmix_bfrops_base_unpack_sizet(pmix_buffer_t *buffer, void *dest,
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(size_t, remote_type, ret);
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH(size_t, remote_type, ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -338,7 +290,7 @@ pmix_status_t pmix_bfrops_base_unpack_pid(pmix_buffer_t *buffer, void *dest,
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(pid_t, remote_type, ret);
|
||||
PMIX_BFROP_UNPACK_SIZE_MISMATCH(pid_t, remote_type, ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -353,7 +305,7 @@ pmix_status_t pmix_bfrops_base_unpack_pid(pmix_buffer_t *buffer, void *dest,
|
||||
pmix_status_t pmix_bfrops_base_unpack_byte(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack_byte * %d\n", (int)*num_vals);
|
||||
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -376,7 +328,7 @@ pmix_status_t pmix_bfrops_base_unpack_int16(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t i;
|
||||
uint16_t tmp, *desttmp = (uint16_t*) dest;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack_int16 * %d\n", (int)*num_vals);
|
||||
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -401,7 +353,7 @@ pmix_status_t pmix_bfrops_base_unpack_int32(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t i;
|
||||
uint32_t tmp, *desttmp = (uint32_t*) dest;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack_int32 * %d\n", (int)*num_vals);
|
||||
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -432,7 +384,7 @@ pmix_status_t pmix_bfrops_base_unpack_int64(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t i;
|
||||
uint64_t tmp, *desttmp = (uint64_t*) dest;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack_int64 * %d\n", (int)*num_vals);
|
||||
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -486,7 +438,7 @@ pmix_status_t pmix_bfrops_base_unpack_float(pmix_buffer_t *buffer, void *dest,
|
||||
pmix_status_t ret;
|
||||
char *convert;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack_float * %d\n", (int)*num_vals);
|
||||
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -518,7 +470,7 @@ pmix_status_t pmix_bfrops_base_unpack_double(pmix_buffer_t *buffer, void *dest,
|
||||
pmix_status_t ret;
|
||||
char *convert;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack_double * %d\n", (int)*num_vals);
|
||||
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -550,7 +502,7 @@ pmix_status_t pmix_bfrops_base_unpack_timeval(pmix_buffer_t *buffer, void *dest,
|
||||
struct timeval *desttmp = (struct timeval *) dest, tt;
|
||||
pmix_status_t ret;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack_timeval * %d\n", (int)*num_vals);
|
||||
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -583,7 +535,7 @@ pmix_status_t pmix_bfrops_base_unpack_time(pmix_buffer_t *buffer, void *dest,
|
||||
* to uint64_t as a generic safe size
|
||||
*/
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack_time * %d\n", (int)*num_vals);
|
||||
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -607,7 +559,7 @@ pmix_status_t pmix_bfrops_base_unpack_time(pmix_buffer_t *buffer, void *dest,
|
||||
pmix_status_t pmix_bfrops_base_unpack_status(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack_status * %d\n", (int)*num_vals);
|
||||
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -859,7 +811,7 @@ pmix_status_t pmix_bfrops_base_unpack_info(pmix_buffer_t *buffer, void *dest,
|
||||
pmix_status_t ret;
|
||||
char *tmp;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d info", *num_vals);
|
||||
|
||||
ptr = (pmix_info_t *) dest;
|
||||
@ -891,7 +843,7 @@ pmix_status_t pmix_bfrops_base_unpack_info(pmix_buffer_t *buffer, void *dest,
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &ptr[i].value.type))) {
|
||||
return ret;
|
||||
}
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: info type %d", ptr[i].value.type);
|
||||
m=1;
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(buffer, &ptr[i].value))) {
|
||||
@ -909,7 +861,7 @@ pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest,
|
||||
pmix_status_t ret;
|
||||
char *tmp;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d pdata", *num_vals);
|
||||
|
||||
ptr = (pmix_pdata_t *) dest;
|
||||
@ -941,7 +893,7 @@ pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest,
|
||||
PMIX_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: pdata type %d %s", ptr[i].value.type, ptr[i].value.data.string);
|
||||
m=1;
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(buffer, &ptr[i].value))) {
|
||||
@ -1003,14 +955,14 @@ pmix_status_t pmix_bfrops_base_unpack_proc(pmix_buffer_t *buffer, void *dest,
|
||||
pmix_status_t ret;
|
||||
char *tmp;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d procs", *num_vals);
|
||||
|
||||
ptr = (pmix_proc_t *) dest;
|
||||
n = *num_vals;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: init proc[%d]", i);
|
||||
memset(&ptr[i], 0, sizeof(pmix_proc_t));
|
||||
/* unpack nspace */
|
||||
@ -1045,7 +997,7 @@ pmix_status_t pmix_bfrops_base_unpack_app(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t nval;
|
||||
char *tmp;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d apps", *num_vals);
|
||||
|
||||
ptr = (pmix_app_t *) dest;
|
||||
@ -1127,7 +1079,7 @@ pmix_status_t pmix_bfrops_base_unpack_kval(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t i, n, m;
|
||||
pmix_status_t ret;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d kvals", *num_vals);
|
||||
|
||||
ptr = (pmix_kval_t*) dest;
|
||||
@ -1160,7 +1112,7 @@ pmix_status_t pmix_bfrops_base_unpack_modex(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t i, n, m;
|
||||
pmix_status_t ret;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d modex", *num_vals);
|
||||
|
||||
ptr = (pmix_modex_data_t *) dest;
|
||||
@ -1198,7 +1150,7 @@ pmix_status_t pmix_bfrops_base_unpack_bo(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t i, n, m;
|
||||
pmix_status_t ret;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d byte_object", *num_vals);
|
||||
|
||||
ptr = (pmix_byte_object_t *) dest;
|
||||
@ -1271,7 +1223,7 @@ pmix_status_t pmix_bfrops_base_unpack_pinfo(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t i, n, m;
|
||||
pmix_status_t ret;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d pinfo", *num_vals);
|
||||
|
||||
ptr = (pmix_proc_info_t *) dest;
|
||||
@ -1315,7 +1267,7 @@ pmix_status_t pmix_bfrops_base_unpack_darray(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t i, n, m;
|
||||
pmix_status_t ret;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d data arrays", *num_vals);
|
||||
|
||||
ptr = (pmix_data_array_t *) dest;
|
||||
@ -1595,7 +1547,7 @@ pmix_status_t pmix_bfrops_base_unpack_query(pmix_buffer_t *buffer, void *dest,
|
||||
pmix_status_t ret;
|
||||
int32_t nkeys;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d queries", *num_vals);
|
||||
|
||||
ptr = (pmix_query_t *) dest;
|
||||
@ -1651,14 +1603,14 @@ pmix_status_t pmix_bfrops_base_unpack_array(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t i, n, m;
|
||||
pmix_status_t ret;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d info arrays", *num_vals);
|
||||
|
||||
ptr = (pmix_info_array_t*) dest;
|
||||
n = *num_vals;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
pmix_output_verbose(20, pmix_globals.debug_output,
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: init array[%d]", i);
|
||||
memset(&ptr[i], 0, sizeof(pmix_info_array_t));
|
||||
/* unpack the size of this array */
|
||||
|
@ -393,30 +393,40 @@ PMIX_EXPORT char* pmix_bfrops_base_get_available_modules(void);
|
||||
/* Select a bfrops module for a given version */
|
||||
PMIX_EXPORT pmix_bfrops_module_t* pmix_bfrops_base_assign_module(const char *version);
|
||||
|
||||
/* provide a backdoor to access the framework debug output */
|
||||
PMIX_EXPORT extern int pmix_bfrops_base_output;
|
||||
|
||||
/* MACROS FOR EXECUTING BFROPS FUNCTIONS */
|
||||
#define PMIX_BFROPS_ASSIGN_TYPE(p, b) \
|
||||
(b)->type = (p)->nptr->compat.type
|
||||
|
||||
#define PMIX_BFROPS_PACK(r, p, b, s, n, t) \
|
||||
do { \
|
||||
if (PMIX_BFROP_BUFFER_UNDEF == (b)->type) { \
|
||||
(b)->type = (p)->nptr->compat.type; \
|
||||
(r) = (p)->nptr->compat.bfrops->pack(b, s, n, t); \
|
||||
} else if ((b)->type == (p)->nptr->compat.type) { \
|
||||
(r) = (p)->nptr->compat.bfrops->pack(b, s, n, t); \
|
||||
} else { \
|
||||
(r) = PMIX_ERR_PACK_MISMATCH; \
|
||||
} \
|
||||
#define PMIX_BFROPS_PACK(r, p, b, s, n, t) \
|
||||
do { \
|
||||
pmix_output_verbose(2, pmix_bfrops_base_output, \
|
||||
"[%s:%d] PACK version %s", \
|
||||
__FILE__, __LINE__, \
|
||||
(p)->nptr->compat.bfrops->version); \
|
||||
if (PMIX_BFROP_BUFFER_UNDEF == (b)->type) { \
|
||||
(b)->type = (p)->nptr->compat.type; \
|
||||
(r) = (p)->nptr->compat.bfrops->pack(b, s, n, t); \
|
||||
} else if ((b)->type == (p)->nptr->compat.type) { \
|
||||
(r) = (p)->nptr->compat.bfrops->pack(b, s, n, t); \
|
||||
} else { \
|
||||
(r) = PMIX_ERR_PACK_MISMATCH; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define PMIX_BFROPS_UNPACK(r, p, b, d, m, t) \
|
||||
do { \
|
||||
if ((b)->type == (p)->nptr->compat.type) { \
|
||||
(r) = (p)->nptr->compat.bfrops->unpack(b, d, m, t); \
|
||||
} else { \
|
||||
pmix_output(0, "MISMATCH %d %d", (b)->type, (p)->nptr->compat.type); \
|
||||
(r) = PMIX_ERR_UNPACK_FAILURE; \
|
||||
} \
|
||||
#define PMIX_BFROPS_UNPACK(r, p, b, d, m, t) \
|
||||
do { \
|
||||
pmix_output_verbose(2, pmix_bfrops_base_output, \
|
||||
"[%s:%d] UNPACK version %s", \
|
||||
__FILE__, __LINE__, \
|
||||
(p)->nptr->compat.bfrops->version); \
|
||||
if ((b)->type == (p)->nptr->compat.type) { \
|
||||
(r) = (p)->nptr->compat.bfrops->unpack(b, d, m, t); \
|
||||
} else { \
|
||||
(r) = PMIX_ERR_UNPACK_FAILURE; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define PMIX_BFROPS_COPY(r, p, d, s, t) \
|
||||
|
57
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/Makefile.am
Обычный файл
57
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/Makefile.am
Обычный файл
@ -0,0 +1,57 @@
|
||||
# -*- makefile -*-
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
# University Research and Technology
|
||||
# Corporation. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
# of Tennessee Research Foundation. All rights
|
||||
# reserved.
|
||||
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
headers = \
|
||||
bfrop_v12.h \
|
||||
internal.h
|
||||
|
||||
sources = \
|
||||
bfrop_v12_component.c \
|
||||
bfrop_v12.c \
|
||||
pack.c \
|
||||
unpack.c \
|
||||
copy.c \
|
||||
print.c
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
# (for static builds).
|
||||
|
||||
if MCA_BUILD_pmix_bfrops_v12_DSO
|
||||
lib =
|
||||
lib_sources =
|
||||
component = mca_bfrops_v12.la
|
||||
component_sources = $(headers) $(sources)
|
||||
else
|
||||
lib = libmca_bfrops_v12.la
|
||||
lib_sources = $(headers) $(sources)
|
||||
component =
|
||||
component_sources =
|
||||
endif
|
||||
|
||||
mcacomponentdir = $(pmixlibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component)
|
||||
mca_bfrops_v12_la_SOURCES = $(component_sources)
|
||||
mca_bfrops_v12_la_LDFLAGS = -module -avoid-version
|
||||
|
||||
noinst_LTLIBRARIES = $(lib)
|
||||
libmca_bfrops_v12_la_SOURCES = $(lib_sources)
|
||||
libmca_bfrops_v12_la_LDFLAGS = -module -avoid-version
|
708
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/bfrop_v12.c
Обычный файл
708
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/bfrop_v12.c
Обычный файл
@ -0,0 +1,708 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-201 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2010-201 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 201-2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 201-2013 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <src/include/pmix_config.h>
|
||||
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
#include "bfrop_v12.h"
|
||||
#include "internal.h"
|
||||
|
||||
static pmix_status_t init(void);
|
||||
static void finalize(void);
|
||||
static pmix_status_t register_type(const char *name,
|
||||
pmix_data_type_t type,
|
||||
pmix_bfrop_pack_fn_t pack,
|
||||
pmix_bfrop_unpack_fn_t unpack,
|
||||
pmix_bfrop_copy_fn_t copy,
|
||||
pmix_bfrop_print_fn_t print);
|
||||
static const char* data_type_string(pmix_data_type_t type);
|
||||
|
||||
pmix_bfrops_module_t pmix_bfrops_pmix12_module = {
|
||||
.version = "v12",
|
||||
.init = init,
|
||||
.finalize = finalize,
|
||||
.pack = pmix12_bfrop_pack,
|
||||
.unpack = pmix12_bfrop_unpack,
|
||||
.copy = pmix12_bfrop_copy,
|
||||
.print = pmix12_bfrop_print,
|
||||
.copy_payload = pmix12_bfrop_copy_payload,
|
||||
.value_xfer = pmix12_bfrop_value_xfer,
|
||||
.value_load = pmix12_bfrop_value_load,
|
||||
.value_unload = pmix12_bfrop_value_unload,
|
||||
.value_cmp = pmix12_bfrop_value_cmp,
|
||||
.register_type = register_type,
|
||||
.data_type_string = data_type_string
|
||||
};
|
||||
|
||||
static pmix_status_t init(void)
|
||||
{
|
||||
/* some standard types don't require anything special */
|
||||
PMIX_REGISTER_TYPE("PMIX_BOOL", PMIX_BOOL,
|
||||
pmix12_bfrop_pack_bool,
|
||||
pmix12_bfrop_unpack_bool,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_bool,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_BYTE", PMIX_BYTE,
|
||||
pmix12_bfrop_pack_byte,
|
||||
pmix12_bfrop_unpack_byte,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_byte,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_STRING", PMIX_STRING,
|
||||
pmix12_bfrop_pack_string,
|
||||
pmix12_bfrop_unpack_string,
|
||||
pmix12_bfrop_copy_string,
|
||||
pmix12_bfrop_print_string,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
/* Register the rest of the standard generic types to point to internal functions */
|
||||
PMIX_REGISTER_TYPE("PMIX_SIZE", PMIX_SIZE,
|
||||
pmix12_bfrop_pack_sizet,
|
||||
pmix12_bfrop_unpack_sizet,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_size,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PID", PMIX_PID,
|
||||
pmix12_bfrop_pack_pid,
|
||||
pmix12_bfrop_unpack_pid,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_pid,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT", PMIX_INT,
|
||||
pmix12_bfrop_pack_int,
|
||||
pmix12_bfrop_unpack_int,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_int,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
/* Register all the standard fixed types to point to base functions */
|
||||
PMIX_REGISTER_TYPE("PMIX_INT8", PMIX_INT8,
|
||||
pmix12_bfrop_pack_byte,
|
||||
pmix12_bfrop_unpack_byte,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_int8,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT16", PMIX_INT16,
|
||||
pmix12_bfrop_pack_int16,
|
||||
pmix12_bfrop_unpack_int16,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_int16,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT32", PMIX_INT32,
|
||||
pmix12_bfrop_pack_int32,
|
||||
pmix12_bfrop_unpack_int32,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_int32,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT64", PMIX_INT64,
|
||||
pmix12_bfrop_pack_int64,
|
||||
pmix12_bfrop_unpack_int64,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_int64,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT", PMIX_UINT,
|
||||
pmix12_bfrop_pack_int,
|
||||
pmix12_bfrop_unpack_int,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_uint,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT8", PMIX_UINT8,
|
||||
pmix12_bfrop_pack_byte,
|
||||
pmix12_bfrop_unpack_byte,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_uint8,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT16", PMIX_UINT16,
|
||||
pmix12_bfrop_pack_int16,
|
||||
pmix12_bfrop_unpack_int16,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_uint16,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT32", PMIX_UINT32,
|
||||
pmix12_bfrop_pack_int32,
|
||||
pmix12_bfrop_unpack_int32,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_uint32,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT64", PMIX_UINT64,
|
||||
pmix12_bfrop_pack_int64,
|
||||
pmix12_bfrop_unpack_int64,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_uint64,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_FLOAT", PMIX_FLOAT,
|
||||
pmix12_bfrop_pack_float,
|
||||
pmix12_bfrop_unpack_float,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_float,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DOUBLE", PMIX_DOUBLE,
|
||||
pmix12_bfrop_pack_double,
|
||||
pmix12_bfrop_unpack_double,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_double,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_TIMEVAL", PMIX_TIMEVAL,
|
||||
pmix12_bfrop_pack_timeval,
|
||||
pmix12_bfrop_unpack_timeval,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_timeval,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_TIME", PMIX_TIME,
|
||||
pmix12_bfrop_pack_time,
|
||||
pmix12_bfrop_unpack_time,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_time,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_STATUS", PMIX_STATUS,
|
||||
pmix12_bfrop_pack_status,
|
||||
pmix12_bfrop_unpack_status,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_status,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
/* structured values need to be done here as they might
|
||||
* callback into standard and/or derived values */
|
||||
PMIX_REGISTER_TYPE("PMIX_VALUE", PMIX_VALUE,
|
||||
pmix12_bfrop_pack_value,
|
||||
pmix12_bfrop_unpack_value,
|
||||
pmix12_bfrop_copy_value,
|
||||
pmix12_bfrop_print_value,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC", PMIX_PROC,
|
||||
pmix12_bfrop_pack_proc,
|
||||
pmix12_bfrop_unpack_proc,
|
||||
pmix12_bfrop_copy_proc,
|
||||
pmix12_bfrop_print_proc,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_APP", PMIX_APP,
|
||||
pmix12_bfrop_pack_app,
|
||||
pmix12_bfrop_unpack_app,
|
||||
pmix12_bfrop_copy_app,
|
||||
pmix12_bfrop_print_app,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INFO", PMIX_INFO,
|
||||
pmix12_bfrop_pack_info,
|
||||
pmix12_bfrop_unpack_info,
|
||||
pmix12_bfrop_copy_info,
|
||||
pmix12_bfrop_print_info,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PDATA", PMIX_PDATA,
|
||||
pmix12_bfrop_pack_pdata,
|
||||
pmix12_bfrop_unpack_pdata,
|
||||
pmix12_bfrop_copy_pdata,
|
||||
pmix12_bfrop_print_pdata,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_BUFFER", PMIX_BUFFER,
|
||||
pmix12_bfrop_pack_buf,
|
||||
pmix12_bfrop_unpack_buf,
|
||||
pmix12_bfrop_copy_buf,
|
||||
pmix12_bfrop_print_buf,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_BYTE_OBJECT", PMIX_BYTE_OBJECT,
|
||||
pmix12_bfrop_pack_bo,
|
||||
pmix12_bfrop_unpack_bo,
|
||||
pmix12_bfrop_copy_bo,
|
||||
pmix12_bfrop_print_bo,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_KVAL", PMIX_KVAL,
|
||||
pmix12_bfrop_pack_kval,
|
||||
pmix12_bfrop_unpack_kval,
|
||||
pmix12_bfrop_copy_kval,
|
||||
pmix12_bfrop_print_kval,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_MODEX", PMIX_MODEX,
|
||||
pmix12_bfrop_pack_modex,
|
||||
pmix12_bfrop_unpack_modex,
|
||||
pmix12_bfrop_copy_modex,
|
||||
pmix12_bfrop_print_modex,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PERSIST", PMIX_PERSIST,
|
||||
pmix12_bfrop_pack_persist,
|
||||
pmix12_bfrop_unpack_persist,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_persist,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_POINTER", PMIX_POINTER,
|
||||
pmix12_bfrop_pack_ptr,
|
||||
pmix12_bfrop_unpack_ptr,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_ptr,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_SCOPE", PMIX_SCOPE,
|
||||
pmix12_bfrop_pack_scope,
|
||||
pmix12_bfrop_unpack_scope,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_scope,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DATA_RANGE", PMIX_DATA_RANGE,
|
||||
pmix12_bfrop_pack_range,
|
||||
pmix12_bfrop_unpack_range,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_ptr,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_COMMAND", PMIX_COMMAND,
|
||||
pmix12_bfrop_pack_cmd,
|
||||
pmix12_bfrop_unpack_cmd,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_cmd,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INFO_DIRECTIVES", PMIX_INFO_DIRECTIVES,
|
||||
pmix12_bfrop_pack_info_directives,
|
||||
pmix12_bfrop_unpack_info_directives,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_info_directives,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DATA_TYPE", PMIX_DATA_TYPE,
|
||||
pmix12_bfrop_pack_datatype,
|
||||
pmix12_bfrop_unpack_datatype,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_datatype,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC_STATE", PMIX_PROC_STATE,
|
||||
pmix12_bfrop_pack_proc_state,
|
||||
pmix12_bfrop_unpack_proc_state,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_proc_state,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC_INFO", PMIX_PROC_INFO,
|
||||
pmix12_bfrop_pack_proc_info,
|
||||
pmix12_bfrop_unpack_proc_info,
|
||||
pmix12_bfrop_copy_proc_info,
|
||||
pmix12_bfrop_print_proc_info,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DATA_ARRAY", PMIX_DATA_ARRAY,
|
||||
pmix12_bfrop_pack_darray,
|
||||
pmix12_bfrop_unpack_darray,
|
||||
pmix12_bfrop_copy_darray,
|
||||
pmix12_bfrop_print_darray,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC_RANK", PMIX_PROC_RANK,
|
||||
pmix12_bfrop_pack_rank,
|
||||
pmix12_bfrop_unpack_rank,
|
||||
pmix12_bfrop_std_copy,
|
||||
pmix12_bfrop_print_rank,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_QUERY", PMIX_QUERY,
|
||||
pmix12_bfrop_pack_query,
|
||||
pmix12_bfrop_unpack_query,
|
||||
pmix12_bfrop_copy_query,
|
||||
pmix12_bfrop_print_query,
|
||||
&mca_bfrops_v12_component.types);
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY,
|
||||
pmix12_bfrop_pack_array,
|
||||
pmix12_bfrop_unpack_array,
|
||||
pmix12_bfrop_copy_array,
|
||||
pmix12_bfrop_print_array,
|
||||
&mca_bfrops_v12_component.types);
|
||||
/********************/
|
||||
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
static void finalize(void)
|
||||
{
|
||||
int n;
|
||||
pmix_bfrop_type_info_t *info;
|
||||
|
||||
for (n=0; n < mca_bfrops_v12_component.types.size; n++) {
|
||||
if (NULL != (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v12_component.types, n))) {
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&mca_bfrops_v12_component.types, n, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static pmix_status_t register_type(const char *name, pmix_data_type_t type,
|
||||
pmix_bfrop_pack_fn_t pack,
|
||||
pmix_bfrop_unpack_fn_t unpack,
|
||||
pmix_bfrop_copy_fn_t copy,
|
||||
pmix_bfrop_print_fn_t print)
|
||||
{
|
||||
PMIX_REGISTER_TYPE(name, type,
|
||||
pack, unpack,
|
||||
copy, print,
|
||||
&mca_bfrops_v12_component.types);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
static const char* data_type_string(pmix_data_type_t type)
|
||||
{
|
||||
pmix_bfrop_type_info_t *info;
|
||||
|
||||
if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v12_component.types, type))) {
|
||||
return NULL;
|
||||
}
|
||||
return info->odti_name;
|
||||
}
|
||||
|
||||
int pmix12_v2_to_v1_datatype(pmix_data_type_t v2type)
|
||||
{
|
||||
int v1type;
|
||||
|
||||
/* I'm passing the data type to
|
||||
* a PMIx v1 compatible peer. The data type was redefined
|
||||
* in v2, and so we have to do some conversions here */
|
||||
switch(v2type) {
|
||||
case 20:
|
||||
/* the client thinks this is simply an int */
|
||||
v1type = 6;
|
||||
break;
|
||||
|
||||
case 44:
|
||||
/* the client thinks this is PMIX_INFO_ARRAY */
|
||||
v1type = 22;
|
||||
break;
|
||||
|
||||
case 40:
|
||||
/* proc rank is just an int in v1 */
|
||||
v1type = 6;
|
||||
break;
|
||||
|
||||
case 22:
|
||||
case 23:
|
||||
case 24:
|
||||
case 25:
|
||||
case 26:
|
||||
case 27:
|
||||
case 28:
|
||||
case 29:
|
||||
case 30:
|
||||
/* shift up one */
|
||||
v1type = v2type + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
v1type = v2type;
|
||||
}
|
||||
return v1type;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type)
|
||||
{
|
||||
int v1type;
|
||||
|
||||
v1type = pmix12_v2_to_v1_datatype(type);
|
||||
|
||||
return pmix12_bfrop_pack_datatype(buffer, &v1type, 1, PMIX_INT);
|
||||
}
|
||||
|
||||
pmix_data_type_t pmix12_v1_to_v2_datatype(int v1type)
|
||||
{
|
||||
pmix_data_type_t v2type;
|
||||
|
||||
/* I'm getting the data type that was given to
|
||||
* me by a PMIx v1 compatible peer. The data type was redefined
|
||||
* in v2, and so we have to do some conversions here */
|
||||
|
||||
switch(v1type) {
|
||||
case 20:
|
||||
/* the peer thinks this is PMIX_HWLOC_TOPO, which we don't support */
|
||||
v2type = PMIX_UNDEF;
|
||||
break;
|
||||
|
||||
case 22:
|
||||
/* the peer thinks this is PMIX_INFO_ARRAY */
|
||||
v2type = PMIX_INFO_ARRAY;
|
||||
break;
|
||||
|
||||
case 23:
|
||||
case 24:
|
||||
case 25:
|
||||
case 26:
|
||||
case 27:
|
||||
case 28:
|
||||
case 29:
|
||||
case 30:
|
||||
case 31:
|
||||
/* shift down one */
|
||||
v2type = v1type - 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
v2type = v1type;
|
||||
}
|
||||
return v2type;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type)
|
||||
{
|
||||
int32_t n=1;
|
||||
int v1type;
|
||||
pmix_status_t rc;
|
||||
|
||||
rc = pmix12_bfrop_unpack_datatype(buffer, &v1type, &n, PMIX_INT);
|
||||
if (PMIX_SUCCESS == rc) {
|
||||
*type = pmix12_v1_to_v2_datatype(v1type);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void pmix12_bfrop_value_load(pmix_value_t *v, const void *data,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
pmix_byte_object_t *bo;
|
||||
|
||||
v->type = type;
|
||||
if (NULL == data) {
|
||||
/* just set the fields to zero */
|
||||
memset(&v->data, 0, sizeof(v->data));
|
||||
} else {
|
||||
switch(type) {
|
||||
case PMIX_UNDEF:
|
||||
break;
|
||||
case PMIX_BOOL:
|
||||
memcpy(&(v->data.flag), data, 1);
|
||||
break;
|
||||
case PMIX_BYTE:
|
||||
memcpy(&(v->data.byte), data, 1);
|
||||
break;
|
||||
case PMIX_STRING:
|
||||
v->data.string = strdup(data);
|
||||
break;
|
||||
case PMIX_SIZE:
|
||||
memcpy(&(v->data.size), data, sizeof(size_t));
|
||||
break;
|
||||
case PMIX_PID:
|
||||
memcpy(&(v->data.pid), data, sizeof(pid_t));
|
||||
break;
|
||||
case PMIX_INT:
|
||||
memcpy(&(v->data.integer), data, sizeof(int));
|
||||
break;
|
||||
case PMIX_INT8:
|
||||
memcpy(&(v->data.int8), data, 1);
|
||||
break;
|
||||
case PMIX_INT16:
|
||||
memcpy(&(v->data.int16), data, 2);
|
||||
break;
|
||||
case PMIX_INT32:
|
||||
memcpy(&(v->data.int32), data, 4);
|
||||
break;
|
||||
case PMIX_INT64:
|
||||
memcpy(&(v->data.int64), data, 8);
|
||||
break;
|
||||
case PMIX_UINT:
|
||||
memcpy(&(v->data.uint), data, sizeof(int));
|
||||
break;
|
||||
case PMIX_UINT8:
|
||||
memcpy(&(v->data.uint8), data, 1);
|
||||
break;
|
||||
case PMIX_UINT16:
|
||||
memcpy(&(v->data.uint16), data, 2);
|
||||
break;
|
||||
case PMIX_UINT32:
|
||||
memcpy(&(v->data.uint32), data, 4);
|
||||
break;
|
||||
case PMIX_UINT64:
|
||||
memcpy(&(v->data.uint64), data, 8);
|
||||
break;
|
||||
case PMIX_FLOAT:
|
||||
memcpy(&(v->data.fval), data, sizeof(float));
|
||||
break;
|
||||
case PMIX_DOUBLE:
|
||||
memcpy(&(v->data.dval), data, sizeof(double));
|
||||
break;
|
||||
case PMIX_TIMEVAL:
|
||||
memcpy(&(v->data.tv), data, sizeof(struct timeval));
|
||||
break;
|
||||
case PMIX_BYTE_OBJECT:
|
||||
bo = (pmix_byte_object_t*)data;
|
||||
v->data.bo.bytes = bo->bytes;
|
||||
memcpy(&(v->data.bo.size), &bo->size, sizeof(size_t));
|
||||
break;
|
||||
case PMIX_TIME:
|
||||
case PMIX_VALUE:
|
||||
case PMIX_INFO_ARRAY:
|
||||
case PMIX_APP:
|
||||
case PMIX_INFO:
|
||||
case PMIX_PDATA:
|
||||
case PMIX_BUFFER:
|
||||
case PMIX_KVAL:
|
||||
case PMIX_MODEX:
|
||||
case PMIX_PERSIST:
|
||||
case PMIX_PROC:
|
||||
/* silence warnings */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_value_unload(pmix_value_t *kv,
|
||||
void **data,
|
||||
size_t *sz)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
|
||||
rc = PMIX_SUCCESS;
|
||||
if (NULL == data ||
|
||||
(NULL == *data && PMIX_STRING != kv->type && PMIX_BYTE_OBJECT != kv->type)) {
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
} else {
|
||||
switch(kv->type) {
|
||||
case PMIX_UNDEF:
|
||||
rc = PMIX_ERR_UNKNOWN_DATA_TYPE;
|
||||
break;
|
||||
case PMIX_BOOL:
|
||||
memcpy(*data, &(kv->data.flag), 1);
|
||||
*sz = 1;
|
||||
break;
|
||||
case PMIX_BYTE:
|
||||
memcpy(*data, &(kv->data.byte), 1);
|
||||
*sz = 1;
|
||||
break;
|
||||
case PMIX_STRING:
|
||||
if (NULL != kv->data.string) {
|
||||
*data = strdup(kv->data.string);
|
||||
*sz = strlen(kv->data.string);
|
||||
}
|
||||
break;
|
||||
case PMIX_SIZE:
|
||||
memcpy(*data, &(kv->data.size), sizeof(size_t));
|
||||
*sz = sizeof(size_t);
|
||||
break;
|
||||
case PMIX_PID:
|
||||
memcpy(*data, &(kv->data.pid), sizeof(pid_t));
|
||||
*sz = sizeof(pid_t);
|
||||
break;
|
||||
case PMIX_INT:
|
||||
memcpy(*data, &(kv->data.integer), sizeof(int));
|
||||
*sz = sizeof(int);
|
||||
break;
|
||||
case PMIX_INT8:
|
||||
memcpy(*data, &(kv->data.int8), 1);
|
||||
*sz = 1;
|
||||
break;
|
||||
case PMIX_INT16:
|
||||
memcpy(*data, &(kv->data.int16), 2);
|
||||
*sz = 2;
|
||||
break;
|
||||
case PMIX_INT32:
|
||||
memcpy(*data, &(kv->data.int32), 4);
|
||||
*sz = 4;
|
||||
break;
|
||||
case PMIX_INT64:
|
||||
memcpy(*data, &(kv->data.int64), 8);
|
||||
*sz = 8;
|
||||
break;
|
||||
case PMIX_UINT:
|
||||
memcpy(*data, &(kv->data.uint), sizeof(int));
|
||||
*sz = sizeof(int);
|
||||
break;
|
||||
case PMIX_UINT8:
|
||||
memcpy(*data, &(kv->data.uint8), 1);
|
||||
*sz = 1;
|
||||
break;
|
||||
case PMIX_UINT16:
|
||||
memcpy(*data, &(kv->data.uint16), 2);
|
||||
*sz = 2;
|
||||
break;
|
||||
case PMIX_UINT32:
|
||||
memcpy(*data, &(kv->data.uint32), 4);
|
||||
*sz = 4;
|
||||
break;
|
||||
case PMIX_UINT64:
|
||||
memcpy(*data, &(kv->data.uint64), 8);
|
||||
*sz = 8;
|
||||
break;
|
||||
case PMIX_FLOAT:
|
||||
memcpy(*data, &(kv->data.fval), sizeof(float));
|
||||
*sz = sizeof(float);
|
||||
break;
|
||||
case PMIX_DOUBLE:
|
||||
memcpy(*data, &(kv->data.dval), sizeof(double));
|
||||
*sz = sizeof(double);
|
||||
break;
|
||||
case PMIX_TIMEVAL:
|
||||
memcpy(*data, &(kv->data.tv), sizeof(struct timeval));
|
||||
*sz = sizeof(struct timeval);
|
||||
break;
|
||||
case PMIX_BYTE_OBJECT:
|
||||
if (NULL != kv->data.bo.bytes && 0 < kv->data.bo.size) {
|
||||
*data = kv->data.bo.bytes;
|
||||
*sz = kv->data.bo.size;
|
||||
} else {
|
||||
*data = NULL;
|
||||
*sz = 0;
|
||||
}
|
||||
break;
|
||||
case PMIX_TIME:
|
||||
case PMIX_VALUE:
|
||||
case PMIX_INFO_ARRAY:
|
||||
case PMIX_APP:
|
||||
case PMIX_INFO:
|
||||
case PMIX_PDATA:
|
||||
case PMIX_BUFFER:
|
||||
case PMIX_KVAL:
|
||||
case PMIX_MODEX:
|
||||
case PMIX_PERSIST:
|
||||
case PMIX_PROC:
|
||||
/* silence warnings */
|
||||
rc = PMIX_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
35
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/bfrop_v12.h
Обычный файл
35
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/bfrop_v12.h
Обычный файл
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef PMIX_BFROPS_V1_H
|
||||
#define PMIX_BFROPS_V1_H
|
||||
|
||||
#include "src/mca/bfrops/bfrops.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/* the component must be visible data for the linker to find it */
|
||||
PMIX_EXPORT extern pmix_bfrops_base_component_t mca_bfrops_v12_component;
|
||||
|
||||
extern pmix_bfrops_module_t pmix_bfrops_pmix12_module;
|
||||
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* PMIX_BFROPS_V1_H */
|
@ -0,0 +1,95 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennbfropsee and The University
|
||||
* of Tennbfropsee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* These symbols are in a file by themselves to provide nice linker
|
||||
* semantics. Since linkers generally pull in symbols by object
|
||||
* files, keeping these symbols as the only symbols in this file
|
||||
* prevents utility programs such as "ompi_info" from having to import
|
||||
* entire components just to query their version and parameters.
|
||||
*/
|
||||
|
||||
#include <src/include/pmix_config.h>
|
||||
#include <pmix_common.h>
|
||||
#include "src/include/types.h"
|
||||
#include "src/include/pmix_globals.h"
|
||||
|
||||
#include "src/util/error.h"
|
||||
#include "src/server/pmix_server_ops.h"
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
#include "bfrop_v12.h"
|
||||
|
||||
extern pmix_bfrops_module_t pmix_bfrops_pmix12_module;
|
||||
|
||||
static pmix_status_t component_open(void);
|
||||
static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority);
|
||||
static pmix_status_t component_close(void);
|
||||
static pmix_bfrops_module_t* assign_module(void);
|
||||
/*
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
pmix_bfrops_base_component_t mca_bfrops_v12_component = {
|
||||
.base = {
|
||||
PMIX_BFROPS_BASE_VERSION_1_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
.pmix_mca_component_name = "v12",
|
||||
PMIX_MCA_BASE_MAKE_VERSION(component, PMIX_MAJOR_VERSION, PMIX_MINOR_VERSION,
|
||||
PMIX_RELEASE_VERSION),
|
||||
|
||||
/* Component open and close functions */
|
||||
.pmix_mca_open_component = component_open,
|
||||
.pmix_mca_close_component = component_close,
|
||||
.pmix_mca_query_component = component_query,
|
||||
},
|
||||
.priority = 5,
|
||||
.assign_module = assign_module
|
||||
};
|
||||
|
||||
|
||||
pmix_status_t component_open(void)
|
||||
{
|
||||
/* setup the types array */
|
||||
PMIX_CONSTRUCT(&mca_bfrops_v12_component.types, pmix_pointer_array_t);
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority)
|
||||
{
|
||||
|
||||
*priority = mca_bfrops_v12_component.priority;
|
||||
*module = (pmix_mca_base_module_t *)&pmix_bfrops_pmix12_module;
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
pmix_status_t component_close(void)
|
||||
{
|
||||
PMIX_DESTRUCT(&mca_bfrops_v12_component.types);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
static pmix_bfrops_module_t* assign_module(void)
|
||||
{
|
||||
return &pmix_bfrops_pmix12_module;
|
||||
}
|
509
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/copy.c
Обычный файл
509
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/copy.c
Обычный файл
@ -0,0 +1,509 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include <src/include/pmix_config.h>
|
||||
|
||||
|
||||
#include "src/util/argv.h"
|
||||
#include "src/util/error.h"
|
||||
#include "src/util/output.h"
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
#include "bfrop_v12.h"
|
||||
#include "internal.h"
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy(void **dest, void *src, pmix_data_type_t type)
|
||||
{
|
||||
pmix_bfrop_type_info_t *info;
|
||||
|
||||
/* check for error */
|
||||
if (NULL == dest) {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||
return PMIX_ERR_BAD_PARAM;
|
||||
}
|
||||
if (NULL == src) {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||
return PMIX_ERR_BAD_PARAM;
|
||||
}
|
||||
|
||||
/* Lookup the copy function for this type and call it */
|
||||
|
||||
if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v12_component.types, type))) {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_UNKNOWN_DATA_TYPE);
|
||||
return PMIX_ERR_UNKNOWN_DATA_TYPE;
|
||||
}
|
||||
|
||||
return info->odti_copy_fn(dest, src, type);
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src)
|
||||
{
|
||||
size_t to_copy = 0;
|
||||
char *ptr;
|
||||
/* deal with buffer type */
|
||||
if( NULL == dest->base_ptr ){
|
||||
/* destination buffer is empty - derive src buffer type */
|
||||
dest->type = src->type;
|
||||
} else if( dest->type != src->type ){
|
||||
/* buffer types mismatch */
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||
return PMIX_ERR_BAD_PARAM;
|
||||
}
|
||||
|
||||
to_copy = src->pack_ptr - src->unpack_ptr;
|
||||
if( NULL == (ptr = pmix_bfrop_buffer_extend(dest, to_copy)) ){
|
||||
PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE);
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
memcpy(ptr,src->unpack_ptr, to_copy);
|
||||
dest->bytes_used += to_copy;
|
||||
dest->pack_ptr += to_copy;
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* STANDARD COPY FUNCTION - WORKS FOR EVERYTHING NON-STRUCTURED
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_std_copy(void **dest, void *src, pmix_data_type_t type)
|
||||
{
|
||||
size_t datasize;
|
||||
uint8_t *val = NULL;
|
||||
|
||||
switch(type) {
|
||||
case PMIX_BOOL:
|
||||
datasize = sizeof(bool);
|
||||
break;
|
||||
|
||||
case PMIX_INT:
|
||||
case PMIX_UINT:
|
||||
datasize = sizeof(int);
|
||||
break;
|
||||
|
||||
case PMIX_SIZE:
|
||||
datasize = sizeof(size_t);
|
||||
break;
|
||||
|
||||
case PMIX_PID:
|
||||
datasize = sizeof(pid_t);
|
||||
break;
|
||||
|
||||
case PMIX_BYTE:
|
||||
case PMIX_INT8:
|
||||
case PMIX_UINT8:
|
||||
datasize = 1;
|
||||
break;
|
||||
|
||||
case PMIX_INT16:
|
||||
case PMIX_UINT16:
|
||||
datasize = 2;
|
||||
break;
|
||||
|
||||
case PMIX_INT32:
|
||||
case PMIX_UINT32:
|
||||
datasize = 4;
|
||||
break;
|
||||
|
||||
case PMIX_INT64:
|
||||
case PMIX_UINT64:
|
||||
datasize = 8;
|
||||
break;
|
||||
|
||||
case PMIX_FLOAT:
|
||||
datasize = sizeof(float);
|
||||
break;
|
||||
|
||||
case PMIX_TIMEVAL:
|
||||
datasize = sizeof(struct timeval);
|
||||
break;
|
||||
|
||||
case PMIX_TIME:
|
||||
datasize = sizeof(time_t);
|
||||
break;
|
||||
|
||||
default:
|
||||
return PMIX_ERR_UNKNOWN_DATA_TYPE;
|
||||
}
|
||||
|
||||
val = (uint8_t*)malloc(datasize);
|
||||
if (NULL == val) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
memcpy(val, src, datasize);
|
||||
*dest = val;
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/* COPY FUNCTIONS FOR NON-STANDARD SYSTEM TYPES */
|
||||
|
||||
/*
|
||||
* STRING
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_copy_string(char **dest, char *src, pmix_data_type_t type)
|
||||
{
|
||||
if (NULL == src) { /* got zero-length string/NULL pointer - store NULL */
|
||||
*dest = NULL;
|
||||
} else {
|
||||
*dest = strdup(src);
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
/* compare function for pmix_value_t*/
|
||||
pmix_value_cmp_t pmix12_bfrop_value_cmp(pmix_value_t *p, pmix_value_t *p1)
|
||||
{
|
||||
bool rc = false;
|
||||
switch (p->type) {
|
||||
case PMIX_BOOL:
|
||||
rc = (p->data.flag == p1->data.flag);
|
||||
break;
|
||||
case PMIX_BYTE:
|
||||
rc = (p->data.byte == p1->data.byte);
|
||||
break;
|
||||
case PMIX_SIZE:
|
||||
rc = (p->data.size == p1->data.size);
|
||||
break;
|
||||
case PMIX_INT:
|
||||
rc = (p->data.integer == p1->data.integer);
|
||||
break;
|
||||
case PMIX_INT8:
|
||||
rc = (p->data.int8 == p1->data.int8);
|
||||
break;
|
||||
case PMIX_INT16:
|
||||
rc = (p->data.int16 == p1->data.int16);
|
||||
break;
|
||||
case PMIX_INT32:
|
||||
rc = (p->data.int32 == p1->data.int32);
|
||||
break;
|
||||
case PMIX_INT64:
|
||||
rc = (p->data.int64 == p1->data.int64);
|
||||
break;
|
||||
case PMIX_UINT:
|
||||
rc = (p->data.uint == p1->data.uint);
|
||||
break;
|
||||
case PMIX_UINT8:
|
||||
rc = (p->data.uint8 == p1->data.int8);
|
||||
break;
|
||||
case PMIX_UINT16:
|
||||
rc = (p->data.uint16 == p1->data.uint16);
|
||||
break;
|
||||
case PMIX_UINT32:
|
||||
rc = (p->data.uint32 == p1->data.uint32);
|
||||
break;
|
||||
case PMIX_UINT64:
|
||||
rc = (p->data.uint64 == p1->data.uint64);
|
||||
break;
|
||||
case PMIX_STRING:
|
||||
rc = strcmp(p->data.string, p1->data.string);
|
||||
break;
|
||||
default:
|
||||
pmix_output(0, "COMPARE-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)p->type);
|
||||
}
|
||||
if (rc) {
|
||||
return PMIX_EQUAL;
|
||||
}
|
||||
return PMIX_VALUE1_GREATER;
|
||||
}
|
||||
/* COPY FUNCTIONS FOR GENERIC PMIX TYPES */
|
||||
pmix_status_t pmix12_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src)
|
||||
{
|
||||
pmix_info_t *p1, *s1;
|
||||
|
||||
/* copy the right field */
|
||||
p->type = src->type;
|
||||
switch (src->type) {
|
||||
case PMIX_BOOL:
|
||||
p->data.flag = src->data.flag;
|
||||
break;
|
||||
case PMIX_BYTE:
|
||||
p->data.byte = src->data.byte;
|
||||
break;
|
||||
case PMIX_STRING:
|
||||
if (NULL != src->data.string) {
|
||||
p->data.string = strdup(src->data.string);
|
||||
} else {
|
||||
p->data.string = NULL;
|
||||
}
|
||||
break;
|
||||
case PMIX_SIZE:
|
||||
p->data.size = src->data.size;
|
||||
break;
|
||||
case PMIX_PID:
|
||||
p->data.pid = src->data.pid;
|
||||
break;
|
||||
case PMIX_INT:
|
||||
/* to avoid alignment issues */
|
||||
memcpy(&p->data.integer, &src->data.integer, sizeof(int));
|
||||
break;
|
||||
case PMIX_INT8:
|
||||
p->data.int8 = src->data.int8;
|
||||
break;
|
||||
case PMIX_INT16:
|
||||
/* to avoid alignment issues */
|
||||
memcpy(&p->data.int16, &src->data.int16, 2);
|
||||
break;
|
||||
case PMIX_INT32:
|
||||
/* to avoid alignment issues */
|
||||
memcpy(&p->data.int32, &src->data.int32, 4);
|
||||
break;
|
||||
case PMIX_INT64:
|
||||
/* to avoid alignment issues */
|
||||
memcpy(&p->data.int64, &src->data.int64, 8);
|
||||
break;
|
||||
case PMIX_UINT:
|
||||
/* to avoid alignment issues */
|
||||
memcpy(&p->data.uint, &src->data.uint, sizeof(unsigned int));
|
||||
break;
|
||||
case PMIX_UINT8:
|
||||
p->data.uint8 = src->data.uint8;
|
||||
break;
|
||||
case PMIX_UINT16:
|
||||
/* to avoid alignment issues */
|
||||
memcpy(&p->data.uint16, &src->data.uint16, 2);
|
||||
break;
|
||||
case PMIX_UINT32:
|
||||
/* to avoid alignment issues */
|
||||
memcpy(&p->data.uint32, &src->data.uint32, 4);
|
||||
break;
|
||||
case PMIX_UINT64:
|
||||
/* to avoid alignment issues */
|
||||
memcpy(&p->data.uint64, &src->data.uint64, 8);
|
||||
break;
|
||||
case PMIX_FLOAT:
|
||||
p->data.fval = src->data.fval;
|
||||
break;
|
||||
case PMIX_DOUBLE:
|
||||
p->data.dval = src->data.dval;
|
||||
break;
|
||||
case PMIX_TIMEVAL:
|
||||
p->data.tv.tv_sec = src->data.tv.tv_sec;
|
||||
p->data.tv.tv_usec = src->data.tv.tv_usec;
|
||||
break;
|
||||
case PMIX_INFO_ARRAY:
|
||||
p->data.array = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
|
||||
if (NULL == p->data.array) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
p->data.array->size = src->data.array->size;
|
||||
if (0 < src->data.array->size) {
|
||||
p->data.array->array = (pmix_info_t*)malloc(src->data.array->size * sizeof(pmix_info_t));
|
||||
if (NULL == p->data.array->array) {
|
||||
free(p->data.array);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
p1 = (pmix_info_t*)p->data.array->array;
|
||||
s1 = (pmix_info_t*)src->data.array->array;
|
||||
memcpy(p1, s1, src->data.array->size * sizeof(pmix_info_t));
|
||||
}
|
||||
break;
|
||||
case PMIX_BYTE_OBJECT:
|
||||
if (NULL != src->data.bo.bytes && 0 < src->data.bo.size) {
|
||||
p->data.bo.bytes = malloc(src->data.bo.size);
|
||||
memcpy(p->data.bo.bytes, src->data.bo.bytes, src->data.bo.size);
|
||||
p->data.bo.size = src->data.bo.size;
|
||||
} else {
|
||||
p->data.bo.bytes = NULL;
|
||||
p->data.bo.size = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pmix_output(0, "COPY-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)src->type);
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/* PMIX_VALUE */
|
||||
pmix_status_t pmix12_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
pmix_value_t *p;
|
||||
|
||||
/* create the new object */
|
||||
*dest = (pmix_value_t*)malloc(sizeof(pmix_value_t));
|
||||
if (NULL == *dest) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
p = *dest;
|
||||
|
||||
/* copy the type */
|
||||
p->type = src->type;
|
||||
/* copy the data */
|
||||
return pmix_value_xfer(p, src);
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_info_t*)malloc(sizeof(pmix_info_t));
|
||||
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
|
||||
return pmix_value_xfer(&(*dest)->value, &src->value);
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = PMIX_NEW(pmix_buffer_t);
|
||||
pmix_bfrops_base_copy_payload(*dest, src);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
size_t j;
|
||||
|
||||
*dest = (pmix_app_t*)malloc(sizeof(pmix_app_t));
|
||||
(*dest)->cmd = strdup(src->cmd);
|
||||
(*dest)->argv = pmix_argv_copy(src->argv);
|
||||
(*dest)->env = pmix_argv_copy(src->env);
|
||||
(*dest)->maxprocs = src->maxprocs;
|
||||
(*dest)->ninfo = src->ninfo;
|
||||
(*dest)->info = (pmix_info_t*)malloc(src->ninfo * sizeof(pmix_info_t));
|
||||
for (j=0; j < src->ninfo; j++) {
|
||||
(void)strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN);
|
||||
pmix_value_xfer(&(*dest)->info[j].value, &src->info[j].value);
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
pmix_kval_t *p;
|
||||
|
||||
/* create the new object */
|
||||
*dest = PMIX_NEW(pmix_kval_t);
|
||||
if (NULL == *dest) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
p = *dest;
|
||||
|
||||
/* copy the type */
|
||||
p->value->type = src->value->type;
|
||||
/* copy the data */
|
||||
return pmix_value_xfer(p->value, src->value);
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_array(pmix_info_array_t **dest,
|
||||
pmix_info_array_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
pmix_info_t *d1, *s1;
|
||||
|
||||
*dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
|
||||
(*dest)->size = src->size;
|
||||
(*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t));
|
||||
d1 = (pmix_info_t*)(*dest)->array;
|
||||
s1 = (pmix_info_t*)src->array;
|
||||
memcpy(d1, s1, src->size * sizeof(pmix_info_t));
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_proc_t*)malloc(sizeof(pmix_proc_t));
|
||||
if (NULL == *dest) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
(void)strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN);
|
||||
(*dest)->rank = src->rank;
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_modex(pmix_modex_data_t **dest,
|
||||
pmix_modex_data_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_modex_data_t*)malloc(sizeof(pmix_modex_data_t));
|
||||
if (NULL == *dest) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
(*dest)->blob = NULL;
|
||||
(*dest)->size = 0;
|
||||
if (NULL != src->blob) {
|
||||
(*dest)->blob = (uint8_t*)malloc(src->size * sizeof(uint8_t));
|
||||
if (NULL == (*dest)->blob) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
memcpy((*dest)->blob, src->blob, src->size * sizeof(uint8_t));
|
||||
(*dest)->size = src->size;
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_persist(pmix_persistence_t **dest,
|
||||
pmix_persistence_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_persistence_t*)malloc(sizeof(pmix_persistence_t));
|
||||
if (NULL == *dest) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
memcpy(*dest, src, sizeof(pmix_persistence_t));
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_bo(pmix_byte_object_t **dest,
|
||||
pmix_byte_object_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_byte_object_t*)malloc(sizeof(pmix_byte_object_t));
|
||||
if (NULL == *dest) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
(*dest)->bytes = (char*)malloc(src->size);
|
||||
memcpy((*dest)->bytes, src->bytes, src->size);
|
||||
(*dest)->size = src->size;
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_pdata(pmix_pdata_t **dest,
|
||||
pmix_pdata_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_pdata_t*)malloc(sizeof(pmix_pdata_t));
|
||||
(void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN);
|
||||
(*dest)->proc.rank = src->proc.rank;
|
||||
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
|
||||
return pmix_value_xfer(&(*dest)->value, &src->value);
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_darray(pmix_pdata_t **dest, pmix_data_array_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_proc_info(pmix_pdata_t **dest, pmix_proc_info_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_query(pmix_pdata_t **dest, pmix_query_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
372
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/internal.h
Обычный файл
372
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/internal.h
Обычный файл
@ -0,0 +1,372 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
#ifndef PMIX1_BFROP_INTERNAL_H_
|
||||
#define PMIX1_BFROP_INTERNAL_H_
|
||||
|
||||
#include <src/include/pmix_config.h>
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h> /* for struct timeval */
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "src/class/pmix_pointer_array.h"
|
||||
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/*
|
||||
* Implementations of API functions
|
||||
*/
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *max_num_vals,
|
||||
pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy(void **dest, void *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_print(char **output, char *prefix, void *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src);
|
||||
|
||||
pmix_status_t pmix12_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src);
|
||||
|
||||
void pmix12_bfrop_value_load(pmix_value_t *v, const void *data,
|
||||
pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_value_unload(pmix_value_t *kv,
|
||||
void **data,
|
||||
size_t *sz);
|
||||
|
||||
pmix_value_cmp_t pmix12_bfrop_value_cmp(pmix_value_t *p,
|
||||
pmix_value_t *p1);
|
||||
|
||||
/*
|
||||
* Specialized functions
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_buffer(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
|
||||
/*
|
||||
* Internal pack functions
|
||||
*/
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_string(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_int(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_float(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_double(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_time(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_value(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_info(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
/* compatibility functions - no corresponding PMIx v1.x definitions */
|
||||
pmix_status_t pmix12_bfrop_pack_ptr(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_status(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_range(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_info_directives(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_proc_state(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_proc_info(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_query(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_pack_rank(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
|
||||
|
||||
/*
|
||||
* Internal unpack functions
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
/* compatibility functions - no corresponding PMIx v1.x definitions */
|
||||
pmix_status_t pmix12_bfrop_unpack_ptr(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_scope(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_range(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_cmd(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_info_directives(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_proc_state(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_proc_info(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_unpack_rank(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
|
||||
|
||||
/*
|
||||
* Internal copy functions
|
||||
*/
|
||||
|
||||
pmix_status_t pmix12_bfrop_std_copy(void **dest, void *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_string(char **dest, char *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_array(pmix_info_array_t **dest, pmix_info_array_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src,
|
||||
pmix_data_type_t type);
|
||||
/* compatibility functions - no corresponding PMIx v1.x definitions */
|
||||
pmix_status_t pmix12_bfrop_copy_darray(pmix_pdata_t **dest, pmix_data_array_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_proc_info(pmix_pdata_t **dest, pmix_proc_info_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_copy_query(pmix_pdata_t **dest, pmix_query_t *src,
|
||||
pmix_data_type_t type);
|
||||
|
||||
|
||||
/*
|
||||
* Internal print functions
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_print_bool(char **output, char *prefix, bool *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_byte(char **output, char *prefix, uint8_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_string(char **output, char *prefix, char *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_size(char **output, char *prefix, size_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_pid(char **output, char *prefix, pid_t *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_print_int(char **output, char *prefix, int *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_int8(char **output, char *prefix, int8_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_int16(char **output, char *prefix, int16_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_int32(char **output, char *prefix, int32_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_int64(char **output, char *prefix, int64_t *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_print_uint(char **output, char *prefix, uint *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_uint8(char **output, char *prefix, uint8_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_uint16(char **output, char *prefix, uint16_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_uint32(char **output, char *prefix, uint32_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_uint64(char **output, char *prefix, uint64_t *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_print_float(char **output, char *prefix, float *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_double(char **output, char *prefix, double *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_print_timeval(char **output, char *prefix, struct timeval *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_time(char **output, char *prefix, time_t *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_print_value(char **output, char *prefix, pmix_value_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_array(char **output, char *prefix,
|
||||
pmix_info_array_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_proc(char **output, char *prefix,
|
||||
pmix_proc_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_app(char **output, char *prefix,
|
||||
pmix_app_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_info(char **output, char *prefix,
|
||||
pmix_info_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_buf(char **output, char *prefix,
|
||||
pmix_buffer_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_kval(char **output, char *prefix,
|
||||
pmix_kval_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_modex(char **output, char *prefix,
|
||||
pmix_modex_data_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_persist(char **output, char *prefix,
|
||||
pmix_persistence_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_bo(char **output, char *prefix,
|
||||
pmix_byte_object_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_pdata(char **output, char *prefix,
|
||||
pmix_pdata_t *src, pmix_data_type_t type);
|
||||
/* compatibility functions - no corresponding PMIx v1.x definitions */
|
||||
pmix_status_t pmix12_bfrop_print_scope(char **output, char *prefix,
|
||||
pmix_scope_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_status(char **output, char *prefix,
|
||||
pmix_status_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_ptr(char **output, char *prefix,
|
||||
void *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_cmd(char **output, char *prefix,
|
||||
void *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_info_directives(char **output, char *prefix,
|
||||
void *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_datatype(char **output, char *prefix,
|
||||
pmix_data_type_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_proc_state(char **output, char *prefix,
|
||||
pmix_data_type_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_darray(char **output, char *prefix,
|
||||
pmix_data_array_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_proc_info(char **output, char *prefix,
|
||||
pmix_proc_info_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_query(char **output, char *prefix,
|
||||
pmix_query_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix12_bfrop_print_rank(char **output, char *prefix,
|
||||
pmix_rank_t *src, pmix_data_type_t type);
|
||||
|
||||
|
||||
/*
|
||||
* Internal helper functions
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix12_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type);
|
||||
|
||||
int pmix12_v2_to_v1_datatype(pmix_data_type_t v2type);
|
||||
|
||||
pmix_data_type_t pmix12_v1_to_v2_datatype(int v1type);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
969
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/pack.c
Обычный файл
969
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/pack.c
Обычный файл
@ -0,0 +1,969 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include <src/include/pmix_config.h>
|
||||
|
||||
#include <src/include/types.h>
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include "src/util/argv.h"
|
||||
#include "src/util/error.h"
|
||||
#include "src/util/output.h"
|
||||
#include "bfrop_v12.h"
|
||||
#include "internal.h"
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack(pmix_buffer_t *buffer,
|
||||
const void *src, int32_t num_vals,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
|
||||
/* check for error */
|
||||
if (NULL == buffer) {
|
||||
return PMIX_ERR_BAD_PARAM;
|
||||
}
|
||||
|
||||
/* Pack the number of values */
|
||||
if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) {
|
||||
if (PMIX_SUCCESS != (rc = pmix12_bfrop_store_data_type(buffer, PMIX_INT32))) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
if (PMIX_SUCCESS != (rc = pmix12_bfrop_pack_int32(buffer, &num_vals, 1, PMIX_INT32))) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Pack the value(s) */
|
||||
return pmix12_bfrop_pack_buffer(buffer, src, num_vals, type);
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_buffer(pmix_buffer_t *buffer,
|
||||
const void *src, int32_t num_vals,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
pmix_bfrop_type_info_t *info;
|
||||
int v1type;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix12_bfrop_pack_buffer( %p, %p, %lu, %d )\n",
|
||||
(void*)buffer, src, (long unsigned int)num_vals, (int)type);
|
||||
|
||||
/* some v1 types are simply declared differently */
|
||||
switch (type) {
|
||||
case PMIX_COMMAND:
|
||||
v1type = PMIX_UINT32;
|
||||
break;
|
||||
case PMIX_SCOPE:
|
||||
case PMIX_DATA_RANGE:
|
||||
v1type = PMIX_UINT;
|
||||
break;
|
||||
case PMIX_PROC_RANK:
|
||||
case PMIX_PERSIST:
|
||||
v1type = PMIX_INT;
|
||||
break;
|
||||
default:
|
||||
v1type = type;
|
||||
}
|
||||
|
||||
/* Pack the declared data type */
|
||||
if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) {
|
||||
if (PMIX_SUCCESS != (rc = pmix12_bfrop_store_data_type(buffer, v1type))) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
/* Lookup the pack function for this type and call it */
|
||||
|
||||
if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v12_component.types, v1type))) {
|
||||
return PMIX_ERR_PACK_FAILURE;
|
||||
}
|
||||
|
||||
return info->odti_pack_fn(buffer, src, num_vals, v1type);
|
||||
}
|
||||
|
||||
|
||||
/* PACK FUNCTIONS FOR GENERIC SYSTEM TYPES */
|
||||
|
||||
/*
|
||||
* BOOL
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
uint8_t *dst;
|
||||
int32_t i;
|
||||
bool *s = (bool*)src;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix12_bfrop_pack_bool * %d\n", num_vals);
|
||||
/* check to see if buffer needs extending */
|
||||
if (NULL == (dst = (uint8_t*)pmix_bfrop_buffer_extend(buffer, num_vals))) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
/* store the data */
|
||||
for (i=0; i < num_vals; i++) {
|
||||
if (s[i]) {
|
||||
dst[i] = 1;
|
||||
} else {
|
||||
dst[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* update buffer pointers */
|
||||
buffer->pack_ptr += num_vals;
|
||||
buffer->bytes_used += num_vals;
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* INT
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_int(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_status_t ret;
|
||||
|
||||
/* System types need to always be described so we can properly
|
||||
unpack them */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_store_data_type(buffer, BFROP_TYPE_INT))) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Turn around and pack the real type */
|
||||
return pmix12_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_INT);
|
||||
}
|
||||
|
||||
/*
|
||||
* SIZE_T
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_status_t ret;
|
||||
|
||||
/* System types need to always be described so we can properly
|
||||
unpack them. */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_store_data_type(buffer, BFROP_TYPE_SIZE_T))) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return pmix12_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_SIZE_T);
|
||||
}
|
||||
|
||||
/*
|
||||
* PID_T
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_status_t ret;
|
||||
|
||||
/* System types need to always be described so we can properly
|
||||
unpack them. */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_store_data_type(buffer, BFROP_TYPE_PID_T))) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Turn around and pack the real type */
|
||||
return pmix12_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_PID_T);
|
||||
}
|
||||
|
||||
|
||||
/* PACK FUNCTIONS FOR NON-GENERIC SYSTEM TYPES */
|
||||
|
||||
/*
|
||||
* BYTE, CHAR, INT8
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
char *dst;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix12_bfrop_pack_byte * %d\n", num_vals);
|
||||
/* check to see if buffer needs extending */
|
||||
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals))) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
/* store the data */
|
||||
memcpy(dst, src, num_vals);
|
||||
|
||||
/* update buffer pointers */
|
||||
buffer->pack_ptr += num_vals;
|
||||
buffer->bytes_used += num_vals;
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* INT16
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
int32_t i;
|
||||
uint16_t tmp, *srctmp = (uint16_t*) src;
|
||||
char *dst;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix12_bfrop_pack_int16 * %d\n", num_vals);
|
||||
/* check to see if buffer needs extending */
|
||||
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals*sizeof(tmp)))) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
tmp = pmix_htons(srctmp[i]);
|
||||
memcpy(dst, &tmp, sizeof(tmp));
|
||||
dst += sizeof(tmp);
|
||||
}
|
||||
buffer->pack_ptr += num_vals * sizeof(tmp);
|
||||
buffer->bytes_used += num_vals * sizeof(tmp);
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* INT32
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
int32_t i;
|
||||
uint32_t tmp, *srctmp = (uint32_t*) src;
|
||||
char *dst;
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix12_bfrop_pack_int32 * %d\n", num_vals);
|
||||
/* check to see if buffer needs extending */
|
||||
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals*sizeof(tmp)))) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
tmp = htonl(srctmp[i]);
|
||||
memcpy(dst, &tmp, sizeof(tmp));
|
||||
dst += sizeof(tmp);
|
||||
}
|
||||
buffer->pack_ptr += num_vals * sizeof(tmp);
|
||||
buffer->bytes_used += num_vals * sizeof(tmp);
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
return pmix12_bfrop_pack_int32(buffer, src, num_vals, type);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT64
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
int32_t i;
|
||||
uint64_t tmp, tmp2;
|
||||
char *dst;
|
||||
size_t bytes_packed = num_vals * sizeof(tmp);
|
||||
|
||||
pmix_output_verbose(20, pmix_globals.debug_output, "pmix12_bfrop_pack_int64 * %d\n", num_vals);
|
||||
/* check to see if buffer needs extending */
|
||||
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, bytes_packed))) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
memcpy(&tmp2, (char *)src+i*sizeof(uint64_t), sizeof(uint64_t));
|
||||
tmp = pmix_hton64(tmp2);
|
||||
memcpy(dst, &tmp, sizeof(tmp));
|
||||
dst += sizeof(tmp);
|
||||
}
|
||||
buffer->pack_ptr += bytes_packed;
|
||||
buffer->bytes_used += bytes_packed;
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* STRING
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_string(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
int ret = PMIX_SUCCESS;
|
||||
int32_t i, len;
|
||||
char **ssrc = (char**) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
if (NULL == ssrc[i]) { /* got zero-length string/NULL pointer - store NULL */
|
||||
len = 0;
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int32(buffer, &len, 1, PMIX_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
len = (int32_t)strlen(ssrc[i]) + 1;
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int32(buffer, &len, 1, PMIX_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (PMIX_SUCCESS != (ret =
|
||||
pmix12_bfrop_pack_byte(buffer, ssrc[i], len, PMIX_BYTE))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/* FLOAT */
|
||||
pmix_status_t pmix12_bfrop_pack_float(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_status_t ret = PMIX_SUCCESS;
|
||||
int32_t i;
|
||||
float *ssrc = (float*)src;
|
||||
char *convert;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
if (0 > asprintf(&convert, "%f", ssrc[i])) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &convert, 1, PMIX_STRING))) {
|
||||
free(convert);
|
||||
return ret;
|
||||
}
|
||||
free(convert);
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/* DOUBLE */
|
||||
pmix_status_t pmix12_bfrop_pack_double(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_status_t ret = PMIX_SUCCESS;
|
||||
int32_t i;
|
||||
double *ssrc = (double*)src;
|
||||
char *convert;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
if (0 > asprintf(&convert, "%f", ssrc[i])) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &convert, 1, PMIX_STRING))) {
|
||||
free(convert);
|
||||
return ret;
|
||||
}
|
||||
free(convert);
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/* TIMEVAL */
|
||||
pmix_status_t pmix12_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
int64_t tmp[2];
|
||||
pmix_status_t ret = PMIX_SUCCESS;
|
||||
int32_t i;
|
||||
struct timeval *ssrc = (struct timeval *)src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
tmp[0] = (int64_t)ssrc[i].tv_sec;
|
||||
tmp[1] = (int64_t)ssrc[i].tv_usec;
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int64(buffer, tmp, 2, PMIX_INT64))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/* TIME */
|
||||
pmix_status_t pmix12_bfrop_pack_time(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_status_t ret = PMIX_SUCCESS;
|
||||
int32_t i;
|
||||
time_t *ssrc = (time_t *)src;
|
||||
uint64_t ui64;
|
||||
|
||||
/* time_t is a system-dependent size, so cast it
|
||||
* to uint64_t as a generic safe size
|
||||
*/
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
ui64 = (uint64_t)ssrc[i];
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int64(buffer, &ui64, 1, PMIX_UINT64))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* PACK FUNCTIONS FOR GENERIC PMIX TYPES */
|
||||
static pmix_status_t pack_val(pmix_buffer_t *buffer,
|
||||
pmix_value_t *p)
|
||||
{
|
||||
pmix_status_t ret;
|
||||
pmix_info_array_t array;
|
||||
|
||||
switch (p->type) {
|
||||
case PMIX_BOOL:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.flag, 1, PMIX_BOOL))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_BYTE:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.byte, 1, PMIX_BYTE))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_STRING:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.string, 1, PMIX_STRING))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_SIZE:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.size, 1, PMIX_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_PID:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.pid, 1, PMIX_PID))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_INT:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.integer, 1, PMIX_INT))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_INT8:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.int8, 1, PMIX_INT8))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_INT16:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.int16, 1, PMIX_INT16))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_INT32:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.int32, 1, PMIX_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_INT64:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.int64, 1, PMIX_INT64))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_UINT:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.uint, 1, PMIX_UINT))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_UINT8:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.uint8, 1, PMIX_UINT8))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_UINT16:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.uint16, 1, PMIX_UINT16))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_UINT32:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.uint32, 1, PMIX_UINT32))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_UINT64:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.uint64, 1, PMIX_UINT64))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_FLOAT:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.fval, 1, PMIX_FLOAT))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_DOUBLE:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.dval, 1, PMIX_DOUBLE))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_TIMEVAL:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.tv, 1, PMIX_TIMEVAL))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_INFO_ARRAY:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, p->data.array, 1, PMIX_INFO_ARRAY))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_BYTE_OBJECT:
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_DATA_ARRAY:
|
||||
/* must convert this to an in info array for v1.2 */
|
||||
if (PMIX_INFO != p->data.darray->type) {
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
array.size = p->data.darray->size;
|
||||
array.array = (pmix_info_t*)p->data.darray->array;
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &array, 1, PMIX_INFO_ARRAY))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
pmix_output(0, "PACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)p->type);
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* PMIX_VALUE
|
||||
*/
|
||||
pmix_status_t pmix12_bfrop_pack_value(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_value_t *ptr;
|
||||
int32_t i;
|
||||
pmix_status_t ret;
|
||||
int v1type;
|
||||
|
||||
ptr = (pmix_value_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
/* pack the type - unfortunately, v1.2 directly packed the int instead of
|
||||
* using the store_data_type function. This means we lose the translation!
|
||||
* So get it here */
|
||||
v1type = pmix12_v2_to_v1_datatype(ptr[i].type);
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &v1type, 1, PMIX_INT))) {
|
||||
return ret;
|
||||
}
|
||||
/* now pack the right field */
|
||||
if (PMIX_SUCCESS != (ret = pack_val(buffer, &ptr[i]))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_info(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_info_t *info;
|
||||
int32_t i;
|
||||
pmix_status_t ret;
|
||||
char *foo;
|
||||
int v1type;
|
||||
|
||||
info = (pmix_info_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
/* pack key */
|
||||
foo = info[i].key;
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &foo, 1, PMIX_STRING))) {
|
||||
return ret;
|
||||
}
|
||||
/* pack the type - unfortunately, v1.2 directly packed the int instead of
|
||||
* using the store_data_type function. This means we lose the translation!
|
||||
* So get it here */
|
||||
v1type = pmix12_v2_to_v1_datatype(info[i].value.type);
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &v1type, 1, PMIX_INT))) {
|
||||
return ret;
|
||||
}
|
||||
/* pack value */
|
||||
if (PMIX_SUCCESS != (ret = pack_val(buffer, &info[i].value))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_pdata_t *pdata;
|
||||
int32_t i;
|
||||
pmix_status_t ret;
|
||||
char *foo;
|
||||
int v1type;
|
||||
|
||||
pdata = (pmix_pdata_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
/* pack the proc */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_proc(buffer, &pdata[i].proc, 1, PMIX_PROC))) {
|
||||
return ret;
|
||||
}
|
||||
/* pack key */
|
||||
foo = pdata[i].key;
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &foo, 1, PMIX_STRING))) {
|
||||
return ret;
|
||||
}
|
||||
/* pack the type - unfortunately, v1.2 directly packed the int instead of
|
||||
* using the store_data_type function. This means we lose the translation!
|
||||
* So get it here */
|
||||
v1type = pmix12_v2_to_v1_datatype(pdata[i].value.type);
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &v1type, 1, PMIX_INT))) {
|
||||
return ret;
|
||||
}
|
||||
/* pack value */
|
||||
if (PMIX_SUCCESS != (ret = pack_val(buffer, &pdata[i].value))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_buffer_t *ptr;
|
||||
int32_t i;
|
||||
pmix_status_t ret;
|
||||
|
||||
ptr = (pmix_buffer_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
/* pack the number of bytes */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(buffer, &ptr[i].bytes_used, 1, PMIX_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
/* pack the bytes */
|
||||
if (0 < ptr[i].bytes_used) {
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_byte(buffer, ptr[i].base_ptr, ptr[i].bytes_used, PMIX_BYTE))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_proc_t *proc;
|
||||
int32_t i;
|
||||
pmix_status_t ret;
|
||||
|
||||
proc = (pmix_proc_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
char *ptr = proc[i].nspace;
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &ptr, 1, PMIX_STRING))) {
|
||||
return ret;
|
||||
}
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &proc[i].rank, 1, PMIX_INT))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_app_t *app;
|
||||
int32_t i, j, nvals;
|
||||
pmix_status_t ret;
|
||||
int argc;
|
||||
|
||||
app = (pmix_app_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &app[i].cmd, 1, PMIX_STRING))) {
|
||||
return ret;
|
||||
}
|
||||
/* argv */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &argc, 1, PMIX_INT))) {
|
||||
return ret;
|
||||
}
|
||||
for (j=0; j < argc; j++) {
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &app[i].argv[j], 1, PMIX_STRING))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
/* env */
|
||||
nvals = pmix_argv_count(app[i].env);
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int32(buffer, &nvals, 1, PMIX_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
for (j=0; j < nvals; j++) {
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &app[i].env[j], 1, PMIX_STRING))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
/* maxprocs */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &app[i].maxprocs, 1, PMIX_INT))) {
|
||||
return ret;
|
||||
}
|
||||
/* info array */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(buffer, &app[i].ninfo, 1, PMIX_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
if (0 < app[i].ninfo) {
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_info(buffer, app[i].info, app[i].ninfo, PMIX_INFO))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_kval_t *ptr;
|
||||
int32_t i;
|
||||
pmix_status_t ret;
|
||||
|
||||
ptr = (pmix_kval_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
/* pack the key */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &ptr[i].key, 1, PMIX_STRING))) {
|
||||
return ret;
|
||||
}
|
||||
/* pack the value */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_value(buffer, ptr[i].value, 1, ptr[i].value->type))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_info_array_t *ptr;
|
||||
int32_t i;
|
||||
pmix_status_t ret;
|
||||
|
||||
ptr = (pmix_info_array_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
/* pack the size */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
if (0 < ptr[i].size) {
|
||||
/* pack the values */
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_modex_data_t *ptr;
|
||||
int32_t i;
|
||||
pmix_status_t ret;
|
||||
|
||||
ptr = (pmix_modex_data_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
if( 0 < ptr[i].size){
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_byte(buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
return pmix12_bfrop_pack_int(buffer, src, num_vals, PMIX_INT);
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_status_t ret;
|
||||
int i;
|
||||
pmix_byte_object_t *bo;
|
||||
|
||||
bo = (pmix_byte_object_t*)src;
|
||||
for (i=0; i < num_vals; i++) {
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(buffer, &bo[i].size, 1, PMIX_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
if (0 < bo[i].size) {
|
||||
if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_byte(buffer, bo[i].bytes, bo[i].size, PMIX_BYTE))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_ptr(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
/* v1.x has no concept of packing a pointer, so just return */
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_scope_t *scope = (pmix_scope_t*)src;
|
||||
unsigned int *v1scope;
|
||||
pmix_status_t ret;
|
||||
int i;
|
||||
|
||||
/* v1.2 packed scope as PMIX_UINT, so we have to convert */
|
||||
v1scope = (unsigned int*)malloc(num_vals * sizeof(unsigned int));
|
||||
if (NULL == v1scope) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
for (i=0; i < num_vals; i++) {
|
||||
v1scope[i] = (unsigned int)scope[i];
|
||||
}
|
||||
ret = pmix12_bfrop_pack_int(buffer, (void*)v1scope, num_vals, PMIX_UINT);
|
||||
free(v1scope);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_status(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
/* v1.2 declares pmix_status_t as an enum, which translates to int and
|
||||
* matches that of v2 */
|
||||
return pmix12_bfrop_pack_int(buffer, src, num_vals, PMIX_INT);
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_range(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_data_range_t *range = (pmix_data_range_t*)src;
|
||||
unsigned int *v1range;
|
||||
pmix_status_t ret;
|
||||
int i;
|
||||
|
||||
/* v1.2 packed data range as PMIX_UINT, so we have to convert */
|
||||
v1range = (unsigned int*)malloc(num_vals * sizeof(unsigned int));
|
||||
if (NULL == v1range) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
for (i=0; i < num_vals; i++) {
|
||||
v1range[i] = (unsigned int)range[i];
|
||||
}
|
||||
ret = pmix12_bfrop_pack_int(buffer, (void*)v1range, num_vals, PMIX_UINT);
|
||||
free(v1range);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_cmd_t *cmd = (pmix_cmd_t*)src;
|
||||
int *v1cmd;
|
||||
pmix_status_t ret;
|
||||
int i;
|
||||
|
||||
/* v1.2 commands were enum (i.e., int), while they are uint8_t in v2 */
|
||||
v1cmd = (int*)malloc(num_vals * sizeof(int));
|
||||
if (NULL == v1cmd) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
for (i=0; i < num_vals; i++) {
|
||||
v1cmd[i] = cmd[i];
|
||||
}
|
||||
ret = pmix12_bfrop_pack_int(buffer, (void*)v1cmd, num_vals, PMIX_INT);
|
||||
free(v1cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_info_directives(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
/* v1.x has no concept of an info directive, so just return */
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_proc_state(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
/* v1.x has no concept of proc state, so just return */
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_proc_info(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_query(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
pmix_status_t pmix12_bfrop_pack_rank(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
/* v1 rank is just an int, not a separate data type - it is defined
|
||||
* to be an unint32 in v2 */
|
||||
return pmix12_bfrop_pack_int(buffer, src, num_vals, PMIX_INT);
|
||||
}
|
1082
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/print.c
Обычный файл
1082
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/print.c
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
1180
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/unpack.c
Обычный файл
1180
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v12/unpack.c
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
57
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/Makefile.am
Обычный файл
57
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/Makefile.am
Обычный файл
@ -0,0 +1,57 @@
|
||||
# -*- makefile -*-
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
# University Research and Technology
|
||||
# Corporation. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
# of Tennessee Research Foundation. All rights
|
||||
# reserved.
|
||||
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
headers = \
|
||||
bfrop_pmix20.h \
|
||||
internal.h
|
||||
|
||||
sources = \
|
||||
bfrop_pmix20_component.c \
|
||||
bfrop_pmix20.c \
|
||||
copy.c \
|
||||
pack.c \
|
||||
print.c \
|
||||
unpack.c
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
# (for static builds).
|
||||
|
||||
if MCA_BUILD_pmix_bfrops_v20_DSO
|
||||
lib =
|
||||
lib_sources =
|
||||
component = mca_bfrops_v20.la
|
||||
component_sources = $(headers) $(sources)
|
||||
else
|
||||
lib = libmca_bfrops_v20.la
|
||||
lib_sources = $(headers) $(sources)
|
||||
component =
|
||||
component_sources =
|
||||
endif
|
||||
|
||||
mcacomponentdir = $(pmixlibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component)
|
||||
mca_bfrops_v20_la_SOURCES = $(component_sources)
|
||||
mca_bfrops_v20_la_LDFLAGS = -module -avoid-version
|
||||
|
||||
noinst_LTLIBRARIES = $(lib)
|
||||
libmca_bfrops_v20_la_SOURCES = $(lib_sources)
|
||||
libmca_bfrops_v20_la_LDFLAGS = -module -avoid-version
|
742
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/bfrop_pmix20.c
Обычный файл
742
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/bfrop_pmix20.c
Обычный файл
@ -0,0 +1,742 @@
|
||||
/*
|
||||
* 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) 2010-2011 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <src/include/pmix_config.h>
|
||||
|
||||
#include "src/util/error.h"
|
||||
#include "src/include/pmix_globals.h"
|
||||
#include "src/client/pmix_client_ops.h"
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
#include "bfrop_pmix20.h"
|
||||
#include "internal.h"
|
||||
|
||||
static pmix_status_t init(void);
|
||||
static void finalize(void);
|
||||
static pmix_status_t register_type(const char *name,
|
||||
pmix_data_type_t type,
|
||||
pmix_bfrop_pack_fn_t pack,
|
||||
pmix_bfrop_unpack_fn_t unpack,
|
||||
pmix_bfrop_copy_fn_t copy,
|
||||
pmix_bfrop_print_fn_t print);
|
||||
static const char* data_type_string(pmix_data_type_t type);
|
||||
|
||||
pmix_bfrops_module_t pmix_bfrops_pmix20_module = {
|
||||
.version = "v20",
|
||||
.init = init,
|
||||
.finalize = finalize,
|
||||
.pack = pmix20_bfrop_pack,
|
||||
.unpack = pmix20_bfrop_unpack,
|
||||
.copy = pmix20_bfrop_copy,
|
||||
.print = pmix20_bfrop_print,
|
||||
.copy_payload = pmix20_bfrop_copy_payload,
|
||||
.value_xfer = pmix20_bfrop_value_xfer,
|
||||
.value_load = pmix20_bfrop_value_load,
|
||||
.value_unload = pmix20_bfrop_value_unload,
|
||||
.value_cmp = pmix20_bfrop_value_cmp,
|
||||
.register_type = register_type,
|
||||
.data_type_string = data_type_string
|
||||
};
|
||||
|
||||
static pmix_status_t init(void)
|
||||
{
|
||||
/* some standard types don't require anything special */
|
||||
PMIX_REGISTER_TYPE("PMIX_BOOL", PMIX_BOOL,
|
||||
pmix20_bfrop_pack_bool,
|
||||
pmix20_bfrop_unpack_bool,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_bool,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_BYTE", PMIX_BYTE,
|
||||
pmix20_bfrop_pack_byte,
|
||||
pmix20_bfrop_unpack_byte,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_byte,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_STRING", PMIX_STRING,
|
||||
pmix20_bfrop_pack_string,
|
||||
pmix20_bfrop_unpack_string,
|
||||
pmix20_bfrop_copy_string,
|
||||
pmix20_bfrop_print_string,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
/* Register the rest of the standard generic types to point to internal functions */
|
||||
PMIX_REGISTER_TYPE("PMIX_SIZE", PMIX_SIZE,
|
||||
pmix20_bfrop_pack_sizet,
|
||||
pmix20_bfrop_unpack_sizet,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_size,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PID", PMIX_PID,
|
||||
pmix20_bfrop_pack_pid,
|
||||
pmix20_bfrop_unpack_pid,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_pid,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT", PMIX_INT,
|
||||
pmix20_bfrop_pack_int,
|
||||
pmix20_bfrop_unpack_int,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_int,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
/* Register all the standard fixed types to point to base functions */
|
||||
PMIX_REGISTER_TYPE("PMIX_INT8", PMIX_INT8,
|
||||
pmix20_bfrop_pack_byte,
|
||||
pmix20_bfrop_unpack_byte,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_int8,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT16", PMIX_INT16,
|
||||
pmix20_bfrop_pack_int16,
|
||||
pmix20_bfrop_unpack_int16,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_int16,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT32", PMIX_INT32,
|
||||
pmix20_bfrop_pack_int32,
|
||||
pmix20_bfrop_unpack_int32,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_int32,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT64", PMIX_INT64,
|
||||
pmix20_bfrop_pack_int64,
|
||||
pmix20_bfrop_unpack_int64,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_int64,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT", PMIX_UINT,
|
||||
pmix20_bfrop_pack_int,
|
||||
pmix20_bfrop_unpack_int,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_uint,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT8", PMIX_UINT8,
|
||||
pmix20_bfrop_pack_byte,
|
||||
pmix20_bfrop_unpack_byte,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_uint8,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT16", PMIX_UINT16,
|
||||
pmix20_bfrop_pack_int16,
|
||||
pmix20_bfrop_unpack_int16,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_uint16,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT32", PMIX_UINT32,
|
||||
pmix20_bfrop_pack_int32,
|
||||
pmix20_bfrop_unpack_int32,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_uint32,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT64", PMIX_UINT64,
|
||||
pmix20_bfrop_pack_int64,
|
||||
pmix20_bfrop_unpack_int64,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_uint64,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_FLOAT", PMIX_FLOAT,
|
||||
pmix20_bfrop_pack_float,
|
||||
pmix20_bfrop_unpack_float,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_float,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DOUBLE", PMIX_DOUBLE,
|
||||
pmix20_bfrop_pack_double,
|
||||
pmix20_bfrop_unpack_double,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_double,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_TIMEVAL", PMIX_TIMEVAL,
|
||||
pmix20_bfrop_pack_timeval,
|
||||
pmix20_bfrop_unpack_timeval,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_timeval,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_TIME", PMIX_TIME,
|
||||
pmix20_bfrop_pack_time,
|
||||
pmix20_bfrop_unpack_time,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_time,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_STATUS", PMIX_STATUS,
|
||||
pmix20_bfrop_pack_status,
|
||||
pmix20_bfrop_unpack_status,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_status,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_VALUE", PMIX_VALUE,
|
||||
pmix20_bfrop_pack_value,
|
||||
pmix20_bfrop_unpack_value,
|
||||
pmix20_bfrop_copy_value,
|
||||
pmix20_bfrop_print_value,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC", PMIX_PROC,
|
||||
pmix20_bfrop_pack_proc,
|
||||
pmix20_bfrop_unpack_proc,
|
||||
pmix20_bfrop_copy_proc,
|
||||
pmix20_bfrop_print_proc,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_APP", PMIX_APP,
|
||||
pmix20_bfrop_pack_app,
|
||||
pmix20_bfrop_unpack_app,
|
||||
pmix20_bfrop_copy_app,
|
||||
pmix20_bfrop_print_app,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INFO", PMIX_INFO,
|
||||
pmix20_bfrop_pack_info,
|
||||
pmix20_bfrop_unpack_info,
|
||||
pmix20_bfrop_copy_info,
|
||||
pmix20_bfrop_print_info,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PDATA", PMIX_PDATA,
|
||||
pmix20_bfrop_pack_pdata,
|
||||
pmix20_bfrop_unpack_pdata,
|
||||
pmix20_bfrop_copy_pdata,
|
||||
pmix20_bfrop_print_pdata,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_BUFFER", PMIX_BUFFER,
|
||||
pmix20_bfrop_pack_buf,
|
||||
pmix20_bfrop_unpack_buf,
|
||||
pmix20_bfrop_copy_buf,
|
||||
pmix20_bfrop_print_buf,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_BYTE_OBJECT", PMIX_BYTE_OBJECT,
|
||||
pmix20_bfrop_pack_bo,
|
||||
pmix20_bfrop_unpack_bo,
|
||||
pmix20_bfrop_copy_bo,
|
||||
pmix20_bfrop_print_bo,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_KVAL", PMIX_KVAL,
|
||||
pmix20_bfrop_pack_kval,
|
||||
pmix20_bfrop_unpack_kval,
|
||||
pmix20_bfrop_copy_kval,
|
||||
pmix20_bfrop_print_kval,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_MODEX", PMIX_MODEX,
|
||||
pmix20_bfrop_pack_modex,
|
||||
pmix20_bfrop_unpack_modex,
|
||||
pmix20_bfrop_copy_modex,
|
||||
pmix20_bfrop_print_modex,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
/* these are fixed-sized values and can be done by base */
|
||||
PMIX_REGISTER_TYPE("PMIX_PERSIST", PMIX_PERSIST,
|
||||
pmix20_bfrop_pack_persist,
|
||||
pmix20_bfrop_unpack_persist,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_persist,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_POINTER", PMIX_POINTER,
|
||||
pmix20_bfrop_pack_ptr,
|
||||
pmix20_bfrop_unpack_ptr,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_ptr,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_SCOPE", PMIX_SCOPE,
|
||||
pmix20_bfrop_pack_scope,
|
||||
pmix20_bfrop_unpack_scope,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_std_copy,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DATA_RANGE", PMIX_DATA_RANGE,
|
||||
pmix20_bfrop_pack_range,
|
||||
pmix20_bfrop_unpack_range,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_ptr,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_COMMAND", PMIX_COMMAND,
|
||||
pmix20_bfrop_pack_cmd,
|
||||
pmix20_bfrop_unpack_cmd,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_cmd,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INFO_DIRECTIVES", PMIX_INFO_DIRECTIVES,
|
||||
pmix20_bfrop_pack_infodirs,
|
||||
pmix20_bfrop_unpack_infodirs,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_infodirs,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DATA_TYPE", PMIX_DATA_TYPE,
|
||||
pmix20_bfrop_pack_datatype,
|
||||
pmix20_bfrop_unpack_datatype,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix_bfrops_base_print_datatype,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC_STATE", PMIX_PROC_STATE,
|
||||
pmix20_bfrop_pack_pstate,
|
||||
pmix20_bfrop_unpack_pstate,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_pstate,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC_INFO", PMIX_PROC_INFO,
|
||||
pmix20_bfrop_pack_pinfo,
|
||||
pmix20_bfrop_unpack_pinfo,
|
||||
pmix20_bfrop_copy_pinfo,
|
||||
pmix20_bfrop_print_pinfo,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DATA_ARRAY", PMIX_DATA_ARRAY,
|
||||
pmix20_bfrop_pack_darray,
|
||||
pmix20_bfrop_unpack_darray,
|
||||
pmix20_bfrop_copy_darray,
|
||||
pmix20_bfrop_print_darray,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC_RANK", PMIX_PROC_RANK,
|
||||
pmix20_bfrop_pack_rank,
|
||||
pmix20_bfrop_unpack_rank,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_rank,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_QUERY", PMIX_QUERY,
|
||||
pmix20_bfrop_pack_query,
|
||||
pmix20_bfrop_unpack_query,
|
||||
pmix20_bfrop_copy_query,
|
||||
pmix20_bfrop_print_query,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_COMPRESSED_STRING",
|
||||
PMIX_COMPRESSED_STRING,
|
||||
pmix20_bfrop_pack_bo,
|
||||
pmix20_bfrop_unpack_bo,
|
||||
pmix20_bfrop_copy_bo,
|
||||
pmix20_bfrop_print_bo,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_ALLOC_DIRECTIVE",
|
||||
PMIX_ALLOC_DIRECTIVE,
|
||||
pmix20_bfrop_pack_alloc_directive,
|
||||
pmix20_bfrop_unpack_alloc_directive,
|
||||
pmix20_bfrop_std_copy,
|
||||
pmix20_bfrop_print_alloc_directive,
|
||||
&mca_bfrops_v20_component.types);
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY,
|
||||
pmix20_bfrop_pack_array,
|
||||
pmix20_bfrop_unpack_array,
|
||||
pmix20_bfrop_copy_array,
|
||||
pmix20_bfrop_print_array,
|
||||
&mca_bfrops_v20_component.types);
|
||||
/********************/
|
||||
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
static void finalize(void)
|
||||
{
|
||||
int n;
|
||||
pmix_bfrop_type_info_t *info;
|
||||
|
||||
for (n=0; n < mca_bfrops_v20_component.types.size; n++) {
|
||||
if (NULL != (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v20_component.types, n))) {
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&mca_bfrops_v20_component.types, n, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static pmix_status_t register_type(const char *name, pmix_data_type_t type,
|
||||
pmix_bfrop_pack_fn_t pack,
|
||||
pmix_bfrop_unpack_fn_t unpack,
|
||||
pmix_bfrop_copy_fn_t copy,
|
||||
pmix_bfrop_print_fn_t print)
|
||||
{
|
||||
PMIX_REGISTER_TYPE(name, type,
|
||||
pack, unpack,
|
||||
copy, print,
|
||||
&mca_bfrops_v20_component.types);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
static const char* data_type_string(pmix_data_type_t type)
|
||||
{
|
||||
pmix_bfrop_type_info_t *info;
|
||||
|
||||
if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v20_component.types, type))) {
|
||||
return NULL;
|
||||
}
|
||||
return info->odti_name;
|
||||
}
|
||||
|
||||
pmix_data_type_t pmix20_v21_to_v20_datatype(pmix_data_type_t v21type)
|
||||
{
|
||||
pmix_data_type_t v20type;
|
||||
|
||||
/* iI'm passing the data type to
|
||||
* a PMIx v20 compatible client. The data type was redefined
|
||||
* in v21, and so we have to do some conversions here */
|
||||
switch(v21type) {
|
||||
case PMIX_COMMAND:
|
||||
/* the peer unfortunately didn't separate these out,
|
||||
* but instead set them to PMIX_UINT32 */
|
||||
v20type = PMIX_UINT32;
|
||||
break;
|
||||
|
||||
default:
|
||||
v20type = v21type;
|
||||
}
|
||||
return v20type;
|
||||
}
|
||||
|
||||
pmix_status_t pmix20_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type)
|
||||
{
|
||||
pmix_data_type_t v20type;
|
||||
|
||||
v20type = pmix20_v21_to_v20_datatype(type);
|
||||
return pmix20_bfrop_pack_datatype(buffer, &v20type, 1, PMIX_DATA_TYPE);
|
||||
}
|
||||
|
||||
pmix_status_t pmix20_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type)
|
||||
{
|
||||
int32_t n=1;
|
||||
pmix_status_t rc;
|
||||
|
||||
rc = pmix20_bfrop_unpack_datatype(buffer, type, &n, PMIX_DATA_TYPE);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void pmix20_bfrop_value_load(pmix_value_t *v,
|
||||
const void *data,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
pmix_byte_object_t *bo;
|
||||
pmix_proc_info_t *pi;
|
||||
|
||||
v->type = type;
|
||||
if (NULL == data) {
|
||||
/* just set the fields to zero */
|
||||
memset(&v->data, 0, sizeof(v->data));
|
||||
if (PMIX_BOOL == type) {
|
||||
v->data.flag = true; // existence of the attribute indicates true unless specified different
|
||||
}
|
||||
} else {
|
||||
switch(type) {
|
||||
case PMIX_UNDEF:
|
||||
break;
|
||||
case PMIX_BOOL:
|
||||
memcpy(&(v->data.flag), data, 1);
|
||||
break;
|
||||
case PMIX_BYTE:
|
||||
memcpy(&(v->data.byte), data, 1);
|
||||
break;
|
||||
case PMIX_STRING:
|
||||
v->data.string = strdup(data);
|
||||
break;
|
||||
case PMIX_SIZE:
|
||||
memcpy(&(v->data.size), data, sizeof(size_t));
|
||||
break;
|
||||
case PMIX_PID:
|
||||
memcpy(&(v->data.pid), data, sizeof(pid_t));
|
||||
break;
|
||||
case PMIX_INT:
|
||||
memcpy(&(v->data.integer), data, sizeof(int));
|
||||
break;
|
||||
case PMIX_INT8:
|
||||
memcpy(&(v->data.int8), data, 1);
|
||||
break;
|
||||
case PMIX_INT16:
|
||||
memcpy(&(v->data.int16), data, 2);
|
||||
break;
|
||||
case PMIX_INT32:
|
||||
memcpy(&(v->data.int32), data, 4);
|
||||
break;
|
||||
case PMIX_INT64:
|
||||
memcpy(&(v->data.int64), data, 8);
|
||||
break;
|
||||
case PMIX_UINT:
|
||||
memcpy(&(v->data.uint), data, sizeof(int));
|
||||
break;
|
||||
case PMIX_UINT8:
|
||||
memcpy(&(v->data.uint8), data, 1);
|
||||
break;
|
||||
case PMIX_UINT16:
|
||||
memcpy(&(v->data.uint16), data, 2);
|
||||
break;
|
||||
case PMIX_UINT32:
|
||||
memcpy(&(v->data.uint32), data, 4);
|
||||
break;
|
||||
case PMIX_UINT64:
|
||||
memcpy(&(v->data.uint64), data, 8);
|
||||
break;
|
||||
case PMIX_FLOAT:
|
||||
memcpy(&(v->data.fval), data, sizeof(float));
|
||||
break;
|
||||
case PMIX_DOUBLE:
|
||||
memcpy(&(v->data.dval), data, sizeof(double));
|
||||
break;
|
||||
case PMIX_TIMEVAL:
|
||||
memcpy(&(v->data.tv), data, sizeof(struct timeval));
|
||||
break;
|
||||
case PMIX_TIME:
|
||||
memcpy(&(v->data.time), data, sizeof(time_t));
|
||||
break;
|
||||
case PMIX_STATUS:
|
||||
memcpy(&(v->data.status), data, sizeof(pmix_status_t));
|
||||
break;
|
||||
case PMIX_PROC_RANK:
|
||||
memcpy(&(v->data.rank), data, sizeof(pmix_rank_t));
|
||||
break;
|
||||
case PMIX_PROC:
|
||||
PMIX_PROC_CREATE(v->data.proc, 1);
|
||||
if (NULL == v->data.proc) {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
|
||||
return;
|
||||
}
|
||||
memcpy(v->data.proc, data, sizeof(pmix_proc_t));
|
||||
break;
|
||||
case PMIX_BYTE_OBJECT:
|
||||
bo = (pmix_byte_object_t*)data;
|
||||
v->data.bo.bytes = bo->bytes;
|
||||
memcpy(&(v->data.bo.size), &bo->size, sizeof(size_t));
|
||||
break;
|
||||
case PMIX_PERSIST:
|
||||
memcpy(&(v->data.persist), data, sizeof(pmix_persistence_t));
|
||||
break;
|
||||
case PMIX_SCOPE:
|
||||
memcpy(&(v->data.scope), data, sizeof(pmix_scope_t));
|
||||
break;
|
||||
case PMIX_DATA_RANGE:
|
||||
memcpy(&(v->data.range), data, sizeof(pmix_data_range_t));
|
||||
break;
|
||||
case PMIX_PROC_STATE:
|
||||
memcpy(&(v->data.state), data, sizeof(pmix_proc_state_t));
|
||||
break;
|
||||
case PMIX_PROC_INFO:
|
||||
PMIX_PROC_INFO_CREATE(v->data.pinfo, 1);
|
||||
if (NULL == v->data.pinfo) {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
|
||||
return;
|
||||
}
|
||||
pi = (pmix_proc_info_t*)data;
|
||||
memcpy(&(v->data.pinfo->proc), &pi->proc, sizeof(pmix_proc_t));
|
||||
if (NULL != pi->hostname) {
|
||||
v->data.pinfo->hostname = strdup(pi->hostname);
|
||||
}
|
||||
if (NULL != pi->executable_name) {
|
||||
v->data.pinfo->executable_name = strdup(pi->executable_name);
|
||||
}
|
||||
memcpy(&(v->data.pinfo->pid), &pi->pid, sizeof(pid_t));
|
||||
memcpy(&(v->data.pinfo->exit_code), &pi->exit_code, sizeof(int));
|
||||
break;
|
||||
case PMIX_POINTER:
|
||||
memcpy(&(v->data.ptr), data, sizeof(void*));
|
||||
break;
|
||||
default:
|
||||
/* silence warnings */
|
||||
PMIX_ERROR_LOG(PMIX_ERR_UNKNOWN_DATA_TYPE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pmix_status_t pmix20_bfrop_value_unload(pmix_value_t *kv,
|
||||
void **data,
|
||||
size_t *sz)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
pmix_proc_t *pc;
|
||||
|
||||
rc = PMIX_SUCCESS;
|
||||
if (NULL == data ||
|
||||
(NULL == *data &&
|
||||
PMIX_STRING != kv->type &&
|
||||
PMIX_BYTE_OBJECT != kv->type)) {
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
} else {
|
||||
switch(kv->type) {
|
||||
case PMIX_UNDEF:
|
||||
rc = PMIX_ERR_UNKNOWN_DATA_TYPE;
|
||||
break;
|
||||
case PMIX_BOOL:
|
||||
memcpy(*data, &(kv->data.flag), 1);
|
||||
*sz = 1;
|
||||
break;
|
||||
case PMIX_BYTE:
|
||||
memcpy(*data, &(kv->data.byte), 1);
|
||||
*sz = 1;
|
||||
break;
|
||||
case PMIX_STRING:
|
||||
if (NULL != kv->data.string) {
|
||||
*data = strdup(kv->data.string);
|
||||
*sz = strlen(kv->data.string);
|
||||
}
|
||||
break;
|
||||
case PMIX_SIZE:
|
||||
memcpy(*data, &(kv->data.size), sizeof(size_t));
|
||||
*sz = sizeof(size_t);
|
||||
break;
|
||||
case PMIX_PID:
|
||||
memcpy(*data, &(kv->data.pid), sizeof(pid_t));
|
||||
*sz = sizeof(pid_t);
|
||||
break;
|
||||
case PMIX_INT:
|
||||
memcpy(*data, &(kv->data.integer), sizeof(int));
|
||||
*sz = sizeof(int);
|
||||
break;
|
||||
case PMIX_INT8:
|
||||
memcpy(*data, &(kv->data.int8), 1);
|
||||
*sz = 1;
|
||||
break;
|
||||
case PMIX_INT16:
|
||||
memcpy(*data, &(kv->data.int16), 2);
|
||||
*sz = 2;
|
||||
break;
|
||||
case PMIX_INT32:
|
||||
memcpy(*data, &(kv->data.int32), 4);
|
||||
*sz = 4;
|
||||
break;
|
||||
case PMIX_INT64:
|
||||
memcpy(*data, &(kv->data.int64), 8);
|
||||
*sz = 8;
|
||||
break;
|
||||
case PMIX_UINT:
|
||||
memcpy(*data, &(kv->data.uint), sizeof(int));
|
||||
*sz = sizeof(int);
|
||||
break;
|
||||
case PMIX_UINT8:
|
||||
memcpy(*data, &(kv->data.uint8), 1);
|
||||
*sz = 1;
|
||||
break;
|
||||
case PMIX_UINT16:
|
||||
memcpy(*data, &(kv->data.uint16), 2);
|
||||
*sz = 2;
|
||||
break;
|
||||
case PMIX_UINT32:
|
||||
memcpy(*data, &(kv->data.uint32), 4);
|
||||
*sz = 4;
|
||||
break;
|
||||
case PMIX_UINT64:
|
||||
memcpy(*data, &(kv->data.uint64), 8);
|
||||
*sz = 8;
|
||||
break;
|
||||
case PMIX_FLOAT:
|
||||
memcpy(*data, &(kv->data.fval), sizeof(float));
|
||||
*sz = sizeof(float);
|
||||
break;
|
||||
case PMIX_DOUBLE:
|
||||
memcpy(*data, &(kv->data.dval), sizeof(double));
|
||||
*sz = sizeof(double);
|
||||
break;
|
||||
case PMIX_TIMEVAL:
|
||||
memcpy(*data, &(kv->data.tv), sizeof(struct timeval));
|
||||
*sz = sizeof(struct timeval);
|
||||
break;
|
||||
case PMIX_TIME:
|
||||
memcpy(*data, &(kv->data.time), sizeof(time_t));
|
||||
*sz = sizeof(time_t);
|
||||
break;
|
||||
case PMIX_STATUS:
|
||||
memcpy(*data, &(kv->data.status), sizeof(pmix_status_t));
|
||||
*sz = sizeof(pmix_status_t);
|
||||
break;
|
||||
case PMIX_PROC_RANK:
|
||||
memcpy(*data, &(kv->data.rank), sizeof(pmix_rank_t));
|
||||
*sz = sizeof(pmix_rank_t);
|
||||
break;
|
||||
case PMIX_PROC:
|
||||
PMIX_PROC_CREATE(pc, 1);
|
||||
if (NULL == pc) {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
|
||||
rc = PMIX_ERR_NOMEM;
|
||||
break;
|
||||
}
|
||||
memcpy(pc, kv->data.proc, sizeof(pmix_proc_t));
|
||||
*sz = sizeof(pmix_proc_t);
|
||||
*data = pc;
|
||||
break;
|
||||
case PMIX_BYTE_OBJECT:
|
||||
if (NULL != kv->data.bo.bytes && 0 < kv->data.bo.size) {
|
||||
*data = kv->data.bo.bytes;
|
||||
*sz = kv->data.bo.size;
|
||||
} else {
|
||||
*data = NULL;
|
||||
*sz = 0;
|
||||
}
|
||||
break;
|
||||
case PMIX_PERSIST:
|
||||
memcpy(*data, &(kv->data.persist), sizeof(pmix_persistence_t));
|
||||
*sz = sizeof(pmix_persistence_t);
|
||||
break;
|
||||
case PMIX_SCOPE:
|
||||
memcpy(*data, &(kv->data.scope), sizeof(pmix_scope_t));
|
||||
*sz = sizeof(pmix_scope_t);
|
||||
break;
|
||||
case PMIX_DATA_RANGE:
|
||||
memcpy(*data, &(kv->data.range), sizeof(pmix_data_range_t));
|
||||
*sz = sizeof(pmix_data_range_t);
|
||||
break;
|
||||
case PMIX_PROC_STATE:
|
||||
memcpy(*data, &(kv->data.state), sizeof(pmix_proc_state_t));
|
||||
*sz = sizeof(pmix_proc_state_t);
|
||||
break;
|
||||
case PMIX_POINTER:
|
||||
memcpy(*data, &(kv->data.ptr), sizeof(void*));
|
||||
*sz = sizeof(void*);
|
||||
break;
|
||||
default:
|
||||
/* silence warnings */
|
||||
rc = PMIX_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
34
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/bfrop_pmix20.h
Обычный файл
34
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/bfrop_pmix20.h
Обычный файл
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef PMIX20_BFROPS_H
|
||||
#define PMIX20_BFROPS_H
|
||||
|
||||
#include "src/mca/bfrops/bfrops.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/* the component must be visible data for the linker to find it */
|
||||
PMIX_EXPORT extern pmix_bfrops_base_component_t mca_bfrops_v20_component;
|
||||
|
||||
extern pmix_bfrops_module_t pmix_bfrops_pmix20_module;
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* PMIX20_BFROPS_H */
|
@ -34,9 +34,9 @@
|
||||
#include "src/util/error.h"
|
||||
#include "src/server/pmix_server_ops.h"
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
#include "src/mca/bfrops/pmix2/bfrop_pmix2.h"
|
||||
#include "bfrop_pmix20.h"
|
||||
|
||||
extern pmix_bfrops_module_t pmix_bfrops_pmix2_module;
|
||||
extern pmix_bfrops_module_t pmix_bfrops_pmix20_module;
|
||||
|
||||
static pmix_status_t component_open(void);
|
||||
static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority);
|
||||
@ -47,12 +47,12 @@ static pmix_bfrops_module_t* assign_module(void);
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
pmix_bfrops_base_component_t mca_bfrops_pmix2_component = {
|
||||
pmix_bfrops_base_component_t mca_bfrops_v20_component = {
|
||||
.base = {
|
||||
PMIX_BFROPS_BASE_VERSION_1_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
.pmix_mca_component_name = "pmix2",
|
||||
.pmix_mca_component_name = "v20",
|
||||
PMIX_MCA_BASE_MAKE_VERSION(component, PMIX_MAJOR_VERSION, PMIX_MINOR_VERSION,
|
||||
PMIX_RELEASE_VERSION),
|
||||
|
||||
@ -69,8 +69,8 @@ pmix_bfrops_base_component_t mca_bfrops_pmix2_component = {
|
||||
pmix_status_t component_open(void)
|
||||
{
|
||||
/* setup the types array */
|
||||
PMIX_CONSTRUCT(&mca_bfrops_pmix2_component.types, pmix_pointer_array_t);
|
||||
pmix_pointer_array_init(&mca_bfrops_pmix2_component.types, 32, INT_MAX, 16);
|
||||
PMIX_CONSTRUCT(&mca_bfrops_v20_component.types, pmix_pointer_array_t);
|
||||
pmix_pointer_array_init(&mca_bfrops_v20_component.types, 32, INT_MAX, 16);
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
@ -79,21 +79,21 @@ pmix_status_t component_open(void)
|
||||
pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority)
|
||||
{
|
||||
|
||||
*priority = mca_bfrops_pmix2_component.priority;
|
||||
*module = (pmix_mca_base_module_t *)&pmix_bfrops_pmix2_module;
|
||||
*priority = mca_bfrops_v20_component.priority;
|
||||
*module = (pmix_mca_base_module_t *)&pmix_bfrops_pmix20_module;
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
pmix_status_t component_close(void)
|
||||
{
|
||||
PMIX_DESTRUCT(&mca_bfrops_pmix2_component.types);
|
||||
PMIX_DESTRUCT(&mca_bfrops_v20_component.types);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
static pmix_bfrops_module_t* assign_module(void)
|
||||
{
|
||||
pmix_output_verbose(10, pmix_bfrops_base_framework.framework_output,
|
||||
"bfrops:pmix2x assigning module");
|
||||
return &pmix_bfrops_pmix2_module;
|
||||
"bfrops:pmix20x assigning module");
|
||||
return &pmix_bfrops_pmix20_module;
|
||||
}
|
1522
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/copy.c
Обычный файл
1522
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/copy.c
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
376
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/internal.h
Обычный файл
376
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/internal.h
Обычный файл
@ -0,0 +1,376 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
#ifndef PMIX20_BFROP_INTERNAL_H_
|
||||
#define PMIX20_BFROP_INTERNAL_H_
|
||||
|
||||
#include <src/include/pmix_config.h>
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h> /* for struct timeval */
|
||||
#endif
|
||||
|
||||
#include "src/class/pmix_pointer_array.h"
|
||||
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/*
|
||||
* Implementations of API functions
|
||||
*/
|
||||
|
||||
pmix_status_t pmix20_bfrop_pack(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *max_num_vals,
|
||||
pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_copy(void **dest, void *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_print(char **output, char *prefix, void *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src);
|
||||
|
||||
pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src);
|
||||
|
||||
void pmix20_bfrop_value_load(pmix_value_t *v, const void *data,
|
||||
pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_value_unload(pmix_value_t *kv,
|
||||
void **data,
|
||||
size_t *sz);
|
||||
|
||||
pmix_value_cmp_t pmix20_bfrop_value_cmp(pmix_value_t *p,
|
||||
pmix_value_t *p1);
|
||||
|
||||
/*
|
||||
* Specialized functions
|
||||
*/
|
||||
pmix_status_t pmix20_bfrop_pack_buffer(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
|
||||
/*
|
||||
* Internal pack functions
|
||||
*/
|
||||
|
||||
pmix_status_t pmix20_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_string(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_pack_int(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_pack_float(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_double(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_time(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_time(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_status(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_value(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_info(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_range(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_infodirs(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_ptr(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_pstate(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_pinfo(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_query(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_rank(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_pack_alloc_directive(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
/**** DEPRECATED ****/
|
||||
pmix_status_t pmix20_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type);
|
||||
/********************/
|
||||
|
||||
/*
|
||||
* Internal unpack functions
|
||||
*/
|
||||
pmix_status_t pmix20_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_scope(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_range(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_cmd(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_infodirs(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_ptr(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_pstate(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_pinfo(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_rank(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_unpack_alloc_directive(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
/**** DEPRECATED ****/
|
||||
pmix_status_t pmix20_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
/********************/
|
||||
|
||||
/*
|
||||
* Internal copy functions
|
||||
*/
|
||||
|
||||
pmix_status_t pmix20_bfrop_std_copy(void **dest, void *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_string(char **dest, char *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_pinfo(pmix_proc_info_t **dest, pmix_proc_info_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_darray(pmix_data_array_t **dest, pmix_data_array_t *src,
|
||||
pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_copy_query(pmix_query_t **dest, pmix_query_t *src,
|
||||
pmix_data_type_t type);
|
||||
/**** DEPRECATED ****/
|
||||
pmix_status_t pmix20_bfrop_copy_array(pmix_info_array_t **dest,
|
||||
pmix_info_array_t *src,
|
||||
pmix_data_type_t type);
|
||||
|
||||
/********************/
|
||||
|
||||
/*
|
||||
* Internal print functions
|
||||
*/
|
||||
pmix_status_t pmix20_bfrop_print_bool(char **output, char *prefix, bool *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_byte(char **output, char *prefix, uint8_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_string(char **output, char *prefix, char *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_size(char **output, char *prefix, size_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_pid(char **output, char *prefix, pid_t *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_print_int(char **output, char *prefix, int *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_int8(char **output, char *prefix, int8_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_int16(char **output, char *prefix, int16_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_int32(char **output, char *prefix, int32_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_int64(char **output, char *prefix, int64_t *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_print_uint(char **output, char *prefix, uint *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_uint8(char **output, char *prefix, uint8_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_uint16(char **output, char *prefix, uint16_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_uint32(char **output, char *prefix, uint32_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_uint64(char **output, char *prefix, uint64_t *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_print_float(char **output, char *prefix, float *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_double(char **output, char *prefix, double *src, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_print_timeval(char **output, char *prefix, struct timeval *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_time(char **output, char *prefix, time_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_status(char **output, char *prefix, pmix_status_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_value(char **output, char *prefix, pmix_value_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_proc(char **output, char *prefix,
|
||||
pmix_proc_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_app(char **output, char *prefix,
|
||||
pmix_app_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_info(char **output, char *prefix,
|
||||
pmix_info_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_buf(char **output, char *prefix,
|
||||
pmix_buffer_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_kval(char **output, char *prefix,
|
||||
pmix_kval_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_modex(char **output, char *prefix,
|
||||
pmix_modex_data_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_persist(char **output, char *prefix,
|
||||
pmix_persistence_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_scope(char **output, char *prefix,
|
||||
pmix_scope_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_range(char **output, char *prefix,
|
||||
pmix_data_range_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_cmd(char **output, char *prefix,
|
||||
pmix_cmd_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_infodirs(char **output, char *prefix,
|
||||
pmix_info_directives_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_bo(char **output, char *prefix,
|
||||
pmix_byte_object_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_pdata(char **output, char *prefix,
|
||||
pmix_pdata_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_ptr(char **output, char *prefix,
|
||||
void *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_pstate(char **output, char *prefix,
|
||||
pmix_proc_state_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_pinfo(char **output, char *prefix,
|
||||
pmix_proc_info_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_darray(char **output, char *prefix,
|
||||
pmix_data_array_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_query(char **output, char *prefix,
|
||||
pmix_query_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_rank(char **output, char *prefix,
|
||||
pmix_rank_t *src, pmix_data_type_t type);
|
||||
pmix_status_t pmix20_bfrop_print_alloc_directive(char **output, char *prefix,
|
||||
pmix_alloc_directive_t *src,
|
||||
pmix_data_type_t type);
|
||||
/**** DEPRECATED ****/
|
||||
pmix_status_t pmix20_bfrop_print_array(char **output, char *prefix,
|
||||
pmix_info_array_t *src,
|
||||
pmix_data_type_t type);
|
||||
/********************/
|
||||
|
||||
/*
|
||||
* Internal helper functions
|
||||
*/
|
||||
|
||||
pmix_status_t pmix20_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix20_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type);
|
||||
|
||||
pmix_data_type_t pmix20_v21_to_v20_datatype(pmix_data_type_t v21type);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
1064
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/pack.c
Обычный файл
1064
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/pack.c
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
1495
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/print.c
Обычный файл
1495
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/print.c
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
1463
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/unpack.c
Обычный файл
1463
opal/mca/pmix/pmix2x/pmix/src/mca/bfrops/v20/unpack.c
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -19,22 +19,22 @@
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
headers = bfrop_pmix2.h
|
||||
headers = bfrop_pmix21.h
|
||||
sources = \
|
||||
bfrop_pmix2_component.c \
|
||||
bfrop_pmix2.c
|
||||
bfrop_pmix21_component.c \
|
||||
bfrop_pmix21.c
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
# (for static builds).
|
||||
|
||||
if MCA_BUILD_pmix_bfrops_pmix2_DSO
|
||||
if MCA_BUILD_pmix_bfrops_v21_DSO
|
||||
lib =
|
||||
lib_sources =
|
||||
component = mca_bfrops_pmix2.la
|
||||
component = mca_bfrops_v21.la
|
||||
component_sources = $(headers) $(sources)
|
||||
else
|
||||
lib = libmca_bfrops_pmix2.la
|
||||
lib = libmca_bfrops_v21.la
|
||||
lib_sources = $(headers) $(sources)
|
||||
component =
|
||||
component_sources =
|
||||
@ -42,9 +42,9 @@ endif
|
||||
|
||||
mcacomponentdir = $(pmixlibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component)
|
||||
mca_bfrops_pmix2_la_SOURCES = $(component_sources)
|
||||
mca_bfrops_pmix2_la_LDFLAGS = -module -avoid-version
|
||||
mca_bfrops_v21_la_SOURCES = $(component_sources)
|
||||
mca_bfrops_v21_la_LDFLAGS = -module -avoid-version
|
||||
|
||||
noinst_LTLIBRARIES = $(lib)
|
||||
libmca_bfrops_pmix2_la_SOURCES = $(lib_sources)
|
||||
libmca_bfrops_pmix2_la_LDFLAGS = -module -avoid-version
|
||||
libmca_bfrops_v21_la_SOURCES = $(lib_sources)
|
||||
libmca_bfrops_v21_la_LDFLAGS = -module -avoid-version
|
@ -25,18 +25,18 @@
|
||||
#include <src/include/pmix_config.h>
|
||||
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
#include "bfrop_pmix2.h"
|
||||
#include "bfrop_pmix21.h"
|
||||
|
||||
static pmix_status_t init(void);
|
||||
static void finalize(void);
|
||||
static pmix_status_t pmix2_pack(pmix_buffer_t *buffer,
|
||||
static pmix_status_t pmix21_pack(pmix_buffer_t *buffer,
|
||||
const void *src, int num_vals,
|
||||
pmix_data_type_t type);
|
||||
static pmix_status_t pmix2_unpack(pmix_buffer_t *buffer, void *dest,
|
||||
static pmix_status_t pmix21_unpack(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type);
|
||||
static pmix_status_t pmix2_copy(void **dest, void *src,
|
||||
static pmix_status_t pmix21_copy(void **dest, void *src,
|
||||
pmix_data_type_t type);
|
||||
static pmix_status_t pmix2_print(char **output, char *prefix,
|
||||
static pmix_status_t pmix21_print(char **output, char *prefix,
|
||||
void *src, pmix_data_type_t type);
|
||||
static pmix_status_t register_type(const char *name,
|
||||
pmix_data_type_t type,
|
||||
@ -46,14 +46,14 @@ static pmix_status_t register_type(const char *name,
|
||||
pmix_bfrop_print_fn_t print);
|
||||
static const char* data_type_string(pmix_data_type_t type);
|
||||
|
||||
pmix_bfrops_module_t pmix_bfrops_pmix2_module = {
|
||||
.version = "pmix2",
|
||||
pmix_bfrops_module_t pmix_bfrops_pmix21_module = {
|
||||
.version = "v21",
|
||||
.init = init,
|
||||
.finalize = finalize,
|
||||
.pack = pmix2_pack,
|
||||
.unpack = pmix2_unpack,
|
||||
.copy = pmix2_copy,
|
||||
.print = pmix2_print,
|
||||
.pack = pmix21_pack,
|
||||
.unpack = pmix21_unpack,
|
||||
.copy = pmix21_copy,
|
||||
.print = pmix21_print,
|
||||
.copy_payload = pmix_bfrops_base_copy_payload,
|
||||
.value_xfer = pmix_bfrops_base_value_xfer,
|
||||
.value_load = pmix_bfrops_base_value_load,
|
||||
@ -71,21 +71,21 @@ static pmix_status_t init(void)
|
||||
pmix_bfrops_base_unpack_bool,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_bool,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_BYTE", PMIX_BYTE,
|
||||
pmix_bfrops_base_pack_byte,
|
||||
pmix_bfrops_base_unpack_byte,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_byte,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_STRING", PMIX_STRING,
|
||||
pmix_bfrops_base_pack_string,
|
||||
pmix_bfrops_base_unpack_string,
|
||||
pmix_bfrops_base_copy_string,
|
||||
pmix_bfrops_base_print_string,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
/* Register the rest of the standard generic types to point to internal functions */
|
||||
PMIX_REGISTER_TYPE("PMIX_SIZE", PMIX_SIZE,
|
||||
@ -93,21 +93,21 @@ static pmix_status_t init(void)
|
||||
pmix_bfrops_base_unpack_sizet,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_size,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PID", PMIX_PID,
|
||||
pmix_bfrops_base_pack_pid,
|
||||
pmix_bfrops_base_unpack_pid,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_pid,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT", PMIX_INT,
|
||||
pmix_bfrops_base_pack_int,
|
||||
pmix_bfrops_base_unpack_int,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_int,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
/* Register all the standard fixed types to point to base functions */
|
||||
PMIX_REGISTER_TYPE("PMIX_INT8", PMIX_INT8,
|
||||
@ -115,161 +115,161 @@ static pmix_status_t init(void)
|
||||
pmix_bfrops_base_unpack_byte,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_int8,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT16", PMIX_INT16,
|
||||
pmix_bfrops_base_pack_int16,
|
||||
pmix_bfrops_base_unpack_int16,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_int16,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT32", PMIX_INT32,
|
||||
pmix_bfrops_base_pack_int32,
|
||||
pmix_bfrops_base_unpack_int32,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_int32,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INT64", PMIX_INT64,
|
||||
pmix_bfrops_base_pack_int64,
|
||||
pmix_bfrops_base_unpack_int64,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_int64,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT", PMIX_UINT,
|
||||
pmix_bfrops_base_pack_int,
|
||||
pmix_bfrops_base_unpack_int,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_uint,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT8", PMIX_UINT8,
|
||||
pmix_bfrops_base_pack_byte,
|
||||
pmix_bfrops_base_unpack_byte,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_uint8,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT16", PMIX_UINT16,
|
||||
pmix_bfrops_base_pack_int16,
|
||||
pmix_bfrops_base_unpack_int16,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_uint16,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT32", PMIX_UINT32,
|
||||
pmix_bfrops_base_pack_int32,
|
||||
pmix_bfrops_base_unpack_int32,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_uint32,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_UINT64", PMIX_UINT64,
|
||||
pmix_bfrops_base_pack_int64,
|
||||
pmix_bfrops_base_unpack_int64,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_uint64,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_FLOAT", PMIX_FLOAT,
|
||||
pmix_bfrops_base_pack_float,
|
||||
pmix_bfrops_base_unpack_float,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_float,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DOUBLE", PMIX_DOUBLE,
|
||||
pmix_bfrops_base_pack_double,
|
||||
pmix_bfrops_base_unpack_double,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_double,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_TIMEVAL", PMIX_TIMEVAL,
|
||||
pmix_bfrops_base_pack_timeval,
|
||||
pmix_bfrops_base_unpack_timeval,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_timeval,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_TIME", PMIX_TIME,
|
||||
pmix_bfrops_base_pack_time,
|
||||
pmix_bfrops_base_unpack_time,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_time,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_STATUS", PMIX_STATUS,
|
||||
pmix_bfrops_base_pack_status,
|
||||
pmix_bfrops_base_unpack_status,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_status,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_VALUE", PMIX_VALUE,
|
||||
pmix_bfrops_base_pack_value,
|
||||
pmix_bfrops_base_unpack_value,
|
||||
pmix_bfrops_base_copy_value,
|
||||
pmix_bfrops_base_print_value,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC", PMIX_PROC,
|
||||
pmix_bfrops_base_pack_proc,
|
||||
pmix_bfrops_base_unpack_proc,
|
||||
pmix_bfrops_base_copy_proc,
|
||||
pmix_bfrops_base_print_proc,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_APP", PMIX_APP,
|
||||
pmix_bfrops_base_pack_app,
|
||||
pmix_bfrops_base_unpack_app,
|
||||
pmix_bfrops_base_copy_app,
|
||||
pmix_bfrops_base_print_app,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INFO", PMIX_INFO,
|
||||
pmix_bfrops_base_pack_info,
|
||||
pmix_bfrops_base_unpack_info,
|
||||
pmix_bfrops_base_copy_info,
|
||||
pmix_bfrops_base_print_info,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PDATA", PMIX_PDATA,
|
||||
pmix_bfrops_base_pack_pdata,
|
||||
pmix_bfrops_base_unpack_pdata,
|
||||
pmix_bfrops_base_copy_pdata,
|
||||
pmix_bfrops_base_print_pdata,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_BUFFER", PMIX_BUFFER,
|
||||
pmix_bfrops_base_pack_buf,
|
||||
pmix_bfrops_base_unpack_buf,
|
||||
pmix_bfrops_base_copy_buf,
|
||||
pmix_bfrops_base_print_buf,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_BYTE_OBJECT", PMIX_BYTE_OBJECT,
|
||||
pmix_bfrops_base_pack_bo,
|
||||
pmix_bfrops_base_unpack_bo,
|
||||
pmix_bfrops_base_copy_bo,
|
||||
pmix_bfrops_base_print_bo,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_KVAL", PMIX_KVAL,
|
||||
pmix_bfrops_base_pack_kval,
|
||||
pmix_bfrops_base_unpack_kval,
|
||||
pmix_bfrops_base_copy_kval,
|
||||
pmix_bfrops_base_print_kval,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_MODEX", PMIX_MODEX,
|
||||
pmix_bfrops_base_pack_modex,
|
||||
pmix_bfrops_base_unpack_modex,
|
||||
pmix_bfrops_base_copy_modex,
|
||||
pmix_bfrops_base_print_modex,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
/* these are fixed-sized values and can be done by base */
|
||||
PMIX_REGISTER_TYPE("PMIX_PERSIST", PMIX_PERSIST,
|
||||
@ -277,84 +277,84 @@ static pmix_status_t init(void)
|
||||
pmix_bfrops_base_unpack_persist,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_persist,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_POINTER", PMIX_POINTER,
|
||||
pmix_bfrops_base_pack_ptr,
|
||||
pmix_bfrops_base_unpack_ptr,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_ptr,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_SCOPE", PMIX_SCOPE,
|
||||
pmix_bfrops_base_pack_scope,
|
||||
pmix_bfrops_base_unpack_scope,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_std_copy,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DATA_RANGE", PMIX_DATA_RANGE,
|
||||
pmix_bfrops_base_pack_range,
|
||||
pmix_bfrops_base_unpack_range,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_ptr,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_COMMAND", PMIX_COMMAND,
|
||||
pmix_bfrops_base_pack_cmd,
|
||||
pmix_bfrops_base_unpack_cmd,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_cmd,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_INFO_DIRECTIVES", PMIX_INFO_DIRECTIVES,
|
||||
pmix_bfrops_base_pack_info_directives,
|
||||
pmix_bfrops_base_unpack_info_directives,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_info_directives,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DATA_TYPE", PMIX_DATA_TYPE,
|
||||
pmix_bfrops_base_pack_datatype,
|
||||
pmix_bfrops_base_unpack_datatype,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_datatype,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC_STATE", PMIX_PROC_STATE,
|
||||
pmix_bfrops_base_pack_pstate,
|
||||
pmix_bfrops_base_unpack_pstate,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_pstate,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC_INFO", PMIX_PROC_INFO,
|
||||
pmix_bfrops_base_pack_pinfo,
|
||||
pmix_bfrops_base_unpack_pinfo,
|
||||
pmix_bfrops_base_copy_pinfo,
|
||||
pmix_bfrops_base_print_pinfo,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_DATA_ARRAY", PMIX_DATA_ARRAY,
|
||||
pmix_bfrops_base_pack_darray,
|
||||
pmix_bfrops_base_unpack_darray,
|
||||
pmix_bfrops_base_copy_darray,
|
||||
pmix_bfrops_base_print_darray,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_PROC_RANK", PMIX_PROC_RANK,
|
||||
pmix_bfrops_base_pack_rank,
|
||||
pmix_bfrops_base_unpack_rank,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_rank,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_QUERY", PMIX_QUERY,
|
||||
pmix_bfrops_base_pack_query,
|
||||
pmix_bfrops_base_unpack_query,
|
||||
pmix_bfrops_base_copy_query,
|
||||
pmix_bfrops_base_print_query,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_COMPRESSED_STRING",
|
||||
PMIX_COMPRESSED_STRING,
|
||||
@ -362,7 +362,7 @@ static pmix_status_t init(void)
|
||||
pmix_bfrops_base_unpack_bo,
|
||||
pmix_bfrops_base_copy_bo,
|
||||
pmix_bfrops_base_print_bo,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
PMIX_REGISTER_TYPE("PMIX_ALLOC_DIRECTIVE",
|
||||
PMIX_ALLOC_DIRECTIVE,
|
||||
@ -370,7 +370,7 @@ static pmix_status_t init(void)
|
||||
pmix_bfrops_base_unpack_alloc_directive,
|
||||
pmix_bfrops_base_std_copy,
|
||||
pmix_bfrops_base_print_alloc_directive,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY,
|
||||
@ -378,7 +378,7 @@ static pmix_status_t init(void)
|
||||
pmix_bfrops_base_unpack_array,
|
||||
pmix_bfrops_base_copy_array,
|
||||
pmix_bfrops_base_print_array,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
/********************/
|
||||
|
||||
|
||||
@ -390,42 +390,42 @@ static void finalize(void)
|
||||
int n;
|
||||
pmix_bfrop_type_info_t *info;
|
||||
|
||||
for (n=0; n < mca_bfrops_pmix2_component.types.size; n++) {
|
||||
if (NULL != (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_pmix2_component.types, n))) {
|
||||
for (n=0; n < mca_bfrops_v21_component.types.size; n++) {
|
||||
if (NULL != (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v21_component.types, n))) {
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&mca_bfrops_pmix2_component.types, n, NULL);
|
||||
pmix_pointer_array_set_item(&mca_bfrops_v21_component.types, n, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static pmix_status_t pmix2_pack(pmix_buffer_t *buffer,
|
||||
static pmix_status_t pmix21_pack(pmix_buffer_t *buffer,
|
||||
const void *src, int num_vals,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
/* kick the process off by passing this in to the base */
|
||||
return pmix_bfrops_base_pack(&mca_bfrops_pmix2_component.types,
|
||||
return pmix_bfrops_base_pack(&mca_bfrops_v21_component.types,
|
||||
buffer, src, num_vals, type);
|
||||
}
|
||||
|
||||
static pmix_status_t pmix2_unpack(pmix_buffer_t *buffer, void *dest,
|
||||
static pmix_status_t pmix21_unpack(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type)
|
||||
{
|
||||
/* kick the process off by passing this in to the base */
|
||||
return pmix_bfrops_base_unpack(&mca_bfrops_pmix2_component.types,
|
||||
return pmix_bfrops_base_unpack(&mca_bfrops_v21_component.types,
|
||||
buffer, dest, num_vals, type);
|
||||
}
|
||||
|
||||
static pmix_status_t pmix2_copy(void **dest, void *src,
|
||||
static pmix_status_t pmix21_copy(void **dest, void *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
return pmix_bfrops_base_copy(&mca_bfrops_pmix2_component.types,
|
||||
return pmix_bfrops_base_copy(&mca_bfrops_v21_component.types,
|
||||
dest, src, type);
|
||||
}
|
||||
|
||||
static pmix_status_t pmix2_print(char **output, char *prefix,
|
||||
static pmix_status_t pmix21_print(char **output, char *prefix,
|
||||
void *src, pmix_data_type_t type)
|
||||
{
|
||||
return pmix_bfrops_base_print(&mca_bfrops_pmix2_component.types,
|
||||
return pmix_bfrops_base_print(&mca_bfrops_v21_component.types,
|
||||
output, prefix, src, type);
|
||||
}
|
||||
|
||||
@ -438,11 +438,11 @@ static pmix_status_t register_type(const char *name, pmix_data_type_t type,
|
||||
PMIX_REGISTER_TYPE(name, type,
|
||||
pack, unpack,
|
||||
copy, print,
|
||||
&mca_bfrops_pmix2_component.types);
|
||||
&mca_bfrops_v21_component.types);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
static const char* data_type_string(pmix_data_type_t type)
|
||||
{
|
||||
return pmix_bfrops_base_data_type_string(&mca_bfrops_pmix2_component.types, type);
|
||||
return pmix_bfrops_base_data_type_string(&mca_bfrops_v21_component.types, type);
|
||||
}
|
@ -25,9 +25,9 @@
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/* the component must be visible data for the linker to find it */
|
||||
PMIX_EXPORT extern pmix_bfrops_base_component_t mca_bfrops_pmix2_component;
|
||||
PMIX_EXPORT extern pmix_bfrops_base_component_t mca_bfrops_v21_component;
|
||||
|
||||
extern pmix_bfrops_module_t pmix_bfrops_pmix2_module;
|
||||
extern pmix_bfrops_module_t pmix_bfrops_pmix21_module;
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -0,0 +1,99 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennbfropsee and The University
|
||||
* of Tennbfropsee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* These symbols are in a file by themselves to provide nice linker
|
||||
* semantics. Since linkers generally pull in symbols by object
|
||||
* files, keeping these symbols as the only symbols in this file
|
||||
* prevents utility programs such as "ompi_info" from having to import
|
||||
* entire components just to query their version and parameters.
|
||||
*/
|
||||
|
||||
#include <src/include/pmix_config.h>
|
||||
#include <pmix_common.h>
|
||||
#include "src/include/types.h"
|
||||
#include "src/include/pmix_globals.h"
|
||||
|
||||
#include "src/util/error.h"
|
||||
#include "src/server/pmix_server_ops.h"
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
#include "bfrop_pmix21.h"
|
||||
|
||||
extern pmix_bfrops_module_t pmix_bfrops_pmix21_module;
|
||||
|
||||
static pmix_status_t component_open(void);
|
||||
static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority);
|
||||
static pmix_status_t component_close(void);
|
||||
static pmix_bfrops_module_t* assign_module(void);
|
||||
|
||||
/*
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
pmix_bfrops_base_component_t mca_bfrops_v21_component = {
|
||||
.base = {
|
||||
PMIX_BFROPS_BASE_VERSION_1_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
.pmix_mca_component_name = "v21",
|
||||
PMIX_MCA_BASE_MAKE_VERSION(component, PMIX_MAJOR_VERSION, PMIX_MINOR_VERSION,
|
||||
PMIX_RELEASE_VERSION),
|
||||
|
||||
/* Component open and close functions */
|
||||
.pmix_mca_open_component = component_open,
|
||||
.pmix_mca_close_component = component_close,
|
||||
.pmix_mca_query_component = component_query,
|
||||
},
|
||||
.priority = 30,
|
||||
.assign_module = assign_module
|
||||
};
|
||||
|
||||
|
||||
pmix_status_t component_open(void)
|
||||
{
|
||||
/* setup the types array */
|
||||
PMIX_CONSTRUCT(&mca_bfrops_v21_component.types, pmix_pointer_array_t);
|
||||
pmix_pointer_array_init(&mca_bfrops_v21_component.types, 32, INT_MAX, 16);
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority)
|
||||
{
|
||||
|
||||
*priority = mca_bfrops_v21_component.priority;
|
||||
*module = (pmix_mca_base_module_t *)&pmix_bfrops_pmix21_module;
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
pmix_status_t component_close(void)
|
||||
{
|
||||
PMIX_DESTRUCT(&mca_bfrops_v21_component.types);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
static pmix_bfrops_module_t* assign_module(void)
|
||||
{
|
||||
pmix_output_verbose(10, pmix_bfrops_base_framework.framework_output,
|
||||
"bfrops:pmix21x assigning module");
|
||||
return &pmix_bfrops_pmix21_module;
|
||||
}
|
@ -367,7 +367,7 @@ static inline void _esh_session_map_clean(ns_map_t *m) {
|
||||
static inline int _flock_init(size_t idx) {
|
||||
pmix_status_t rc = PMIX_SUCCESS;
|
||||
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
_ESH_SESSION_lock(idx) = open(_ESH_SESSION_lockfile(idx), O_CREAT | O_RDWR | O_EXCL, 0600);
|
||||
|
||||
/* if previous launch was crashed, the lockfile might not be deleted and unlocked,
|
||||
@ -421,7 +421,7 @@ static inline int _rwlock_init(size_t idx) {
|
||||
rc = PMIX_ERR_OUT_OF_RESOURCE;
|
||||
return rc;
|
||||
}
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
if (PMIX_SUCCESS != (rc = pmix_pshmem.segment_create(_ESH_SESSION_pthread_seg(idx), _ESH_SESSION_lockfile(idx), size))) {
|
||||
return rc;
|
||||
}
|
||||
@ -512,7 +512,7 @@ static inline const char *_unique_id(void)
|
||||
/* see: pmix_server.c initialize_server_base()
|
||||
* to get format of uri
|
||||
*/
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
static char buf[100];
|
||||
snprintf(buf, sizeof(buf) - 1, "pmix-%d", getpid());
|
||||
str = buf;
|
||||
@ -855,7 +855,7 @@ static inline int _esh_session_init(size_t idx, ns_map_data_t *m, size_t jobuid,
|
||||
PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output,
|
||||
"%s:%d:%s _lockfile_name: %s", __FILE__, __LINE__, __func__, s->lockfile));
|
||||
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
if (0 != mkdir(s->nspace_path, 0770)) {
|
||||
if (EEXIST != errno) {
|
||||
pmix_output(0, "session init: can not create session directory \"%s\": %s",
|
||||
@ -913,13 +913,13 @@ static inline void _esh_session_release(session_t *s)
|
||||
close(s->lockfd);
|
||||
|
||||
if (NULL != s->lockfile) {
|
||||
if(PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if(PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
unlink(s->lockfile);
|
||||
}
|
||||
free(s->lockfile);
|
||||
}
|
||||
if (NULL != s->nspace_path) {
|
||||
if(PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if(PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
_esh_dir_del(s->nspace_path);
|
||||
}
|
||||
free(s->nspace_path);
|
||||
@ -1137,7 +1137,7 @@ static int _update_ns_elem(ns_track_elem_t *ns_elem, ns_seg_info_t *info)
|
||||
|
||||
/* synchronize number of meta segments for the target namespace. */
|
||||
for (i = ns_elem->num_meta_seg; i < info->num_meta_seg; i++) {
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
seg = _create_new_segment(NS_META_SEGMENT, &info->ns_map, i);
|
||||
if (NULL == seg) {
|
||||
rc = PMIX_ERR_OUT_OF_RESOURCE;
|
||||
@ -1170,7 +1170,7 @@ static int _update_ns_elem(ns_track_elem_t *ns_elem, ns_seg_info_t *info)
|
||||
}
|
||||
/* synchronize number of data segments for the target namespace. */
|
||||
for (i = ns_elem->num_data_seg; i < info->num_data_seg; i++) {
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
seg = _create_new_segment(NS_DATA_SEGMENT, &info->ns_map, i);
|
||||
if (NULL == seg) {
|
||||
rc = PMIX_ERR_OUT_OF_RESOURCE;
|
||||
@ -1990,7 +1990,7 @@ static pmix_status_t dstore_init(pmix_info_t info[], size_t ninfo)
|
||||
}
|
||||
|
||||
/* find the temp dir */
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
_esh_session_map_search = _esh_session_map_search_server;
|
||||
|
||||
/* scan incoming info for directives */
|
||||
@ -2119,7 +2119,7 @@ static void dstore_finalize(void)
|
||||
pmix_pshmem.finalize();
|
||||
|
||||
if (NULL != _base_path){
|
||||
if(PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if(PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
if (lstat(_base_path, &st) >= 0){
|
||||
if (PMIX_SUCCESS != (rc = _esh_dir_del(_base_path))) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
@ -2242,7 +2242,7 @@ static pmix_status_t dstore_store(const pmix_proc_t *proc,
|
||||
"[%s:%d] gds: dstore store for key '%s' scope %d",
|
||||
proc->nspace, proc->rank, kv->key, scope);
|
||||
|
||||
if (PMIX_PROC_CLIENT == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) {
|
||||
rc = PMIX_ERR_NOT_SUPPORTED;
|
||||
PMIX_ERROR_LOG(rc);
|
||||
return rc;
|
||||
@ -2408,7 +2408,8 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank,
|
||||
if ((NULL == key) && (kval_cnt > 0)) {
|
||||
kval = (pmix_value_t*)malloc(sizeof(pmix_value_t));
|
||||
if (NULL == kval) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
rc = PMIX_ERR_NOMEM;
|
||||
goto done;
|
||||
}
|
||||
PMIX_VALUE_CONSTRUCT(kval);
|
||||
|
||||
@ -2791,7 +2792,7 @@ static pmix_status_t dstore_assign_module(pmix_info_t *info, size_t ninfo,
|
||||
size_t n, m;
|
||||
char **options;
|
||||
|
||||
*priority = -1;
|
||||
*priority = 20;
|
||||
if (NULL != info) {
|
||||
for (n=0; n < ninfo; n++) {
|
||||
if (0 == strncmp(info[n].key, PMIX_GDS_MODULE, PMIX_MAX_KEYLEN)) {
|
||||
@ -2963,7 +2964,7 @@ static inline int _collect_key_for_rank(pmix_peer_t *peer, pmix_rank_t rank, pmi
|
||||
|
||||
if ((cur_rank + 1) <= size) {
|
||||
tmp = &(PMIX_VALUE_ARRAY_GET_ITEM(rank_kv_bufs, pmix_buffer_t, cur_rank));
|
||||
PMIX_BFROPS_PACK(rc, peer, tmp, kv, 1, PMIX_KVAL);
|
||||
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, tmp, kv, 1, PMIX_KVAL);
|
||||
return rc;
|
||||
}
|
||||
if (PMIX_SUCCESS != (rc = pmix_value_array_set_size(rank_kv_bufs, cur_rank + 1))) {
|
||||
@ -2974,7 +2975,7 @@ static inline int _collect_key_for_rank(pmix_peer_t *peer, pmix_rank_t rank, pmi
|
||||
tmp = &(PMIX_VALUE_ARRAY_GET_ITEM(rank_kv_bufs, pmix_buffer_t, i));
|
||||
PMIX_CONSTRUCT(tmp, pmix_buffer_t);
|
||||
}
|
||||
PMIX_BFROPS_PACK(rc, peer, tmp, kv, 1, PMIX_KVAL);
|
||||
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, tmp, kv, 1, PMIX_KVAL);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ static pmix_status_t hash_assign_module(pmix_info_t *info, size_t ninfo,
|
||||
size_t n, m;
|
||||
char **options;
|
||||
|
||||
*priority = -1;
|
||||
*priority = 10;
|
||||
if (NULL != info) {
|
||||
for (n=0; n < ninfo; n++) {
|
||||
if (0 == strncmp(info[n].key, PMIX_GDS_MODULE, PMIX_MAX_KEYLEN)) {
|
||||
@ -786,7 +786,7 @@ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr,
|
||||
pmix_status_t rc;
|
||||
pmix_hash_trkr_t *trk, *t2;
|
||||
|
||||
if (PMIX_PROC_SERVER != pmix_globals.proc_type) {
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
/* this function is only available on servers */
|
||||
PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED);
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
@ -894,7 +894,7 @@ static pmix_status_t hash_store_job_info(const char *nspace,
|
||||
"[%s:%u] pmix:gds:hash store job info for nspace %s",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank, nspace);
|
||||
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
/* this function is NOT available on servers */
|
||||
PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED);
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
@ -1604,9 +1604,11 @@ static pmix_status_t assemb_kvs_req(const pmix_proc_t *proc,
|
||||
pmix_server_caddy_t *cd = (pmix_server_caddy_t*)cbdata;
|
||||
pmix_kval_t *kv;
|
||||
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, buf, proc, 1, PMIX_PROC);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
return rc;
|
||||
if (!PMIX_PROC_IS_V1(cd->peer)) {
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, buf, proc, 1, PMIX_PROC);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
PMIX_LIST_FOREACH(kv, kvs, pmix_kval_t) {
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, buf, kv, 1, PMIX_KVAL);
|
||||
|
@ -131,11 +131,11 @@ PMIX_EXPORT pmix_psec_module_t* pmix_psec_base_assign_module(const char *options
|
||||
pmix_output_verbose(2, pmix_globals.debug_output, \
|
||||
"validation of credential failed: %s", \
|
||||
PMIx_Error_string(_r)); \
|
||||
} else { \
|
||||
pmix_output_verbose(2, pmix_globals.debug_output, \
|
||||
"credential validated"); \
|
||||
} \
|
||||
pmix_output_verbose(2, pmix_globals.debug_output, \
|
||||
"credential validated"); \
|
||||
/* send them success */ \
|
||||
_r = PMIX_SUCCESS; \
|
||||
/* send them the result */ \
|
||||
if (PMIX_SUCCESS != (_r = pmix_ptl_base_send_blocking((p)->sd, (char*)&(_r), sizeof(int)))) { \
|
||||
PMIX_ERROR_LOG(_r); \
|
||||
} \
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "src/mca/mca.h"
|
||||
#include "src/mca/base/pmix_mca_base_framework.h"
|
||||
|
||||
#include "src/include/pmix_globals.h"
|
||||
#include "src/mca/ptl/ptl.h"
|
||||
|
||||
|
||||
@ -77,6 +78,7 @@ struct pmix_ptl_globals_t {
|
||||
int stop_thread[2];
|
||||
bool listen_thread_active;
|
||||
pmix_list_t listeners;
|
||||
uint32_t current_tag;
|
||||
};
|
||||
typedef struct pmix_ptl_globals_t pmix_ptl_globals_t;
|
||||
|
||||
@ -114,6 +116,7 @@ PMIX_EXPORT pmix_status_t pmix_ptl_base_connect(struct sockaddr_storage *addr,
|
||||
PMIX_EXPORT void pmix_ptl_base_connection_handler(int sd, short args, void *cbdata);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_send_connect_ack(int sd);
|
||||
PMIX_EXPORT pmix_status_t pmix_ptl_base_recv_connect_ack(int sd);
|
||||
PMIX_EXPORT void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err);
|
||||
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -87,7 +87,7 @@ pmix_status_t pmix_ptl_base_send_blocking(int sd, char *ptr, size_t size)
|
||||
size_t cnt = 0;
|
||||
int retval;
|
||||
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"send blocking of %"PRIsize_t" bytes to socket %d",
|
||||
size, sd );
|
||||
while (cnt < size) {
|
||||
@ -96,13 +96,13 @@ pmix_status_t pmix_ptl_base_send_blocking(int sd, char *ptr, size_t size)
|
||||
if (EAGAIN == pmix_socket_errno ||
|
||||
EWOULDBLOCK == pmix_socket_errno) {
|
||||
/* just cycle and let it try again */
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"blocking_send received error %d:%s from remote - cycling",
|
||||
pmix_socket_errno, strerror(pmix_socket_errno));
|
||||
continue;
|
||||
}
|
||||
if (pmix_socket_errno != EINTR) {
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"ptl:base:peer_send_blocking: send() to socket %d failed: %s (%d)\n",
|
||||
sd, strerror(pmix_socket_errno),
|
||||
pmix_socket_errno);
|
||||
@ -113,7 +113,7 @@ pmix_status_t pmix_ptl_base_send_blocking(int sd, char *ptr, size_t size)
|
||||
cnt += retval;
|
||||
}
|
||||
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"blocking send complete to socket %d", sd);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
@ -126,7 +126,7 @@ pmix_status_t pmix_ptl_base_recv_blocking(int sd, char *data, size_t size)
|
||||
{
|
||||
size_t cnt = 0;
|
||||
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"waiting for blocking recv of %"PRIsize_t" bytes", size);
|
||||
|
||||
while (cnt < size) {
|
||||
@ -134,7 +134,7 @@ pmix_status_t pmix_ptl_base_recv_blocking(int sd, char *data, size_t size)
|
||||
|
||||
/* remote closed connection */
|
||||
if (retval == 0) {
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"ptl:base:recv_blocking: remote closed connection");
|
||||
return PMIX_ERR_UNREACH;
|
||||
}
|
||||
@ -144,7 +144,7 @@ pmix_status_t pmix_ptl_base_recv_blocking(int sd, char *data, size_t size)
|
||||
if (EAGAIN == pmix_socket_errno ||
|
||||
EWOULDBLOCK == pmix_socket_errno) {
|
||||
/* just cycle and let it try again */
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"blocking_recv received error %d:%s from remote - cycling",
|
||||
pmix_socket_errno, strerror(pmix_socket_errno));
|
||||
continue;
|
||||
@ -164,7 +164,7 @@ pmix_status_t pmix_ptl_base_recv_blocking(int sd, char *data, size_t size)
|
||||
CONNECT_ACK and propogate the error up to
|
||||
recv_connect_ack, who will try to establish the
|
||||
connection again */
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"blocking_recv received error %d:%s from remote - aborting",
|
||||
pmix_socket_errno, strerror(pmix_socket_errno));
|
||||
return PMIX_ERR_UNREACH;
|
||||
@ -174,7 +174,7 @@ pmix_status_t pmix_ptl_base_recv_blocking(int sd, char *data, size_t size)
|
||||
cnt += retval;
|
||||
}
|
||||
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"blocking receive complete from remote");
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
@ -187,7 +187,7 @@ pmix_status_t pmix_ptl_base_connect(struct sockaddr_storage *addr,
|
||||
int sd = -1;
|
||||
int retries = 0;
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"ptl_base_connect: attempting to connect to server");
|
||||
|
||||
while (retries < PMIX_MAX_RETRIES) {
|
||||
@ -200,13 +200,13 @@ pmix_status_t pmix_ptl_base_connect(struct sockaddr_storage *addr,
|
||||
pmix_socket_errno);
|
||||
continue;
|
||||
}
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
"usock_peer_try_connect: attempting to connect to server on socket %d", sd);
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"pmix_ptl_base_connect: attempting to connect to server on socket %d", sd);
|
||||
/* try to connect */
|
||||
if (connect(sd, (struct sockaddr*)addr, addrlen) < 0) {
|
||||
if (pmix_socket_errno == ETIMEDOUT) {
|
||||
/* The server may be too busy to accept new connections */
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"timeout connecting to server");
|
||||
CLOSE_THE_SOCKET(sd);
|
||||
continue;
|
||||
@ -218,12 +218,12 @@ pmix_status_t pmix_ptl_base_connect(struct sockaddr_storage *addr,
|
||||
connection. Handle that case in a semi-rational
|
||||
way by trying twice before giving up */
|
||||
if (ECONNABORTED == pmix_socket_errno) {
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"connection to server aborted by OS - retrying");
|
||||
CLOSE_THE_SOCKET(sd);
|
||||
continue;
|
||||
} else {
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"Connect failed: %s (%d)", strerror(pmix_socket_errno),
|
||||
pmix_socket_errno);
|
||||
CLOSE_THE_SOCKET(sd);
|
||||
|
@ -55,6 +55,7 @@
|
||||
|
||||
/* Instantiate the global vars */
|
||||
pmix_ptl_globals_t pmix_ptl_globals = {{{0}}};
|
||||
int pmix_ptl_base_output = -1;
|
||||
|
||||
static int pmix_ptl_register(pmix_mca_base_register_flag_t flags)
|
||||
{
|
||||
@ -89,6 +90,8 @@ static pmix_status_t pmix_ptl_close(void)
|
||||
|
||||
static pmix_status_t pmix_ptl_open(pmix_mca_base_open_flag_t flags)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
|
||||
/* initialize globals */
|
||||
pmix_ptl_globals.initialized = true;
|
||||
PMIX_CONSTRUCT(&pmix_ptl_globals.actives, pmix_list_t);
|
||||
@ -96,9 +99,12 @@ static pmix_status_t pmix_ptl_open(pmix_mca_base_open_flag_t flags)
|
||||
PMIX_CONSTRUCT(&pmix_ptl_globals.unexpected_msgs, pmix_list_t);
|
||||
pmix_ptl_globals.listen_thread_active = false;
|
||||
PMIX_CONSTRUCT(&pmix_ptl_globals.listeners, pmix_list_t);
|
||||
pmix_ptl_globals.current_tag = PMIX_PTL_TAG_DYNAMIC;
|
||||
|
||||
/* Open up all available components */
|
||||
return pmix_mca_base_framework_components_open(&pmix_ptl_base_framework, flags);
|
||||
rc = pmix_mca_base_framework_components_open(&pmix_ptl_base_framework, flags);
|
||||
pmix_ptl_base_output = pmix_ptl_base_framework.framework_output;
|
||||
return rc;
|
||||
}
|
||||
|
||||
PMIX_MCA_BASE_FRAMEWORK_DECLARE(pmix, ptl, "PMIx Transfer Layer",
|
||||
@ -126,9 +132,9 @@ static void sdes(pmix_ptl_send_t *p)
|
||||
PMIX_RELEASE(p->data);
|
||||
}
|
||||
}
|
||||
PMIX_CLASS_INSTANCE(pmix_ptl_send_t,
|
||||
pmix_list_item_t,
|
||||
scon, sdes);
|
||||
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_ptl_send_t,
|
||||
pmix_list_item_t,
|
||||
scon, sdes);
|
||||
|
||||
static void rcon(pmix_ptl_recv_t *p)
|
||||
{
|
||||
@ -147,9 +153,9 @@ static void rdes(pmix_ptl_recv_t *p)
|
||||
PMIX_RELEASE(p->peer);
|
||||
}
|
||||
}
|
||||
PMIX_CLASS_INSTANCE(pmix_ptl_recv_t,
|
||||
pmix_list_item_t,
|
||||
rcon, rdes);
|
||||
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_ptl_recv_t,
|
||||
pmix_list_item_t,
|
||||
rcon, rdes);
|
||||
|
||||
static void prcon(pmix_ptl_posted_recv_t *p)
|
||||
{
|
||||
@ -157,9 +163,9 @@ static void prcon(pmix_ptl_posted_recv_t *p)
|
||||
p->cbfunc = NULL;
|
||||
p->cbdata = NULL;
|
||||
}
|
||||
PMIX_CLASS_INSTANCE(pmix_ptl_posted_recv_t,
|
||||
pmix_list_item_t,
|
||||
prcon, NULL);
|
||||
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_ptl_posted_recv_t,
|
||||
pmix_list_item_t,
|
||||
prcon, NULL);
|
||||
|
||||
|
||||
static void srcon(pmix_ptl_sr_t *p)
|
||||
@ -189,6 +195,7 @@ static void pccon(pmix_pending_connection_t *p)
|
||||
p->gds = NULL;
|
||||
p->ptl = NULL;
|
||||
p->cred = NULL;
|
||||
p->proc_type = PMIX_PROC_UNDEF;
|
||||
}
|
||||
static void pcdes(pmix_pending_connection_t *p)
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ void pmix_ptl_base_stop_listening(void)
|
||||
int i;
|
||||
pmix_listener_t *lt;
|
||||
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"listen_thread: shutdown");
|
||||
|
||||
if (!pmix_ptl_globals.listen_thread_active) {
|
||||
@ -190,7 +190,7 @@ static void* listen_thread(void *obj)
|
||||
fd_set readfds;
|
||||
pmix_listener_t *lt;
|
||||
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"listen_thread: active");
|
||||
|
||||
|
||||
@ -281,7 +281,7 @@ static void* listen_thread(void *obj)
|
||||
continue;
|
||||
}
|
||||
|
||||
pmix_output_verbose(8, pmix_globals.debug_output,
|
||||
pmix_output_verbose(8, pmix_ptl_base_framework.framework_output,
|
||||
"listen_thread: new connection: (%d, %d)",
|
||||
pending_connection->sd, pmix_socket_errno);
|
||||
/* post the object */
|
||||
|
@ -47,15 +47,13 @@
|
||||
|
||||
#include "src/mca/ptl/base/base.h"
|
||||
|
||||
static uint32_t current_tag = PMIX_PTL_TAG_DYNAMIC;
|
||||
|
||||
static void _notify_complete(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
pmix_event_chain_t *chain = (pmix_event_chain_t*)cbdata;
|
||||
PMIX_RELEASE(chain);
|
||||
}
|
||||
|
||||
static void lost_connection(pmix_peer_t *peer, pmix_status_t err)
|
||||
void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err)
|
||||
{
|
||||
pmix_server_trkr_t *trk;
|
||||
pmix_server_caddy_t *rinfo, *rnext;
|
||||
@ -82,7 +80,7 @@ static void lost_connection(pmix_peer_t *peer, pmix_status_t err)
|
||||
}
|
||||
CLOSE_THE_SOCKET(peer->sd);
|
||||
|
||||
if (PMIX_PROC_SERVER == pmix_globals.proc_type) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
/* if I am a server, then we need to ensure that
|
||||
* we properly account for the loss of this client
|
||||
* from any local collectives in which it was
|
||||
@ -286,7 +284,7 @@ static pmix_status_t read_bytes(int sd, char **buf, size_t *remain)
|
||||
* the error back to the RML and let the caller know
|
||||
* to abort this message
|
||||
*/
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"pmix_ptl_base_msg_recv: readv failed: %s (%d)",
|
||||
strerror(pmix_socket_errno),
|
||||
pmix_socket_errno);
|
||||
@ -320,7 +318,7 @@ void pmix_ptl_base_send_handler(int sd, short flags, void *cbdata)
|
||||
/* acquire the object */
|
||||
PMIX_ACQUIRE_OBJECT(peer);
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"%s:%d ptl:base:send_handler SENDING TO PEER %s:%d tag %u with %s msg",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
peer->info->pname.nspace, peer->info->pname.rank,
|
||||
@ -328,25 +326,25 @@ void pmix_ptl_base_send_handler(int sd, short flags, void *cbdata)
|
||||
(NULL == msg) ? "NULL" : "NON-NULL");
|
||||
|
||||
if (NULL != msg) {
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"ptl:base:send_handler SENDING MSG");
|
||||
if (PMIX_SUCCESS == (rc = send_msg(peer->sd, msg))) {
|
||||
// message is complete
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"ptl:base:send_handler MSG SENT");
|
||||
PMIX_RELEASE(msg);
|
||||
peer->send_msg = NULL;
|
||||
} else if (PMIX_ERR_RESOURCE_BUSY == rc ||
|
||||
PMIX_ERR_WOULD_BLOCK == rc) {
|
||||
/* exit this event and let the event lib progress */
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"ptl:base:send_handler RES BUSY OR WOULD BLOCK");
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
return;
|
||||
} else {
|
||||
pmix_output_verbose(5, pmix_globals.debug_output,
|
||||
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
|
||||
"%s:%d SEND ERROR %s",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
PMIx_Error_string(rc));
|
||||
@ -355,7 +353,7 @@ void pmix_ptl_base_send_handler(int sd, short flags, void *cbdata)
|
||||
peer->send_ev_active = false;
|
||||
PMIX_RELEASE(msg);
|
||||
peer->send_msg = NULL;
|
||||
lost_connection(peer, rc);
|
||||
pmix_ptl_base_lost_connection(peer, rc);
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
@ -399,7 +397,7 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata)
|
||||
/* acquire the object */
|
||||
PMIX_ACQUIRE_OBJECT(peer);
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"%s:%d ptl:base:recv:handler called with peer %s:%d",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
(NULL == peer) ? "NULL" : peer->info->pname.nspace,
|
||||
@ -410,7 +408,7 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata)
|
||||
}
|
||||
/* allocate a new message and setup for recv */
|
||||
if (NULL == peer->recv_msg) {
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"ptl:base:recv:handler allocate new recv msg");
|
||||
peer->recv_msg = PMIX_NEW(pmix_ptl_recv_t);
|
||||
if (NULL == peer->recv_msg) {
|
||||
@ -427,7 +425,7 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata)
|
||||
msg->sd = sd;
|
||||
/* if the header hasn't been completely read, read it */
|
||||
if (!msg->hdr_recvd) {
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"ptl:base:recv:handler read hdr on socket %d", peer->sd);
|
||||
nbytes = sizeof(pmix_ptl_hdr_t);
|
||||
ptr = (char*)&hdr;
|
||||
@ -438,13 +436,13 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata)
|
||||
peer->recv_msg->hdr.pindex = ntohl(hdr.pindex);
|
||||
peer->recv_msg->hdr.tag = ntohl(hdr.tag);
|
||||
peer->recv_msg->hdr.nbytes = ntohl(hdr.nbytes);
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"RECVD MSG FOR TAG %d SIZE %d",
|
||||
(int)peer->recv_msg->hdr.tag,
|
||||
(int)peer->recv_msg->hdr.nbytes);
|
||||
/* if this is a zero-byte message, then we are done */
|
||||
if (0 == peer->recv_msg->hdr.nbytes) {
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"RECVD ZERO-BYTE MESSAGE FROM %s:%u for tag %d",
|
||||
peer->info->pname.nspace, peer->info->pname.rank,
|
||||
peer->recv_msg->hdr.tag);
|
||||
@ -457,7 +455,7 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata)
|
||||
PMIX_POST_OBJECT(peer);
|
||||
return;
|
||||
} else {
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"ptl:base:recv:handler allocate data region of size %lu",
|
||||
(unsigned long)peer->recv_msg->hdr.nbytes);
|
||||
/* allocate the data region */
|
||||
@ -476,7 +474,7 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata)
|
||||
/* the remote peer closed the connection - report that condition
|
||||
* and let the caller know
|
||||
*/
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"ptl:base:msg_recv: peer %s:%d closed connection",
|
||||
peer->nptr->nspace, peer->info->pname.rank);
|
||||
goto err_close;
|
||||
@ -490,7 +488,7 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata)
|
||||
*/
|
||||
if (PMIX_SUCCESS == (rc = read_bytes(peer->sd, &msg->rdptr, &msg->rdbytes))) {
|
||||
/* we recvd all of the message */
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"%s:%d RECVD COMPLETE MESSAGE FROM SERVER OF %d BYTES FOR TAG %d ON PEER SOCKET %d",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
(int)peer->recv_msg->hdr.nbytes,
|
||||
@ -513,7 +511,7 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata)
|
||||
/* the remote peer closed the connection - report that condition
|
||||
* and let the caller know
|
||||
*/
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"%s:%d ptl:base:msg_recv: peer %s:%d closed connection",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
peer->nptr->nspace, peer->info->pname.rank);
|
||||
@ -537,7 +535,7 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata)
|
||||
PMIX_RELEASE(peer->recv_msg);
|
||||
peer->recv_msg = NULL;
|
||||
}
|
||||
lost_connection(peer, PMIX_ERR_UNREACH);
|
||||
pmix_ptl_base_lost_connection(peer, PMIX_ERR_UNREACH);
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
@ -561,7 +559,7 @@ void pmix_ptl_base_send(int sd, short args, void *cbdata)
|
||||
return;
|
||||
}
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"[%s:%d] send to %s:%u on tag %d",
|
||||
__FILE__, __LINE__,
|
||||
(queue->peer)->info->pname.nspace,
|
||||
@ -613,11 +611,11 @@ void pmix_ptl_base_send_recv(int fd, short args, void *cbdata)
|
||||
}
|
||||
|
||||
/* take the next tag in the sequence */
|
||||
current_tag++;
|
||||
if (UINT32_MAX == current_tag ) {
|
||||
current_tag = PMIX_PTL_TAG_DYNAMIC;
|
||||
pmix_ptl_globals.current_tag++;
|
||||
if (UINT32_MAX == pmix_ptl_globals.current_tag ) {
|
||||
pmix_ptl_globals.current_tag = PMIX_PTL_TAG_DYNAMIC;
|
||||
}
|
||||
tag = current_tag;
|
||||
tag = pmix_ptl_globals.current_tag;
|
||||
|
||||
if (NULL != ms->cbfunc) {
|
||||
/* if a callback msg is expected, setup a recv for it */
|
||||
@ -626,7 +624,7 @@ void pmix_ptl_base_send_recv(int fd, short args, void *cbdata)
|
||||
req->cbfunc = ms->cbfunc;
|
||||
req->cbdata = ms->cbdata;
|
||||
|
||||
pmix_output_verbose(5, pmix_globals.debug_output,
|
||||
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
|
||||
"posting recv on tag %d", req->tag);
|
||||
/* add it to the list of recvs - we cannot have unexpected messages
|
||||
* in this subsystem as the server never sends us something that
|
||||
@ -634,7 +632,7 @@ void pmix_ptl_base_send_recv(int fd, short args, void *cbdata)
|
||||
pmix_list_prepend(&pmix_ptl_globals.posted_recvs, &req->super);
|
||||
}
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"QUEIENG MSG TO SERVER OF SIZE %d",
|
||||
(int)ms->bfr->bytes_used);
|
||||
snd = PMIX_NEW(pmix_ptl_send_t);
|
||||
@ -673,14 +671,14 @@ void pmix_ptl_base_process_msg(int fd, short flags, void *cbdata)
|
||||
/* acquire the object */
|
||||
PMIX_ACQUIRE_OBJECT(msg);
|
||||
|
||||
pmix_output_verbose(5, pmix_globals.debug_output,
|
||||
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
|
||||
"%s:%d message received %d bytes for tag %u on socket %d",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
(int)msg->hdr.nbytes, msg->hdr.tag, msg->sd);
|
||||
|
||||
/* see if we have a waiting recv for this message */
|
||||
PMIX_LIST_FOREACH(rcv, &pmix_ptl_globals.posted_recvs, pmix_ptl_posted_recv_t) {
|
||||
pmix_output_verbose(5, pmix_globals.debug_output,
|
||||
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
|
||||
"checking msg on tag %u for tag %u",
|
||||
msg->hdr.tag, rcv->tag);
|
||||
|
||||
@ -696,12 +694,12 @@ void pmix_ptl_base_process_msg(int fd, short flags, void *cbdata)
|
||||
buf.type = msg->peer->nptr->compat.type;
|
||||
}
|
||||
msg->data = NULL; // protect the data region
|
||||
pmix_output_verbose(5, pmix_globals.debug_output,
|
||||
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
|
||||
"%s:%d EXECUTE CALLBACK for tag %u",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
msg->hdr.tag);
|
||||
rcv->cbfunc(msg->peer, &msg->hdr, &buf, rcv->cbdata);
|
||||
pmix_output_verbose(5, pmix_globals.debug_output,
|
||||
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
|
||||
"%s:%d CALLBACK COMPLETE",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank);
|
||||
PMIX_DESTRUCT(&buf); // free's the msg data
|
||||
|
@ -42,7 +42,7 @@ pmix_status_t pmix_ptl_base_set_notification_cbfunc(pmix_ptl_cbfunc_t cbfunc)
|
||||
}
|
||||
req->tag = 0;
|
||||
req->cbfunc = cbfunc;
|
||||
pmix_output_verbose(5, pmix_globals.debug_output,
|
||||
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
|
||||
"posting notification recv on tag %d", req->tag);
|
||||
/* add it to the list of recvs - we cannot have unexpected messages
|
||||
* in this subsystem as the server never sends us something that
|
||||
@ -108,7 +108,7 @@ static void post_recv(int fd, short args, void *cbdata)
|
||||
pmix_ptl_recv_t *msg, *nmsg;
|
||||
pmix_buffer_t buf;
|
||||
|
||||
pmix_output_verbose(5, pmix_globals.debug_output,
|
||||
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
|
||||
"posting recv on tag %d", req->tag);
|
||||
|
||||
/* add it to the list of recvs */
|
||||
|
@ -61,6 +61,25 @@ BEGIN_C_DECLS
|
||||
struct pmix_peer_t;
|
||||
struct pmix_ptl_module_t;
|
||||
|
||||
/* define a process type */
|
||||
typedef uint16_t pmix_proc_type_t;
|
||||
#define PMIX_PROC_UNDEF 0x0000
|
||||
#define PMIX_PROC_CLIENT 0x0001
|
||||
#define PMIX_PROC_SERVER 0x0002
|
||||
#define PMIX_PROC_TOOL 0x0004
|
||||
#define PMIX_PROC_V1 0x0008
|
||||
#define PMIX_PROC_V20 0x0010
|
||||
#define PMIX_PROC_V21 0x0020
|
||||
|
||||
/* defins some convenience macros for testing proc type */
|
||||
#define PMIX_PROC_IS_CLIENT(p) (PMIX_PROC_CLIENT & (p)->proc_type)
|
||||
#define PMIX_PROC_IS_SERVER(p) (PMIX_PROC_SERVER & (p)->proc_type)
|
||||
#define PMIX_PROC_IS_TOOL(p) (PMIX_PROC_TOOL & (p)->proc_type)
|
||||
#define PMIX_PROC_IS_V1(p) (PMIX_PROC_V1 & (p)->proc_type)
|
||||
#define PMIX_PROC_IS_V20(p) (PMIX_PROC_V20 & (p)->proc_type)
|
||||
#define PMIX_PROC_IS_V21(p) (PMIX_PROC_V21 & (p)->proc_type)
|
||||
|
||||
|
||||
/**** MESSAGING STRUCTURES ****/
|
||||
typedef uint32_t pmix_ptl_tag_t;
|
||||
/* define a range of "reserved" tags - these
|
||||
@ -179,6 +198,7 @@ typedef struct {
|
||||
size_t len;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
pmix_proc_type_t proc_type;
|
||||
} pmix_pending_connection_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_pending_connection_t);
|
||||
|
||||
@ -199,10 +219,12 @@ typedef struct pmix_listener_t {
|
||||
} pmix_listener_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_listener_t);
|
||||
|
||||
/* provide a backdoor to the framework output for debugging */
|
||||
PMIX_EXPORT extern int pmix_ptl_base_output;
|
||||
|
||||
#define PMIX_ACTIVATE_POST_MSG(ms) \
|
||||
do { \
|
||||
pmix_output_verbose(5, pmix_globals.debug_output, \
|
||||
pmix_output_verbose(5, pmix_ptl_base_output, \
|
||||
"[%s:%d] post msg", \
|
||||
__FILE__, __LINE__); \
|
||||
pmix_event_assign(&((ms)->ev), pmix_globals.evbase, -1, \
|
||||
@ -228,7 +250,8 @@ PMIX_CLASS_DECLARATION(pmix_listener_t);
|
||||
#define PMIX_SERVER_QUEUE_REPLY(p, t, b) \
|
||||
do { \
|
||||
pmix_ptl_send_t *snd; \
|
||||
pmix_output_verbose(5, pmix_globals.debug_output, \
|
||||
uint32_t nbytes; \
|
||||
pmix_output_verbose(5, pmix_ptl_base_output, \
|
||||
"[%s:%d] queue callback called: reply to %s:%d on tag %d size %d", \
|
||||
__FILE__, __LINE__, \
|
||||
(p)->info->pname.nspace, \
|
||||
@ -236,7 +259,8 @@ PMIX_CLASS_DECLARATION(pmix_listener_t);
|
||||
snd = PMIX_NEW(pmix_ptl_send_t); \
|
||||
snd->hdr.pindex = htonl(pmix_globals.pindex); \
|
||||
snd->hdr.tag = htonl(t); \
|
||||
snd->hdr.nbytes = htonl((b)->bytes_used); \
|
||||
nbytes = (b)->bytes_used; \
|
||||
snd->hdr.nbytes = htonl(nbytes); \
|
||||
snd->data = (b); \
|
||||
/* always start with the header */ \
|
||||
snd->sdptr = (char*)&snd->hdr; \
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "src/util/argv.h"
|
||||
#include "src/util/error.h"
|
||||
#include "src/util/os_path.h"
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
|
||||
#include "src/mca/ptl/base/base.h"
|
||||
#include "ptl_tcp.h"
|
||||
@ -134,13 +135,35 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
|
||||
|
||||
/* if I am a client, then we need to look for the appropriate
|
||||
* connection info in the environment */
|
||||
if (PMIX_PROC_IS_CLIENT) {
|
||||
if (NULL == (evar = getenv("PMIX_SERVER_URI2"))) {
|
||||
if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) {
|
||||
if (NULL != (evar = getenv("PMIX_SERVER_URI21"))) {
|
||||
/* we are talking to a v2.1 server */
|
||||
pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V21;
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"V21 SERVER DETECTED");
|
||||
/* must use the v21 bfrops module */
|
||||
pmix_globals.mypeer->nptr->compat.bfrops = pmix_bfrops_base_assign_module("v21");
|
||||
if (NULL == pmix_globals.mypeer->nptr->compat.bfrops) {
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
} else if (NULL != (evar = getenv("PMIX_SERVER_URI2"))) {
|
||||
/* we are talking to a v2.0 server */
|
||||
pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V20;
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"V20 SERVER DETECTED");
|
||||
/* must use the v20 bfrops module */
|
||||
pmix_globals.mypeer->nptr->compat.bfrops = pmix_bfrops_base_assign_module("v20");
|
||||
if (NULL == pmix_globals.mypeer->nptr->compat.bfrops) {
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
} else {
|
||||
/* not us */
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
/* the server will be using the same bfrops as us */
|
||||
pmix_client_globals.myserver->nptr->compat.bfrops = pmix_globals.mypeer->nptr->compat.bfrops;
|
||||
|
||||
/* the URI consists of elements:
|
||||
/* the URI consists of the following elements:
|
||||
* - server nspace.rank
|
||||
* - ptl rendezvous URI
|
||||
*/
|
||||
@ -322,7 +345,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
|
||||
}
|
||||
|
||||
complete:
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"sock_peer_try_connect: Connection across to server succeeded");
|
||||
|
||||
/* do a final bozo check */
|
||||
@ -442,6 +465,24 @@ static pmix_status_t parse_uri_file(char *filename,
|
||||
fclose(fp);
|
||||
return PMIX_ERR_UNREACH;
|
||||
}
|
||||
/* see if this file contains the server's version */
|
||||
p2 = pmix_getline(fp);
|
||||
if (NULL == p2) {
|
||||
pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V20;
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"V20 SERVER DETECTED");
|
||||
} else if (0 == strncmp(p2, "v2.1", strlen("v2.1"))) {
|
||||
pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V21;
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"V21 SERVER DETECTED");
|
||||
} else {
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"UNKNOWN SERVER VERSION DETECTED: %s", p2);
|
||||
}
|
||||
if (NULL != p2) {
|
||||
free(p2);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
/* up to the first ';' is the server nspace/rank */
|
||||
if (NULL == (p = strchr(srvr, ';'))) {
|
||||
@ -590,7 +631,7 @@ static pmix_status_t send_connect_ack(int sd)
|
||||
"pmix:tcp SEND CONNECT ACK");
|
||||
|
||||
/* if we are a server, then we shouldn't be here */
|
||||
if (PMIX_PROC_IS_SERVER) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@ -613,7 +654,7 @@ static pmix_status_t send_connect_ack(int sd)
|
||||
/* allow space for a marker indicating client vs tool */
|
||||
sdsize = 1;
|
||||
|
||||
if (PMIX_PROC_IS_CLIENT) {
|
||||
if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) {
|
||||
flag = 0;
|
||||
/* reserve space for our nspace and rank info */
|
||||
sdsize += strlen(pmix_globals.myid.nspace) + 1 + sizeof(int);
|
||||
@ -660,18 +701,6 @@ static pmix_status_t send_connect_ack(int sd)
|
||||
memcpy(msg+csize, sec, strlen(sec));
|
||||
csize += strlen(sec)+1;
|
||||
|
||||
/* provide our active bfrops module */
|
||||
memcpy(msg+csize, bfrops, strlen(bfrops));
|
||||
csize += strlen(bfrops)+1;
|
||||
|
||||
/* provide the bfrops type */
|
||||
memcpy(msg+csize, &bftype, sizeof(bftype));
|
||||
csize += sizeof(bftype);
|
||||
|
||||
/* provide the gds module */
|
||||
memcpy(msg+csize, gds, strlen(gds));
|
||||
csize += strlen(gds)+1;
|
||||
|
||||
/* load the length of the credential - we put this in uint32_t
|
||||
* format as that is a fixed size, and convert to network
|
||||
* byte order for heterogeneity */
|
||||
@ -689,7 +718,7 @@ static pmix_status_t send_connect_ack(int sd)
|
||||
memcpy(msg+csize, &flag, 1);
|
||||
csize += 1;
|
||||
|
||||
if (PMIX_PROC_IS_CLIENT) {
|
||||
if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) {
|
||||
/* if we are a client, provide our nspace/rank */
|
||||
memcpy(msg+csize, pmix_globals.myid.nspace, strlen(pmix_globals.myid.nspace));
|
||||
csize += strlen(pmix_globals.myid.nspace)+1;
|
||||
@ -714,6 +743,18 @@ static pmix_status_t send_connect_ack(int sd)
|
||||
memcpy(msg+csize, PMIX_VERSION, strlen(PMIX_VERSION));
|
||||
csize += strlen(PMIX_VERSION)+1;
|
||||
|
||||
/* provide our active bfrops module */
|
||||
memcpy(msg+csize, bfrops, strlen(bfrops));
|
||||
csize += strlen(bfrops)+1;
|
||||
|
||||
/* provide the bfrops type */
|
||||
memcpy(msg+csize, &bftype, sizeof(bftype));
|
||||
csize += sizeof(bftype);
|
||||
|
||||
/* provide the gds module */
|
||||
memcpy(msg+csize, gds, strlen(gds));
|
||||
csize += strlen(gds)+1;
|
||||
|
||||
/* send the entire message across */
|
||||
if (PMIX_SUCCESS != pmix_ptl_base_send_blocking(sd, msg, sdsize)) {
|
||||
free(msg);
|
||||
@ -772,7 +813,7 @@ static pmix_status_t recv_connect_ack(int sd)
|
||||
}
|
||||
reply = ntohl(u32);
|
||||
|
||||
if (PMIX_PROC_IS_CLIENT) {
|
||||
if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) {
|
||||
/* see if they want us to do the handshake */
|
||||
if (PMIX_ERR_READY_FOR_HANDSHAKE == reply) {
|
||||
PMIX_PSEC_CLIENT_HANDSHAKE(rc, pmix_client_globals.myserver, sd);
|
||||
|
@ -278,7 +278,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
|
||||
"ptl:tcp setup_listener");
|
||||
|
||||
/* if we are not a server, then we shouldn't be doing this */
|
||||
if (PMIX_PROC_SERVER != pmix_globals.proc_type) {
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@ -482,7 +482,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
|
||||
}
|
||||
|
||||
lt = PMIX_NEW(pmix_listener_t);
|
||||
lt->varname = strdup("PMIX_SERVER_URI2");
|
||||
lt->varname = strdup("PMIX_SERVER_URI2:PMIX_SERVER_URI21");
|
||||
lt->protocol = PMIX_PROTOCOL_V2;
|
||||
lt->ptl = (struct pmix_ptl_module_t*)&pmix_ptl_tcp_module;
|
||||
lt->cbfunc = connection_handler;
|
||||
@ -587,7 +587,9 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
|
||||
}
|
||||
|
||||
/* output my nspace and rank plus the URI */
|
||||
fprintf(fp, "%s.%d:%s\n", pmix_globals.myid.nspace, pmix_globals.myid.rank, lt->uri);
|
||||
fprintf(fp, "%s\n", lt->uri);
|
||||
/* add a flag that indicates we accept v2.1 protocols */
|
||||
fprintf(fp, "%s\n", PMIX_VERSION);
|
||||
fclose(fp);
|
||||
/* set the file mode */
|
||||
if (0 != chmod(mca_ptl_tcp_component.system_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) {
|
||||
@ -618,8 +620,10 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
|
||||
goto sockerror;
|
||||
}
|
||||
|
||||
/* output my nspace and rank plus the URI */
|
||||
fprintf(fp, "%s.%d:%s\n", pmix_globals.myid.nspace, pmix_globals.myid.rank, lt->uri);
|
||||
/* output my URI */
|
||||
fprintf(fp, "%s\n", lt->uri);
|
||||
/* add a flag that indicates we accept v2.1 protocols */
|
||||
fprintf(fp, "%s\n", PMIX_VERSION);
|
||||
fclose(fp);
|
||||
/* set the file mode */
|
||||
if (0 != chmod(mca_ptl_tcp_component.session_filename, S_IRUSR | S_IWUSR | S_IRGRP)) {
|
||||
@ -751,7 +755,7 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
pmix_peer_t *peer;
|
||||
pmix_rank_t rank;
|
||||
pmix_status_t rc;
|
||||
char *msg, *mg;
|
||||
char *msg, *mg, *version;
|
||||
char *sec, *bfrops, *gds;
|
||||
pmix_bfrop_buffer_type_t bftype;
|
||||
char *nspace;
|
||||
@ -763,6 +767,7 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
pmix_rank_info_t *info;
|
||||
pmix_proc_t proc;
|
||||
pmix_info_t ginfo;
|
||||
pmix_proc_type_t proc_type;
|
||||
|
||||
/* acquire the object */
|
||||
PMIX_ACQUIRE_OBJECT(pnd);
|
||||
@ -824,47 +829,6 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* extract the name of the bfrops module they used */
|
||||
PMIX_STRNLEN(msglen, mg, cnt);
|
||||
if (msglen < cnt) {
|
||||
bfrops = mg;
|
||||
mg += strlen(bfrops) + 1;
|
||||
cnt -= strlen(bfrops) + 1;
|
||||
} else {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* extract the type of buffer they used */
|
||||
if (sizeof(bftype) < cnt) {
|
||||
memcpy(&bftype, mg, sizeof(bftype));
|
||||
mg += sizeof(bftype);
|
||||
cnt -= sizeof(bftype);
|
||||
} else {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* extract the name of the gds module they used */
|
||||
PMIX_STRNLEN(msglen, mg, cnt);
|
||||
if (msglen < cnt) {
|
||||
gds = mg;
|
||||
mg += strlen(gds) + 1;
|
||||
cnt -= strlen(gds) + 1;
|
||||
} else {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* extract any credential so we can validate this connection
|
||||
* before doing anything else */
|
||||
if (sizeof(uint32_t) <= cnt) {
|
||||
@ -896,7 +860,7 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
cnt -= pnd->len;
|
||||
}
|
||||
|
||||
/* get the request type */
|
||||
/* get the process type of the connecting peer */
|
||||
if (1 <= cnt) {
|
||||
memcpy(&flag, mg, 1);
|
||||
++mg;
|
||||
@ -908,14 +872,34 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* see if this is a tool connection request */
|
||||
if (1 == flag) {
|
||||
/* does the server support tool connections? */
|
||||
if (NULL == pmix_host_server.tool_connected) {
|
||||
if (0 == flag) {
|
||||
/* they must be a client, so get their nspace/rank */
|
||||
PMIX_STRNLEN(msglen, mg, cnt);
|
||||
if (msglen < cnt) {
|
||||
nspace = mg;
|
||||
mg += strlen(nspace) + 1;
|
||||
cnt -= strlen(nspace) + 1;
|
||||
} else {
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_NOT_SUPPORTED;
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (sizeof(pmix_rank_t) <= cnt) {
|
||||
/* have to convert this to host order */
|
||||
memcpy(&u32, mg, sizeof(uint32_t));
|
||||
rank = ntohl(u32);
|
||||
mg += sizeof(uint32_t);
|
||||
cnt -= sizeof(uint32_t);
|
||||
} else {
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
} else if (1 == flag) {
|
||||
/* they are a tool */
|
||||
/* extract the uid/gid */
|
||||
if (sizeof(uint32_t) <= cnt) {
|
||||
memcpy(&u32, mg, sizeof(uint32_t));
|
||||
@ -939,6 +923,85 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
/* we don't know what they are! */
|
||||
rc = PMIX_ERR_NOT_SUPPORTED;
|
||||
free(msg);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* extract their VERSION */
|
||||
PMIX_STRNLEN(msglen, mg, cnt);
|
||||
if (msglen < cnt) {
|
||||
version = mg;
|
||||
mg += strlen(version) + 1;
|
||||
cnt -= strlen(version) + 1;
|
||||
} else {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (0 == strncmp(version, "2.0", 3)) {
|
||||
/* the 2.0 release handshake ends with the version string */
|
||||
proc_type = PMIX_PROC_V20;
|
||||
bfrops = "v20";
|
||||
bftype = pmix_bfrops_globals.default_type; // we can't know any better
|
||||
gds = "hash";
|
||||
} else {
|
||||
proc_type = PMIX_PROC_V21;
|
||||
/* extract the name of the bfrops module they used */
|
||||
PMIX_STRNLEN(msglen, mg, cnt);
|
||||
if (msglen < cnt) {
|
||||
bfrops = mg;
|
||||
mg += strlen(bfrops) + 1;
|
||||
cnt -= strlen(bfrops) + 1;
|
||||
} else {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* extract the type of buffer they used */
|
||||
if (sizeof(bftype) < cnt) {
|
||||
memcpy(&bftype, mg, sizeof(bftype));
|
||||
mg += sizeof(bftype);
|
||||
cnt -= sizeof(bftype);
|
||||
} else {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* extract the name of the gds module they used */
|
||||
PMIX_STRNLEN(msglen, mg, cnt);
|
||||
if (msglen < cnt) {
|
||||
gds = mg;
|
||||
mg += strlen(gds) + 1;
|
||||
cnt -= strlen(gds) + 1;
|
||||
} else {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/* see if this is a tool connection request */
|
||||
if (1 == flag) {
|
||||
/* does the server support tool connections? */
|
||||
if (NULL == pmix_host_server.tool_connected) {
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_NOT_SUPPORTED;
|
||||
goto error;
|
||||
}
|
||||
/* setup the info array to pass the relevant info
|
||||
* to the server - starting with the version, if present */
|
||||
n = 0;
|
||||
@ -964,12 +1027,18 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
pnd->info[n].value.type = PMIX_UINT32;
|
||||
pnd->info[n].value.data.uint32 = pnd->gid;
|
||||
++n;
|
||||
/* pass along the proc_type */
|
||||
pnd->proc_type = proc_type;
|
||||
/* pass along the bfrop, buffer_type, and sec fields so
|
||||
* we can assign them once we create a peer object */
|
||||
pnd->psec = strdup(sec);
|
||||
pnd->bfrops = strdup(bfrops);
|
||||
if (NULL != bfrops) {
|
||||
pnd->bfrops = strdup(bfrops);
|
||||
}
|
||||
pnd->buffer_type = bftype;
|
||||
pnd->gds = strdup(gds);
|
||||
if (NULL != gds) {
|
||||
pnd->gds = strdup(gds);
|
||||
}
|
||||
/* release the msg */
|
||||
free(msg);
|
||||
/* request an nspace for this requestor - it will
|
||||
@ -978,32 +1047,6 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
return;
|
||||
}
|
||||
|
||||
/* they must be a client, so get their nspace/rank */
|
||||
PMIX_STRNLEN(msglen, mg, cnt);
|
||||
if (msglen < cnt) {
|
||||
nspace = mg;
|
||||
mg += strlen(nspace) + 1;
|
||||
cnt -= strlen(nspace) + 1;
|
||||
} else {
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (sizeof(pmix_rank_t) <= cnt) {
|
||||
/* have to convert this to host order */
|
||||
memcpy(&u32, mg, sizeof(uint32_t));
|
||||
rank = ntohl(u32);
|
||||
mg += sizeof(uint32_t);
|
||||
cnt -= sizeof(uint32_t);
|
||||
} else {
|
||||
free(msg);
|
||||
/* send an error reply to the client */
|
||||
rc = PMIX_ERR_BAD_PARAM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* see if we know this nspace */
|
||||
nptr = NULL;
|
||||
PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_nspace_t) {
|
||||
@ -1048,6 +1091,9 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
PMIX_RELEASE(pnd);
|
||||
return;
|
||||
}
|
||||
/* mark that this peer is a client of the given type */
|
||||
peer->proc_type = PMIX_PROC_CLIENT | proc_type;
|
||||
/* add in the nspace pointer */
|
||||
PMIX_RETAIN(nptr);
|
||||
peer->nptr = nptr;
|
||||
PMIX_RETAIN(info);
|
||||
@ -1057,7 +1103,6 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
if (0 > (peer->index = pmix_pointer_array_add(&pmix_server_globals.clients, peer))) {
|
||||
free(msg);
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
PMIX_RELEASE(peer);
|
||||
/* probably cannot send an error reply if we are out of memory */
|
||||
CLOSE_THE_SOCKET(pnd->sd);
|
||||
@ -1071,7 +1116,6 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
if (NULL == peer->nptr->compat.psec) {
|
||||
free(msg);
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL);
|
||||
PMIX_RELEASE(peer);
|
||||
/* send an error reply to the client */
|
||||
@ -1083,7 +1127,6 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
if (NULL == peer->nptr->compat.bfrops) {
|
||||
free(msg);
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL);
|
||||
PMIX_RELEASE(peer);
|
||||
/* send an error reply to the client */
|
||||
@ -1098,7 +1141,6 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
peer->nptr->compat.gds = pmix_gds_base_assign_module(&ginfo, 1);
|
||||
if (NULL == peer->nptr->compat.gds) {
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL);
|
||||
PMIX_RELEASE(peer);
|
||||
/* send an error reply to the client */
|
||||
@ -1116,7 +1158,6 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"validation of client connection failed");
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL);
|
||||
PMIX_RELEASE(peer);
|
||||
/* send an error reply to the client */
|
||||
@ -1131,7 +1172,6 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL);
|
||||
PMIX_RELEASE(peer);
|
||||
CLOSE_THE_SOCKET(pnd->sd);
|
||||
@ -1143,7 +1183,6 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL);
|
||||
PMIX_RELEASE(peer);
|
||||
goto error;
|
||||
@ -1263,6 +1302,9 @@ static void process_cbfunc(int sd, short args, void *cbdata)
|
||||
|
||||
/* setup a peer object for this tool */
|
||||
pmix_peer_t *peer = PMIX_NEW(pmix_peer_t);
|
||||
/* mark the peer proc type */
|
||||
peer->proc_type = PMIX_PROC_TOOL | pnd->proc_type;
|
||||
/* add in the nspace pointer */
|
||||
PMIX_RETAIN(nptr);
|
||||
peer->nptr = nptr;
|
||||
PMIX_RETAIN(info);
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "src/client/pmix_client_ops.h"
|
||||
#include "src/include/pmix_globals.h"
|
||||
#include "src/include/pmix_socket_errno.h"
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
#include "src/mca/psec/base/base.h"
|
||||
|
||||
#include "src/mca/ptl/base/base.h"
|
||||
@ -89,6 +90,9 @@ static void finalize(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void pmix_usock_send_recv(int fd, short args, void *cbdata);
|
||||
static void pmix_usock_send(int fd, short args, void *cbdata);
|
||||
|
||||
static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
|
||||
pmix_info_t *info, size_t ninfo)
|
||||
{
|
||||
@ -98,8 +102,12 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
|
||||
int sd;
|
||||
pmix_socklen_t len;
|
||||
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"[%s:%d] connect to server",
|
||||
__FILE__, __LINE__);
|
||||
|
||||
/* if we are not a client, there is nothing we can do */
|
||||
if (!PMIX_PROC_IS_CLIENT) {
|
||||
if (!PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) {
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@ -112,8 +120,18 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
|
||||
uri = pmix_argv_split(evar, ':');
|
||||
if (3 != pmix_argv_count(uri)) {
|
||||
pmix_argv_free(uri);
|
||||
PMIX_ERROR_LOG(PMIX_ERROR);
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
/* definitely a v1 server */
|
||||
pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V1;
|
||||
/* must use the v12 bfrops module */
|
||||
pmix_globals.mypeer->nptr->compat.bfrops = pmix_bfrops_base_assign_module("v12");
|
||||
if (NULL == pmix_globals.mypeer->nptr->compat.bfrops) {
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
/* the server will be using the same */
|
||||
pmix_client_globals.myserver->nptr->compat.bfrops = pmix_globals.mypeer->nptr->compat.bfrops;
|
||||
|
||||
/* set the server nspace */
|
||||
if (NULL == pmix_client_globals.myserver->info) {
|
||||
@ -140,6 +158,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
|
||||
/* if the rendezvous file doesn't exist, that's an error */
|
||||
if (0 != access(uri[2], R_OK)) {
|
||||
pmix_argv_free(uri);
|
||||
PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND);
|
||||
return PMIX_ERR_NOT_FOUND;
|
||||
}
|
||||
pmix_argv_free(uri);
|
||||
@ -164,7 +183,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
|
||||
return rc;
|
||||
}
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"sock_peer_try_connect: Connection across to server succeeded");
|
||||
|
||||
/* mark the connection as made */
|
||||
@ -177,16 +196,18 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
|
||||
pmix_globals.evbase,
|
||||
pmix_client_globals.myserver->sd,
|
||||
EV_READ | EV_PERSIST,
|
||||
pmix_ptl_base_recv_handler, &pmix_client_globals.myserver);
|
||||
pmix_usock_recv_handler, pmix_client_globals.myserver);
|
||||
pmix_event_add(&pmix_client_globals.myserver->recv_event, 0);
|
||||
pmix_client_globals.myserver->recv_ev_active = true;
|
||||
PMIX_POST_OBJECT(pmix_client_globals.myserver);
|
||||
pmix_event_add(&pmix_client_globals.myserver->recv_event, 0);
|
||||
|
||||
/* setup send event */
|
||||
pmix_event_assign(&pmix_client_globals.myserver->send_event,
|
||||
pmix_globals.evbase,
|
||||
pmix_client_globals.myserver->sd,
|
||||
EV_WRITE|EV_PERSIST,
|
||||
pmix_ptl_base_send_handler, &pmix_client_globals.myserver);
|
||||
pmix_usock_send_handler, pmix_client_globals.myserver);
|
||||
pmix_client_globals.myserver->send_ev_active = false;
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
@ -198,17 +219,19 @@ static pmix_status_t send_recv(struct pmix_peer_t *peer,
|
||||
void *cbdata)
|
||||
{
|
||||
pmix_ptl_sr_t *ms;
|
||||
pmix_peer_t *pr = (pmix_peer_t*)peer;
|
||||
|
||||
pmix_output_verbose(5, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"[%s:%d] post send to server",
|
||||
__FILE__, __LINE__);
|
||||
|
||||
ms = PMIX_NEW(pmix_ptl_sr_t);
|
||||
ms->peer = peer;
|
||||
PMIX_RETAIN(pr);
|
||||
ms->peer = pr;
|
||||
ms->bfr = bfr;
|
||||
ms->cbfunc = cbfunc;
|
||||
ms->cbdata = cbdata;
|
||||
PMIX_THREADSHIFT(ms, pmix_ptl_base_send_recv);
|
||||
PMIX_THREADSHIFT(ms, pmix_usock_send_recv);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
@ -227,7 +250,7 @@ static pmix_status_t send_oneway(struct pmix_peer_t *peer,
|
||||
q->peer = peer;
|
||||
q->buf = bfr;
|
||||
q->tag = tag;
|
||||
PMIX_THREADSHIFT(q, pmix_ptl_base_send);
|
||||
PMIX_THREADSHIFT(q, pmix_usock_send);
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
@ -240,7 +263,7 @@ static pmix_status_t send_connect_ack(int sd)
|
||||
char *cred = NULL;
|
||||
pmix_status_t rc;
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"pmix: SEND CONNECT ACK");
|
||||
|
||||
/* setup the header */
|
||||
@ -310,7 +333,8 @@ static pmix_status_t recv_connect_ack(int sd)
|
||||
struct timeval tv, save;
|
||||
pmix_socklen_t sz;
|
||||
bool sockopt = true;
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"pmix: RECV CONNECT ACK FROM SERVER");
|
||||
|
||||
/* get the current timeout value so we can reset to it */
|
||||
@ -326,7 +350,7 @@ static pmix_status_t recv_connect_ack(int sd)
|
||||
tv.tv_sec = 2;
|
||||
tv.tv_usec = 0;
|
||||
if (0 != setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv))) {
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"pmix: recv_connect_ack could not setsockopt SO_RCVTIMEO");
|
||||
return PMIX_ERR_UNREACH;
|
||||
}
|
||||
@ -349,7 +373,7 @@ static pmix_status_t recv_connect_ack(int sd)
|
||||
return reply;
|
||||
}
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"pmix: RECV CONNECT CONFIRMATION");
|
||||
|
||||
/* receive our index into the server's client array */
|
||||
@ -367,3 +391,502 @@ static pmix_status_t recv_connect_ack(int sd)
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
static pmix_status_t send_bytes(int sd, char **buf, size_t *remain)
|
||||
{
|
||||
pmix_status_t ret = PMIX_SUCCESS;
|
||||
int rc;
|
||||
char *ptr = *buf;
|
||||
while (0 < *remain) {
|
||||
rc = write(sd, ptr, *remain);
|
||||
if (rc < 0) {
|
||||
if (pmix_socket_errno == EINTR) {
|
||||
continue;
|
||||
} else if (pmix_socket_errno == EAGAIN) {
|
||||
/* tell the caller to keep this message on active,
|
||||
* but let the event lib cycle so other messages
|
||||
* can progress while this socket is busy
|
||||
*/
|
||||
ret = PMIX_ERR_RESOURCE_BUSY;
|
||||
goto exit;
|
||||
} else if (pmix_socket_errno == EWOULDBLOCK) {
|
||||
/* tell the caller to keep this message on active,
|
||||
* but let the event lib cycle so other messages
|
||||
* can progress while this socket is busy
|
||||
*/
|
||||
ret = PMIX_ERR_WOULD_BLOCK;
|
||||
goto exit;
|
||||
}
|
||||
/* we hit an error and cannot progress this message */
|
||||
pmix_output(0, "pmix_usock_msg_send_bytes: write failed: %s (%d) [sd = %d]",
|
||||
strerror(pmix_socket_errno),
|
||||
pmix_socket_errno, sd);
|
||||
ret = PMIX_ERR_COMM_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
/* update location */
|
||||
(*remain) -= rc;
|
||||
ptr += rc;
|
||||
}
|
||||
/* we sent the full data block */
|
||||
exit:
|
||||
*buf = ptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static pmix_status_t read_bytes(int sd, char **buf, size_t *remain)
|
||||
{
|
||||
pmix_status_t ret = PMIX_SUCCESS;
|
||||
int rc;
|
||||
char *ptr = *buf;
|
||||
|
||||
/* read until all bytes recvd or error */
|
||||
while (0 < *remain) {
|
||||
rc = read(sd, ptr, *remain);
|
||||
if (rc < 0) {
|
||||
if(pmix_socket_errno == EINTR) {
|
||||
continue;
|
||||
} else if (pmix_socket_errno == EAGAIN) {
|
||||
/* tell the caller to keep this message on active,
|
||||
* but let the event lib cycle so other messages
|
||||
* can progress while this socket is busy
|
||||
*/
|
||||
ret = PMIX_ERR_RESOURCE_BUSY;
|
||||
goto exit;
|
||||
} else if (pmix_socket_errno == EWOULDBLOCK) {
|
||||
/* tell the caller to keep this message on active,
|
||||
* but let the event lib cycle so other messages
|
||||
* can progress while this socket is busy
|
||||
*/
|
||||
ret = PMIX_ERR_WOULD_BLOCK;
|
||||
goto exit;
|
||||
}
|
||||
/* we hit an error and cannot progress this message - report
|
||||
* the error back to the RML and let the caller know
|
||||
* to abort this message
|
||||
*/
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"pmix_usock_msg_recv: readv failed: %s (%d)",
|
||||
strerror(pmix_socket_errno),
|
||||
pmix_socket_errno);
|
||||
ret = PMIX_ERR_UNREACH;
|
||||
goto exit;
|
||||
} else if (0 == rc) {
|
||||
/* the remote peer closed the connection */
|
||||
ret = PMIX_ERR_UNREACH;
|
||||
goto exit;
|
||||
}
|
||||
/* we were able to read something, so adjust counters and location */
|
||||
*remain -= rc;
|
||||
ptr += rc;
|
||||
}
|
||||
/* we read the full data block */
|
||||
exit:
|
||||
*buf = ptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* A file descriptor is available/ready for send. Check the state
|
||||
* of the socket and take the appropriate action.
|
||||
*/
|
||||
void pmix_usock_send_handler(int sd, short flags, void *cbdata)
|
||||
{
|
||||
pmix_peer_t *peer = (pmix_peer_t*)cbdata;
|
||||
pmix_ptl_send_t *msg = peer->send_msg;
|
||||
pmix_status_t rc;
|
||||
uint32_t nbytes;
|
||||
|
||||
/* acquire the object */
|
||||
PMIX_ACQUIRE_OBJECT(peer);
|
||||
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"%s:%d usock:send_handler SENDING TO PEER %s:%d tag %u with %s msg",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
peer->info->pname.nspace, peer->info->pname.rank,
|
||||
(NULL == msg) ? UINT_MAX : msg->hdr.tag,
|
||||
(NULL == msg) ? "NULL" : "NON-NULL");
|
||||
|
||||
if (NULL != msg) {
|
||||
if (!msg->hdr_sent) {
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
/* we have to convert the header back to host-byte order */
|
||||
msg->hdr.pindex = ntohl(msg->hdr.pindex);
|
||||
msg->hdr.tag = ntohl(msg->hdr.tag);
|
||||
nbytes = msg->hdr.nbytes;
|
||||
msg->hdr.nbytes = ntohl(nbytes);
|
||||
} else {
|
||||
msg->hdr.pindex = msg->hdr.pindex;
|
||||
msg->hdr.tag = msg->hdr.tag;
|
||||
nbytes = msg->hdr.nbytes;
|
||||
msg->hdr.nbytes = nbytes;
|
||||
}
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"usock:send_handler SENDING HEADER WITH MSG IDX %d TAG %d SIZE %lu",
|
||||
msg->hdr.pindex, msg->hdr.tag, (unsigned long)msg->hdr.nbytes);
|
||||
if (PMIX_SUCCESS == (rc = send_bytes(peer->sd, &msg->sdptr, &msg->sdbytes))) {
|
||||
/* header is completely sent */
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"usock:send_handler HEADER SENT");
|
||||
msg->hdr_sent = true;
|
||||
/* setup to send the data */
|
||||
if (NULL == msg->data) {
|
||||
/* this was a zero-byte msg - nothing more to do */
|
||||
PMIX_RELEASE(msg);
|
||||
peer->send_msg = NULL;
|
||||
goto next;
|
||||
} else {
|
||||
/* send the data as a single block */
|
||||
msg->sdptr = msg->data->base_ptr;
|
||||
msg->sdbytes = msg->hdr.nbytes;
|
||||
}
|
||||
/* fall thru and let the send progress */
|
||||
} else if (PMIX_ERR_RESOURCE_BUSY == rc ||
|
||||
PMIX_ERR_WOULD_BLOCK == rc) {
|
||||
/* exit this event and let the event lib progress */
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"usock:send_handler RES BUSY OR WOULD BLOCK");
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
/* have to convert back again so we are correct when we re-enter */
|
||||
msg->hdr.pindex = htonl(msg->hdr.pindex);
|
||||
msg->hdr.tag = htonl(msg->hdr.tag);
|
||||
nbytes = msg->hdr.nbytes;
|
||||
msg->hdr.nbytes = htonl(nbytes);
|
||||
}
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
return;
|
||||
} else {
|
||||
// report the error
|
||||
event_del(&peer->send_event);
|
||||
peer->send_ev_active = false;
|
||||
PMIX_RELEASE(msg);
|
||||
peer->send_msg = NULL;
|
||||
pmix_ptl_base_lost_connection(peer, rc);
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (msg->hdr_sent) {
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"usock:send_handler SENDING BODY OF MSG");
|
||||
if (PMIX_SUCCESS == (rc = send_bytes(peer->sd, &msg->sdptr, &msg->sdbytes))) {
|
||||
// message is complete
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"usock:send_handler BODY SENT");
|
||||
PMIX_RELEASE(msg);
|
||||
peer->send_msg = NULL;
|
||||
} else if (PMIX_ERR_RESOURCE_BUSY == rc ||
|
||||
PMIX_ERR_WOULD_BLOCK == rc) {
|
||||
/* exit this event and let the event lib progress */
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"usock:send_handler RES BUSY OR WOULD BLOCK");
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
return;
|
||||
} else {
|
||||
// report the error
|
||||
pmix_output(0, "pmix_usock_peer_send_handler: unable to send message ON SOCKET %d",
|
||||
peer->sd);
|
||||
pmix_event_del(&peer->send_event);
|
||||
peer->send_ev_active = false;
|
||||
PMIX_RELEASE(msg);
|
||||
peer->send_msg = NULL;
|
||||
pmix_ptl_base_lost_connection(peer, rc);
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
next:
|
||||
/* if current message completed - progress any pending sends by
|
||||
* moving the next in the queue into the "on-deck" position. Note
|
||||
* that this doesn't mean we send the message right now - we will
|
||||
* wait for another send_event to fire before doing so. This gives
|
||||
* us a chance to service any pending recvs.
|
||||
*/
|
||||
peer->send_msg = (pmix_ptl_send_t*)
|
||||
pmix_list_remove_first(&peer->send_queue);
|
||||
}
|
||||
|
||||
/* if nothing else to do unregister for send event notifications */
|
||||
if (NULL == peer->send_msg && peer->send_ev_active) {
|
||||
pmix_event_del(&peer->send_event);
|
||||
peer->send_ev_active = false;
|
||||
}
|
||||
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dispatch to the appropriate action routine based on the state
|
||||
* of the connection with the peer.
|
||||
*/
|
||||
|
||||
void pmix_usock_recv_handler(int sd, short flags, void *cbdata)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
pmix_peer_t *peer = (pmix_peer_t*)cbdata;
|
||||
pmix_ptl_recv_t *msg = NULL;
|
||||
|
||||
/* acquire the object */
|
||||
PMIX_ACQUIRE_OBJECT(peer);
|
||||
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"usock:recv:handler called with peer %s:%d",
|
||||
(NULL == peer) ? "NULL" : peer->info->pname.nspace,
|
||||
(NULL == peer) ? PMIX_RANK_UNDEF : peer->info->pname.rank);
|
||||
|
||||
if (NULL == peer) {
|
||||
return;
|
||||
}
|
||||
/* allocate a new message and setup for recv */
|
||||
if (NULL == peer->recv_msg) {
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"usock:recv:handler allocate new recv msg");
|
||||
peer->recv_msg = PMIX_NEW(pmix_ptl_recv_t);
|
||||
if (NULL == peer->recv_msg) {
|
||||
pmix_output(0, "usock_recv_handler: unable to allocate recv message\n");
|
||||
goto err_close;
|
||||
}
|
||||
PMIX_RETAIN(peer);
|
||||
peer->recv_msg->peer = peer; // provide a handle back to the peer object
|
||||
/* start by reading the header */
|
||||
peer->recv_msg->rdptr = (char*)&peer->recv_msg->hdr;
|
||||
peer->recv_msg->rdbytes = sizeof(pmix_usock_hdr_t);
|
||||
}
|
||||
msg = peer->recv_msg;
|
||||
msg->sd = sd;
|
||||
/* if the header hasn't been completely read, read it */
|
||||
if (!msg->hdr_recvd) {
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"usock:recv:handler read hdr on socket %d", peer->sd);
|
||||
if (PMIX_SUCCESS == (rc = read_bytes(peer->sd, &msg->rdptr, &msg->rdbytes))) {
|
||||
/* completed reading the header */
|
||||
peer->recv_msg->hdr_recvd = true;
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"RECVD MSG FOR TAG %d SIZE %d",
|
||||
(int)peer->recv_msg->hdr.tag,
|
||||
(int)peer->recv_msg->hdr.nbytes);
|
||||
/* if this is a zero-byte message, then we are done */
|
||||
if (0 == peer->recv_msg->hdr.nbytes) {
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"RECVD ZERO-BYTE MESSAGE FROM %s:%d for tag %d",
|
||||
peer->info->pname.nspace, peer->info->pname.rank,
|
||||
peer->recv_msg->hdr.tag);
|
||||
peer->recv_msg->data = NULL; // make sure
|
||||
peer->recv_msg->rdptr = NULL;
|
||||
peer->recv_msg->rdbytes = 0;
|
||||
/* post it for delivery */
|
||||
PMIX_ACTIVATE_POST_MSG(peer->recv_msg);
|
||||
peer->recv_msg = NULL;
|
||||
PMIX_POST_OBJECT(peer);
|
||||
return;
|
||||
} else {
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"usock:recv:handler allocate data region of size %lu",
|
||||
(unsigned long)peer->recv_msg->hdr.nbytes);
|
||||
/* allocate the data region */
|
||||
peer->recv_msg->data = (char*)malloc(peer->recv_msg->hdr.nbytes);
|
||||
memset(peer->recv_msg->data, 0, peer->recv_msg->hdr.nbytes);
|
||||
/* point to it */
|
||||
peer->recv_msg->rdptr = peer->recv_msg->data;
|
||||
peer->recv_msg->rdbytes = peer->recv_msg->hdr.nbytes;
|
||||
}
|
||||
/* fall thru and attempt to read the data */
|
||||
} else if (PMIX_ERR_RESOURCE_BUSY == rc ||
|
||||
PMIX_ERR_WOULD_BLOCK == rc) {
|
||||
/* exit this event and let the event lib progress */
|
||||
return;
|
||||
} else {
|
||||
/* the remote peer closed the connection - report that condition
|
||||
* and let the caller know
|
||||
*/
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"pmix_usock_msg_recv: peer closed connection");
|
||||
goto err_close;
|
||||
}
|
||||
}
|
||||
|
||||
if (peer->recv_msg->hdr_recvd) {
|
||||
/* continue to read the data block - we start from
|
||||
* wherever we left off, which could be at the
|
||||
* beginning or somewhere in the message
|
||||
*/
|
||||
if (PMIX_SUCCESS == (rc = read_bytes(peer->sd, &msg->rdptr, &msg->rdbytes))) {
|
||||
/* we recvd all of the message */
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"RECVD COMPLETE MESSAGE FROM SERVER OF %d BYTES FOR TAG %d ON PEER SOCKET %d",
|
||||
(int)peer->recv_msg->hdr.nbytes,
|
||||
peer->recv_msg->hdr.tag, peer->sd);
|
||||
/* post it for delivery */
|
||||
PMIX_ACTIVATE_POST_MSG(peer->recv_msg);
|
||||
peer->recv_msg = NULL;
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
return;
|
||||
} else if (PMIX_ERR_RESOURCE_BUSY == rc ||
|
||||
PMIX_ERR_WOULD_BLOCK == rc) {
|
||||
/* exit this event and let the event lib progress */
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
return;
|
||||
} else {
|
||||
/* the remote peer closed the connection - report that condition
|
||||
* and let the caller know
|
||||
*/
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"pmix_usock_msg_recv: peer closed connection");
|
||||
goto err_close;
|
||||
}
|
||||
}
|
||||
/* success */
|
||||
return;
|
||||
|
||||
err_close:
|
||||
/* stop all events */
|
||||
if (peer->recv_ev_active) {
|
||||
pmix_event_del(&peer->recv_event);
|
||||
peer->recv_ev_active = false;
|
||||
}
|
||||
if (peer->send_ev_active) {
|
||||
pmix_event_del(&peer->send_event);
|
||||
peer->send_ev_active = false;
|
||||
}
|
||||
if (NULL != peer->recv_msg) {
|
||||
PMIX_RELEASE(peer->recv_msg);
|
||||
peer->recv_msg = NULL;
|
||||
}
|
||||
pmix_ptl_base_lost_connection(peer, PMIX_ERR_UNREACH);
|
||||
/* ensure we post the modified peer object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(peer);
|
||||
}
|
||||
|
||||
void pmix_usock_send_recv(int fd, short args, void *cbdata)
|
||||
{
|
||||
pmix_ptl_sr_t *ms = (pmix_ptl_sr_t*)cbdata;
|
||||
pmix_ptl_posted_recv_t *req;
|
||||
pmix_ptl_send_t *snd;
|
||||
uint32_t tag;
|
||||
|
||||
/* acquire the object */
|
||||
PMIX_ACQUIRE_OBJECT(ms);
|
||||
|
||||
if (ms->peer->sd < 0) {
|
||||
/* this peer's socket has been closed */
|
||||
PMIX_RELEASE(ms);
|
||||
/* ensure we post the object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
/* take the next tag in the sequence */
|
||||
pmix_ptl_globals.current_tag++;
|
||||
if (UINT32_MAX == pmix_ptl_globals.current_tag ) {
|
||||
pmix_ptl_globals.current_tag = PMIX_PTL_TAG_DYNAMIC;
|
||||
}
|
||||
tag = pmix_ptl_globals.current_tag;
|
||||
|
||||
if (NULL != ms->cbfunc) {
|
||||
/* if a callback msg is expected, setup a recv for it */
|
||||
req = PMIX_NEW(pmix_ptl_posted_recv_t);
|
||||
req->tag = tag;
|
||||
req->cbfunc = ms->cbfunc;
|
||||
req->cbdata = ms->cbdata;
|
||||
pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
|
||||
"posting recv on tag %d", req->tag);
|
||||
/* add it to the list of recvs - we cannot have unexpected messages
|
||||
* in this subsystem as the server never sends us something that
|
||||
* we didn't previously request */
|
||||
pmix_list_prepend(&pmix_ptl_globals.posted_recvs, &req->super);
|
||||
}
|
||||
|
||||
snd = PMIX_NEW(pmix_ptl_send_t);
|
||||
snd->hdr.pindex = pmix_globals.pindex;
|
||||
snd->hdr.tag = tag;
|
||||
snd->hdr.nbytes = ms->bfr->bytes_used;
|
||||
snd->data = ms->bfr;
|
||||
/* always start with the header */
|
||||
snd->sdptr = (char*)&snd->hdr;
|
||||
snd->sdbytes = sizeof(pmix_usock_hdr_t);
|
||||
|
||||
/* if there is no message on-deck, put this one there */
|
||||
if (NULL == ms->peer->send_msg) {
|
||||
ms->peer->send_msg = snd;
|
||||
} else {
|
||||
/* add it to the queue */
|
||||
pmix_list_append(&ms->peer->send_queue, &snd->super);
|
||||
}
|
||||
/* ensure the send event is active */
|
||||
if (!ms->peer->send_ev_active) {
|
||||
ms->peer->send_ev_active = true;
|
||||
PMIX_POST_OBJECT(snd);
|
||||
pmix_event_add(&ms->peer->send_event, 0);
|
||||
}
|
||||
/* cleanup */
|
||||
PMIX_RELEASE(ms);
|
||||
PMIX_POST_OBJECT(snd);
|
||||
}
|
||||
|
||||
static void pmix_usock_send(int sd, short args, void *cbdata)
|
||||
{
|
||||
pmix_ptl_queue_t *queue = (pmix_ptl_queue_t*)cbdata;
|
||||
pmix_ptl_send_t *snd;
|
||||
|
||||
/* acquire the object */
|
||||
PMIX_ACQUIRE_OBJECT(queue);
|
||||
|
||||
if (NULL == queue->peer || queue->peer->sd < 0 ||
|
||||
NULL == queue->peer->info || NULL == queue->peer->nptr) {
|
||||
/* this peer has lost connection */
|
||||
PMIX_RELEASE(queue);
|
||||
/* ensure we post the object before another thread
|
||||
* picks it back up */
|
||||
PMIX_POST_OBJECT(queue);
|
||||
return;
|
||||
}
|
||||
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"[%s:%d] send to %s:%u on tag %d",
|
||||
__FILE__, __LINE__,
|
||||
(queue->peer)->info->pname.nspace,
|
||||
(queue->peer)->info->pname.rank, (queue->tag));
|
||||
|
||||
snd = PMIX_NEW(pmix_ptl_send_t);
|
||||
snd->hdr.pindex = htonl(pmix_globals.pindex);
|
||||
snd->hdr.tag = htonl(queue->tag);
|
||||
snd->hdr.nbytes = htonl((queue->buf)->bytes_used);
|
||||
snd->data = (queue->buf);
|
||||
/* always start with the header */
|
||||
snd->sdptr = (char*)&snd->hdr;
|
||||
snd->sdbytes = sizeof(pmix_ptl_hdr_t);
|
||||
|
||||
/* if there is no message on-deck, put this one there */
|
||||
if (NULL == (queue->peer)->send_msg) {
|
||||
(queue->peer)->send_msg = snd;
|
||||
} else {
|
||||
/* add it to the queue */
|
||||
pmix_list_append(&(queue->peer)->send_queue, &snd->super);
|
||||
}
|
||||
/* ensure the send event is active */
|
||||
if (!(queue->peer)->send_ev_active) {
|
||||
(queue->peer)->send_ev_active = true;
|
||||
PMIX_POST_OBJECT(queue->peer);
|
||||
pmix_event_add(&(queue->peer)->send_event, 0);
|
||||
}
|
||||
PMIX_RELEASE(queue);
|
||||
PMIX_POST_OBJECT(snd);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -42,6 +42,10 @@ extern pmix_ptl_usock_component_t mca_ptl_usock_component;
|
||||
|
||||
extern pmix_ptl_module_t pmix_ptl_usock_module;
|
||||
|
||||
void pmix_usock_send_handler(int sd, short args, void *cbdata);
|
||||
|
||||
void pmix_usock_recv_handler(int sd, short args, void *cbdata);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* PMIX_PTL_USOCK_H */
|
||||
|
@ -59,6 +59,8 @@
|
||||
#include "src/util/fd.h"
|
||||
#include "src/util/show_help.h"
|
||||
#include "src/util/strnlen.h"
|
||||
#include "src/mca/bfrops/base/base.h"
|
||||
#include "src/mca/gds/base/base.h"
|
||||
#include "src/mca/psec/base/base.h"
|
||||
#include "src/server/pmix_server_ops.h"
|
||||
|
||||
@ -181,7 +183,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo,
|
||||
"ptl:usock setup_listener");
|
||||
|
||||
/* if we are not a server, then we shouldn't be doing this */
|
||||
if (PMIX_PROC_SERVER != pmix_globals.proc_type) {
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@ -451,8 +453,8 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
return;
|
||||
}
|
||||
|
||||
if (PMIX_SUCCESS != (rc = parse_connect_ack (msg, hdr.nbytes, &nspace,
|
||||
&rank, &version, &cred))) {
|
||||
if (PMIX_SUCCESS != (rc = parse_connect_ack(msg, hdr.nbytes, &nspace,
|
||||
&rank, &version, &cred))) {
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"error parsing connect-ack from client ON SOCKET %d", pnd->sd);
|
||||
free(msg);
|
||||
@ -511,6 +513,9 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
rc = PMIX_ERR_NOMEM;
|
||||
goto error;
|
||||
}
|
||||
/* mark it as being a v1 type */
|
||||
psave->proc_type = PMIX_PROC_CLIENT | PMIX_PROC_V1;
|
||||
/* add the nspace tracker */
|
||||
PMIX_RETAIN(nptr);
|
||||
psave->nptr = nptr;
|
||||
PMIX_RETAIN(info);
|
||||
@ -535,11 +540,38 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
free(msg);
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
PMIX_RELEASE(psave);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, psave->index, NULL);
|
||||
PMIX_RELEASE(psave);
|
||||
/* send an error reply to the client */
|
||||
goto error;
|
||||
}
|
||||
/* we need the v1.2 bfrops module */
|
||||
nptr->compat.bfrops = pmix_bfrops_base_assign_module("v12");
|
||||
if (NULL == nptr->compat.bfrops) {
|
||||
free(msg);
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, psave->index, NULL);
|
||||
PMIX_RELEASE(psave);
|
||||
/* send an error reply to the client */
|
||||
goto error;
|
||||
}
|
||||
/* we have no way of knowing their buffer type, so take our default */
|
||||
nptr->compat.type = pmix_bfrops_globals.default_type;
|
||||
|
||||
/* take the highest priority gds module - in the absence of any info,
|
||||
* we assume they can handle both dstore and hash */
|
||||
nptr->compat.gds = pmix_gds_base_assign_module(NULL, 0);
|
||||
if (NULL == nptr->compat.gds) {
|
||||
free(msg);
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, psave->index, NULL);
|
||||
PMIX_RELEASE(psave);
|
||||
/* send an error reply to the client */
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* the choice of PTL module was obviously made by the connecting
|
||||
* tool as we received this request via that channel, so simply
|
||||
* record it here for future use */
|
||||
@ -560,25 +592,14 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
free(msg);
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
PMIX_RELEASE(psave);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, psave->index, NULL);
|
||||
/* send an error reply to the client */
|
||||
goto error;
|
||||
}
|
||||
free(msg);
|
||||
|
||||
/* send them success */
|
||||
rc = PMIX_SUCCESS;
|
||||
if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&rc, sizeof(int)))) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
info->proc_cnt--;
|
||||
PMIX_RELEASE(info);
|
||||
pmix_pointer_array_set_item(&pmix_server_globals.clients, psave->index, NULL);
|
||||
PMIX_RELEASE(psave);
|
||||
/* error reply was sent by the above macro */
|
||||
CLOSE_THE_SOCKET(pnd->sd);
|
||||
PMIX_RELEASE(pnd);
|
||||
return;
|
||||
}
|
||||
free(msg);
|
||||
|
||||
/* send the client's array index */
|
||||
if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&psave->index, sizeof(int)))) {
|
||||
@ -612,11 +633,11 @@ static void connection_handler(int sd, short args, void *cbdata)
|
||||
|
||||
/* start the events for this client */
|
||||
pmix_event_assign(&psave->recv_event, pmix_globals.evbase, pnd->sd,
|
||||
EV_READ|EV_PERSIST, pmix_ptl_base_recv_handler, psave);
|
||||
EV_READ|EV_PERSIST, pmix_usock_recv_handler, psave);
|
||||
pmix_event_add(&psave->recv_event, NULL);
|
||||
psave->recv_ev_active = true;
|
||||
pmix_event_assign(&psave->send_event, pmix_globals.evbase, pnd->sd,
|
||||
EV_WRITE|EV_PERSIST, pmix_ptl_base_send_handler, psave);
|
||||
EV_WRITE|EV_PERSIST, pmix_usock_send_handler, psave);
|
||||
pmix_output_verbose(2, pmix_ptl_base_framework.framework_output,
|
||||
"pmix:server client %s:%u has connected on socket %d",
|
||||
psave->info->pname.nspace, psave->info->pname.rank, psave->sd);
|
||||
|
@ -73,7 +73,6 @@ bool pmix_init_called = false;
|
||||
PMIX_EXPORT pmix_globals_t pmix_globals = {
|
||||
.init_cntr = 0,
|
||||
.mypeer = NULL,
|
||||
.proc_type = PMIX_PROC_UNDEF,
|
||||
.pindex = 0,
|
||||
.evbase = NULL,
|
||||
.external_evbase = false,
|
||||
@ -151,7 +150,6 @@ int pmix_rte_init(pmix_proc_type_t type,
|
||||
}
|
||||
|
||||
/* setup the globals structure */
|
||||
pmix_globals.proc_type = type;
|
||||
memset(&pmix_globals.myid, 0, sizeof(pmix_proc_t));
|
||||
PMIX_CONSTRUCT(&pmix_globals.events, pmix_events_t);
|
||||
pmix_globals.event_window.tv_sec = pmix_event_caching_window;
|
||||
@ -176,6 +174,8 @@ int pmix_rte_init(pmix_proc_type_t type,
|
||||
ret = PMIX_ERR_NOMEM;
|
||||
goto return_error;
|
||||
}
|
||||
/* whatever our declared proc type, we are definitely v2.1 */
|
||||
pmix_globals.mypeer->proc_type = type | PMIX_PROC_V21;
|
||||
/* create an nspace object for ourselves - we will
|
||||
* fill in the nspace name later */
|
||||
pmix_globals.mypeer->nptr = PMIX_NEW(pmix_nspace_t);
|
||||
|
@ -139,20 +139,6 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
|
||||
memset(&pmix_host_server, 0, sizeof(pmix_server_module_t));
|
||||
pmix_host_server = *module;
|
||||
|
||||
/* setup the wildcard recv for inbound messages from clients */
|
||||
req = PMIX_NEW(pmix_ptl_posted_recv_t);
|
||||
req->tag = UINT32_MAX;
|
||||
req->cbfunc = server_message_handler;
|
||||
/* add it to the end of the list of recvs */
|
||||
pmix_list_append(&pmix_ptl_globals.posted_recvs, &req->super);
|
||||
|
||||
if (PMIX_SUCCESS != pmix_ptl_base_start_listening(info, ninfo)) {
|
||||
pmix_show_help("help-pmix-server.txt", "listener-thread-start", true);
|
||||
PMIx_server_finalize();
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
|
||||
/* assign our internal bfrops module */
|
||||
pmix_globals.mypeer->nptr->compat.bfrops = pmix_bfrops_base_assign_module(NULL);
|
||||
if (NULL == pmix_globals.mypeer->nptr->compat.bfrops) {
|
||||
@ -292,6 +278,21 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
|
||||
PMIX_RETAIN(pmix_globals.mypeer->info);
|
||||
pmix_client_globals.myserver->info = pmix_globals.mypeer->info;
|
||||
|
||||
/* setup the wildcard recv for inbound messages from clients */
|
||||
req = PMIX_NEW(pmix_ptl_posted_recv_t);
|
||||
req->tag = UINT32_MAX;
|
||||
req->cbfunc = server_message_handler;
|
||||
/* add it to the end of the list of recvs */
|
||||
pmix_list_append(&pmix_ptl_globals.posted_recvs, &req->super);
|
||||
|
||||
/* start listening for connections */
|
||||
if (PMIX_SUCCESS != pmix_ptl_base_start_listening(info, ninfo)) {
|
||||
pmix_show_help("help-pmix-server.txt", "listener-thread-start", true);
|
||||
PMIx_server_finalize();
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
|
||||
++pmix_globals.init_cntr;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
|
||||
@ -911,6 +912,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_setup_fork(const pmix_proc_t *proc, char *
|
||||
char rankstr[128];
|
||||
pmix_listener_t *lt;
|
||||
pmix_status_t rc;
|
||||
char **varnames;
|
||||
int n;
|
||||
|
||||
PMIX_ACQUIRE_THREAD(&pmix_global_lock);
|
||||
if (pmix_globals.init_cntr <= 0) {
|
||||
@ -931,15 +934,17 @@ PMIX_EXPORT pmix_status_t PMIx_server_setup_fork(const pmix_proc_t *proc, char *
|
||||
/* pass our rendezvous info */
|
||||
PMIX_LIST_FOREACH(lt, &pmix_ptl_globals.listeners, pmix_listener_t) {
|
||||
if (NULL != lt->uri && NULL != lt->varname) {
|
||||
pmix_setenv(lt->varname, lt->uri, true, env);
|
||||
varnames = pmix_argv_split(lt->varname, ':');
|
||||
for (n=0; NULL != varnames[n]; n++) {
|
||||
pmix_setenv(varnames[n], lt->uri, true, env);
|
||||
}
|
||||
pmix_argv_free(varnames);
|
||||
}
|
||||
}
|
||||
/* pass our active security modules */
|
||||
pmix_setenv("PMIX_SECURITY_MODE", security_mode, true, env);
|
||||
/* pass our available ptl modules */
|
||||
pmix_setenv("PMIX_PTL_MODULE", ptl_mode, true, env);
|
||||
/* pass our available bfrop modes */
|
||||
pmix_setenv("PMIX_BFROP_MODULE", bfrops_mode, true, env);
|
||||
/* pass the type of buffer we are using */
|
||||
if (PMIX_BFROP_BUFFER_FULLY_DESC == pmix_globals.mypeer->nptr->compat.type) {
|
||||
pmix_setenv("PMIX_BFROP_BUFFER_TYPE", "PMIX_BFROP_BUFFER_FULLY_DESC", true, env);
|
||||
@ -1764,7 +1769,7 @@ static void get_cbfunc(pmix_status_t status, const char *data, size_t ndata, voi
|
||||
pmix_status_t rc;
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
"server:get_cbfunc called with %d elements", (int)ndata);
|
||||
"server:get_cbfunc called with %d bytes", (int)ndata);
|
||||
|
||||
/* no need to thread-shift here as no global data is accessed */
|
||||
|
||||
@ -1799,7 +1804,7 @@ static void get_cbfunc(pmix_status_t status, const char *data, size_t ndata, voi
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
"server:get_cbfunc reply being sent to %s:%u",
|
||||
cd->peer->info->pname.nspace, cd->peer->info->pname.rank);
|
||||
pmix_output_hexdump(5, pmix_globals.debug_output,
|
||||
pmix_output_hexdump(10, pmix_globals.debug_output,
|
||||
reply->base_ptr, (reply->bytes_used < 256 ? reply->bytes_used : 256));
|
||||
|
||||
PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply);
|
||||
@ -2132,16 +2137,18 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag,
|
||||
|
||||
if (PMIX_COMMIT_CMD == cmd) {
|
||||
rc = pmix_server_commit(peer, buf);
|
||||
reply = PMIX_NEW(pmix_buffer_t);
|
||||
if (NULL == reply) {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
|
||||
return PMIX_ERR_NOMEM;
|
||||
if (!PMIX_PROC_IS_V1(peer)) {
|
||||
reply = PMIX_NEW(pmix_buffer_t);
|
||||
if (NULL == reply) {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
PMIX_BFROPS_PACK(rc, peer, reply, &rc, 1, PMIX_STATUS);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
}
|
||||
PMIX_SERVER_QUEUE_REPLY(peer, tag, reply);
|
||||
}
|
||||
PMIX_BFROPS_PACK(rc, peer, reply, &rc, 1, PMIX_STATUS);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
}
|
||||
PMIX_SERVER_QUEUE_REPLY(peer, tag, reply);
|
||||
return PMIX_SUCCESS; // don't reply twice
|
||||
}
|
||||
|
||||
|
@ -578,19 +578,36 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, pmix_rank_t rank,
|
||||
cb.proc = &proc;
|
||||
cb.scope = PMIX_INTERNAL;
|
||||
cb.copy = false;
|
||||
peer = pmix_globals.mypeer;
|
||||
PMIX_GDS_FETCH_KV(rc, peer, &cb);
|
||||
PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb);
|
||||
if (PMIX_SUCCESS == rc) {
|
||||
PMIX_CONSTRUCT(&pkt, pmix_buffer_t);
|
||||
/* assemble the provided data into a byte object */
|
||||
PMIX_GDS_ASSEMB_KVS_REQ(rc, peer, &proc, &cb.kvs, &pkt, cd);
|
||||
PMIX_GDS_ASSEMB_KVS_REQ(rc, cd->peer, &proc, &cb.kvs, &pkt, cd);
|
||||
if (rc != PMIX_SUCCESS) {
|
||||
PMIX_DESTRUCT(&pkt);
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
PMIX_DESTRUCT(&cb);
|
||||
return rc;
|
||||
}
|
||||
PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size);
|
||||
if (PMIX_PROC_IS_V1(cd->peer)) {
|
||||
/* if the client is using v1, then it expects the
|
||||
* data returned to it as the rank followed by abyte object containing
|
||||
* a buffer - so we have to do a little gyration */
|
||||
pmix_buffer_t xfer;
|
||||
PMIX_CONSTRUCT(&xfer, pmix_buffer_t);
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, &xfer, &pkt, 1, PMIX_BUFFER);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_DESTRUCT(&pkt);
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
PMIX_DESTRUCT(&xfer);
|
||||
PMIX_DESTRUCT(&cb);
|
||||
return rc;
|
||||
}
|
||||
PMIX_UNLOAD_BUFFER(&xfer, bo.bytes, bo.size);
|
||||
PMIX_DESTRUCT(&xfer);
|
||||
} else {
|
||||
PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size);
|
||||
}
|
||||
PMIX_DESTRUCT(&pkt);
|
||||
/* pack it for transmission */
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT);
|
||||
@ -621,21 +638,44 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, pmix_rank_t rank,
|
||||
found = true;
|
||||
PMIX_CONSTRUCT(&pkt, pmix_buffer_t);
|
||||
/* assemble the provided data into a byte object */
|
||||
PMIX_GDS_ASSEMB_KVS_REQ(rc, peer, &proc, &cb.kvs, &pkt, cd);
|
||||
PMIX_GDS_ASSEMB_KVS_REQ(rc, cd->peer, &proc, &cb.kvs, &pkt, cd);
|
||||
if (rc != PMIX_SUCCESS) {
|
||||
PMIX_DESTRUCT(&pkt);
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
PMIX_DESTRUCT(&cb);
|
||||
return rc;
|
||||
}
|
||||
PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size);
|
||||
PMIX_DESTRUCT(&pkt);
|
||||
/* pack it for transmission */
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
PMIX_DESTRUCT(&cb);
|
||||
return rc;
|
||||
if (PMIX_PROC_IS_V1(peer)) {
|
||||
/* if the client is using v1, then it expects the
|
||||
* data returned to it in a different order than v2
|
||||
* - so we have to do a little gyration */
|
||||
/* pack the rank */
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &rank, 1, PMIX_PROC_RANK);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_DESTRUCT(&pkt);
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
PMIX_DESTRUCT(&cb);
|
||||
return rc;
|
||||
}
|
||||
/* now pack the data itself as a buffer */
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &pkt, 1, PMIX_BUFFER);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_DESTRUCT(&pkt);
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
PMIX_DESTRUCT(&cb);
|
||||
return rc;
|
||||
}
|
||||
PMIX_DESTRUCT(&pkt);
|
||||
} else {
|
||||
PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size);
|
||||
PMIX_DESTRUCT(&pkt);
|
||||
/* pack it for transmission */
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
PMIX_DESTRUCT(&cb);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
PMIX_DESTRUCT(&cb);
|
||||
|
@ -171,6 +171,8 @@ pmix_status_t pmix_server_commit(pmix_peer_t *peer, pmix_buffer_t *buf)
|
||||
while (PMIX_SUCCESS == rc) {
|
||||
/* unpack and store the blob */
|
||||
cnt = 1;
|
||||
PMIX_CONSTRUCT(&b2, pmix_buffer_t);
|
||||
PMIX_BFROPS_ASSIGN_TYPE(peer, &b2);
|
||||
PMIX_BFROPS_UNPACK(rc, peer, buf, &b2, &cnt, PMIX_BUFFER);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user