1
1

Merge in the new data support subsystem for ORTE. MPI folks should not notice a difference. Longer explanation will be sent to developers mailing list.

This commit was SVN r8912.
Этот коммит содержится в:
Ralph Castain 2006-02-07 03:32:36 +00:00
родитель bc22539441
Коммит 4b9f015c0b
245 изменённых файлов: 28928 добавлений и 8634 удалений

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

@ -1601,15 +1601,18 @@ AC_CONFIG_FILES([
test/Makefile
test/asm/Makefile
test/class/Makefile
test/dps/Makefile
test/dss/Makefile
test/mca/Makefile
test/mca/gpr/Makefile
test/mca/gpr/remote/Makefile
test/mca/ns/Makefile
test/mca/oob/Makefile
test/mca/ras/Makefile
test/mca/rds/Makefile
test/mca/rmaps/Makefile
test/mca/rmgr/Makefile
test/mca/schema/Makefile
test/mca/soh/Makefile
test/memory/Makefile
test/runtime/Makefile
test/support/Makefile

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

@ -86,6 +86,7 @@
#include "ompi/communicator/communicator.h"
#include "orte/util/proc_info.h"
#include "ompi/mca/pml/pml.h"
#include "orte/dss/dss.h"
#include "orte/mca/ns/ns.h"
#include "orte/mca/gpr/gpr.h"
#include "orte/mca/errmgr/errmgr.h"
@ -214,11 +215,12 @@ void ompi_attr_create_predefined_callback(
orte_gpr_notify_data_t *data,
void *cbdata)
{
size_t i, j, k;
size_t i, j, k, *sptr;
orte_gpr_keyval_t **keyval;
orte_gpr_value_t **value;
orte_jobid_t job;
unsigned int universe_size = 0;
int rc;
/* Set some default values */
@ -268,9 +270,13 @@ void ompi_attr_create_predefined_callback(
/* make sure we don't get confused - all slot counts
* are in size_t fields
*/
if (ORTE_SIZE == keyval[j]->type) {
if (ORTE_SIZE == keyval[j]->value->type) {
/* Process slot count */
universe_size += keyval[j]->value.size;
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&sptr, keyval[j]->value, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return;
}
universe_size += *sptr;
}
}
}

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

@ -21,7 +21,7 @@
#include <stdio.h>
#include "ompi/include/constants.h"
#include "dps/dps.h"
#include "orte/dss/dss.h"
#include "proc/proc.h"
#include "opal/threads/mutex.h"
#include "opal/util/bit_ops.h"
@ -852,7 +852,7 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
if ( OMPI_SUCCESS != rc ) {
goto err_exit;
}
if (ORTE_SUCCESS != (rc = orte_dps.unload(sbuf, &sendbuf, &size_len))) {
if (ORTE_SUCCESS != (rc = orte_dss.unload(sbuf, &sendbuf, &size_len))) {
goto err_exit;
}
@ -897,7 +897,7 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
goto err_exit;
}
if (ORTE_SUCCESS != (rc = orte_dps.load(rbuf, recvbuf, rlen))) {
if (ORTE_SUCCESS != (rc = orte_dss.load(rbuf, recvbuf, rlen))) {
goto err_exit;
}

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

@ -18,7 +18,7 @@
#include "ompi_config.h"
#include "dps/dps.h"
#include "orte/dss/dss.h"
#include "opal/util/convert.h"
#include "mca/ns/ns_types.h"
#include "communicator/communicator.h"
@ -665,7 +665,7 @@ static int ompi_comm_allreduce_intra_oob (int *inbuf, int *outbuf,
sbuf = OBJ_NEW(orte_buffer_t);
rbuf = OBJ_NEW(orte_buffer_t);
if (ORTE_SUCCESS != (rc = orte_dps.pack(sbuf, tmpbuf, count, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(sbuf, tmpbuf, count, ORTE_INT))) {
goto exit;
}
@ -678,7 +678,7 @@ static int ompi_comm_allreduce_intra_oob (int *inbuf, int *outbuf,
rc = orte_rml.send_buffer(remote_leader, sbuf, 0, 0);
}
if (ORTE_SUCCESS != (rc = orte_dps.unpack(rbuf, outbuf, &size_count, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(rbuf, outbuf, &size_count, ORTE_INT))) {
goto exit;
}
OBJ_RELEASE(sbuf);

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -26,7 +26,7 @@
#include <unistd.h>
#endif
#include "dps/dps.h"
#include "orte/dss/dss.h"
#include "ompi/communicator/communicator.h"
#include "ompi/request/request.h"
#include "errhandler/errhandler.h"
@ -75,49 +75,49 @@ int ompi_comm_connect_accept ( ompi_communicator_t *comm, int root,
opal_progress_event_increment();
if ( rank == root ) {
/* The process receiving first does not have yet the contact
/* The process receiving first does not have yet the contact
information of the remote process. Therefore, we have to
exchange that.
*/
if ( OMPI_COMM_JOIN_TAG != (int)tag ) {
rport = ompi_comm_get_rport( port,send_first,
if ( OMPI_COMM_JOIN_TAG != (int)tag ) {
rport = ompi_comm_get_rport( port,send_first,
group->grp_proc_pointers[rank], tag);
} else {
rport = port;
}
/* Generate the message buffer containing the number of processes and the list of
participating processes */
nbuf = OBJ_NEW(orte_buffer_t);
if (NULL == nbuf) {
return OMPI_ERROR;
}
} else {
rport = port;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(nbuf, &size, 1, ORTE_INT))) {
goto exit;
}
ompi_proc_get_namebuf (group->grp_proc_pointers, size, nbuf);
nrbuf = OBJ_NEW(orte_buffer_t);
if (NULL == nrbuf ) {
rc = OMPI_ERROR;
goto exit;
}
/* Exchange the number and the list of processes in the groups */
if ( send_first ) {
rc = orte_rml.send_buffer(rport, nbuf, tag, 0);
rc = orte_rml.recv_buffer(rport, nrbuf, tag);
} else {
rc = orte_rml.recv_buffer(rport, nrbuf, tag);
rc = orte_rml.send_buffer(rport, nbuf, tag, 0);
}
if (ORTE_SUCCESS != (rc = orte_dps.unload(nrbuf, &rnamebuf, &rnamebuflen))) {
goto exit;
}
/* Generate the message buffer containing the number of processes and the list of
participating processes */
nbuf = OBJ_NEW(orte_buffer_t);
if (NULL == nbuf) {
return OMPI_ERROR;
}
if (ORTE_SUCCESS != (rc = orte_dss.pack(nbuf, &size, 1, ORTE_INT))) {
goto exit;
}
ompi_proc_get_namebuf (group->grp_proc_pointers, size, nbuf);
nrbuf = OBJ_NEW(orte_buffer_t);
if (NULL == nrbuf ) {
rc = OMPI_ERROR;
goto exit;
}
/* Exchange the number and the list of processes in the groups */
if ( send_first ) {
rc = orte_rml.send_buffer(rport, nbuf, tag, 0);
rc = orte_rml.recv_buffer(rport, nrbuf, tag);
} else {
rc = orte_rml.recv_buffer(rport, nrbuf, tag);
rc = orte_rml.send_buffer(rport, nbuf, tag, 0);
}
if (ORTE_SUCCESS != (rc = orte_dss.unload(nrbuf, &rnamebuf, &rnamebuflen))) {
goto exit;
}
}
/* First convert the size_t to an int so we can cast in the bcast to a void *
* if we don't then we will get badness when using big vs little endian */
if (OMPI_SUCCESS != (rc = opal_size2int(rnamebuflen, &rnamebuflen_int, true))) {
@ -132,54 +132,54 @@ int ompi_comm_connect_accept ( ompi_communicator_t *comm, int root,
rnamebuflen = (size_t)rnamebuflen_int;
if ( rank != root ) {
/* non root processes need to allocate the buffer manually */
rnamebuf = (char *) malloc(rnamebuflen);
if ( NULL == rnamebuf ) {
rc = OMPI_ERR_OUT_OF_RESOURCE;
goto exit;
}
/* non root processes need to allocate the buffer manually */
rnamebuf = (char *) malloc(rnamebuflen);
if ( NULL == rnamebuf ) {
rc = OMPI_ERR_OUT_OF_RESOURCE;
goto exit;
}
}
/* bcast list of processes to all procs in local group
/* bcast list of processes to all procs in local group
and reconstruct the data. Note that proc_get_proclist
adds processes, which were not known yet to our
process pool.
*/
rc = comm->c_coll.coll_bcast (rnamebuf, rnamebuflen_int, MPI_BYTE, root, comm );
if ( OMPI_SUCCESS != rc ) {
goto exit;
goto exit;
}
nrbuf = OBJ_NEW(orte_buffer_t);
if (NULL == nrbuf) {
goto exit;
goto exit;
}
if ( ORTE_SUCCESS != ( rc = orte_dps.load(nrbuf, rnamebuf, rnamebuflen))) {
goto exit;
if ( ORTE_SUCCESS != ( rc = orte_dss.load(nrbuf, rnamebuf, rnamebuflen))) {
goto exit;
}
num_vals = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(nrbuf, &rsize, &num_vals, ORTE_INT))) {
goto exit;
if (ORTE_SUCCESS != (rc = orte_dss.unpack(nrbuf, &rsize, &num_vals, ORTE_INT))) {
goto exit;
}
rc = ompi_proc_get_proclist (nrbuf, rsize, &rprocs);
if ( OMPI_SUCCESS != rc ) {
goto exit;
goto exit;
}
OBJ_RELEASE(nrbuf);
if ( rank == root ) {
OBJ_RELEASE(nbuf);
OBJ_RELEASE(nbuf);
}
/* allocate comm-structure */
newcomp = ompi_comm_allocate ( size, rsize );
if ( NULL == newcomp ) {
rc = OMPI_ERR_OUT_OF_RESOURCE;
goto exit;
rc = OMPI_ERR_OUT_OF_RESOURCE;
goto exit;
}
/* allocate comm_cid */
rc = ompi_comm_nextcid ( newcomp, /* new communicator */
comm, /* old communicator */
@ -220,10 +220,10 @@ int ompi_comm_connect_accept ( ompi_communicator_t *comm, int root,
/* Question: do we have to re-start some low level stuff
to enable the usage of fast communication devices
between the two worlds ?
between the two worlds ?
*/
exit:
/* done with OOB and such - slow our tick rate again */
opal_progress();
@ -250,14 +250,14 @@ int ompi_comm_connect_accept ( ompi_communicator_t *comm, int root,
/*
* This routine is necessary, since in the connect/accept case, the processes
* executing the connect operation have the OOB contact information of the
* leader of the remote group, however, the processes executing the
* accept get their own port_name = OOB contact information passed in as
* leader of the remote group, however, the processes executing the
* accept get their own port_name = OOB contact information passed in as
* an argument. This is however useless.
*
*
* Therefore, the two root processes exchange this information at this point.
*
*/
orte_process_name_t *ompi_comm_get_rport (orte_process_name_t *port, int send_first,
orte_process_name_t *ompi_comm_get_rport (orte_process_name_t *port, int send_first,
ompi_proc_t *proc, orte_rml_tag_t tag)
{
int rc;
@ -274,7 +274,7 @@ orte_process_name_t *ompi_comm_get_rport (orte_process_name_t *port, int send_fi
if (NULL == sbuf) {
return NULL;
}
if (ORTE_SUCCESS != orte_dps.pack(sbuf, &(proc->proc_name), 1, ORTE_NAME)) {
if (ORTE_SUCCESS != orte_dss.pack(sbuf, &(proc->proc_name), 1, ORTE_NAME)) {
return NULL;
}
rc = orte_rml.send_buffer(port, sbuf, tag, 0);
@ -291,7 +291,7 @@ orte_process_name_t *ompi_comm_get_rport (orte_process_name_t *port, int send_fi
}
rc = orte_rml.recv_buffer(ORTE_RML_NAME_ANY, rbuf, tag);
num_vals = 1;
if (ORTE_SUCCESS != orte_dps.unpack(rbuf, &tbuf, &num_vals, ORTE_NAME)) {
if (ORTE_SUCCESS != orte_dss.unpack(rbuf, &tbuf, &num_vals, ORTE_NAME)) {
return NULL;
}
OBJ_RELEASE(rbuf);
@ -312,12 +312,12 @@ orte_process_name_t *ompi_comm_get_rport (orte_process_name_t *port, int send_fi
/**********************************************************************/
int
ompi_comm_start_processes(int count, char **array_of_commands,
char ***array_of_argv,
int *array_of_maxprocs,
MPI_Info *array_of_info,
char ***array_of_argv,
int *array_of_maxprocs,
MPI_Info *array_of_info,
char *port_name)
{
int rc, i, j;
int rc, i, j, counter;
int have_wdir=0;
int valuelen=OMPI_PATH_MAX, flag=0;
char cwd[OMPI_PATH_MAX];
@ -327,7 +327,7 @@ ompi_comm_start_processes(int count, char **array_of_commands,
/* parse the info object */
/* check potentially for:
/* check potentially for:
- "host": desired host where to spawn the processes
- "arch": desired architecture
- "wdir": directory, where executable can be found
@ -368,7 +368,7 @@ ompi_comm_start_processes(int count, char **array_of_commands,
apps[i]->num_procs = array_of_maxprocs[i];
/* copy over the argv array */
apps[i]->argc = 1;
counter = 1;
if (MPI_ARGVS_NULL != array_of_argv &&
MPI_ARGV_NULL != array_of_argv[i]) {
@ -377,36 +377,36 @@ ompi_comm_start_processes(int count, char **array_of_commands,
while (NULL != array_of_argv[i][j]) {
j++;
}
apps[i]->argc += j;
}
/* now copy them over, ensuring to NULL terminate the array */
apps[i]->argv = (char**)malloc((1 + apps[i]->argc) * sizeof(char*));
if (NULL == apps[i]->argv) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
/* rollback what was already done */
for (j=0; j < i; j++) {
OBJ_RELEASE(apps[j]);
}
opal_progress_event_decrement();
return ORTE_ERR_OUT_OF_RESOURCE;
}
apps[i]->argv[0] = strdup(array_of_commands[i]);
for (j=1; j < apps[i]->argc; j++) {
apps[i]->argv[j] = strdup(array_of_argv[i][j-1]);
}
apps[i]->argv[apps[i]->argc] = NULL;
counter += j;
}
/* now copy them over, ensuring to NULL terminate the array */
apps[i]->argv = (char**)malloc((1 + counter) * sizeof(char*));
if (NULL == apps[i]->argv) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
/* rollback what was already done */
for (j=0; j < i; j++) {
OBJ_RELEASE(apps[j]);
}
opal_progress_event_decrement();
return ORTE_ERR_OUT_OF_RESOURCE;
}
apps[i]->argv[0] = strdup(array_of_commands[i]);
for (j=1; j < counter; j++) {
apps[i]->argv[j] = strdup(array_of_argv[i][j-1]);
}
apps[i]->argv[counter] = NULL;
/* the environment gets set by the launcher
* all we need to do is add the specific values
* needed for comm_spawn
*/
/* Add environment variable with the contact information for the
child processes.
*/
apps[i]->num_env = 1;
apps[i]->env = (char**)malloc((1+apps[i]->num_env) * sizeof(char*));
/* Add environment variable with the contact information for the
child processes.
*/
counter = 1;
apps[i]->env = (char**)malloc((1+counter) * sizeof(char*));
if (NULL == apps[i]->env) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
/* rollback what was already done */
@ -418,18 +418,13 @@ ompi_comm_start_processes(int count, char **array_of_commands,
apps[i]->env[1] = NULL;
for (j = 0; NULL != environ[j]; ++j) {
if (0 == strncmp("OMPI_", environ[j], 5)) {
/* for some reason, num_env is a size_t. cope */
int tmp_num_env = apps[i]->num_env;
opal_argv_append(&tmp_num_env,
&apps[i]->env,
environ[j]);
apps[i]->num_env = tmp_num_env;
opal_argv_append_nosize(&apps[i]->env, environ[j]);
}
}
/* Check for the 'wdir' and later potentially for the
'path' Info object */
have_wdir = 0;
have_wdir = 0;
if ( array_of_info != NULL && array_of_info[i] != MPI_INFO_NULL ) {
ompi_info_get (array_of_info[i], "wdir", valuelen, cwd, &flag);
if ( flag ) {
@ -437,8 +432,8 @@ ompi_comm_start_processes(int count, char **array_of_commands,
have_wdir = 1;
}
}
/* default value: If the user did not tell us where to look for the
/* default value: If the user did not tell us where to look for the
executable, we assume the current working directory */
if ( !have_wdir ) {
getcwd(cwd, OMPI_PATH_MAX);
@ -453,21 +448,21 @@ ompi_comm_start_processes(int count, char **array_of_commands,
/* spawn procs */
if (ORTE_SUCCESS != (rc = orte_rmgr.spawn(apps, count, &new_jobid,
NULL))) {
ORTE_ERROR_LOG(rc);
ORTE_ERROR_LOG(rc);
opal_progress_event_decrement();
return MPI_ERR_SPAWN;
}
/* clean up */
opal_progress_event_decrement();
for ( i=0; i<count; i++) {
OBJ_RELEASE(apps[i]);
OBJ_RELEASE(apps[i]);
}
free (apps);
return OMPI_SUCCESS;
}
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
@ -486,43 +481,43 @@ int ompi_comm_dyn_init (void)
asprintf(&envvarname, "OMPI_PARENT_PORT");
port_name = getenv(envvarname);
free (envvarname);
/* if env-variable is set, parse port and call comm_connect_accept */
if (NULL != port_name ) {
ompi_communicator_t *oldcomm;
ompi_communicator_t *oldcomm;
/* split the content of the environment variable into
its pieces, which are : port_name and tag */
oob_port = ompi_parse_port (port_name, &tag);
if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_process_name(&port_proc_name, oob_port))) {
/* split the content of the environment variable into
its pieces, which are : port_name and tag */
oob_port = ompi_parse_port (port_name, &tag);
if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_process_name(&port_proc_name, oob_port))) {
return rc;
}
rc = ompi_comm_connect_accept (MPI_COMM_WORLD, root, port_proc_name,
send_first, &newcomm, tag );
rc = ompi_comm_connect_accept (MPI_COMM_WORLD, root, port_proc_name,
send_first, &newcomm, tag );
if (ORTE_SUCCESS != rc) {
return rc;
}
/* Set the parent communicator */
ompi_mpi_comm_parent = newcomm;
/* Set the parent communicator */
ompi_mpi_comm_parent = newcomm;
/* originally, we set comm_parent to comm_null (in comm_init),
* now we have to decrease the reference counters to the according
* objects
*/
/* originally, we set comm_parent to comm_null (in comm_init),
* now we have to decrease the reference counters to the according
* objects
*/
oldcomm = &ompi_mpi_comm_null;
OBJ_RELEASE(oldcomm);
oldcomm = &ompi_mpi_comm_null;
OBJ_RELEASE(oldcomm);
group = &ompi_mpi_group_null;
OBJ_RELEASE(group);
errhandler = &ompi_mpi_errors_are_fatal;
OBJ_RELEASE(errhandler);
OBJ_RELEASE(group);
errhandler = &ompi_mpi_errors_are_fatal;
OBJ_RELEASE(errhandler);
/* Set name for debugging purposes */
snprintf(newcomm->c_name, MPI_MAX_OBJECT_NAME, "MPI_COMM_PARENT");
/* Set name for debugging purposes */
snprintf(newcomm->c_name, MPI_MAX_OBJECT_NAME, "MPI_COMM_PARENT");
}
return OMPI_SUCCESS;
}
@ -538,30 +533,30 @@ int ompi_comm_dyn_finalize (void)
ompi_communicator_t *comm=NULL;
if ( 1 <ompi_comm_num_dyncomm ) {
objs = (ompi_comm_disconnect_obj **)malloc (ompi_comm_num_dyncomm*
sizeof(ompi_comm_disconnect_obj*));
if ( NULL == objs ) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
max = ompi_pointer_array_get_size(&ompi_mpi_communicators);
for ( i=3; i<max; i++ ) {
comm = (ompi_communicator_t*)ompi_pointer_array_get_item(&ompi_mpi_communicators,i);
if ( OMPI_COMM_IS_DYNAMIC(comm)) {
objs[j++]=ompi_comm_disconnect_init(comm);
}
}
if ( j != ompi_comm_num_dyncomm+1 ) {
free (objs);
return OMPI_ERROR;
}
ompi_comm_disconnect_waitall (ompi_comm_num_dyncomm, objs);
free (objs);
objs = (ompi_comm_disconnect_obj **)malloc (ompi_comm_num_dyncomm*
sizeof(ompi_comm_disconnect_obj*));
if ( NULL == objs ) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
max = ompi_pointer_array_get_size(&ompi_mpi_communicators);
for ( i=3; i<max; i++ ) {
comm = (ompi_communicator_t*)ompi_pointer_array_get_item(&ompi_mpi_communicators,i);
if ( OMPI_COMM_IS_DYNAMIC(comm)) {
objs[j++]=ompi_comm_disconnect_init(comm);
}
}
if ( j != ompi_comm_num_dyncomm+1 ) {
free (objs);
return OMPI_ERROR;
}
ompi_comm_disconnect_waitall (ompi_comm_num_dyncomm, objs);
free (objs);
}
return OMPI_SUCCESS;
}
@ -577,49 +572,49 @@ ompi_comm_disconnect_obj *ompi_comm_disconnect_init ( ompi_communicator_t *comm)
obj = (ompi_comm_disconnect_obj *) calloc(1,sizeof(ompi_comm_disconnect_obj));
if ( NULL == obj ) {
return NULL;
return NULL;
}
if ( OMPI_COMM_IS_INTER(comm) ) {
obj->size = ompi_comm_remote_size (comm);
obj->size = ompi_comm_remote_size (comm);
}
else {
obj->size = ompi_comm_size (comm);
obj->size = ompi_comm_size (comm);
}
obj->comm = comm;
obj->reqs = (ompi_request_t **) malloc(2*obj->size*sizeof(ompi_request_t *));
if ( NULL == obj->reqs ) {
free (obj);
return NULL;
free (obj);
return NULL;
}
/* initiate all isend_irecvs. We use a dummy buffer stored on
the object, since we are sending zero size messages anyway. */
for ( i=0; i < obj->size; i++ ) {
ret = MCA_PML_CALL(irecv (&(obj->buf), 0, MPI_INT, i,
OMPI_COMM_BARRIER_TAG, comm,
&(obj->reqs[2*i])));
if ( OMPI_SUCCESS != ret ) {
free (obj->reqs);
free (obj);
return NULL;
}
ret = MCA_PML_CALL(irecv (&(obj->buf), 0, MPI_INT, i,
OMPI_COMM_BARRIER_TAG, comm,
&(obj->reqs[2*i])));
ret = MCA_PML_CALL(isend (&(obj->buf), 0, MPI_INT, i,
OMPI_COMM_BARRIER_TAG,
MCA_PML_BASE_SEND_SYNCHRONOUS,
comm, &(obj->reqs[2*i+1])));
if ( OMPI_SUCCESS != ret ) {
free (obj->reqs);
free (obj);
return NULL;
}
if ( OMPI_SUCCESS != ret ) {
free (obj->reqs);
free (obj);
return NULL;
}
ret = MCA_PML_CALL(isend (&(obj->buf), 0, MPI_INT, i,
OMPI_COMM_BARRIER_TAG,
MCA_PML_BASE_SEND_SYNCHRONOUS,
comm, &(obj->reqs[2*i+1])));
if ( OMPI_SUCCESS != ret ) {
free (obj->reqs);
free (obj);
return NULL;
}
}
/* return handle */
return obj;
}
@ -634,7 +629,7 @@ ompi_comm_disconnect_obj *ompi_comm_disconnect_init ( ompi_communicator_t *comm)
*/
void ompi_comm_disconnect_waitall (int count, ompi_comm_disconnect_obj **objs)
{
ompi_request_t **reqs=NULL;
char *treq=NULL;
int totalcount = 0;
@ -642,25 +637,25 @@ void ompi_comm_disconnect_waitall (int count, ompi_comm_disconnect_obj **objs)
int ret;
for (i=0; i<count; i++) {
if (NULL == objs[i]) {
printf("Error in comm_disconnect_waitall\n");
return;
}
totalcount += objs[i]->size;
if (NULL == objs[i]) {
printf("Error in comm_disconnect_waitall\n");
return;
}
totalcount += objs[i]->size;
}
reqs = (ompi_request_t **) malloc (2*totalcount*sizeof(ompi_request_t *));
if ( NULL == reqs ) {
printf("ompi_comm_disconnect_waitall: error allocating memory\n");
return;
printf("ompi_comm_disconnect_waitall: error allocating memory\n");
return;
}
/* generate a single, large array of pending requests */
treq = (char *)reqs;
for (i=0; i<count; i++) {
memcpy (treq, objs[i]->reqs, 2*objs[i]->size * sizeof(ompi_request_t *));
treq += 2*objs[i]->size * sizeof(ompi_request_t *);
memcpy (treq, objs[i]->reqs, 2*objs[i]->size * sizeof(ompi_request_t *));
treq += 2*objs[i]->size * sizeof(ompi_request_t *);
}
/* force all non-blocking all-to-alls to finish */
@ -668,12 +663,12 @@ void ompi_comm_disconnect_waitall (int count, ompi_comm_disconnect_obj **objs)
/* Finally, free everything */
for (i=0; i< count; i++ ) {
if (NULL != objs[i]->reqs ) {
free (objs[i]->reqs );
free (objs[i]);
}
if (NULL != objs[i]->reqs ) {
free (objs[i]->reqs );
free (objs[i]);
}
}
free (reqs);
/* decrease the counter for dynamic communicators by 'count'.
@ -698,7 +693,7 @@ void ompi_comm_mark_dyncomm (ompi_communicator_t *comm)
/* special case for MPI_COMM_NULL */
if ( comm == MPI_COMM_NULL ) {
return;
return;
}
size = ompi_comm_size (comm);
@ -708,19 +703,19 @@ void ompi_comm_mark_dyncomm (ompi_communicator_t *comm)
of different jobids. */
grp = comm->c_local_group;
for (i=0; i< size; i++) {
if (ORTE_SUCCESS != orte_ns.get_jobid(&thisjobid, &(grp->grp_proc_pointers[i]->proc_name))) {
if (ORTE_SUCCESS != orte_ns.get_jobid(&thisjobid, &(grp->grp_proc_pointers[i]->proc_name))) {
return;
}
found = 0;
for ( j=0; j<numjobids; j++) {
if ( thisjobid == jobids[j]) {
found = 1;
break;
}
}
if (!found ) {
jobids[numjobids++] = thisjobid;
}
found = 0;
for ( j=0; j<numjobids; j++) {
if ( thisjobid == jobids[j]) {
found = 1;
break;
}
}
if (!found ) {
jobids[numjobids++] = thisjobid;
}
}
/* if inter-comm, loop over all processes in remote_group
@ -730,22 +725,22 @@ void ompi_comm_mark_dyncomm (ompi_communicator_t *comm)
if (ORTE_SUCCESS != orte_ns.get_jobid(&thisjobid, &(grp->grp_proc_pointers[i]->proc_name))) {
return;
}
found = 0;
for ( j=0; j<numjobids; j++) {
if ( thisjobid == jobids[j]) {
found = 1;
break;
}
}
if (!found ) {
jobids[numjobids++] = thisjobid;
}
found = 0;
for ( j=0; j<numjobids; j++) {
if ( thisjobid == jobids[j]) {
found = 1;
break;
}
}
if (!found ) {
jobids[numjobids++] = thisjobid;
}
}
/* if number of joibds larger than one, set the disconnect flag*/
if ( numjobids > 1 ) {
ompi_comm_num_dyncomm++;
OMPI_COMM_SET_DYNAMIC(comm);
ompi_comm_num_dyncomm++;
OMPI_COMM_SET_DYNAMIC(comm);
}
return;

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -23,12 +23,13 @@
#include "ompi/communicator/communicator.h"
#include "ompi/proc/proc.h"
#include "ompi/include/constants.h"
#include "ompi/mca/pml/pml.h"
#include "mca/errmgr/errmgr.h"
#include "mca/pml/pml.h"
#include "mca/ns/ns.h"
#include "mca/gpr/gpr.h"
#include "mca/rml/rml_types.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/ns/ns.h"
#include "orte/mca/gpr/gpr.h"
#include "orte/mca/rml/rml_types.h"
#if OMPI_HAVE_THREAD_SUPPORT
static opal_mutex_t ompi_port_lock;
@ -44,13 +45,13 @@ int ompi_open_port(char *port_name)
size_t size=0;
orte_rml_tag_t lport_id=0;
int rc;
/*
* The port_name is equal to the OOB-contact information
* and an integer. The reason for adding the integer is
* to make the port unique for multi-threaded scenarios.
*/
myproc = ompi_proc_self (&size);
if (ORTE_SUCCESS != (rc = orte_ns.get_proc_name_string (&name, &(myproc[0]->proc_name)))) {
return rc;
@ -58,7 +59,7 @@ int ompi_open_port(char *port_name)
OPAL_THREAD_LOCK(&ompi_port_lock);
if (ORTE_SUCCESS != (rc = orte_ns.assign_rml_tag(&lport_id, NULL))) {
OPAL_THREAD_UNLOCK(&ompi_port_lock);
OPAL_THREAD_UNLOCK(&ompi_port_lock);
return rc;
}
OPAL_THREAD_UNLOCK(&ompi_port_lock);
@ -66,20 +67,20 @@ int ompi_open_port(char *port_name)
sprintf (port_name, "%s:%d", name, lport_id);
free ( myproc );
free ( name );
return OMPI_SUCCESS;
}
/* takes a port_name and separates it into the process_name
/* takes a port_name and separates it into the process_name
and the tag
*/
char *ompi_parse_port (char *port_name, orte_rml_tag_t *tag)
char *ompi_parse_port (char *port_name, orte_rml_tag_t *tag)
{
char tmp_port[MPI_MAX_PORT_NAME], *tmp_string;
tmp_string = (char *) malloc (MPI_MAX_PORT_NAME);
if (NULL == tmp_string ) {
return NULL;
return NULL;
}
strncpy (tmp_port, port_name, MPI_MAX_PORT_NAME);
@ -89,48 +90,34 @@ char *ompi_parse_port (char *port_name, orte_rml_tag_t *tag)
return tmp_string;
}
/*
/*
* publish the port_name using the service_name as a token
* jobid and vpid are used later to make
* sure, that only this process can unpublish the information.
*/
int ompi_comm_namepublish ( char *service_name, char *port_name )
int ompi_comm_namepublish ( char *service_name, char *port_name )
{
orte_gpr_value_t *value;
int rc;
value = OBJ_NEW(orte_gpr_value_t);
if (NULL == value) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
value->addr_mode = ORTE_GPR_TOKENS_AND | ORTE_GPR_OVERWRITE;
value->segment = strdup(OMPI_NAMESPACE_SEGMENT);
value->tokens = (char**)malloc(2*sizeof(char*));
if (NULL == value->tokens) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
if (ORTE_SUCCESS != (rc = orte_gpr.create_value(&value, ORTE_GPR_TOKENS_AND | ORTE_GPR_OVERWRITE,
OMPI_NAMESPACE_SEGMENT, 1, 1))) {
ORTE_ERROR_LOG(rc);
return rc;
}
value->tokens[0] = strdup(service_name);
value->tokens[1] = NULL;
value->num_tokens = 1;
value->keyvals = (orte_gpr_keyval_t **)malloc(sizeof(orte_gpr_keyval_t *));
value->cnt = 1;
value->keyvals[0] = OBJ_NEW(orte_gpr_keyval_t);
if (NULL == value->keyvals[0]) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[0]), OMPI_COMM_PORT_KEY, ORTE_STRING, port_name))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(value);
return ORTE_ERR_OUT_OF_RESOURCE;
return rc;
}
(value->keyvals[0])->key = strdup(OMPI_COMM_PORT_KEY);
(value->keyvals[0])->type = ORTE_STRING;
((value->keyvals[0])->value).strptr = strdup(port_name);
rc = orte_gpr.put(1, &value);
if (ORTE_SUCCESS != (rc = orte_gpr.put(1, &value))) {
ORTE_ERROR_LOG(rc);
}
OBJ_RELEASE(value);
return rc;
}
@ -143,13 +130,13 @@ char* ompi_comm_namelookup ( char *service_name )
size_t cnt=0;
char *stmp=NULL;
int ret;
token[0] = service_name;
token[1] = NULL;
key[0] = strdup(OMPI_COMM_PORT_KEY);
key[1] = NULL;
ret = orte_gpr.get(ORTE_GPR_TOKENS_AND, OMPI_NAMESPACE_SEGMENT,
token, key, &cnt, &values);
if (ORTE_SUCCESS != ret) {
@ -157,29 +144,29 @@ char* ompi_comm_namelookup ( char *service_name )
}
if ( 0 < cnt && NULL != values[0] ) { /* should be only one, if any */
keyvals = values[0]->keyvals;
stmp = strdup(keyvals[0]->value.strptr);
stmp = strdup(keyvals[0]->value->data);
OBJ_RELEASE(values[0]);
}
return (stmp);
}
/*
/*
* delete the entry. Just the process who has published
* the service_name, has the right to remove this
* the service_name, has the right to remove this
* service. Will be done later, by adding jobid and vpid
* as tokens
*/
int ompi_comm_nameunpublish ( char *service_name )
{
char *token[2];
token[0] = service_name;
token[1] = NULL;
#if 0
#if 0
return orte_gpr.delete_entries(ORTE_GPR_TOKENS_AND,
OMPI_NAMESPACE_SEGMENT,
token, NULL);
token, NULL);
#endif
return OMPI_SUCCESS;
}

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

@ -59,27 +59,19 @@ enum {
OMPI_ERR_NO_CONNECTION_ALLOWED = ORTE_ERR_NO_CONNECTION_ALLOWED,
OMPI_ERR_CONNECTION_REFUSED = ORTE_ERR_CONNECTION_REFUSED ,
OMPI_ERR_CONNECTION_FAILED = ORTE_ERR_CONNECTION_FAILED,
OMPI_STARTUP_DETECTED = ORTE_STARTUP_DETECTED,
OMPI_SHUTDOWN_DETECTED = ORTE_SHUTDOWN_DETECTED,
OMPI_PROC_STARTING = ORTE_PROC_STARTING,
OMPI_PROC_STOPPED = ORTE_PROC_STOPPED,
OMPI_PROC_TERMINATING = ORTE_PROC_TERMINATING,
OMPI_PROC_ALIVE = ORTE_PROC_ALIVE,
OMPI_PROC_RUNNING = ORTE_PROC_RUNNING,
OMPI_PROC_KILLED = ORTE_PROC_KILLED,
OMPI_PROC_EXITED = ORTE_PROC_EXITED,
OMPI_NODE_UP = ORTE_NODE_UP,
OMPI_NODE_DOWN = ORTE_NODE_DOWN,
OMPI_NODE_BOOTING = ORTE_NODE_BOOTING,
OMPI_NODE_ERROR = ORTE_NODE_ERROR,
OMPI_PACK_MISMATCH = ORTE_PACK_MISMATCH,
OMPI_PACK_MISMATCH = ORTE_ERR_PACK_MISMATCH,
OMPI_ERR_PACK_FAILURE = ORTE_ERR_PACK_FAILURE,
OMPI_ERR_UNPACK_FAILURE = ORTE_ERR_UNPACK_FAILURE,
OMPI_ERR_COMM_FAILURE = ORTE_ERR_COMM_FAILURE,
OMPI_UNPACK_INADEQUATE_SPACE = ORTE_UNPACK_INADEQUATE_SPACE,
OMPI_UNPACK_READ_PAST_END_OF_BUFFER = ORTE_UNPACK_READ_PAST_END_OF_BUFFER,
OMPI_UNPACK_INADEQUATE_SPACE = ORTE_ERR_UNPACK_INADEQUATE_SPACE,
OMPI_UNPACK_READ_PAST_END_OF_BUFFER = ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER,
OMPI_ERR_GPR_DATA_CORRUPT = ORTE_ERR_GPR_DATA_CORRUPT,
OMPI_ERR_TYPE_MISMATCH = ORTE_ERR_TYPE_MISMATCH
OMPI_ERR_TYPE_MISMATCH = ORTE_ERR_TYPE_MISMATCH,
OMPI_ERR_COMPARE_FAILURE = ORTE_ERR_COMPARE_FAILURE,
OMPI_ERR_COPY_FAILURE = ORTE_ERR_COPY_FAILURE,
OMPI_ERR_UNKNOWN_DATA_TYPE = ORTE_ERR_UNKNOWN_DATA_TYPE,
OMPI_ERR_DATA_TYPE_REDEF = ORTE_ERR_DATA_TYPE_REDEF,
OMPI_ERR_DATA_OVERWRITE_ATTEMPT = ORTE_ERR_DATA_OVERWRITE_ATTEMPT
};
#define OMPI_ERR_MAX (OMPI_ERR_BASE - 1)

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

@ -26,7 +26,7 @@
#include "mca/oob/base/base.h"
#include "mca/rml/rml.h"
#include "mca/errmgr/errmgr.h"
#include "dps/dps.h"
#include "dss/dss.h"
#include "btl_mvapi.h"
#include "btl_mvapi_endpoint.h"
#include "btl_mvapi_proc.h"
@ -260,24 +260,24 @@ static int mca_btl_mvapi_endpoint_send_connect_data(mca_btl_base_endpoint_t* end
/* pack the info in the send buffer */
rc = orte_dps.pack(buffer, &endpoint->lcl_qp_prop_hp.qp_num, 1, ORTE_UINT32);
rc = orte_dss.pack(buffer, &endpoint->lcl_qp_prop_hp.qp_num, 1, ORTE_UINT32);
if(rc != ORTE_SUCCESS) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_dps.pack(buffer, &endpoint->lcl_qp_prop_lp.qp_num, 1, ORTE_UINT32);
rc = orte_dss.pack(buffer, &endpoint->lcl_qp_prop_lp.qp_num, 1, ORTE_UINT32);
if(rc != ORTE_SUCCESS) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_dps.pack(buffer, &endpoint->endpoint_btl->port.lid, 1, ORTE_UINT32);
rc = orte_dss.pack(buffer, &endpoint->endpoint_btl->port.lid, 1, ORTE_UINT32);
if(rc != ORTE_SUCCESS) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_dps.pack(buffer, &((mca_btl_mvapi_endpoint_t*)endpoint)->subnet, 1, ORTE_UINT32);
rc = orte_dss.pack(buffer, &((mca_btl_mvapi_endpoint_t*)endpoint)->subnet, 1, ORTE_UINT32);
if(rc != ORTE_SUCCESS) {
ORTE_ERROR_LOG(rc);
return rc;
@ -506,22 +506,22 @@ static void mca_btl_mvapi_endpoint_recv(
/* start by unpacking data first so we know who is knocking at
our door */
rc = orte_dps.unpack(buffer, &rem_info.rem_qp_num_hp, &cnt, ORTE_UINT32);
rc = orte_dss.unpack(buffer, &rem_info.rem_qp_num_hp, &cnt, ORTE_UINT32);
if(ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return;
}
rc = orte_dps.unpack(buffer, &rem_info.rem_qp_num_lp, &cnt, ORTE_UINT32);
rc = orte_dss.unpack(buffer, &rem_info.rem_qp_num_lp, &cnt, ORTE_UINT32);
if(ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return;
}
rc = orte_dps.unpack(buffer, &rem_info.rem_lid, &cnt, ORTE_UINT32);
rc = orte_dss.unpack(buffer, &rem_info.rem_lid, &cnt, ORTE_UINT32);
if(ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return;
}
rc = orte_dps.unpack(buffer, &rem_info.rem_subnet, &cnt, ORTE_UINT32);
rc = orte_dss.unpack(buffer, &rem_info.rem_subnet, &cnt, ORTE_UINT32);
if(ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return;

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

@ -51,7 +51,6 @@
#include "mca/rml/rml.h"
#include "mca/errmgr/errmgr.h"
#include "mca/btl/base/btl_base_error.h"
#include "dps/dps.h"
#include "btl_tcp.h"
#include "btl_tcp_endpoint.h"
#include "btl_tcp_proc.h"

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

@ -23,7 +23,7 @@
#include "opal/util/output.h"
#include "util/proc_info.h"
#include "dps/dps.h"
#include "dss/dss.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/errmgr/errmgr.h"
@ -274,18 +274,21 @@ static void mca_pml_base_modex_registry_callback(
void* bytes = NULL;
size_t cnt;
size_t num_bytes;
orte_byte_object_t *bo;
if(strcmp(keyval[j]->key,OMPI_MODEX_KEY) != 0)
continue;
OBJ_CONSTRUCT(&buffer, orte_buffer_t);
if (ORTE_SUCCESS != (rc = orte_dps.load(&buffer,
keyval[j]->value.byteobject.bytes,
keyval[j]->value.byteobject.size))) {
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&bo, keyval[j]->value, ORTE_BYTE_OBJECT))) {
ORTE_ERROR_LOG(rc);
continue;
}
if (ORTE_SUCCESS != (rc = orte_dss.load(&buffer, bo->bytes, bo->size))) {
ORTE_ERROR_LOG(rc);
continue;
}
cnt = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(&buffer, &ptr, &cnt, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer, &ptr, &cnt, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
continue;
}
@ -293,7 +296,7 @@ static void mca_pml_base_modex_registry_callback(
free(ptr);
cnt = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(&buffer, &ptr, &cnt, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer, &ptr, &cnt, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
continue;
}
@ -301,19 +304,19 @@ static void mca_pml_base_modex_registry_callback(
free(ptr);
cnt = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(&buffer,
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer,
&component.mca_component_major_version, &cnt, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
continue;
}
cnt = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(&buffer,
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer,
&component.mca_component_minor_version, &cnt, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
continue;
}
cnt = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(&buffer,
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer,
&num_bytes, &cnt, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
continue;
@ -323,7 +326,7 @@ static void mca_pml_base_modex_registry_callback(
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
continue;
}
if (ORTE_SUCCESS != (rc = orte_dps.unpack(&buffer, bytes, &num_bytes, ORTE_BYTE))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(&buffer, bytes, &num_bytes, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
continue;
}
@ -487,11 +490,12 @@ int mca_pml_base_modex_send(
size_t size)
{
orte_jobid_t jobid;
orte_gpr_value_union_t value;
int rc;
orte_buffer_t buffer;
size_t i, num_tokens;
char *ptr, *segment, **tokens;
orte_byte_object_t bo;
orte_data_value_t value = ORTE_DATA_VALUE_EMPTY;
if (ORTE_SUCCESS != (rc = orte_ns.get_jobid(&jobid, orte_process_info.my_name))) {
ORTE_ERROR_LOG(rc);
@ -528,36 +532,49 @@ int mca_pml_base_modex_send(
#else
OBJ_CONSTRUCT(&buffer, orte_buffer_t);
ptr = source_component->mca_type_name;
if (ORTE_SUCCESS != (rc = orte_dps.pack(&buffer, &ptr, 1, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &ptr, 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
ptr = source_component->mca_component_name;
if (ORTE_SUCCESS != (rc = orte_dps.pack(&buffer, &ptr, 1, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &ptr, 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(&buffer, &source_component->mca_component_major_version, 1, ORTE_INT32))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &source_component->mca_component_major_version, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(&buffer, &source_component->mca_component_minor_version, 1, ORTE_INT32))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &source_component->mca_component_minor_version, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(&buffer, &size, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &size, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (0 != size) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(&buffer, (void*)data, size, ORTE_BYTE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, (void*)data, size, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
}
if (ORTE_SUCCESS != (rc = orte_dps.unload(&buffer, (void**)&value.byteobject.bytes,
(size_t*)&value.byteobject.size))) {
if (ORTE_SUCCESS != (rc = orte_dss.unload(&buffer, (void**)&(bo.bytes), (size_t*)&(bo.size)))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
OBJ_DESTRUCT(&buffer);
/* setup the data_value structure to hold the byte object */
if (ORTE_SUCCESS != (rc = orte_dss.set(&value, (void*)&bo, ORTE_BYTE_OBJECT))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
#endif
rc = orte_gpr.put_1(ORTE_GPR_TOKENS_AND | ORTE_GPR_KEYS_OR,
segment, tokens, OMPI_MODEX_KEY, ORTE_BYTE_OBJECT, value);
segment, tokens, OMPI_MODEX_KEY, &value);
cleanup:
free(segment);

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

@ -23,7 +23,7 @@
#include "opal/threads/mutex.h"
#include "opal/util/output.h"
#include "orte/util/sys_info.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/oob/oob.h"
#include "orte/mca/ns/ns.h"
#include "orte/mca/gpr/gpr.h"
@ -97,7 +97,8 @@ int ompi_proc_init(void)
size_t i, npeers, self, num_tokens;
orte_jobid_t jobid;
char *segment, **tokens;
orte_gpr_value_union_t value;
orte_data_value_t value = { {OBJ_CLASS(orte_data_value_t),0}, ORTE_NULL, NULL};
uint32_t ui32;
int rc;
OBJ_CONSTRUCT(&ompi_proc_list, opal_list_t);
@ -131,7 +132,11 @@ int ompi_proc_init(void)
/* Here we have to add to the GPR the information about the current architecture.
*/
if (OMPI_SUCCESS != (rc = ompi_arch_compute_local_id(&value.ui32))) {
if (OMPI_SUCCESS != (rc = ompi_arch_compute_local_id(&ui32))) {
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dss.set(&value, &ui32, ORTE_UINT32))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -156,7 +161,7 @@ int ompi_proc_init(void)
/* put the arch info on the registry */
if (ORTE_SUCCESS != (rc = orte_gpr.put_1(ORTE_GPR_TOKENS_OR | ORTE_GPR_KEYS_OR,
segment, tokens,
OMPI_PROC_ARCH, ORTE_UINT32, value))) {
OMPI_PROC_ARCH, &value))) {
ORTE_ERROR_LOG(rc);
}
free(segment);
@ -326,7 +331,7 @@ int ompi_proc_get_namebuf ( ompi_proc_t **proclist, int proclistsize, orte_buffe
int i;
OPAL_THREAD_LOCK(&ompi_proc_lock);
for (i=0; i<proclistsize; i++) {
int rc = orte_dps.pack(buf, &(proclist[i]->proc_name), 1, ORTE_NAME);
int rc = orte_dss.pack(buf, &(proclist[i]->proc_name), 1, ORTE_NAME);
if(rc != OMPI_SUCCESS) {
OPAL_THREAD_UNLOCK(&ompi_proc_lock);
return rc;
@ -353,7 +358,7 @@ int ompi_proc_get_proclist (orte_buffer_t* buf, int proclistsize, ompi_proc_t **
for ( i=0; i<proclistsize; i++ ){
size_t count=1;
int rc = orte_dps.unpack(buf, &name, &count, ORTE_NAME);
int rc = orte_dss.unpack(buf, &name, &count, ORTE_NAME);
if(rc != ORTE_SUCCESS) {
return rc;
}
@ -453,13 +458,14 @@ static void callback(orte_gpr_notify_data_t *data, void *cbdata)
{
size_t i, j, k;
char *str;
uint32_t arch = 0;
uint32_t arch = 0, *ui32;
bool found_name, found_arch;
orte_ns_cmp_bitmask_t mask;
orte_process_name_t name;
orte_process_name_t name, *nptr;
orte_gpr_value_t **value;
orte_gpr_keyval_t **keyval;
ompi_proc_t *proc;
int rc;
/* check bozo case */
if (0 == data->cnt) {
@ -484,16 +490,24 @@ static void callback(orte_gpr_notify_data_t *data, void *cbdata)
/* find the 2 keys that we're looking for */
for (j = 0; j < value[i]->cnt; ++j) {
if (strcmp(keyval[j]->key, ORTE_PROC_NAME_KEY) == 0) {
orte_ns.get_proc_name_string(&str, &keyval[j]->value.proc);
name = keyval[j]->value.proc;
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&nptr, keyval[j]->value, ORTE_NAME))) {
ORTE_ERROR_LOG(rc);
return;
}
orte_ns.get_proc_name_string(&str, nptr);
name = *nptr;
found_name = true;
} else if (strcmp(keyval[j]->key, ORTE_NODE_NAME_KEY) == 0) {
if (NULL != str) {
free(str);
}
str = strdup(keyval[j]->value.strptr);
str = strdup(keyval[j]->value->data);
} else if (strcmp(keyval[j]->key, OMPI_PROC_ARCH) == 0) {
arch = keyval[j]->value.ui32;
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&ui32, keyval[j]->value, ORTE_UINT32))) {
ORTE_ERROR_LOG(rc);
return;
}
arch = *ui32;
found_arch = true;
}
}

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

@ -21,7 +21,7 @@
#include "include/types.h"
#include "opal/class/opal_list.h"
#include "dps/dps_types.h"
#include "dss/dss_types.h"
#include "opal/threads/mutex.h"
#include "mca/ns/ns_types.h"

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

@ -137,8 +137,8 @@ void ompi_info::open_components()
// Open the DPS
if (ORTE_SUCCESS != orte_dps_open()) {
printf( "Unable to initialize the DPS\n" );
if (ORTE_SUCCESS != orte_dss_open()) {
printf( "Unable to initialize the DSS\n" );
return;
}

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

@ -33,6 +33,7 @@ DIST_SUBDIRS = \
lib_LTLIBRARIES = liborte.la
liborte_la_SOURCES =
liborte_la_LIBADD = \
dss/libdss.la \
$(MCA_orte_FRAMEWORK_LIBS) \
$(top_ompi_builddir)/opal/libopal.la
liborte_la_DEPENDENCIES = $(liborte_la_LIBADD)
@ -56,7 +57,7 @@ endif
include include/Makefile.am
include class/Makefile.am
include dps/Makefile.am
include dss/Makefile.am
include runtime/Makefile.am
include util/Makefile.am
include tools/Makefile.am

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

@ -1,259 +0,0 @@
/* -*- C -*-
*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-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$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef ORTE_DPS_INTERNAL_H_
#define ORTE_DPS_INTERNAL_H_
#include "orte_config.h"
#include "include/orte_constants.h"
#include "class/orte_pointer_array.h"
#include "dps/dps.h"
#if HAVE_STRING_H
# if !defined(STDC_HEADERS) && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* DEFINE THE DEFAULT PAGE SIZE FOR THE DPS BUFFERS - IN KILOBYTES
*/
#define ORTE_DPS_DEFAULT_PAGE_SIZE 1
/*
* ORTE type corresponding to size_t
*/
#if SIZEOF_SIZE_T == 1
#define DPS_TYPE_SIZE_T ORTE_UINT8
#elif SIZEOF_SIZE_T == 2
#define DPS_TYPE_SIZE_T ORTE_UINT16
#elif SIZEOF_SIZE_T == 4
#define DPS_TYPE_SIZE_T ORTE_UINT32
#elif SIZEOF_SIZE_T == 8
#define DPS_TYPE_SIZE_T ORTE_UINT64
#else
#error Unsupported size_t size!
#endif
/*
* ORTE type corresponding to bool
*/
#if SIZEOF_BOOL == 1
#define DPS_TYPE_BOOL ORTE_UINT8
#elif SIZEOF_BOOL == 2
#define DPS_TYPE_BOOL ORTE_UINT16
#elif SIZEOF_BOOL == 4
#define DPS_TYPE_BOOL ORTE_UINT32
#elif SIZEOF_BOOL == 8
#define DPS_TYPE_BOOL ORTE_UINT64
#else
#error Unsupported bool size!
#endif
/*
* ORTE type corresponding to int and unsigned int
*/
#if SIZEOF_INT == 1
#define DPS_TYPE_INT ORTE_INT8
#define DPS_TYPE_UINT ORTE_UINT8
#elif SIZEOF_INT == 2
#define DPS_TYPE_INT ORTE_INT16
#define DPS_TYPE_UINT ORTE_UINT16
#elif SIZEOF_INT == 4
#define DPS_TYPE_INT ORTE_INT32
#define DPS_TYPE_UINT ORTE_UINT32
#elif SIZEOF_INT == 8
#define DPS_TYPE_INT ORTE_INT64
#define DPS_TYPE_UINT ORTE_UINT64
#else
#error Unsupported int size!
#endif
/*
* ORTE type corresponding to pid_t
*/
#if SIZEOF_PID_T == 1
#define DPS_TYPE_PID_T ORTE_UINT8
#elif SIZEOF_PID_T == 2
#define DPS_TYPE_PID_T ORTE_UINT16
#elif SIZEOF_PID_T == 4
#define DPS_TYPE_PID_T ORTE_UINT32
#elif SIZEOF_PID_T == 8
#define DPS_TYPE_PID_T ORTE_UINT64
#else
#error Unsupported pid_t size!
#endif
/**
* Internal struct used for holding registered dps functions
*/
struct orte_dps_type_info_t {
opal_object_t super;
/* type identifier */
orte_data_type_t odti_type;
/** Debugging string name */
char *odti_name;
/** Pack function */
orte_dps_pack_fn_t odti_pack_fn;
/** Unpack function */
orte_dps_unpack_fn_t odti_unpack_fn;
};
/**
* Convenience typedef
*/
typedef struct orte_dps_type_info_t orte_dps_type_info_t;
OBJ_CLASS_DECLARATION(orte_dps_type_info_t);
/*
* globals needed within dps
*/
extern bool orte_dps_initialized;
extern bool orte_dps_debug;
extern int orte_dps_verbose;
extern int orte_dps_page_size;
extern orte_pointer_array_t *orte_dps_types;
/*
* Implementations of API functions
*/
int orte_dps_pack(orte_buffer_t *buffer, void *src,
size_t num_vals,
orte_data_type_t type);
int orte_dps_unpack(orte_buffer_t *buffer, void *dest,
size_t *max_num_vals,
orte_data_type_t type);
int orte_dps_peek(orte_buffer_t *buffer, orte_data_type_t *type,
size_t *number);
int orte_dps_unload(orte_buffer_t *buffer, void **payload,
size_t *bytes_used);
int orte_dps_load(orte_buffer_t *buffer, void *payload, size_t bytes_used);
int orte_dps_register(orte_dps_pack_fn_t pack_fn,
orte_dps_unpack_fn_t unpack_fn,
const char *name, orte_data_type_t *type);
char *orte_dps_lookup_data_type(orte_data_type_t type);
/*
* Non-API functions that need to be reachable
*/
int orte_dps_pack_buffer(orte_buffer_t *buffer, void *src, size_t num_vals,
orte_data_type_t type);
int orte_dps_unpack_buffer(orte_buffer_t *buffer, void *dst, size_t *num_vals,
orte_data_type_t type);
/*
* Internal pack functions
*/
int orte_dps_pack_null(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_byte(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_bool(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_int(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_int16(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_int32(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_int64(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_sizet(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_pid(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_string(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_data_type(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dps_pack_byte_object(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
/*
* Internal unpack functions
*/
int orte_dps_unpack_null(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_byte(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_bool(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_int(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_int16(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_int32(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_int64(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_sizet(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_pid(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_string(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_data_type(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dps_unpack_byte_object(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
/*
* Internal helper functions
*/
char* orte_dps_buffer_extend(orte_buffer_t *bptr, size_t bytes_to_add);
bool orte_dps_too_small(orte_buffer_t *buffer, size_t bytes_reqd);
int orte_dps_store_data_type(orte_buffer_t *buffer, orte_data_type_t type);
int orte_dps_get_data_type(orte_buffer_t *buffer, orte_data_type_t *type);
orte_dps_type_info_t* orte_dps_find_type(orte_data_type_t type);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

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

@ -1,438 +0,0 @@
/*
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "include/orte_types.h"
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "mca/errmgr/errmgr.h"
#include "dps/dps_internal.h"
#include "opal/util/output.h"
int orte_dps_unpack(orte_buffer_t *buffer, void *dst, size_t *num_vals,
orte_data_type_t type)
{
int ret=ORTE_SUCCESS, rc=ORTE_SUCCESS;
size_t local_num, n=1;
orte_data_type_t local_type;
/* check for error */
if (NULL == buffer || NULL == dst || NULL == num_vals) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* if user provides a zero for num_vals, then there is no storage allocated
* so return an appropriate error
*/
if (0 == *num_vals) {
ORTE_ERROR_LOG(ORTE_UNPACK_INADEQUATE_SPACE);
return ORTE_UNPACK_INADEQUATE_SPACE;
}
/* Unpack the declared number of values
* REMINDER: it is possible that the buffer is corrupted and that
* the DPS will *think* there is a proper size_t variable at the
* beginning of the unpack region - but that the value is bogus (e.g., just
* a byte field in a string array that so happens to have a value that
* matches the size_t data type flag). Therefore, this error check is
* NOT completely safe. This is true for ALL unpack functions, not just
* size_t as used here.
*/
if (ORTE_SUCCESS != (
rc = orte_dps_get_data_type(buffer, &local_type))) {
ORTE_ERROR_LOG(rc);
*num_vals = 0;
return rc;
}
if (ORTE_SIZE != local_type) { /* if the length wasn't first, then error */
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_FAILURE);
*num_vals = 0;
return ORTE_ERR_UNPACK_FAILURE;
}
if (ORTE_SUCCESS != (
rc = orte_dps_unpack_sizet(buffer, &local_num, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
*num_vals = 0;
return rc;
}
/* if the storage provided is inadequate, set things up
* to unpack as much as we can and to return an error code
* indicating that everything was not unpacked - the buffer
* is left in a state where it can not be further unpacked.
*/
if (local_num > *num_vals) {
ORTE_ERROR_LOG(ORTE_UNPACK_INADEQUATE_SPACE);
local_num = *num_vals;
ret = ORTE_UNPACK_INADEQUATE_SPACE;
} else if (local_num < *num_vals) { /* more than enough storage */
*num_vals = local_num; /* let the user know how many we actually unpacked */
}
/* Unpack the value(s) */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, dst, &local_num, type))) {
ORTE_ERROR_LOG(rc);
*num_vals = 0;
}
if (ORTE_SUCCESS != ret) {
return ret;
}
return rc;
}
int orte_dps_unpack_buffer(orte_buffer_t *buffer, void *dst, size_t *num_vals,
orte_data_type_t type)
{
int rc;
orte_data_type_t local_type;
orte_dps_type_info_t *info;
OPAL_OUTPUT( ( orte_dps_verbose, "orte_dps_unpack_buffer( %p, %p, %lu, %d )\n", buffer, dst, *num_vals, (int)type ) );
/* Unpack the declared data type */
if (ORTE_SUCCESS != (rc = orte_dps_get_data_type(buffer, &local_type))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* if the data types don't match, then return an error */
if (type != local_type) {
ORTE_ERROR_LOG(ORTE_PACK_MISMATCH);
return ORTE_PACK_MISMATCH;
}
/* Lookup the unpack function for this type and call it */
if (NULL == (info = orte_pointer_array_get_item(orte_dps_types, type))) {
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_FAILURE);
return ORTE_ERR_UNPACK_FAILURE;
}
if (ORTE_SUCCESS != (rc = info->odti_unpack_fn(buffer, dst, num_vals, type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
/* UNPACK GENERIC SYSTEM TYPES */
/*
* NULL
*/
int orte_dps_unpack_null(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int rc;
/* Turn around and unpack the real type */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_byte(buffer, dest, num_vals, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
/*
* BOOL
*/
int orte_dps_unpack_bool(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and unpack the real type */
if (ORTE_SUCCESS != (
ret = orte_dps_unpack_buffer(buffer, dest, num_vals, DPS_TYPE_BOOL))) {
ORTE_ERROR_LOG(ret);
}
return ret;
}
/*
* INT
*/
int orte_dps_unpack_int(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and unpack the real type */
if (ORTE_SUCCESS != (
ret = orte_dps_unpack_buffer(buffer, dest, num_vals, DPS_TYPE_INT))) {
ORTE_ERROR_LOG(ret);
}
return ret;
}
/*
* SIZE_T
*/
int orte_dps_unpack_sizet(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and unpack the real type */
if (ORTE_SUCCESS != (
ret = orte_dps_unpack_buffer(buffer, dest, num_vals, DPS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(ret);
}
return ret;
}
/*
* PID_T
*/
int orte_dps_unpack_pid(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and unpack the real type */
if (ORTE_SUCCESS != (
ret = orte_dps_unpack_buffer(buffer, dest, num_vals, DPS_TYPE_PID_T))) {
ORTE_ERROR_LOG(ret);
}
return ret;
}
/* UNPACK FUNCTIONS FOR NON-GENERIC SYSTEM TYPES */
/*
* BYTE, CHAR, INT8
*/
int orte_dps_unpack_byte(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
OPAL_OUTPUT( ( orte_dps_verbose, "orte_dps_unpack_byte * %d\n", (int)*num_vals ) );
/* check to see if there's enough data in buffer */
if (orte_dps_too_small(buffer, *num_vals)) {
ORTE_ERROR_LOG(ORTE_UNPACK_READ_PAST_END_OF_BUFFER);
return ORTE_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* unpack the data */
memcpy(dest, buffer->unpack_ptr, *num_vals);
/* update buffer pointer */
buffer->unpack_ptr += *num_vals;
return ORTE_SUCCESS;
}
int orte_dps_unpack_int16(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
size_t i;
uint16_t tmp, *desttmp = (uint16_t*) dest;
OPAL_OUTPUT( ( orte_dps_verbose, "orte_dps_unpack_int16 * %d\n", (int)*num_vals ) );
/* check to see if there's enough data in buffer */
if (orte_dps_too_small(buffer, (*num_vals)*sizeof(tmp))) {
ORTE_ERROR_LOG(ORTE_UNPACK_READ_PAST_END_OF_BUFFER);
return ORTE_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* unpack the data */
for (i = 0; i < (*num_vals); ++i) {
memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
desttmp[i] = ntohs(tmp);
buffer->unpack_ptr += sizeof(tmp);
}
return ORTE_SUCCESS;
}
int orte_dps_unpack_int32(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
size_t i;
uint32_t tmp, *desttmp = (uint32_t*) dest;
OPAL_OUTPUT( ( orte_dps_verbose, "orte_dps_unpack_int32 * %d\n", (int)*num_vals ) );
/* check to see if there's enough data in buffer */
if (orte_dps_too_small(buffer, (*num_vals)*sizeof(tmp))) {
ORTE_ERROR_LOG(ORTE_UNPACK_READ_PAST_END_OF_BUFFER);
return ORTE_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* unpack the data */
for (i = 0; i < (*num_vals); ++i) {
memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
desttmp[i] = ntohl(tmp);
buffer->unpack_ptr += sizeof(tmp);
}
return ORTE_SUCCESS;
}
int orte_dps_unpack_int64(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
size_t i;
uint32_t tmp, *desttmp = (uint32_t*) dest;
OPAL_OUTPUT( ( orte_dps_verbose, "orte_dps_unpack_int64 * %d\n", (int)*num_vals ) );
/* check to see if there's enough data in buffer */
if (orte_dps_too_small(buffer, 2*(*num_vals)*sizeof(tmp))) {
ORTE_ERROR_LOG(ORTE_UNPACK_READ_PAST_END_OF_BUFFER);
return ORTE_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* unpack the data */
for (i = 0; i < (2 * (*num_vals)); i += 2) {
memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
desttmp[i] = ntohl(tmp);
buffer->unpack_ptr += sizeof(tmp);
memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
desttmp[i+1] = ntohl(tmp);
buffer->unpack_ptr += sizeof(tmp);
}
return ORTE_SUCCESS;
}
int orte_dps_unpack_string(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int ret;
size_t i, len, n=1;
char **sdest = (char**) dest;
for (i = 0; i < (*num_vals); ++i) {
if (ORTE_SUCCESS != (ret = orte_dps_unpack_sizet(buffer, &len, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
if (0 == len) { /* zero-length string - unpack the NULL */
sdest[i] = NULL;
} else {
sdest[i] = malloc(len);
if (NULL == sdest[i]) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (ret = orte_dps_unpack_byte(buffer, sdest[i], &len, ORTE_BYTE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
}
}
return ORTE_SUCCESS;
}
/* UNPACK FUNCTIONS FOR GENERIC ORTE TYPES */
/*
* ORTE_DATA_TYPE
*/
int orte_dps_unpack_data_type(orte_buffer_t *buffer, void *dest, size_t *num,
orte_data_type_t type)
{
size_t required;
int rc;
required = sizeof(orte_data_type_t);
switch (required) {
case 1:
if (ORTE_SUCCESS != (
rc = orte_dps_unpack_byte(buffer, dest, num, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
}
break;
case 2:
if (ORTE_SUCCESS != (
rc = orte_dps_unpack_int16(buffer, dest, num, ORTE_INT16))) {
ORTE_ERROR_LOG(rc);
}
break;
case 4:
if (ORTE_SUCCESS != (
rc = orte_dps_unpack_int32(buffer, dest, num, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
}
break;
case 8:
if (ORTE_SUCCESS != (
rc = orte_dps_unpack_int64(buffer, dest, num, ORTE_INT64))) {
ORTE_ERROR_LOG(rc);
}
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
return rc;
}
/*
* ORTE_BYTE_OBJECT
*/
int orte_dps_unpack_byte_object(orte_buffer_t *buffer, void *dest, size_t *num,
orte_data_type_t type)
{
int ret;
size_t i, n, m=1;
orte_byte_object_t *dbyteptr;
dbyteptr = (orte_byte_object_t*)dest;
n = *num;
for(i=0; i<n; i++) {
/* unpack object size in bytes */
if (ORTE_SUCCESS != (ret = orte_dps_unpack_sizet(buffer, &(dbyteptr->size), &m, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
if (0 < dbyteptr->size) {
dbyteptr->bytes = (uint8_t*)malloc(dbyteptr->size);
if (NULL == dbyteptr->bytes) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (ret = orte_dps_unpack_byte(buffer, dbyteptr->bytes,
&dbyteptr->size, ORTE_BYTE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
}
dbyteptr++;
}
return ORTE_SUCCESS;
}

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

@ -1,279 +0,0 @@
/*
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
*/
#include "orte_config.h"
#include "include/orte_types.h"
#include "mca/base/mca_base_param.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/ns.h"
#include "dps/dps_internal.h"
/* definitions
*/
#define ORTE_DPS_TABLE_PAGE_SIZE 10
/**
* globals
*/
bool orte_dps_initialized = false;
bool orte_dps_debug = false;
int orte_dps_verbose = -1; /* by default disabled */
int orte_dps_page_size;
orte_pointer_array_t *orte_dps_types;
OMPI_DECLSPEC orte_dps_t orte_dps = {
orte_dps_pack,
orte_dps_unpack,
orte_dps_peek,
orte_dps_unload,
orte_dps_load,
orte_dps_register,
orte_dps_lookup_data_type
};
/**
* Object constructors, destructors, and instantiations
*/
static void orte_buffer_construct (orte_buffer_t* buffer)
{
/* Make everything NULL to begin with */
buffer->base_ptr = buffer->pack_ptr = buffer->unpack_ptr = NULL;
buffer->bytes_allocated = buffer->bytes_used = buffer->bytes_avail = 0;
}
static void orte_buffer_destruct (orte_buffer_t* buffer)
{
if (NULL != buffer) {
if (NULL != buffer->base_ptr) {
free (buffer->base_ptr);
}
}
}
OBJ_CLASS_INSTANCE(orte_buffer_t,
opal_object_t,
orte_buffer_construct,
orte_buffer_destruct);
static void orte_dps_type_info_construct(orte_dps_type_info_t *obj)
{
obj->odti_name = NULL;
}
static void orte_dps_type_info_destruct(orte_dps_type_info_t *obj)
{
if (NULL != obj->odti_name) {
free(obj->odti_name);
}
}
OBJ_CLASS_INSTANCE(orte_dps_type_info_t, opal_object_t,
orte_dps_type_info_construct,
orte_dps_type_info_destruct);
int orte_dps_open(void)
{
char *enviro_val;
int id, page_size, rc;
orte_data_type_t tmp;
if (orte_dps_initialized) {
return ORTE_SUCCESS;
}
enviro_val = getenv("ORTE_dps_debug");
if (NULL != enviro_val) { /* debug requested */
orte_dps_debug = true;
} else {
orte_dps_debug = false;
}
/* setup the page size, convert to bytes */
id = mca_base_param_register_int("dps", "page", "size", NULL, ORTE_DPS_DEFAULT_PAGE_SIZE);
mca_base_param_lookup_int(id, &page_size);
orte_dps_page_size = 1024 * page_size;
/* Setup the value array */
if (ORTE_SUCCESS != (rc = orte_pointer_array_init(&orte_dps_types,
ORTE_DPS_ID_DYNAMIC,
ORTE_DPS_ID_MAX,
ORTE_DPS_TABLE_PAGE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* Register all the intrinsic types */
tmp = ORTE_NULL;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_null,
orte_dps_unpack_null,
"ORTE_NULL", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_BYTE;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_byte,
orte_dps_unpack_byte,
"ORTE_BYTE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_DATA_TYPE;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_data_type,
orte_dps_unpack_data_type,
"ORTE_DATA_TYPE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_BOOL;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_bool,
orte_dps_unpack_bool,
"ORTE_BOOL", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_INT;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_int,
orte_dps_unpack_int,
"ORTE_INT", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_UINT;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_int,
orte_dps_unpack_int,
"ORTE_UINT", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_INT8;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_byte,
orte_dps_unpack_byte,
"ORTE_INT8", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_UINT8;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_byte,
orte_dps_unpack_byte,
"ORTE_UINT8", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_INT16;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_int16,
orte_dps_unpack_int16,
"ORTE_INT16", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_UINT16;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_int16,
orte_dps_unpack_int16,
"ORTE_UINT16", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_INT32;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_int32,
orte_dps_unpack_int32,
"ORTE_INT32", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_UINT32;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_int32,
orte_dps_unpack_int32,
"ORTE_UINT32", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_INT64;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_int64,
orte_dps_unpack_int64,
"ORTE_INT64", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_UINT64;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_int64,
orte_dps_unpack_int64,
"ORTE_UINT64", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_SIZE;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_sizet,
orte_dps_unpack_sizet,
"ORTE_SIZE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_PID;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_pid,
orte_dps_unpack_pid,
"ORTE_PID", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_STRING;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_string,
orte_dps_unpack_string,
"ORTE_STRING", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_BYTE_OBJECT;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_dps_pack_byte_object,
orte_dps_unpack_byte_object,
"ORTE_BYTE_OBJECT", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* All done */
return ORTE_SUCCESS;
}
int orte_dps_close(void)
{
size_t i;
orte_dps_initialized = false;
for (i = 0 ; i < orte_pointer_array_get_size(orte_dps_types) ; ++i) {
orte_dps_type_info_t *info = orte_pointer_array_get_item(orte_dps_types, i);
if (NULL != info) {
OBJ_RELEASE(info);
}
}
OBJ_RELEASE(orte_dps_types);
return ORTE_SUCCESS;
}

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

@ -6,30 +6,39 @@
# 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,
# 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$
#
#
# Additional copyrights may follow
#
#
# $HEADER$
#
# This makefile.am does not stand on its own - it is included from orte/Makefile.am
headers += \
dps/dps.h \
dps/dps_types.h \
dps/dps_internal.h
dss/dss.h \
dss/dss_types.h \
dss/dss_internal.h
liborte_la_SOURCES += \
dps/dps_internal_functions.c \
dps/dps_load_unload.c \
dps/dps_lookup.c \
dps/dps_pack.c \
dps/dps_peek.c \
dps/dps_register.c \
dps/dps_unpack.c \
dps/orte_dps_open_close.c
noinst_LTLIBRARIES += dss/libdss.la
dss_libdss_la_SOURCES = \
dss/dss_internal_functions.c \
dss/dss_arith.c \
dss/dss_compare.c \
dss/dss_copy.c \
dss/dss_get.c \
dss/dss_load_unload.c \
dss/dss_lookup.c \
dss/dss_pack.c \
dss/dss_peek.c \
dss/dss_print.c \
dss/dss_register.c \
dss/dss_release.c \
dss/dss_set.c \
dss/dss_size.c \
dss/dss_unpack.c \
dss/dss_open_close.c

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

@ -6,14 +6,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/**
@ -22,15 +22,15 @@
* Data packing subsystem.
*/
#ifndef ORTE_DPS_H_
#define ORTE_DPS_H_
#ifndef ORTE_DSS_H_
#define ORTE_DSS_H_
#include "orte_config.h"
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "dps/dps_types.h"
#include "orte/dss/dss_types.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
@ -44,23 +44,23 @@ extern "C" {
* initialized via an OBJ_NEW or OBJ_CONSTRUCT call - otherwise, the
* pack_value function will return an error. Providing an unsupported
* type flag will likewise be reported as an error.
*
*
* Note that any data to be packed that is not hard type cast (i.e.,
* not type cast to a specific size) may lose precision when unpacked
* by a non-homogeneous recipient. The DPS will do its best to deal
* by a non-homogeneous recipient. The DSS will do its best to deal
* with heterogeneity issues between the packer and unpacker in such
* cases. Sending a number larger than can be handled by the recipient
* will return an error code (generated by the DPS upon unpacking) via
* the RML upon transmission - the DPS cannot detect such errors
* will return an error code (generated by the DSS upon unpacking) via
* the RML upon transmission - the DSS cannot detect such errors
* during packing.
*
*
* @param *buffer A pointer to the buffer into which the value is to
* be packed.
*
* @param *src A void* pointer to the data that is to be packed. Note
* that strings are to be passed as (char **) - i.e., the caller must
* pass the address of the pointer to the string as the void*. This
* allows the DPS to use a single interface function, but still allow
* allows the DSS to use a single interface function, but still allow
* the caller to pass multiple strings in a single call.
*
* @param num A size_t value indicating the number of values that are
@ -71,22 +71,22 @@ extern "C" {
* to need not be contiguous across array entries.
*
* @param type The type of the data to be packed - must be one of the
* DPS defined data types.
*
* DSS defined data types.
*
* @retval ORTE_SUCCESS The data was packed as requested.
*
* @retval ORTE_ERROR(s) An appropriate ORTE error code indicating the
* problem encountered. This error code should be handled
* appropriately.
*
*
* @code
* orte_buffer_t *buffer;
* int32_t src;
*
* status_code = orte_dps.pack(buffer, &src, 1, ORTE_INT32);
*
* status_code = orte_dss.pack(buffer, &src, 1, ORTE_INT32);
* @endcode
*/
typedef int (*orte_dps_pack_fn_t)(orte_buffer_t *buffer, void *src,
typedef int (*orte_dss_pack_fn_t)(orte_buffer_t *buffer, void *src,
size_t num_values,
orte_data_type_t type);
@ -104,38 +104,38 @@ typedef int (*orte_dps_pack_fn_t)(orte_buffer_t *buffer, void *src,
* type of the next item in the buffer. An attempt to read beyond the
* end of the stored data held in the buffer will also return an
* error.
*
*
* NOTE: it is possible for the buffer to be corrupted and that
* the DPS will *think* there is a proper variable type at the
* the DSS will *think* there is a proper variable type at the
* beginning of an unpack region - but that the value is bogus (e.g., just
* a byte field in a string array that so happens to have a value that
* matches the specified data type flag). Therefore, the data type error check
* is NOT completely safe. This is true for ALL unpack functions.
*
*
*
* Unpacking values is a "destructive" process - i.e., the values are
* removed from the buffer, thus reducing the buffer size. It is
* therefore not possible for the caller to re-unpack a value from the
* same buffer.
*
*
* Warning: The caller is responsible for providing adequate memory
* storage for the requested data. The orte_dps_peek() function is
* storage for the requested data. The orte_dss_peek() function is
* provided to assist in meeting this requirement. As noted below, the user
* must provide a parameter indicating the maximum number of values that
* can be unpacked into the allocated memory. If more values exist in the
* buffer than can fit into the memory storage, then the dps will unpack
* buffer than can fit into the memory storage, then the dss will unpack
* what it can fit into that location and return an error code indicating
* that the buffer was only partially unpacked.
*
*
* Note that any data that was not hard type cast (i.e., not type cast
* to a specific size) when packed may lose precision when unpacked by
* a non-homogeneous recipient. The DPS will do its best to deal with
* a non-homogeneous recipient. The DSS will do its best to deal with
* heterogeneity issues between the packer and unpacker in such
* cases. Sending a number larger than can be handled by the recipient
* will return an error code (generated by the DPS upon unpacking) via
* the RML upon transmission - the DPS cannot detect such errors
* will return an error code (generated by the DSS upon unpacking) via
* the RML upon transmission - the DSS cannot detect such errors
* during packing.
*
*
* @param *buffer A pointer to the buffer from which the value will be
* extracted.
*
@ -143,7 +143,7 @@ typedef int (*orte_dps_pack_fn_t)(orte_buffer_t *buffer, void *src,
* data is to be stored. Note that these values will be stored
* contiguously in memory. For strings, this pointer must be to (char
* **) to provide a means of supporting multiple string
* operations. The DPS unpack function will allocate memory for each
* operations. The DSS unpack function will allocate memory for each
* string in the array - the caller must only provide adequate memory
* for the array of pointers.
*
@ -152,46 +152,46 @@ typedef int (*orte_dps_pack_fn_t)(orte_buffer_t *buffer, void *src,
* pointed to by src. This is provided to help protect the caller from
* memory overrun. Note that a string
* value is counted as a single value regardless of length.
*
*
* @note The unpack function will return the actual number of values
* unpacked in this location.
*
*
* @param type The type of the data to be unpacked - must be one of
* the DPS defined data types.
*
* the DSS defined data types.
*
* @retval *max_num_values The number of values actually unpacked. In
* most cases, this should match the maximum number provided in the
* parameters - but in no case will it exceed the value of this
* parameter. Note that if you unpack fewer values than are actually
* available, the buffer will be in an unpackable state - the dps will
* available, the buffer will be in an unpackable state - the dss will
* return an error code to warn of this condition.
*
*
* @retval ORTE_SUCCESS The next item in the buffer was successfully
* unpacked.
*
*
* @retval ORTE_ERROR(s) The unpack function returns an error code
* under one of several conditions: (a) the number of values in the
* item exceeds the max num provided by the caller; (b) the type of
* the next item in the buffer does not match the type specified by
* the caller; or (c) the unpack failed due to either an error in the
* buffer or an attempt to read past the end of the buffer.
*
*
* @code
* orte_buffer_t *buffer;
* int32_t dest;
* char **string_array;
* size_t num_values;
*
*
* num_values = 1;
* status_code = orte_dps.unpack(buffer, (void*)&dest, &num_values, ORTE_INT32);
*
* status_code = orte_dss.unpack(buffer, (void*)&dest, &num_values, ORTE_INT32);
*
* num_values = 5;
* string_array = malloc(num_values*sizeof(char *));
* status_code = orte_dps.unpack(buffer, (void*)(string_array), &num_values, ORTE_STRING);
*
* status_code = orte_dss.unpack(buffer, (void*)(string_array), &num_values, ORTE_STRING);
*
* @endcode
*/
typedef int (*orte_dps_unpack_fn_t)(orte_buffer_t *buffer, void *dest,
typedef int (*orte_dss_unpack_fn_t)(orte_buffer_t *buffer, void *dest,
size_t *max_num_values,
orte_data_type_t type);
@ -202,7 +202,7 @@ typedef int (*orte_dps_unpack_fn_t)(orte_buffer_t *buffer, void *dest,
* both its type and the number of values in the item. This is a
* non-destructive function call that does not disturb the buffer, so
* it can be called multiple times if desired.
*
*
* @param buffer A pointer to the buffer in question.
*
* @param type A pointer to an orte_data_type_t variable where the
@ -212,14 +212,14 @@ typedef int (*orte_dps_unpack_fn_t)(orte_buffer_t *buffer, void *dest,
* @param number A pointer to a size_t variable where the number of
* data values in the next item is to be stored. Caller must have
* memory backing this location.
*
*
* @retval ORTE_SUCCESS Requested info was successfully returned.
* @retval ORTE_ERROR(s) An appropriate error code indicating the
* problem will be returned. This should be handled appropriately by
* the caller.
*
*
*/
typedef int (*orte_dps_peek_next_item_fn_t)(orte_buffer_t *buffer,
typedef int (*orte_dss_peek_next_item_fn_t)(orte_buffer_t *buffer,
orte_data_type_t *type,
size_t *number);
@ -230,12 +230,12 @@ typedef int (*orte_dps_peek_next_item_fn_t)(orte_buffer_t *buffer,
* payload within the buffer and the size of that payload. This allows
* the user to directly access the payload - typically used in the RML
* to unload the payload from the buffer for transmission.
*
*
* @note This is a destructive operation. While the payload is
* undisturbed, the function will clear the buffer's pointers to the
* payload. Thus, the buffer and the payload are completely separated,
* leaving the caller free to OBJ_RELEASE the buffer.
*
*
* @param buffer A pointer to the buffer whose payload is to be
* unloaded.
*
@ -243,7 +243,7 @@ typedef int (*orte_dps_peek_next_item_fn_t)(orte_buffer_t *buffer,
* with the address of the data payload in the buffer.
*
* @param size The size (in bytes) of the data payload in the buffer.
*
*
* @retval ORTE_SUCCESS The request was succesfully completed.
*
* @retval ORTE_ERROR(s) An appropriate error code indicating the
@ -254,12 +254,12 @@ typedef int (*orte_dps_peek_next_item_fn_t)(orte_buffer_t *buffer,
* orte_buffer_t *buffer;
* uint8_t *bytes;
* size_t size;
*
* status_code = orte_dps.unload(buffer, (void**)(&bytes), &size);
*
* status_code = orte_dss.unload(buffer, (void**)(&bytes), &size);
* OBJ_RELEASE(buffer);
* @endcode
*/
typedef int (*orte_dps_unload_fn_t)(orte_buffer_t *buffer,
typedef int (*orte_dss_unload_fn_t)(orte_buffer_t *buffer,
void **payload,
size_t *size);
@ -271,15 +271,15 @@ typedef int (*orte_dps_unload_fn_t)(orte_buffer_t *buffer,
* in the buffer, the function will "free" the existing data to
* release it, and then replace the data payload with the one provided
* by the caller.
*
*
* @note The buffer must be allocated in advance via the OBJ_NEW
* function call - failing to do so will cause the load function to
* return an error code.
*
*
* @note The caller is responsible for pre-packing the provided
* payload - the load function cannot convert to network byte order
* any data contained in the provided payload.
*
*
* @param buffer A pointer to the buffer into which lthe payload is to
* be loaded.
*
@ -287,7 +287,7 @@ typedef int (*orte_dps_unload_fn_t)(orte_buffer_t *buffer,
* buffer.
*
* @param size The size (in bytes) of the provided payload.
*
*
* @retval ORTE_SUCCESS The request was successfully completed
*
* @retval ORTE_ERROR(s) An appropriate error code indicating the
@ -298,95 +298,281 @@ typedef int (*orte_dps_unload_fn_t)(orte_buffer_t *buffer,
* orte_buffer_t *buffer;
* uint8_t bytes;
* size_t size;
*
*
* buffer = OBJ_NEW(orte_buffer_t);
* status_code = orte_dps.load(buffer, (void*)(&bytes), size);
* status_code = orte_dss.load(buffer, (void*)(&bytes), size);
* @endcode
*/
typedef int (*orte_dps_load_fn_t)(orte_buffer_t *buffer,
typedef int (*orte_dss_load_fn_t)(orte_buffer_t *buffer,
void *payload,
size_t size);
/**
* DPS initialization function.
* DSS initialization function.
*
* In dynamic libraries, declared objects and functions don't get
* loaded until called. We need to ensure that the orte_dps function
* loaded until called. We need to ensure that the orte_dss function
* structure gets loaded, so we provide an "open" call that is
* executed as part of the program startup.
*/
OMPI_DECLSPEC int orte_dps_open(void);
OMPI_DECLSPEC int orte_dss_open(void);
/**
* Register a pack/unpack function pair.
*
* @param pack_fn [IN] Function pointer to the pack routine
* @param unpack_fn [IN] Function pointer to the unpack routine
* @param name [IN] String name for this pair (mainly for debugging)
* @param type [OUT] Type number for this registration
*
* @returns ORTE_SUCCESS upon success
* DSS finalize function
*/
OMPI_DECLSPEC int orte_dss_close(void);
/**
* DPS finalize function
* Copy a data value from one location to another.
*
* Since registered data types can be complex structures, the system
* needs some way to know how to copy the data from one location to
* another (e.g., for storage in the registry). This function, which
* can call other copy functions to build up complex data types, defines
* the method for making a copy of the specified data type.
*
* @param **dest The address of a pointer into which the
* address of the resulting data is to be stored.
*
* @param *src A pointer to the memory location from which the
* data is to be copied.
*
* @param type The type of the data to be copied - must be one of
* the DSS defined data types.
*
* @retval ORTE_SUCCESS The value was successfully copied.
*
* @retval ORTE_ERROR(s) An appropriate error code.
*
*/
OMPI_DECLSPEC int orte_dps_close(void);
typedef int (*orte_dss_copy_fn_t)(void **dest, void *src, orte_data_type_t type);
/**
* Compare two data values.
*
* Since registered data types can be complex structures, the system
* needs some way to know how to compare two data values (e.g., when
* trying to order them in some fashion). This function, which
* can call other compare functions to build up complex data types, defines
* the method for comparing two values of the specified data type.
*
* @retval -1 Indicates first value is greater than second value
* @retval 0 Indicates two values are equal
* @retval +1 Indicates second value is greater than first value
*/
typedef int (*orte_dss_compare_fn_t)(void *value1, void *value2,
orte_data_type_t type);
/**
* Register a pack/unpack function pair.
* Compute size of data value.
*
* @param pack_fn [IN] Function pointer to the pack routine
* @param unpack_fn [IN] Function pointer to the unpack routine
* @param name [IN] String name for this pair (mainly for debugging)
* @param type [OUT] Type number for this registration
* Since registered data types can be complex structures, the system
* needs some way to compute its size. Some of these types, however, involve
* variable amounts of storage (e.g., a string!). Hence, a pointer to the
* actual object being "sized" needs to be passed as well.
*
* @returns ORTE_SUCCESS upon success
* @param size Address of a size_t value where the size of the data value
* (in bytes) will be stored - set to zero in event of error.
*
* This function registers a pack/unpack function pair for a specific
* @param *src A pointer to the memory location of the data object. It is okay
* for this to be NULL - if NULL, the function must return the size of the object
* itself, not including any data contained in its fields.
*
* @param type The type of the data value - must be one of
* the DSS defined data types or an error will be returned.
*
* @retval ORTE_SUCCESS The value was successfully copied.
*
* @retval ORTE_ERROR(s) An appropriate error code.
*/
typedef int (*orte_dss_size_fn_t)(size_t *size, void *src, orte_data_type_t type);
/**
* Print a data value.
*
* Since registered data types can be complex structures, the system
* needs some way to know how to print them (i.e., convert them to a string
* representation).
*
* @retval ORTE_SUCCESS The value was successfully printed.
*
* @retval ORTE_ERROR(s) An appropriate error code.
*/
typedef int (*orte_dss_print_fn_t)(char **output, char *prefix, void *src, orte_data_type_t type);
/**
* Set a data value
*
* Since the data values are stored in an opaque manner, the system needs
* a function by which it can set the data value to a specific value. This
* is the equivalent to a C++ access function.
*
* NOTE: this function does NOT allocate any memory. It only sets the value pointer
* and type to the specified location and type. Use "copy" if you want dynamic allocation
* of storage.
*
* @retval ORTE_SUCCESS The value was successfully stored
*
* @retval ORTE_ERROR(s) An appropriate error code.
*/
typedef int (*orte_dss_set_fn_t)(orte_data_value_t *value, void *new_value, orte_data_type_t type);
/**
* Get a data value
*
* Since the data values are stored in an opaque manner, the system needs
* a function by which it can get the data value from within the data_value object. This
* is the equivalent to a C++ access function.
*
* NOTE: this function does NOT allocate any memory. It simply points the "data" location
* to that of the value, after ensuring that the value's type matches the specified one.
* Use "copy" if you want dynamic allocation of memory.
*
* @retval ORTE_SUCCESS The value was successfully retrieved
*
* @retval ORTE_ERROR(s) An appropriate error code - usually caused by the specified type
* not matching the data type within the stored object.
*/
typedef int (*orte_dss_get_fn_t)(void **data, orte_data_value_t *value, orte_data_type_t type);
/**
* Perform an arithemetic operation on a data value
*
* Since the data values are stored in an opaque manner, the system needs
* a function by which it can manipulate the data value within the data_value object. This
* is the equivalent to a C++ access function.
*
* @retval ORTE_SUCCESS The value was successfully retrieved
*
* @retval ORTE_ERROR(s) An appropriate error code - usually caused by the specified type
* not matching the data type within the stored object.
*/
typedef int (*orte_dss_arith_fn_t)(orte_data_value_t *value, void *operand, orte_dss_arith_op_t operation, orte_data_type_t type);
/**
* Increment a data value
*
* Since the data values are stored in an opaque manner, the system needs
* a function by which it can manipulate the data value within the data_value object. This
* is the equivalent to a C++ access function.
*
* @retval ORTE_SUCCESS The value was successfully retrieved
*
* @retval ORTE_ERROR(s) An appropriate error code.
*/
typedef int (*orte_dss_increment_fn_t)(orte_data_value_t *value);
/**
* Decrement a data value
*
* Since the data values are stored in an opaque manner, the system needs
* a function by which it can manipulate the data value within the data_value object. This
* is the equivalent to a C++ access function.
*
* @retval ORTE_SUCCESS The value was successfully retrieved
*
* @retval ORTE_ERROR(s) An appropriate error code.
*/
typedef int (*orte_dss_decrement_fn_t)(orte_data_value_t *value);
/**
* Release the storage used by a data value
*
* Since the data values are stored in an opaque manner, the system needs
* a function by which it can release the storage associated with a value
* stored in a data value object.
*/
typedef void (*orte_dss_release_fn_t)(orte_data_value_t *value);
/**
* Register a set of data handling functions.
*
* * This function registers a set of data type functions for a specific
* type. An integer is returned that should be used a an argument to
* future invocations of orte_dps.pack() and orte_dps.unpack(), which
* will trigger calls to pack_fn and unpack_fn (as appropriate). This
* is most useful when extending the datatypes that the DPS can
* handle; pack and unpack functions can nest calls to orte_dps.pack()
* / orte_dps.unpack(), so defining small pack/unpack functions can be
* future invocations of orte_dss.pack(), orte_dss.unpack(), orte_dss.copy(),
* and orte_dss.compare, which
* will trigger calls to the appropriate functions. This
* is most useful when extending the datatypes that the dss can
* handle; pack and unpack functions can nest calls to orte_dss.pack()
* / orte_dss.unpack(), so defining small pack/unpack functions can be
* used recursively to build larger types (e.g., packing/unpacking
* structs can use calls to orte_dps.pack()/unpack() to serialize /
* deserialize individual members).
* structs can use calls to orte_dss.pack()/unpack() to serialize /
* deserialize individual members). This is likewise true for the copy
* and compare functions.
*
* @param release_fn [IN] Function pointer to the release routine
* @param pack_fn [IN] Function pointer to the pack routine
* @param unpack_fn [IN] Function pointer to the unpack routine
* @param copy_fn [IN] Function pointer to copy routine
* @param compare_fn [IN] Function pointer to compare routine
* @param size_fn [IN] Function pointer to size routine
* @param print_fn [IN] Function pointer to print routine
* @param structured [IN] Boolean indicator as to whether or not the data is structured. A true
* value indicates that this data type is always passed via reference (i.e., a pointer to the
* object is passed) as opposed to directly (e.g., the way an int32_t would appear)
* @param name [IN] String name for this pair (mainly for debugging)
* @param type [OUT] Type number for this registration
*
* @returns ORTE_SUCCESS upon success
*
*/
typedef int (*orte_dps_register_fn_t)(orte_dps_pack_fn_t pack_fn,
orte_dps_unpack_fn_t unpack_fn,
typedef int (*orte_dss_register_fn_t)(orte_dss_pack_fn_t pack_fn,
orte_dss_unpack_fn_t unpack_fn,
orte_dss_copy_fn_t copy_fn,
orte_dss_compare_fn_t compare_fn,
orte_dss_size_fn_t size_fn,
orte_dss_print_fn_t print_fn,
orte_dss_release_fn_t release_fn,
bool structured,
const char *name, orte_data_type_t *type);
/*
* This function looks up the string name corresponding to the identified
* data type - used for debugging messages.
*/
typedef char* (*orte_dps_lookup_data_type_fn_t)(orte_data_type_t type);
typedef char* (*orte_dss_lookup_data_type_fn_t)(orte_data_type_t type);
/*
* Dump the data type list - used for debugging to see what has been registered
*/
typedef void (*orte_dss_dump_data_types_fn_t)(int output);
/**
* Base structure for the DPS
* Base structure for the DSS
*
* Base module structure for the DPS - presents the required function
* pointers to the calling interface.
* Base module structure for the DSS - presents the required function
* pointers to the calling interface.
*/
struct orte_dps_t {
orte_dps_pack_fn_t pack;
orte_dps_unpack_fn_t unpack;
orte_dps_peek_next_item_fn_t peek;
orte_dps_unload_fn_t unload;
orte_dps_load_fn_t load;
orte_dps_register_fn_t register_type;
orte_dps_lookup_data_type_fn_t lookup_data_type;
struct orte_dss_t {
orte_dss_set_fn_t set;
orte_dss_get_fn_t get;
orte_dss_arith_fn_t arith;
orte_dss_increment_fn_t increment;
orte_dss_decrement_fn_t decrement;
orte_dss_pack_fn_t pack;
orte_dss_unpack_fn_t unpack;
orte_dss_copy_fn_t copy;
orte_dss_compare_fn_t compare;
orte_dss_size_fn_t size;
orte_dss_print_fn_t print;
orte_dss_release_fn_t release;
orte_dss_peek_next_item_fn_t peek;
orte_dss_unload_fn_t unload;
orte_dss_load_fn_t load;
orte_dss_register_fn_t register_type;
orte_dss_lookup_data_type_fn_t lookup_data_type;
orte_dss_dump_data_types_fn_t dump_data_types;
};
typedef struct orte_dps_t orte_dps_t;
typedef struct orte_dss_t orte_dss_t;
OMPI_DECLSPEC extern orte_dps_t orte_dps; /* holds dps function pointers */
OMPI_DECLSPEC extern orte_dss_t orte_dss; /* holds dss function pointers */
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTE_DPS_H */
#endif /* ORTE_DSS_H */

748
orte/dss/dss_arith.c Исполняемый файл
Просмотреть файл

@ -0,0 +1,748 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss_internal.h"
#include "opal/util/output.h"
static void orte_dss_arith_int(int *value, int *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_uint(uint *value, uint *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_size(size_t *value, size_t *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_pid(pid_t *value, pid_t *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_byte(uint8_t *value, uint8_t *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_int8(int8_t *value, int8_t *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_int16(int16_t *value, int16_t *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_uint16(uint16_t *value, uint16_t *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_int32(int32_t *value, int32_t *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_uint32(uint32_t *value, uint32_t *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_int64(int64_t *value, int64_t *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_uint64(uint64_t *value, uint64_t *operand, orte_dss_arith_op_t operation);
/* some weird ones - but somebody *might* want to do it, I suppose... */
static void orte_dss_arith_data_type(orte_data_type_t *value, orte_data_type_t *operand, orte_dss_arith_op_t operation);
static void orte_dss_arith_daemon_cmd(orte_daemon_cmd_flag_t *value, orte_daemon_cmd_flag_t *operand, orte_dss_arith_op_t operation);
int orte_dss_arith(orte_data_value_t *value, void *operand, orte_dss_arith_op_t operation, orte_data_type_t type)
{
/* check for error */
if (NULL == value || NULL == operand) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
if (type != value->type) {
ORTE_ERROR_LOG(ORTE_ERR_TYPE_MISMATCH);
return ORTE_ERR_TYPE_MISMATCH;
}
/* Lookup the arith function for this type and call it */
switch(type) {
case ORTE_INT:
orte_dss_arith_int(value->data, operand, operation);
break;
case ORTE_UINT:
orte_dss_arith_uint(value->data, operand, operation);
break;
case ORTE_SIZE:
orte_dss_arith_size(value->data, operand, operation);
break;
case ORTE_PID:
orte_dss_arith_pid(value->data, operand, operation);
break;
case ORTE_BYTE:
case ORTE_UINT8:
orte_dss_arith_byte(value->data, operand, operation);
break;
case ORTE_INT8:
orte_dss_arith_int8(value->data, operand, operation);
break;
case ORTE_INT16:
orte_dss_arith_int16(value->data, operand, operation);
break;
case ORTE_UINT16:
orte_dss_arith_uint16(value->data, operand, operation);
break;
case ORTE_INT32:
orte_dss_arith_int32(value->data, operand, operation);
break;
case ORTE_UINT32:
orte_dss_arith_uint32(value->data, operand, operation);
break;
case ORTE_INT64:
orte_dss_arith_int64(value->data, operand, operation);
break;
case ORTE_UINT64:
orte_dss_arith_uint64(value->data, operand, operation);
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return ORTE_ERR_OPERATION_UNSUPPORTED;
}
return ORTE_SUCCESS;
}
int orte_dss_increment(orte_data_value_t *value)
{
int one;
unsigned int uone;
size_t sone;
pid_t pone;
uint8_t u8one;
int8_t i8one;
uint16_t u16one;
int16_t i16one;
uint32_t u32one;
int32_t i32one;
uint64_t u64one;
int64_t i64one;
orte_daemon_cmd_flag_t daemoncmdone;
orte_data_type_t datatypeone;
/* check for error */
if (NULL == value) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* Lookup the arith function for this type and call it */
switch(value->type) {
case ORTE_INT:
one = 1;
orte_dss_arith_int(value->data, &one, ORTE_DSS_ADD);
break;
case ORTE_UINT:
uone = 1;
orte_dss_arith_uint(value->data, &uone, ORTE_DSS_ADD);
break;
case ORTE_SIZE:
sone = 1;
orte_dss_arith_size(value->data, &sone, ORTE_DSS_ADD);
break;
case ORTE_PID:
pone = 1;
orte_dss_arith_pid(value->data, &pone, ORTE_DSS_ADD);
break;
case ORTE_BYTE:
case ORTE_UINT8:
u8one = 1;
orte_dss_arith_byte(value->data, &u8one, ORTE_DSS_ADD);
break;
case ORTE_INT8:
i8one = 1;
orte_dss_arith_int8(value->data, &i8one, ORTE_DSS_ADD);
break;
case ORTE_INT16:
i16one = 1;
orte_dss_arith_int16(value->data, &i16one, ORTE_DSS_ADD);
break;
case ORTE_UINT16:
u16one = 1;
orte_dss_arith_uint16(value->data, &u16one, ORTE_DSS_ADD);
break;
case ORTE_INT32:
i32one = 1;
orte_dss_arith_int32(value->data, &i32one, ORTE_DSS_ADD);
break;
case ORTE_UINT32:
u32one = 1;
orte_dss_arith_uint32(value->data, &u32one, ORTE_DSS_ADD);
break;
case ORTE_INT64:
i64one = 1;
orte_dss_arith_int64(value->data, &i64one, ORTE_DSS_ADD);
break;
case ORTE_UINT64:
u64one = 1;
orte_dss_arith_uint64(value->data, &u64one, ORTE_DSS_ADD);
break;
case ORTE_DAEMON_CMD:
daemoncmdone = 1;
orte_dss_arith_daemon_cmd(value->data, &daemoncmdone, ORTE_DSS_ADD);
break;
case ORTE_DATA_TYPE:
datatypeone = 1;
orte_dss_arith_data_type(value->data, &datatypeone, ORTE_DSS_ADD);
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return ORTE_ERR_OPERATION_UNSUPPORTED;
}
return ORTE_SUCCESS;
}
int orte_dss_decrement(orte_data_value_t *value)
{
int one;
unsigned int uone;
size_t sone;
pid_t pone;
uint8_t u8one;
int8_t i8one;
uint16_t u16one;
int16_t i16one;
uint32_t u32one;
int32_t i32one;
uint64_t u64one;
int64_t i64one;
orte_daemon_cmd_flag_t daemoncmdone;
orte_data_type_t datatypeone;
/* check for error */
if (NULL == value) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* Lookup the arith function for this type and call it */
switch(value->type) {
case ORTE_INT:
one = 1;
orte_dss_arith_int(value->data, &one, ORTE_DSS_SUB);
break;
case ORTE_UINT:
uone = 1;
orte_dss_arith_uint(value->data, &uone, ORTE_DSS_SUB);
break;
case ORTE_SIZE:
sone = 1;
orte_dss_arith_size(value->data, &sone, ORTE_DSS_SUB);
break;
case ORTE_PID:
pone = 1;
orte_dss_arith_pid(value->data, &pone, ORTE_DSS_SUB);
break;
case ORTE_BYTE:
case ORTE_UINT8:
u8one = 1;
orte_dss_arith_byte(value->data, &u8one, ORTE_DSS_SUB);
break;
case ORTE_INT8:
i8one = 1;
orte_dss_arith_int8(value->data, &i8one, ORTE_DSS_SUB);
break;
case ORTE_INT16:
i16one = 1;
orte_dss_arith_int16(value->data, &i16one, ORTE_DSS_SUB);
break;
case ORTE_UINT16:
u16one = 1;
orte_dss_arith_uint16(value->data, &u16one, ORTE_DSS_SUB);
break;
case ORTE_INT32:
i32one = 1;
orte_dss_arith_int32(value->data, &i32one, ORTE_DSS_SUB);
break;
case ORTE_UINT32:
u32one = 1;
orte_dss_arith_uint32(value->data, &u32one, ORTE_DSS_SUB);
break;
case ORTE_INT64:
i64one = 1;
orte_dss_arith_int64(value->data, &i64one, ORTE_DSS_SUB);
break;
case ORTE_UINT64:
u64one = 1;
orte_dss_arith_uint64(value->data, &u64one, ORTE_DSS_SUB);
break;
case ORTE_DAEMON_CMD:
daemoncmdone = 1;
orte_dss_arith_daemon_cmd(value->data, &daemoncmdone, ORTE_DSS_SUB);
break;
case ORTE_DATA_TYPE:
datatypeone = 1;
orte_dss_arith_data_type(value->data, &datatypeone, ORTE_DSS_SUB);
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return ORTE_ERR_OPERATION_UNSUPPORTED;
}
return ORTE_SUCCESS;
}
/*
* NUMERIC arith FUNCTIONS
*/
static void orte_dss_arith_int(int *value, int *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_uint(uint *value, uint *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_size(size_t *value, size_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_pid(pid_t *value, pid_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_byte(uint8_t *value, uint8_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_int8(int8_t *value, int8_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_int16(int16_t *value, int16_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_uint16(uint16_t *value, uint16_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_int32(int32_t *value, int32_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_uint32(uint32_t *value, uint32_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_int64(int64_t *value, int64_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_uint64(uint64_t *value, uint64_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_data_type(orte_data_type_t *value, orte_data_type_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}
static void orte_dss_arith_daemon_cmd(orte_daemon_cmd_flag_t *value, orte_daemon_cmd_flag_t *operand, orte_dss_arith_op_t operation)
{
switch(operation) {
case ORTE_DSS_ADD:
(*value) += *operand;
return;
case ORTE_DSS_SUB:
(*value) -= *operand;
return;
case ORTE_DSS_MUL:
(*value) *= *operand;
return;
case ORTE_DSS_DIV:
if (0 == *operand) {
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
(*value) /= *operand;
return;
default:
ORTE_ERROR_LOG(ORTE_ERR_OPERATION_UNSUPPORTED);
return;
}
return;
}

276
orte/dss/dss_compare.c Исполняемый файл
Просмотреть файл

@ -0,0 +1,276 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#include <stdlib.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss_internal.h"
#include "opal/util/output.h"
int orte_dss_compare(void *value1, void *value2, orte_data_type_t type)
{
orte_dss_type_info_t *info;
/* check for error */
if (NULL == value1 || NULL == value2) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* Lookup the compare function for this type and call it */
if (!(type < orte_dss_types->size) ||
(NULL == (info = orte_pointer_array_get_item(orte_dss_types, type)))) {
ORTE_ERROR_LOG(ORTE_ERR_UNKNOWN_DATA_TYPE);
return ORTE_ERR_UNKNOWN_DATA_TYPE;
}
return info->odti_compare_fn(value1, value2, type);
}
/*
* NUMERIC COMPARE FUNCTIONS
*/
int orte_dss_compare_int(int *value1, int *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_uint(uint *value1, uint *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_size(size_t *value1, size_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_pid(pid_t *value1, pid_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_byte(char *value1, char *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_char(char *value1, char *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_int8(int8_t *value1, int8_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_uint8(uint8_t *value1, uint8_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_int16(int16_t *value1, int16_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_uint16(uint16_t *value1, uint16_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_int32(int32_t *value1, int32_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_uint32(uint32_t *value1, uint32_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_int64(int64_t *value1, int64_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_dss_compare_uint64(uint64_t *value1, uint64_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
/*
* NON-NUMERIC SYSTEM TYPES
*/
/* NULL */
int orte_dss_compare_null(char *value1, char *value2, orte_data_type_t type)
{
return ORTE_EQUAL;
}
/* BOOL */
int orte_dss_compare_bool(bool *value1, bool *value2, orte_data_type_t type)
{
if (*value1 && !(*value2)) return ORTE_VALUE1_GREATER;
if (*value2 && !(*value1)) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
/* STRING */
int orte_dss_compare_string(char *value1, char *value2, orte_data_type_t type)
{
if (0 < strcmp(value1, value2)) return ORTE_VALUE2_GREATER;
if (0 > strcmp(value1, value2)) return ORTE_VALUE1_GREATER;
return ORTE_EQUAL;
}
/* COMPARE FUNCTIONS FOR GENERIC ORTE TYPES */
/* ORTE_DATA_TYPE */
int orte_dss_compare_dt(orte_data_type_t *value1, orte_data_type_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
/* ORTE_DAEMON_CMD */
int orte_dss_compare_daemon_cmd(orte_daemon_cmd_flag_t *value1, orte_daemon_cmd_flag_t *value2, orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
/* ORTE_DATA_VALUE */
int orte_dss_compare_data_value(orte_data_value_t *value1, orte_data_value_t *value2, orte_data_type_t type)
{
/* can't compare if the two types don't match */
if (value1->type != value2->type) {
ORTE_ERROR_LOG(ORTE_ERR_TYPE_MISMATCH);
return ORTE_ERR_TYPE_MISMATCH;
}
/* okay, go ahead and compare the values themselves */
return orte_dss.compare(value1->data, value2->data, value1->type);
}
/* ORTE_BYTE_OBJECT */
int orte_dss_compare_byte_object(orte_byte_object_t *value1, orte_byte_object_t *value2, orte_data_type_t type)
{
int checksum, diff;
size_t i;
/* compare the sizes first - bigger size object is "greater than" */
if (value1->size > value2->size) return ORTE_VALUE1_GREATER;
if (value2->size > value1->size) return ORTE_VALUE2_GREATER;
/* get here if the two sizes are identical - now do a simple checksum-style
* calculation to determine "biggest"
*/
checksum = 0;
for (i=0; i < value1->size; i++) {
/* protect against overflows */
diff = value1->bytes[i] - value2->bytes[i];
if (INT_MAX-abs(checksum)-abs(diff) < 0) { /* got an overflow condition */
checksum = 0;
}
checksum += diff;
}
if (0 > checksum) return ORTE_VALUE2_GREATER; /* sum of value2 bytes was greater */
if (0 < checksum) return ORTE_VALUE1_GREATER; /* of value1 bytes was greater */
return ORTE_EQUAL; /* sum of both value's bytes was identical */
}

226
orte/dss/dss_copy.c Исполняемый файл
Просмотреть файл

@ -0,0 +1,226 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss_internal.h"
#include "opal/util/output.h"
int orte_dss_copy(void **dest, void *src, orte_data_type_t type)
{
int rc;
orte_dss_type_info_t *info;
/* check for error */
if (NULL == dest) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
if (NULL == src && (ORTE_NULL != type && ORTE_STRING != type)) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* Lookup the copy function for this type and call it */
if (!(type < orte_dss_types->size) ||
(NULL == (info = orte_pointer_array_get_item(orte_dss_types, type)))) {
ORTE_ERROR_LOG(ORTE_ERR_UNKNOWN_DATA_TYPE);
return ORTE_ERR_UNKNOWN_DATA_TYPE;
}
if (ORTE_SUCCESS != (rc = info->odti_copy_fn(dest, src, type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
/*
* STANDARD COPY FUNCTION - WORKS FOR EVERYTHING NON-STRUCTURED
*/
int orte_dss_std_copy(void **dest, void *src, orte_data_type_t type)
{
size_t datasize;
uint8_t *val;
switch(type) {
case ORTE_BOOL:
datasize = sizeof(bool);
break;
case ORTE_INT:
case ORTE_UINT:
datasize = sizeof(int);
break;
case ORTE_SIZE:
datasize = sizeof(size_t);
break;
case ORTE_PID:
datasize = sizeof(pid_t);
break;
case ORTE_BYTE:
case ORTE_INT8:
case ORTE_UINT8:
datasize = 1;
break;
case ORTE_INT16:
case ORTE_UINT16:
datasize = 2;
break;
case ORTE_INT32:
case ORTE_UINT32:
datasize = 4;
break;
case ORTE_INT64:
case ORTE_UINT64:
datasize = 8;
break;
case ORTE_DATA_TYPE:
datasize = sizeof(orte_data_type_t);
break;
case ORTE_DAEMON_CMD:
datasize = sizeof(orte_daemon_cmd_flag_t);
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_UNKNOWN_DATA_TYPE);
return ORTE_ERR_UNKNOWN_DATA_TYPE;
}
val = (uint8_t*)malloc(datasize);
if (NULL == val) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
memcpy(val, src, datasize);
*dest = val;
return ORTE_SUCCESS;
}
/* COPY FUNCTIONS FOR NON-STANDARD SYSTEM TYPES */
/*
* NULL
*/
int orte_dss_copy_null(char **dest, char *src, orte_data_type_t type)
{
char *val;
*dest = (char*)malloc(sizeof(char*));
if (NULL == *dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
val = *dest; /* save the address of the value */
/* set the dest to null */
*val = 0x00;
return ORTE_SUCCESS;
}
/*
* STRING
*/
int orte_dss_copy_string(char **dest, char *src, orte_data_type_t type)
{
if (NULL == src) { /* got zero-length string/NULL pointer - store NULL */
*dest = NULL;
} else {
*dest = strdup(src);
}
return ORTE_SUCCESS;
}
/* COPY FUNCTIONS FOR GENERIC ORTE TYPES */
/*
* ORTE_DATA_VALUE
*/
int orte_dss_copy_data_value(orte_data_value_t **dest, orte_data_value_t *src,
orte_data_type_t type)
{
int rc;
/* create the new object */
*dest = OBJ_NEW(orte_data_value_t);
if (NULL == *dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
(*dest)->type = src->type;
/* copy the payload with its associated copy function */
if (ORTE_SUCCESS != (rc = orte_dss.copy(&((*dest)->data), src->data, src->type))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(*dest);
return rc;
}
return ORTE_SUCCESS;
}
/*
* ORTE_BYTE_OBJECT
*/
int orte_dss_copy_byte_object(orte_byte_object_t **dest, orte_byte_object_t *src,
orte_data_type_t type)
{
/* allocate space for the new object */
*dest = (orte_byte_object_t*)malloc(sizeof(orte_byte_object_t));
if (NULL == *dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
(*dest)->size = src->size;
/* allocate the required space for the bytes */
(*dest)->bytes = (uint8_t*)malloc(src->size);
if (NULL == (*dest)->bytes) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_RELEASE(*dest);
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* copy the data across */
memcpy((*dest)->bytes, src->bytes, src->size);
return ORTE_SUCCESS;
}

48
orte/dss/dss_dump.c Исполняемый файл
Просмотреть файл

@ -0,0 +1,48 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/include/orte_types.h"
#include "opal/util/output.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss.h"
#include "orte/dss/dss_internal.h"
void orte_dss_dump_data_types(int output)
{
orte_dss_type_info_t **ptr;
orte_data_type_t j;
size_t i;
opal_output(output, "DUMP OF REGISTERED DATA TYPES");
ptr = (orte_dss_type_info_t**)(orte_dss_types->addr);
for (i=0, j=0; j < orte_dss_num_reg_types &&
i < orte_dss_types->size; i++) {
if (NULL != ptr[i]) {
j++;
/* print out the info */
opal_output(output, "\tIndex: %lu\tData type: %lu\tName: %s",
(unsigned long)j,
(unsigned long)ptr[i]->odti_type,
ptr[i]->odti_name);
}
}
}

53
orte/dss/dss_get.c Исполняемый файл
Просмотреть файл

@ -0,0 +1,53 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss_internal.h"
#include "opal/util/output.h"
int orte_dss_get(void **data, orte_data_value_t *value, orte_data_type_t type)
{
/* check for error */
if (NULL == value || NULL == data) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* okay, we assume that the user has provided memory for the destination.
* check to ensure the data types match.
* this is absolutely critical as "get" will NOT allocate space
* but will assume that *data contains a valid address for the
* type of data being requested
*/
if (type != value->type) {
ORTE_ERROR_LOG(ORTE_ERR_TYPE_MISMATCH);
return ORTE_ERR_TYPE_MISMATCH;
}
/* point the destination at the value */
*data = value->data;
return ORTE_SUCCESS;
}

358
orte/dss/dss_internal.h Обычный файл
Просмотреть файл

@ -0,0 +1,358 @@
/* -*- C -*-
*
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef ORTE_DSS_INTERNAL_H_
#define ORTE_DSS_INTERNAL_H_
#include "orte_config.h"
#include "include/orte_constants.h"
#include "class/orte_pointer_array.h"
#include "dss/dss.h"
#if HAVE_STRING_H
# if !defined(STDC_HEADERS) && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* DEFINE THE DEFAULT PAGE SIZE FOR THE DSS BUFFERS - IN KILOBYTES
*/
#define ORTE_DSS_DEFAULT_PAGE_SIZE 1
/**
* Internal struct used for holding registered dss functions
*/
struct orte_dss_type_info_t {
opal_object_t super;
/* type identifier */
orte_data_type_t odti_type;
/** Debugging string name */
char *odti_name;
/** Pack function */
orte_dss_pack_fn_t odti_pack_fn;
/** Unpack function */
orte_dss_unpack_fn_t odti_unpack_fn;
/** copy function */
orte_dss_copy_fn_t odti_copy_fn;
/** compare function */
orte_dss_compare_fn_t odti_compare_fn;
/** size function */
orte_dss_size_fn_t odti_size_fn;
/** print function */
orte_dss_print_fn_t odti_print_fn;
/** Release function */
orte_dss_release_fn_t odti_release_fn;
/** flag to indicate structured data */
bool odti_structured;
};
/**
* Convenience typedef
*/
typedef struct orte_dss_type_info_t orte_dss_type_info_t;
OBJ_CLASS_DECLARATION(orte_dss_type_info_t);
/*
* globals needed within dss
*/
extern bool orte_dss_initialized;
extern bool orte_dss_debug;
extern int orte_dss_verbose;
extern int orte_dss_page_size;
extern orte_pointer_array_t *orte_dss_types;
extern orte_data_type_t orte_dss_num_reg_types;
/*
* Implementations of API functions
*/
int orte_dss_set(orte_data_value_t *value, void *new_value, orte_data_type_t type);
int orte_dss_get(void **data, orte_data_value_t *value, orte_data_type_t type);
int orte_dss_arith(orte_data_value_t *value, void *operand, orte_dss_arith_op_t operation, orte_data_type_t type);
int orte_dss_increment(orte_data_value_t *value);
int orte_dss_decrement(orte_data_value_t *value);
int orte_dss_pack(orte_buffer_t *buffer, void *src,
size_t num_vals,
orte_data_type_t type);
int orte_dss_unpack(orte_buffer_t *buffer, void *dest,
size_t *max_num_vals,
orte_data_type_t type);
int orte_dss_copy(void **dest, void *src, orte_data_type_t type);
int orte_dss_compare(void *value1, void *value2,
orte_data_type_t type);
int orte_dss_print(char **output, char *prefix, void *src, orte_data_type_t type);
int orte_dss_size(size_t *size, void *src, orte_data_type_t type);
int orte_dss_peek(orte_buffer_t *buffer, orte_data_type_t *type,
size_t *number);
int orte_dss_peek_type(orte_buffer_t *buffer, orte_data_type_t *type);
int orte_dss_unload(orte_buffer_t *buffer, void **payload,
size_t *bytes_used);
int orte_dss_load(orte_buffer_t *buffer, void *payload, size_t bytes_used);
int orte_dss_register(orte_dss_pack_fn_t pack_fn,
orte_dss_unpack_fn_t unpack_fn,
orte_dss_copy_fn_t copy_fn,
orte_dss_compare_fn_t compare_fn,
orte_dss_size_fn_t size_fn,
orte_dss_print_fn_t print_fn,
orte_dss_release_fn_t release_fn,
bool structured,
const char *name, orte_data_type_t *type);
void orte_dss_release(orte_data_value_t *value);
char *orte_dss_lookup_data_type(orte_data_type_t type);
void orte_dss_dump_data_types(int output);
/*
* Non-API functions
*/
int orte_dss_pack_buffer(orte_buffer_t *buffer, void *src, size_t num_vals,
orte_data_type_t type);
int orte_dss_unpack_buffer(orte_buffer_t *buffer, void *dst, size_t *num_vals,
orte_data_type_t type);
/*
* Internal pack functions
*/
int orte_dss_pack_null(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_byte(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_bool(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_int(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_int16(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_int32(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_int64(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_sizet(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_pid(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_string(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_data_type(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_daemon_cmd(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_data_value(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
int orte_dss_pack_byte_object(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type);
/*
* Internal unpack functions
*/
int orte_dss_unpack_null(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_byte(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_bool(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_int(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_int16(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_int32(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_int64(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_sizet(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_pid(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_string(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_data_type(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_daemon_cmd(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_data_value(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
int orte_dss_unpack_byte_object(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
/*
* Internal copy functions
*/
int orte_dss_std_copy(void **dest, void *src, orte_data_type_t type);
int orte_dss_copy_null(char **dest, char *src, orte_data_type_t type);
int orte_dss_copy_string(char **dest, char *src, orte_data_type_t type);
int orte_dss_copy_byte_object(orte_byte_object_t **dest, orte_byte_object_t *src,
orte_data_type_t type);
int orte_dss_copy_data_value(orte_data_value_t **dest, orte_data_value_t *src,
orte_data_type_t type);
/*
* Internal compare functions
*/
int orte_dss_compare_bool(bool *value1, bool *value2, orte_data_type_t type);
int orte_dss_compare_int(int *value1, int *value2, orte_data_type_t type);
int orte_dss_compare_uint(uint *value1, uint *value2, orte_data_type_t type);
int orte_dss_compare_size(size_t *value1, size_t *value2, orte_data_type_t type);
int orte_dss_compare_pid(pid_t *value1, pid_t *value2, orte_data_type_t type);
int orte_dss_compare_byte(char *value1, char *value2, orte_data_type_t type);
int orte_dss_compare_char(char *value1, char *value2, orte_data_type_t type);
int orte_dss_compare_int8(int8_t *value1, int8_t *value2, orte_data_type_t type);
int orte_dss_compare_uint8(uint8_t *value1, uint8_t *value2, orte_data_type_t type);
int orte_dss_compare_int16(int16_t *value1, int16_t *value2, orte_data_type_t type);
int orte_dss_compare_uint16(uint16_t *value1, uint16_t *value2, orte_data_type_t type);
int orte_dss_compare_int32(int32_t *value1, int32_t *value2, orte_data_type_t type);
int orte_dss_compare_uint32(uint32_t *value1, uint32_t *value2, orte_data_type_t type);
int orte_dss_compare_int64(int64_t *value1, int64_t *value2, orte_data_type_t type);
int orte_dss_compare_uint64(uint64_t *value1, uint64_t *value2, orte_data_type_t type);
int orte_dss_compare_null(char *value1, char *value2, orte_data_type_t type);
int orte_dss_compare_string(char *value1, char *value2, orte_data_type_t type);
int orte_dss_compare_dt(orte_data_type_t *value1, orte_data_type_t *value2, orte_data_type_t type);
int orte_dss_compare_daemon_cmd(orte_daemon_cmd_flag_t *value1, orte_daemon_cmd_flag_t *value2, orte_data_type_t type);
int orte_dss_compare_data_value(orte_data_value_t *value1, orte_data_value_t *value2, orte_data_type_t type);
int orte_dss_compare_byte_object(orte_byte_object_t *value1, orte_byte_object_t *value2, orte_data_type_t type);
/*
* Internal size functions
*/
int orte_dss_std_size(size_t *size, void *src, orte_data_type_t type);
int orte_dss_size_string(size_t *size, char *src, orte_data_type_t type);
int orte_dss_size_data_value(size_t *size, orte_data_value_t *src, orte_data_type_t type);
int orte_dss_size_byte_object(size_t *size, orte_byte_object_t *src, orte_data_type_t type);
/*
* Internal print functions
*/
int orte_dss_print_byte(char **output, char *prefix, uint8_t *src, orte_data_type_t type);
int orte_dss_print_string(char **output, char *prefix, char *src, orte_data_type_t type);
int orte_dss_print_size(char **output, char *prefix, size_t *src, orte_data_type_t type);
int orte_dss_print_pid(char **output, char *prefix, pid_t *src, orte_data_type_t type);
int orte_dss_print_bool(char **output, char *prefix, bool *src, orte_data_type_t type);
int orte_dss_print_int(char **output, char *prefix, int *src, orte_data_type_t type);
int orte_dss_print_uint(char **output, char *prefix, int *src, orte_data_type_t type);
int orte_dss_print_uint8(char **output, char *prefix, uint8_t *src, orte_data_type_t type);
int orte_dss_print_uint16(char **output, char *prefix, uint16_t *src, orte_data_type_t type);
int orte_dss_print_uint32(char **output, char *prefix, uint32_t *src, orte_data_type_t type);
int orte_dss_print_int8(char **output, char *prefix, int8_t *src, orte_data_type_t type);
int orte_dss_print_int16(char **output, char *prefix, int16_t *src, orte_data_type_t type);
int orte_dss_print_int32(char **output, char *prefix, int32_t *src, orte_data_type_t type);
#ifdef HAVE_INT64_T
int orte_dss_print_uint64(char **output, char *prefix, uint64_t *src, orte_data_type_t type);
int orte_dss_print_int64(char **output, char *prefix, int64_t *src, orte_data_type_t type);
#else
int orte_dss_print_uint64(char **output, char *prefix, void *src, orte_data_type_t type);
int orte_dss_print_int64(char **output, char *prefix, void *src, orte_data_type_t type);
#endif
int orte_dss_print_null(char **output, char *prefix, void *src, orte_data_type_t type);
int orte_dss_print_data_type(char **output, char *prefix, orte_data_type_t *src, orte_data_type_t type);
int orte_dss_print_daemon_cmd(char **output, char *prefix, orte_daemon_cmd_flag_t *src, orte_data_type_t type);
int orte_dss_print_data_value(char **output, char *prefix, orte_data_value_t *src, orte_data_type_t type);
int orte_dss_print_byte_object(char **output, char *prefix, orte_byte_object_t *src, orte_data_type_t type);
/*
* Internal release functions
*/
void orte_dss_std_release(orte_data_value_t *value);
void orte_dss_std_obj_release(orte_data_value_t *value);
void orte_dss_release_byte_object(orte_data_value_t *value);
/*
* Internal helper functions
*/
char* orte_dss_buffer_extend(orte_buffer_t *bptr, size_t bytes_to_add);
bool orte_dss_too_small(orte_buffer_t *buffer, size_t bytes_reqd);
int orte_dss_store_data_type(orte_buffer_t *buffer, orte_data_type_t type);
int orte_dss_get_data_type(orte_buffer_t *buffer, orte_data_type_t *type);
orte_dss_type_info_t* orte_dss_find_type(orte_data_type_t type);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

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

@ -27,15 +27,15 @@
#endif
#include "opal/util/output.h"
#include "mca/errmgr/errmgr.h"
#include "orte/mca/errmgr/errmgr.h"
#include "dps/dps_internal.h"
#include "orte/dss/dss_internal.h"
/**
* Internal function that resizes (expands) an inuse buffer if
* necessary.
*/
char* orte_dps_buffer_extend(orte_buffer_t *buffer, size_t bytes_to_add)
char* orte_dss_buffer_extend(orte_buffer_t *buffer, size_t bytes_to_add)
{
size_t required, num_pages;
size_t pack_offset, unpack_offset;
@ -50,8 +50,8 @@ char* orte_dps_buffer_extend(orte_buffer_t *buffer, size_t bytes_to_add)
that */
required = buffer->bytes_used + bytes_to_add;
num_pages = required / orte_dps_page_size;
if (0 != required % orte_dps_page_size) {
num_pages = required / orte_dss_page_size;
if (0 != required % orte_dss_page_size) {
++num_pages;
}
if (NULL != buffer->base_ptr) {
@ -59,12 +59,12 @@ char* orte_dps_buffer_extend(orte_buffer_t *buffer, size_t bytes_to_add)
unpack_offset = ((char*) buffer->unpack_ptr) -
((char*) buffer->base_ptr);
buffer->base_ptr = realloc(buffer->base_ptr,
num_pages * orte_dps_page_size);
num_pages * orte_dss_page_size);
} else {
pack_offset = 0;
unpack_offset = 0;
buffer->bytes_used = 0;
buffer->base_ptr = malloc(num_pages * orte_dps_page_size);
buffer->base_ptr = malloc(num_pages * orte_dss_page_size);
}
if (NULL == buffer->base_ptr) {
@ -73,7 +73,7 @@ char* orte_dps_buffer_extend(orte_buffer_t *buffer, size_t bytes_to_add)
}
buffer->pack_ptr = ((char*) buffer->base_ptr) + pack_offset;
buffer->unpack_ptr = ((char*) buffer->base_ptr) + unpack_offset;
buffer->bytes_allocated = num_pages * orte_dps_page_size;
buffer->bytes_allocated = num_pages * orte_dss_page_size;
buffer->bytes_avail = buffer->bytes_allocated - buffer->bytes_used;
/* All done */
@ -85,7 +85,7 @@ char* orte_dps_buffer_extend(orte_buffer_t *buffer, size_t bytes_to_add)
* Internal function that checks to see if the specified number of bytes
* remain in the buffer for unpacking
*/
bool orte_dps_too_small(orte_buffer_t *buffer, size_t bytes_reqd)
bool orte_dss_too_small(orte_buffer_t *buffer, size_t bytes_reqd)
{
size_t bytes_remaining_packed;
@ -97,7 +97,7 @@ bool orte_dps_too_small(orte_buffer_t *buffer, size_t bytes_reqd)
bytes_remaining_packed = buffer->pack_ptr - buffer->unpack_ptr;
if (bytes_remaining_packed < bytes_reqd) {
ORTE_ERROR_LOG(ORTE_UNPACK_READ_PAST_END_OF_BUFFER);
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER);
return true;
}
@ -107,7 +107,7 @@ bool orte_dps_too_small(orte_buffer_t *buffer, size_t bytes_reqd)
/*
* Internal function to store data type in buffer
*/
int orte_dps_store_data_type(orte_buffer_t *buffer, orte_data_type_t type)
int orte_dss_store_data_type(orte_buffer_t *buffer, orte_data_type_t type)
{
size_t required;
int rc;
@ -117,28 +117,28 @@ int orte_dps_store_data_type(orte_buffer_t *buffer, orte_data_type_t type)
case 1:
if (ORTE_SUCCESS != (
rc = orte_dps_pack_byte(buffer, &type, 1, ORTE_BYTE))) {
rc = orte_dss_pack_byte(buffer, &type, 1, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
}
break;
case 2:
if (ORTE_SUCCESS != (
rc = orte_dps_pack_int16(buffer, &type, 1, ORTE_INT16))) {
rc = orte_dss_pack_int16(buffer, &type, 1, ORTE_INT16))) {
ORTE_ERROR_LOG(rc);
}
break;
case 4:
if (ORTE_SUCCESS != (
rc = orte_dps_pack_int32(buffer, &type, 1, ORTE_INT32))) {
rc = orte_dss_pack_int32(buffer, &type, 1, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
}
break;
case 8:
if (ORTE_SUCCESS != (
rc = orte_dps_pack_int64(buffer, &type, 1, ORTE_INT64))) {
rc = orte_dss_pack_int64(buffer, &type, 1, ORTE_INT64))) {
ORTE_ERROR_LOG(rc);
}
break;
@ -154,7 +154,7 @@ int orte_dps_store_data_type(orte_buffer_t *buffer, orte_data_type_t type)
/*
* Internal function to retrieve data type from buffer
*/
int orte_dps_get_data_type(orte_buffer_t *buffer, orte_data_type_t *type)
int orte_dss_get_data_type(orte_buffer_t *buffer, orte_data_type_t *type)
{
size_t required, n=1;
int rc;
@ -164,28 +164,28 @@ int orte_dps_get_data_type(orte_buffer_t *buffer, orte_data_type_t *type)
case 1:
if (ORTE_SUCCESS != (
rc = orte_dps_unpack_byte(buffer, type, &n, ORTE_BYTE))) {
rc = orte_dss_unpack_byte(buffer, type, &n, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
}
break;
case 2:
if (ORTE_SUCCESS != (
rc = orte_dps_unpack_int16(buffer, type, &n, ORTE_INT16))) {
rc = orte_dss_unpack_int16(buffer, type, &n, ORTE_INT16))) {
ORTE_ERROR_LOG(rc);
}
break;
case 4:
if (ORTE_SUCCESS != (
rc = orte_dps_unpack_int32(buffer, type, &n, ORTE_INT32))) {
rc = orte_dss_unpack_int32(buffer, type, &n, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
}
break;
case 8:
if (ORTE_SUCCESS != (
rc = orte_dps_unpack_int64(buffer, type, &n, ORTE_INT64))) {
rc = orte_dss_unpack_int64(buffer, type, &n, ORTE_INT64))) {
ORTE_ERROR_LOG(rc);
}
break;

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

@ -31,12 +31,12 @@
#include <netinet/in.h>
#endif
#include "mca/ns/base/base.h"
#include "orte/mca/ns/base/base.h"
#include "dps/dps_internal.h"
#include "orte/dss/dss_internal.h"
int orte_dps_unload(orte_buffer_t *buffer, void **payload,
int orte_dss_unload(orte_buffer_t *buffer, void **payload,
size_t *bytes_used)
{
/* check that buffer is not null */
@ -71,7 +71,7 @@ int orte_dps_unload(orte_buffer_t *buffer, void **payload,
}
int orte_dps_load(orte_buffer_t *buffer, void *payload,
int orte_dss_load(orte_buffer_t *buffer, void *payload,
size_t bytes_used)
{
/* check to see if the buffer has been initialized */

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

@ -5,32 +5,36 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
#include "orte_config.h"
#include "include/orte_types.h"
#include "mca/errmgr/errmgr.h"
#include "orte/mca/errmgr/errmgr.h"
#include "dps/dps.h"
#include "dps/dps_internal.h"
#include "orte/dss/dss.h"
#include "orte/dss/dss_internal.h"
char *orte_dps_lookup_data_type(orte_data_type_t type)
char *orte_dss_lookup_data_type(orte_data_type_t type)
{
orte_dps_type_info_t *info;
orte_dss_type_info_t *info;
char *name;
info = orte_pointer_array_get_item(orte_dps_types, type);
if (!(type < orte_dss_types->size)) {
return NULL;
}
info = orte_pointer_array_get_item(orte_dss_types, type);
if (NULL != info) { /* type found on list */
name = strdup(info->odti_name);
return name;

456
orte/dss/dss_open_close.c Обычный файл
Просмотреть файл

@ -0,0 +1,456 @@
/*
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
*/
#include "orte_config.h"
#include "orte/include/orte_types.h"
#include "opal/mca/base/mca_base_param.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/ns/ns.h"
#include "orte/dss/dss_internal.h"
/**
* globals
*/
bool orte_dss_initialized = false;
bool orte_dss_debug = false;
int orte_dss_verbose = -1; /* by default disabled */
int orte_dss_page_size;
orte_pointer_array_t *orte_dss_types;
orte_data_type_t orte_dss_num_reg_types;
OMPI_DECLSPEC orte_dss_t orte_dss = {
orte_dss_set,
orte_dss_get,
orte_dss_arith,
orte_dss_increment,
orte_dss_decrement,
orte_dss_pack,
orte_dss_unpack,
orte_dss_copy,
orte_dss_compare,
orte_dss_size,
orte_dss_print,
orte_dss_release,
orte_dss_peek,
orte_dss_unload,
orte_dss_load,
orte_dss_register,
orte_dss_lookup_data_type
};
/**
* Object constructors, destructors, and instantiations
*/
/** Data Value **/
/* constructor - used to initialize state of data value instance */
static void orte_data_value_construct(orte_data_value_t* ptr)
{
ptr->type = ORTE_UNDEF;
ptr->data = NULL;
}
/* destructor - used to release data value instance */
static void orte_data_value_destruct(orte_data_value_t* ptr)
{
if (NULL != ptr->data) {
orte_dss.release(ptr);
}
}
/* define instance of opal_class_t */
OBJ_CLASS_INSTANCE(
orte_data_value_t, /* type name */
opal_object_t, /* parent "class" name */
orte_data_value_construct, /* constructor */
orte_data_value_destruct); /* destructor */
static void orte_buffer_construct (orte_buffer_t* buffer)
{
/* Make everything NULL to begin with */
buffer->base_ptr = buffer->pack_ptr = buffer->unpack_ptr = NULL;
buffer->bytes_allocated = buffer->bytes_used = buffer->bytes_avail = 0;
}
static void orte_buffer_destruct (orte_buffer_t* buffer)
{
if (NULL != buffer) {
if (NULL != buffer->base_ptr) {
free (buffer->base_ptr);
}
}
}
OBJ_CLASS_INSTANCE(orte_buffer_t,
opal_object_t,
orte_buffer_construct,
orte_buffer_destruct);
static void orte_dss_type_info_construct(orte_dss_type_info_t *obj)
{
obj->odti_name = NULL;
obj->odti_pack_fn = NULL;
obj->odti_unpack_fn = NULL;
obj->odti_copy_fn = NULL;
obj->odti_compare_fn = NULL;
obj->odti_size_fn = NULL;
obj->odti_print_fn = NULL;
obj->odti_release_fn = NULL;
obj->odti_structured = false;
}
static void orte_dss_type_info_destruct(orte_dss_type_info_t *obj)
{
if (NULL != obj->odti_name) {
free(obj->odti_name);
}
}
OBJ_CLASS_INSTANCE(orte_dss_type_info_t, opal_object_t,
orte_dss_type_info_construct,
orte_dss_type_info_destruct);
int orte_dss_open(void)
{
char *enviro_val;
int id, page_size, rc;
orte_data_type_t tmp;
if (orte_dss_initialized) {
return ORTE_SUCCESS;
}
enviro_val = getenv("ORTE_dss_debug");
if (NULL != enviro_val) { /* debug requested */
orte_dss_debug = true;
} else {
orte_dss_debug = false;
}
/* setup the page size -this is for use by the BUFFER system, NOT the data type
manager that keeps track of registered data types!! It must be converted to
bytes since the buffer system will allocate a "page_size" at a time.
*/
id = mca_base_param_register_int("dss", "page", "size", NULL, ORTE_DSS_DEFAULT_PAGE_SIZE);
mca_base_param_lookup_int(id, &page_size);
orte_dss_page_size = 1024*page_size;
/* Setup the types array */
if (ORTE_SUCCESS != (rc = orte_pointer_array_init(&orte_dss_types,
ORTE_DSS_ID_DYNAMIC,
ORTE_DSS_ID_MAX,
ORTE_DSS_ID_MAX))) {
ORTE_ERROR_LOG(rc);
return rc;
}
orte_dss_num_reg_types = 0;
/* Register all the intrinsic types */
tmp = ORTE_NULL;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_null,
orte_dss_unpack_null,
(orte_dss_copy_fn_t)orte_dss_copy_null,
(orte_dss_compare_fn_t)orte_dss_compare_null,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_null,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_NULL", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_BYTE;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_byte,
orte_dss_unpack_byte,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_byte,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_byte,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_BYTE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_BOOL;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_bool,
orte_dss_unpack_bool,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_bool,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_bool,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_BOOL", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_INT;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_int,
orte_dss_unpack_int,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_int,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_int,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_INT", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_UINT;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_int,
orte_dss_unpack_int,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_uint,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_uint,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_UINT", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_INT8;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_byte,
orte_dss_unpack_byte,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_int8,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_int8,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_INT8", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_UINT8;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_byte,
orte_dss_unpack_byte,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_uint8,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_uint8,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_UINT8", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_INT16;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_int16,
orte_dss_unpack_int16,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_int16,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_int16,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_INT16", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_UINT16;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_int16,
orte_dss_unpack_int16,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_uint16,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_uint16,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_UINT16", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_INT32;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_int32,
orte_dss_unpack_int32,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_int32,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_int32,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_INT32", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_UINT32;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_int32,
orte_dss_unpack_int32,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_uint32,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_uint32,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_UINT32", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_INT64;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_int64,
orte_dss_unpack_int64,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_int64,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_int64,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_INT64", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_UINT64;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_int64,
orte_dss_unpack_int64,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_uint64,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_uint64,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_UINT64", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_SIZE;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_sizet,
orte_dss_unpack_sizet,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_size,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_size,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_SIZE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_PID;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_pid,
orte_dss_unpack_pid,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_pid,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_pid,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_PID", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_STRING;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_string,
orte_dss_unpack_string,
(orte_dss_copy_fn_t)orte_dss_copy_string,
(orte_dss_compare_fn_t)orte_dss_compare_string,
(orte_dss_size_fn_t)orte_dss_size_string,
(orte_dss_print_fn_t)orte_dss_print_string,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_STRUCTURED,
"ORTE_STRING", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_DATA_TYPE;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_data_type,
orte_dss_unpack_data_type,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_dt,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_data_type,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_DATA_TYPE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_DATA_VALUE;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_data_value,
orte_dss_unpack_data_value,
(orte_dss_copy_fn_t)orte_dss_copy_data_value,
(orte_dss_compare_fn_t)orte_dss_compare_data_value,
(orte_dss_size_fn_t)orte_dss_size_data_value,
(orte_dss_print_fn_t)orte_dss_print_data_value,
(orte_dss_release_fn_t)orte_dss_std_obj_release,
ORTE_DSS_STRUCTURED,
"ORTE_DATA_VALUE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_DAEMON_CMD;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_daemon_cmd,
orte_dss_unpack_daemon_cmd,
(orte_dss_copy_fn_t)orte_dss_std_copy,
(orte_dss_compare_fn_t)orte_dss_compare_daemon_cmd,
(orte_dss_size_fn_t)orte_dss_std_size,
(orte_dss_print_fn_t)orte_dss_print_daemon_cmd,
(orte_dss_release_fn_t)orte_dss_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_DATA_TYPE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_BYTE_OBJECT;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_byte_object,
orte_dss_unpack_byte_object,
(orte_dss_copy_fn_t)orte_dss_copy_byte_object,
(orte_dss_compare_fn_t)orte_dss_compare_byte_object,
(orte_dss_size_fn_t)orte_dss_size_byte_object,
(orte_dss_print_fn_t)orte_dss_print_byte_object,
(orte_dss_release_fn_t)orte_dss_release_byte_object,
ORTE_DSS_STRUCTURED,
"ORTE_BYTE_OBJECT", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* All done */
return ORTE_SUCCESS;
}
int orte_dss_close(void)
{
size_t i;
orte_dss_initialized = false;
for (i = 0 ; i < orte_pointer_array_get_size(orte_dss_types) ; ++i) {
orte_dss_type_info_t *info = orte_pointer_array_get_item(orte_dss_types, i);
if (NULL != info) {
OBJ_RELEASE(info);
}
}
OBJ_RELEASE(orte_dss_types);
return ORTE_SUCCESS;
}

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

@ -5,17 +5,17 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
@ -23,12 +23,13 @@
#include <netinet/in.h>
#endif
#include "mca/errmgr/errmgr.h"
#include "dps/dps_internal.h"
#include "opal/util/output.h"
int orte_dps_pack(orte_buffer_t *buffer, void *src, size_t num_vals,
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss_internal.h"
int orte_dss_pack(orte_buffer_t *buffer, void *src, size_t num_vals,
orte_data_type_t type)
{
int rc;
@ -40,80 +41,64 @@ int orte_dps_pack(orte_buffer_t *buffer, void *src, size_t num_vals,
}
/* Pack the number of values */
if (ORTE_SUCCESS != (rc = orte_dps_store_data_type(buffer, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss_store_data_type(buffer, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps_pack_sizet(buffer, &num_vals, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_sizet(buffer, &num_vals, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* Pack the value(s) */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, src, num_vals, type))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, src, num_vals, type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
int orte_dps_pack_buffer(orte_buffer_t *buffer, void *src, size_t num_vals,
int orte_dss_pack_buffer(orte_buffer_t *buffer, void *src, size_t num_vals,
orte_data_type_t type)
{
int rc;
orte_dps_type_info_t *info;
OPAL_OUTPUT( ( orte_dps_verbose, "orte_dps_pack_buffer( %p, %p, %lu, %d )\n", buffer, src, num_vals, (int)type ) );
orte_dss_type_info_t *info;
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_pack_buffer( %p, %p, %lu, %d )\n", buffer, src, num_vals, (int)type ) );
/* Pack the declared data type */
if (ORTE_SUCCESS != (rc = orte_dps_pack_data_type(buffer, &type, 1, type))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_data_type(buffer, &type, 1, type))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* Lookup the pack function for this type and call it */
if (NULL == (info = orte_pointer_array_get_item(orte_dps_types, type))) {
if (NULL == (info = orte_pointer_array_get_item(orte_dss_types, type))) {
ORTE_ERROR_LOG(ORTE_ERR_PACK_FAILURE);
return ORTE_ERR_PACK_FAILURE;
}
if (ORTE_SUCCESS != (rc = info->odti_pack_fn(buffer, src, num_vals, type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
/* PACK FUNCTIONS FOR GENERIC SYSTEM TYPES */
/*
* NULL
*/
int orte_dps_pack_null(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
char null=0x00;
int rc;
if (ORTE_SUCCESS != (rc = orte_dps_pack_byte(buffer, &null, num_vals, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
/*
* BOOL
*/
int orte_dps_pack_bool(orte_buffer_t *buffer, void *src,
int orte_dss_pack_bool(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and pack the real type */
if (ORTE_SUCCESS != (
ret = orte_dps_pack_buffer(buffer, src, num_vals, DPS_TYPE_BOOL))) {
ret = orte_dss_pack_buffer(buffer, src, num_vals, DSS_TYPE_BOOL))) {
ORTE_ERROR_LOG(ret);
}
@ -123,14 +108,14 @@ int orte_dps_pack_bool(orte_buffer_t *buffer, void *src,
/*
* INT
*/
int orte_dps_pack_int(orte_buffer_t *buffer, void *src,
int orte_dss_pack_int(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and pack the real type */
if (ORTE_SUCCESS != (
ret = orte_dps_pack_buffer(buffer, src, num_vals, DPS_TYPE_INT))) {
ret = orte_dss_pack_buffer(buffer, src, num_vals, DSS_TYPE_INT))) {
ORTE_ERROR_LOG(ret);
}
@ -140,14 +125,14 @@ int orte_dps_pack_int(orte_buffer_t *buffer, void *src,
/*
* SIZE_T
*/
int orte_dps_pack_sizet(orte_buffer_t *buffer, void *src,
int orte_dss_pack_sizet(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and pack the real type */
if (ORTE_SUCCESS != (
ret = orte_dps_pack_buffer(buffer, src, num_vals, DPS_TYPE_SIZE_T))) {
ret = orte_dss_pack_buffer(buffer, src, num_vals, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(ret);
}
@ -157,14 +142,14 @@ int orte_dps_pack_sizet(orte_buffer_t *buffer, void *src,
/*
* PID_T
*/
int orte_dps_pack_pid(orte_buffer_t *buffer, void *src,
int orte_dss_pack_pid(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and pack the real type */
if (ORTE_SUCCESS != (
ret = orte_dps_pack_buffer(buffer, src, num_vals, DPS_TYPE_PID_T))) {
ret = orte_dss_pack_buffer(buffer, src, num_vals, DSS_TYPE_PID_T))) {
ORTE_ERROR_LOG(ret);
}
@ -175,48 +160,76 @@ int orte_dps_pack_pid(orte_buffer_t *buffer, void *src,
/* PACK FUNCTIONS FOR NON-GENERIC SYSTEM TYPES */
/*
* BYTE, CHAR, INT8
* NULL
*/
int orte_dps_pack_byte(orte_buffer_t *buffer, void *src,
int orte_dss_pack_null(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
char null=0x00;
char *dst;
OPAL_OUTPUT( ( orte_dps_verbose, "orte_dps_pack_byte * %d\n", num_vals ) );
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_pack_null * %d\n", num_vals ) );
/* check to see if buffer needs extending */
if (NULL == (dst = orte_dps_buffer_extend(buffer, num_vals))) {
if (NULL == (dst = orte_dss_buffer_extend(buffer, num_vals))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* store the data */
memcpy(dst, src, num_vals);
/* store the nulls */
memset(dst, (int)null, num_vals);
/* update buffer pointers */
buffer->pack_ptr += num_vals;
buffer->bytes_used += num_vals;
buffer->bytes_avail -= num_vals;
return ORTE_SUCCESS;
}
/*
* BYTE, CHAR, INT8
*/
int orte_dss_pack_byte(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
char *dst;
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_pack_byte * %d\n", num_vals ) );
/* check to see if buffer needs extending */
if (NULL == (dst = orte_dss_buffer_extend(buffer, num_vals))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_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;
buffer->bytes_avail -= num_vals;
return ORTE_SUCCESS;
}
/*
* INT16
*/
int orte_dps_pack_int16(orte_buffer_t *buffer, void *src,
int orte_dss_pack_int16(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
size_t i;
uint16_t tmp, *srctmp = (uint16_t*) src;
char *dst;
OPAL_OUTPUT( ( orte_dps_verbose, "orte_dps_pack_int16 * %d\n", num_vals ) );
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_pack_int16 * %d\n", num_vals ) );
/* check to see if buffer needs extending */
if (NULL == (dst = orte_dps_buffer_extend(buffer, num_vals*sizeof(tmp)))) {
if (NULL == (dst = orte_dss_buffer_extend(buffer, num_vals*sizeof(tmp)))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
for (i = 0; i < num_vals; ++i) {
tmp = htons(srctmp[i]);
memcpy(dst, &tmp, sizeof(tmp));
@ -225,27 +238,27 @@ int orte_dps_pack_int16(orte_buffer_t *buffer, void *src,
buffer->pack_ptr += num_vals * sizeof(tmp);
buffer->bytes_used += num_vals * sizeof(tmp);
buffer->bytes_avail -= num_vals * sizeof(tmp);
return ORTE_SUCCESS;
}
/*
* INT32
*/
int orte_dps_pack_int32(orte_buffer_t *buffer, void *src,
int orte_dss_pack_int32(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
size_t i;
uint32_t tmp, *srctmp = (uint32_t*) src;
char *dst;
OPAL_OUTPUT( ( orte_dps_verbose, "orte_dps_pack_int32 * %d\n", num_vals ) );
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_pack_int32 * %d\n", num_vals ) );
/* check to see if buffer needs extending */
if (NULL == (dst = orte_dps_buffer_extend(buffer, num_vals*sizeof(tmp)))) {
if (NULL == (dst = orte_dss_buffer_extend(buffer, num_vals*sizeof(tmp)))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
for (i = 0; i < num_vals; ++i) {
tmp = htonl(srctmp[i]);
memcpy(dst, &tmp, sizeof(tmp));
@ -254,28 +267,28 @@ int orte_dps_pack_int32(orte_buffer_t *buffer, void *src,
buffer->pack_ptr += num_vals * sizeof(tmp);
buffer->bytes_used += num_vals * sizeof(tmp);
buffer->bytes_avail -= num_vals * sizeof(tmp);
return ORTE_SUCCESS;
}
/*
* INT64
*/
int orte_dps_pack_int64(orte_buffer_t *buffer, void *src,
int orte_dss_pack_int64(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
size_t i;
uint32_t tmp, *srctmp = (uint32_t*) src;
char *dst;
size_t bytes_packed = num_vals * sizeof(tmp) * 2;
OPAL_OUTPUT( ( orte_dps_verbose, "orte_dps_pack_int64 * %d\n", num_vals ) );
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_pack_int64 * %d\n", num_vals ) );
/* check to see if buffer needs extending */
if (NULL == (dst = orte_dps_buffer_extend(buffer, bytes_packed))) {
if (NULL == (dst = orte_dss_buffer_extend(buffer, bytes_packed))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
for (i = 0; i < 2*num_vals; i += 2) {
tmp = htonl(srctmp[i]);
memcpy(dst, &tmp, sizeof(tmp));
@ -287,14 +300,14 @@ int orte_dps_pack_int64(orte_buffer_t *buffer, void *src,
buffer->pack_ptr += bytes_packed;
buffer->bytes_used += bytes_packed;
buffer->bytes_avail -= bytes_packed;
return ORTE_SUCCESS;
}
/*
* STRING
*/
int orte_dps_pack_string(orte_buffer_t *buffer, void *src,
int orte_dss_pack_string(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
int ret = ORTE_SUCCESS;
@ -304,18 +317,18 @@ int orte_dps_pack_string(orte_buffer_t *buffer, void *src,
for (i = 0; i < num_vals; ++i) {
if (NULL == ssrc[i]) { /* got zero-length string/NULL pointer - store NULL */
len = 0;
if (ORTE_SUCCESS != (ret = orte_dps_pack_sizet(buffer, &len, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (ret = orte_dss_pack_sizet(buffer, &len, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
} else {
len = strlen(ssrc[i]) + 1;
if (ORTE_SUCCESS != (ret = orte_dps_pack_sizet(buffer, &len, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (ret = orte_dss_pack_sizet(buffer, &len, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
if (ORTE_SUCCESS != (ret =
orte_dps_pack_byte(buffer, ssrc[i], len, ORTE_BYTE))) {
if (ORTE_SUCCESS != (ret =
orte_dss_pack_byte(buffer, ssrc[i], len, ORTE_BYTE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
@ -330,43 +343,133 @@ int orte_dps_pack_string(orte_buffer_t *buffer, void *src,
/*
* ORTE_DATA_TYPE
*/
int orte_dps_pack_data_type(orte_buffer_t *buffer, void *src, size_t num,
int orte_dss_pack_data_type(orte_buffer_t *buffer, void *src, size_t num,
orte_data_type_t type)
{
size_t required;
int rc;
required = sizeof(orte_data_type_t);
switch (required) {
case 1:
if (ORTE_SUCCESS != (
rc = orte_dps_pack_byte(buffer, src, num, ORTE_BYTE))) {
rc = orte_dss_pack_byte(buffer, src, num, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
}
break;
case 2:
if (ORTE_SUCCESS != (
rc = orte_dps_pack_int16(buffer, src, num, ORTE_INT16))) {
rc = orte_dss_pack_int16(buffer, src, num, ORTE_INT16))) {
ORTE_ERROR_LOG(rc);
}
break;
case 4:
if (ORTE_SUCCESS != (
rc = orte_dps_pack_int32(buffer, src, num, ORTE_INT32))) {
rc = orte_dss_pack_int32(buffer, src, num, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
}
break;
case 8:
if (ORTE_SUCCESS != (
rc = orte_dps_pack_int64(buffer, src, num, ORTE_INT64))) {
rc = orte_dss_pack_int64(buffer, src, num, ORTE_INT64))) {
ORTE_ERROR_LOG(rc);
}
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
return rc;
}
/*
* ORTE_DATA_VALUE
*/
int orte_dss_pack_data_value(orte_buffer_t *buffer, void *src, size_t num, orte_data_type_t type)
{
orte_dss_type_info_t *info;
orte_data_value_t **sdv;
size_t i;
int ret;
sdv = (orte_data_value_t **) src;
for (i = 0; i < num; ++i) {
/* pack the data type - we'll need it on the other end */
if (ORTE_SUCCESS != (ret = orte_dss_store_data_type(buffer, sdv[i]->type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
/* Lookup the pack function for this type and call it */
if (NULL == (info = orte_pointer_array_get_item(orte_dss_types, sdv[i]->type))) {
ORTE_ERROR_LOG(ORTE_ERR_PACK_FAILURE);
return ORTE_ERR_PACK_FAILURE;
}
if (info->odti_structured) {
if (ORTE_SUCCESS != (ret = orte_dss_pack_buffer(buffer, &(sdv[i]->data), 1, sdv[i]->type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
} else {
if (ORTE_SUCCESS != (ret = orte_dss_pack_buffer(buffer, sdv[i]->data, 1, sdv[i]->type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
}
}
return ORTE_SUCCESS;
}
/*
* ORTE_DAEMON_CMD
*/
int orte_dss_pack_daemon_cmd(orte_buffer_t *buffer, void *src, size_t num,
orte_data_type_t type)
{
size_t required;
int rc;
required = sizeof(orte_daemon_cmd_flag_t);
switch (required) {
case 1:
if (ORTE_SUCCESS != (
rc = orte_dss_pack_byte(buffer, src, num, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
}
break;
case 2:
if (ORTE_SUCCESS != (
rc = orte_dss_pack_int16(buffer, src, num, ORTE_INT16))) {
ORTE_ERROR_LOG(rc);
}
break;
case 4:
if (ORTE_SUCCESS != (
rc = orte_dss_pack_int32(buffer, src, num, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
}
break;
case 8:
if (ORTE_SUCCESS != (
rc = orte_dss_pack_int64(buffer, src, num, ORTE_INT64))) {
ORTE_ERROR_LOG(rc);
}
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
@ -378,30 +481,29 @@ int orte_dps_pack_data_type(orte_buffer_t *buffer, void *src, size_t num,
/*
* ORTE_BYTE_OBJECT
*/
int orte_dps_pack_byte_object(orte_buffer_t *buffer, void *src, size_t num,
int orte_dss_pack_byte_object(orte_buffer_t *buffer, void *src, size_t num,
orte_data_type_t type)
{
orte_byte_object_t *sbyteptr;
orte_byte_object_t **sbyteptr;
size_t i, n;
int ret;
sbyteptr = (orte_byte_object_t *) src;
sbyteptr = (orte_byte_object_t **) src;
for (i = 0; i < num; ++i) {
n = sbyteptr->size;
n = sbyteptr[i]->size;
if (ORTE_SUCCESS != (ret = orte_dss_pack_sizet(buffer, &n, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
if (0 < n) {
if (ORTE_SUCCESS != (ret = orte_dps_pack_sizet(buffer, &n, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
if (ORTE_SUCCESS != (ret =
orte_dps_pack_byte(buffer, sbyteptr->bytes, n, ORTE_BYTE))) {
if (ORTE_SUCCESS != (ret =
orte_dss_pack_byte(buffer, sbyteptr[i]->bytes, n, ORTE_BYTE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
}
sbyteptr++;
}
return ORTE_SUCCESS;
}

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

@ -5,25 +5,25 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
#include "orte_config.h"
#include "mca/errmgr/errmgr.h"
#include "orte/mca/errmgr/errmgr.h"
#include "dps/dps_internal.h"
#include "orte/dss/dss_internal.h"
int orte_dps_peek(orte_buffer_t *buffer, orte_data_type_t *type,
int orte_dss_peek(orte_buffer_t *buffer, orte_data_type_t *type,
size_t *num_vals)
{
int ret;
@ -42,7 +42,7 @@ int orte_dps_peek(orte_buffer_t *buffer, orte_data_type_t *type,
if (buffer->unpack_ptr >= buffer->base_ptr + buffer->bytes_used) {
*type = ORTE_NULL;
*num_vals = 0;
return ORTE_UNPACK_READ_PAST_END_OF_BUFFER;
return ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* cheat: unpack from a copy of the buffer -- leaving all the
@ -50,7 +50,7 @@ int orte_dps_peek(orte_buffer_t *buffer, orte_data_type_t *type,
tmp = *buffer;
if (ORTE_SUCCESS != (
ret = orte_dps_get_data_type(&tmp, &local_type))) {
ret = orte_dss_get_data_type(&tmp, &local_type))) {
*type = ORTE_NULL;
*num_vals = 0;
return ret;
@ -61,13 +61,13 @@ int orte_dps_peek(orte_buffer_t *buffer, orte_data_type_t *type,
*num_vals = 0;
return ORTE_ERR_UNPACK_FAILURE;
}
if (ORTE_SUCCESS != (ret = orte_dps_unpack_sizet(&tmp, num_vals, &n, ORTE_SIZE))) {
if (ORTE_SUCCESS != (ret = orte_dss_unpack_sizet(&tmp, num_vals, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
*type = ORTE_NULL;
*num_vals = 0;
return ret;
}
if (ORTE_SUCCESS != (ret = orte_dps_get_data_type(&tmp, type))) {
if (ORTE_SUCCESS != (ret = orte_dss_get_data_type(&tmp, type))) {
ORTE_ERROR_LOG(ret);
*type = ORTE_NULL;
*num_vals = 0;
@ -75,3 +75,35 @@ int orte_dps_peek(orte_buffer_t *buffer, orte_data_type_t *type,
return ret;
}
int orte_dss_peek_type(orte_buffer_t *buffer, orte_data_type_t *type)
{
int ret;
orte_buffer_t tmp;
size_t n=1;
/* check for errors */
if (buffer == NULL) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* Double check and ensure that there is data left in the buffer. */
if (buffer->unpack_ptr >= buffer->base_ptr + buffer->bytes_used) {
*type = ORTE_UNDEF;
return ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* cheat: unpack from a copy of the buffer -- leaving all the
original pointers intact */
tmp = *buffer;
if (ORTE_SUCCESS != (
ret = orte_dss_get_data_type(&tmp, type))) {
*type = ORTE_UNDEF;
return ret;
}
return ORTE_SUCCESS;
}

478
orte/dss/dss_print.c Исполняемый файл
Просмотреть файл

@ -0,0 +1,478 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "opal/util/output.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss_internal.h"
int orte_dss_print(char **output, char *prefix, void *src, orte_data_type_t type)
{
int rc;
orte_dss_type_info_t *info;
/* check for error */
if (NULL == output) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* Lookup the print function for this type and call it */
if (!(type < orte_dss_types->size) ||
(NULL == (info = orte_pointer_array_get_item(orte_dss_types, type)))) {
ORTE_ERROR_LOG(ORTE_ERR_UNKNOWN_DATA_TYPE);
return ORTE_ERR_UNKNOWN_DATA_TYPE;
}
if (ORTE_SUCCESS != (rc = info->odti_print_fn(output, prefix, src, type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
/*
* STANDARD PRINT FUNCTIONS FOR SYSTEM TYPES
*/
int orte_dss_print_byte(char **output, char *prefix, uint8_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_BYTE\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_BYTE\tValue: %x", prefix, *src);
return ORTE_SUCCESS;
}
int orte_dss_print_string(char **output, char *prefix, char *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_STRING\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_STRING\tValue: %s", prefx, src);
return ORTE_SUCCESS;
}
int orte_dss_print_size(char **output, char *prefix, size_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_SIZE\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_SIZE\tValue: %lu", prefx, (unsigned long) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_pid(char **output, char *prefix, pid_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_PID\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_PID\tValue: %lu", prefx, (unsigned long) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_bool(char **output, char *prefix, bool *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_BOOL\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_BOOL\tValue: %s", prefx, *src ? "TRUE" : "FALSE");
return ORTE_SUCCESS;
}
int orte_dss_print_int(char **output, char *prefix, int *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_INT\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_INT\tValue: %ld", prefx, (long) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_uint(char **output, char *prefix, int *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_UINT\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_UINT\tValue: %lu", prefx, (unsigned long) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_uint8(char **output, char *prefix, uint8_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_UINT8\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_UINT8\tValue: %u", prefx, (unsigned int) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_uint16(char **output, char *prefix, uint16_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_UINT16\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_UINT16\tValue: %u", prefx, (unsigned int) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_uint32(char **output, char *prefix, uint32_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_UINT32\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_UINT32\tValue: %u", prefx, (unsigned int) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_int8(char **output, char *prefix, int8_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_INT8\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_INT8\tValue: %d", prefx, (int) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_int16(char **output, char *prefix, int16_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_INT16\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_INT16\tValue: %d", prefx, (int) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_int32(char **output, char *prefix, int32_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_INT32\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_INT32\tValue: %d", prefx, (int) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_uint64(char **output, char *prefix, uint64_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_UINT64\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_UINT64\tValue: %lu", prefx, (unsigned long) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_int64(char **output, char *prefix, int64_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_INT64\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_INT64\tValue: %ld", prefx, (long) *src);
return ORTE_SUCCESS;
}
int orte_dss_print_null(char **output, char *prefix, void *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_NULL\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_NULL", prefx);
return ORTE_SUCCESS;
}
/* PRINT FUNCTIONS FOR GENERIC ORTE TYPES */
/*
* ORTE_DATA_TYPE
*/
int orte_dss_print_data_type(char **output, char *prefix, orte_data_type_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_DATA_TYPE\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_DATA_TYPE\tValue: %lu", prefx, (unsigned long) *src);
return ORTE_SUCCESS;
}
/*
* ORTE_DATA_VALUE
*/
int orte_dss_print_data_value(char **output, char *prefix, orte_data_value_t *src, orte_data_type_t type)
{
char *pfx, *tmp1, *tmp2;
int rc;
/* if src is NULL, just print data type and return */
if (NULL == src) {
if (NULL != prefix) {
asprintf(output, "%sData type: ORTE_DATA_VALUE\tValue: NULL pointer", prefix);
} else {
asprintf(output, "Data type: ORTE_DATA_VALUE\tValue: NULL pointer");
}
return ORTE_SUCCESS;
}
if (NULL != prefix) {
asprintf(&pfx, "%s\t", prefix);
asprintf(&tmp1, "%sData type: ORTE_DATA_VALUE:\n", prefix);
} else {
asprintf(&tmp1, "Data type: ORTE_DATA_VALUE:\n");
asprintf(&pfx, "\t");
}
/* if data is included, print it */
if (ORTE_UNDEF == src->type) { /* undefined data type - just report it */
asprintf(&tmp2, "%sData type: ORTE_UNDEF\tValue: N/A", pfx);
} else if (NULL != src->data) {
if (ORTE_SUCCESS != (rc = orte_dss.print(&tmp2, pfx, src->data, src->type))) {
ORTE_ERROR_LOG(rc);
if (NULL != tmp1) free(tmp1);
if (NULL != pfx) free(pfx);
*output = NULL;
return rc;
}
} else { /* indicate the data field was NULL */
asprintf(&tmp2, "%sData field is NULL", pfx);
}
asprintf(output, "%s%s", tmp1, tmp2);
free(tmp1);
free(tmp2);
if (NULL != pfx) free(pfx);
return ORTE_SUCCESS;
}
/*
* ORTE_DAEMON_CMD
*/
int orte_dss_print_daemon_cmd(char **output, char *prefix, orte_daemon_cmd_flag_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_DAEMON_CMD\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_DAEMON_CMD\tValue: %lu", prefx, (unsigned long) *src);
return ORTE_SUCCESS;
}
/*
* ORTE_BYTE_OBJECT
*/
int orte_dss_print_byte_object(char **output, char *prefix, orte_byte_object_t *src, orte_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: ORTE_BYTE_OBJECT\tValue: NULL pointer", prefx);
return ORTE_SUCCESS;
}
asprintf(output, "%sData type: ORTE_BYTE_OBJECT\tSize: %lu", prefx, (unsigned long) src->size);
return ORTE_SUCCESS;
}

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

@ -5,41 +5,63 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
#include "orte_config.h"
#include "include/orte_types.h"
#include "orte/include/orte_types.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/ns.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/ns/ns.h"
#include "dps/dps.h"
#include "dps/dps_internal.h"
#include "orte/dss/dss.h"
#include "orte/dss/dss_internal.h"
int orte_dps_register(orte_dps_pack_fn_t pack_fn,
orte_dps_unpack_fn_t unpack_fn,
int orte_dss_register(orte_dss_pack_fn_t pack_fn,
orte_dss_unpack_fn_t unpack_fn,
orte_dss_copy_fn_t copy_fn,
orte_dss_compare_fn_t compare_fn,
orte_dss_size_fn_t size_fn,
orte_dss_print_fn_t print_fn,
orte_dss_release_fn_t release_fn,
bool structured,
const char *name, orte_data_type_t *type)
{
int ret;
orte_dps_type_info_t *info;
orte_dss_type_info_t *info, **ptr;
size_t i;
orte_data_type_t j;
/* Check for bozo cases */
if (NULL == pack_fn || NULL == unpack_fn || NULL == name || NULL == type) {
if (NULL == pack_fn || NULL == unpack_fn || NULL == copy_fn || NULL == compare_fn ||
NULL == size_fn || NULL == print_fn || NULL == name || NULL == type) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* check if this entry already exists - if so, error - we do NOT allow multiple type registrations */
ptr = (orte_dss_type_info_t**)(orte_dss_types->addr);
for (i=0, j=0; j < orte_dss_num_reg_types &&
i < orte_dss_types->size; i++) {
if (NULL != ptr[i]) {
j++;
if (0 == strcmp(ptr[i]->odti_name, name)) {
ORTE_ERROR_LOG(ORTE_ERR_DATA_TYPE_REDEF);
return ORTE_ERR_DATA_TYPE_REDEF;
}
}
}
/* if type is given (i.e., *type > 0), then just use it.
* otherwise, go and get a new type id from the name
* service
@ -50,9 +72,9 @@ int orte_dps_register(orte_dps_pack_fn_t pack_fn,
return ret;
}
}
/* Add a new entry to the table */
info = (orte_dps_type_info_t*) OBJ_NEW(orte_dps_type_info_t);
info = (orte_dss_type_info_t*) OBJ_NEW(orte_dss_type_info_t);
if (NULL == info) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
@ -60,7 +82,13 @@ int orte_dps_register(orte_dps_pack_fn_t pack_fn,
info->odti_name = strdup(name);
info->odti_pack_fn = pack_fn;
info->odti_unpack_fn = unpack_fn;
if (ORTE_SUCCESS != (ret = orte_pointer_array_set_item(orte_dps_types, *type, info))) {
info->odti_copy_fn = copy_fn;
info->odti_compare_fn = compare_fn;
info->odti_size_fn = size_fn;
info->odti_print_fn = print_fn;
info->odti_release_fn = release_fn;
info->odti_structured = structured;
if (ORTE_SUCCESS != (ret = orte_pointer_array_set_item(orte_dss_types, *type, info))) {
ORTE_ERROR_LOG(ret);
}

82
orte/dss/dss_release.c Обычный файл
Просмотреть файл

@ -0,0 +1,82 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss_internal.h"
#include "opal/util/output.h"
void orte_dss_release(orte_data_value_t *value)
{
int rc;
orte_dss_type_info_t *info;
/* check for error */
if (NULL == value) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return;
}
/* Lookup the release function for this type and call it */
if (!(value->type < orte_dss_types->size) ||
(NULL == (info = orte_pointer_array_get_item(orte_dss_types, value->type)))) {
ORTE_ERROR_LOG(ORTE_ERR_UNKNOWN_DATA_TYPE);
}
info->odti_release_fn(value);
return;
}
/*
* STANDARD RELEASE FUNCTION - WORKS FOR EVERYTHING NON-STRUCTURED
*/
void orte_dss_std_release(orte_data_value_t *value)
{
free(value->data);
value->data = NULL;
}
/*
* STANDARD OBJECT RELEASE FUNCTION - WORKS FOR EVERYTHING
*/
void orte_dss_std_obj_release(orte_data_value_t *value)
{
OBJ_RELEASE(value->data);
}
/*
* ORTE_BYTE_OBJECT
*/
void orte_dss_release_byte_object(orte_data_value_t *value)
{
orte_byte_object_t *bo;
bo = value->data;
free(bo->bytes);
free(value->data);
value->data = NULL;
}

56
orte/dss/dss_set.c Исполняемый файл
Просмотреть файл

@ -0,0 +1,56 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "opal/util/output.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss.h"
#include "orte/dss/dss_internal.h"
int orte_dss_set(orte_data_value_t *value, void *new_value, orte_data_type_t type)
{
/* check for error */
if (NULL == value || NULL == new_value) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* see if a value is already loaded - if so, that's just wrong. We can't
release it ourselves because we don't know for certain that the data
was stored dynamically
*/
if (NULL != value->data) {
ORTE_ERROR_LOG(ORTE_ERR_DATA_OVERWRITE_ATTEMPT);
return ORTE_ERR_DATA_OVERWRITE_ATTEMPT;
}
/* set the type */
value->type = type;
/* point the value to the data object */
value->data = new_value;
return ORTE_SUCCESS;
}

176
orte/dss/dss_size.c Исполняемый файл
Просмотреть файл

@ -0,0 +1,176 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "opal/util/output.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss_internal.h"
int orte_dss_size(size_t *size, void *src, orte_data_type_t type)
{
int rc;
orte_dss_type_info_t *info;
/* check for error */
if (NULL == size) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* Lookup the size function for this type and call it */
if (!(type < orte_dss_types->size) ||
(NULL == (info = orte_pointer_array_get_item(orte_dss_types, type)))) {
ORTE_ERROR_LOG(ORTE_ERR_UNKNOWN_DATA_TYPE);
return ORTE_ERR_UNKNOWN_DATA_TYPE;
}
if (ORTE_SUCCESS != (rc = info->odti_size_fn(size, src, type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
/*
* STANDARD SIZE FUNCTION - WORKS FOR EVERYTHING NON-STRUCTURED
*/
int orte_dss_std_size(size_t *size, void *src, orte_data_type_t type)
{
switch(type) {
case ORTE_BOOL:
*size = sizeof(bool);
break;
case ORTE_INT:
case ORTE_UINT:
*size = sizeof(int);
break;
case ORTE_SIZE:
*size = sizeof(size_t);
break;
case ORTE_PID:
*size = sizeof(pid_t);
break;
case ORTE_BYTE:
case ORTE_INT8:
case ORTE_UINT8:
case ORTE_NULL:
*size = 1;
break;
case ORTE_INT16:
case ORTE_UINT16:
*size = sizeof(uint16_t);
break;
case ORTE_INT32:
case ORTE_UINT32:
*size = sizeof(uint32_t);
break;
case ORTE_INT64:
case ORTE_UINT64:
*size = sizeof(uint64_t);
break;
case ORTE_DATA_TYPE:
*size = sizeof(orte_data_type_t);
break;
case ORTE_DAEMON_CMD:
*size = sizeof(orte_daemon_cmd_flag_t);
break;
default:
*size = 0;
ORTE_ERROR_LOG(ORTE_ERR_UNKNOWN_DATA_TYPE);
return ORTE_ERR_UNKNOWN_DATA_TYPE;
}
return ORTE_SUCCESS;
}
/* SIZE FUNCTIONS FOR NON-STANDARD SYSTEM TYPES */
/*
* STRING
*/
int orte_dss_size_string(size_t *size, char *src, orte_data_type_t type)
{
if (NULL != src) {
*size = strlen(src) + 1;
} else {
*size = sizeof(char*); /* account for NULL */
}
return ORTE_SUCCESS;
}
/* SIZE FUNCTIONS FOR GENERIC ORTE TYPES */
/*
* ORTE_DATA_VALUE
*/
int orte_dss_size_data_value(size_t *size, orte_data_value_t *src, orte_data_type_t type)
{
size_t data_size;
int rc;
/* account for size of object itself... */
*size = sizeof(orte_data_value_t);
if (NULL != src) {
/* ...and the number of bytes in the payload, IF an actual object was provided */
if (ORTE_SUCCESS != (rc = orte_dss.size(&data_size, src->data, src->type))) {
ORTE_ERROR_LOG(rc);
return rc;
}
*size += data_size;
}
return ORTE_SUCCESS;
}
/*
* ORTE_BYTE_OBJECT
*/
int orte_dss_size_byte_object(size_t *size, orte_byte_object_t *src, orte_data_type_t type)
{
/* account for size of object itself... */
*size = sizeof(orte_byte_object_t);
if (NULL != src) {
/* ...and the number of bytes in the payload, IF an actual object was provided */
*size += src->size;
}
return ORTE_SUCCESS;
}

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

@ -6,14 +6,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/**
@ -22,15 +22,104 @@
* Buffer management types.
*/
#ifndef ORTE_DPS_TYPES_H_
#define ORTE_DPS_TYPES_H_
#ifndef ORTE_DSS_TYPES_H_
#define ORTE_DSS_TYPES_H_
#include "orte_config.h"
#include "orte/include/orte_types.h"
#include "opal/class/opal_object.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/* define arithmetic operations for readability */
typedef uint8_t orte_dss_arith_op_t;
#define ORTE_DSS_ADD 1
#define ORTE_DSS_SUB 2
#define ORTE_DSS_MUL 3
#define ORTE_DSS_DIV 4
/* Data value object */
typedef struct {
opal_object_t super; /* required for this to be an object */
orte_data_type_t type; /* the type of value stored */
void *data;
} orte_data_value_t;
OBJ_CLASS_DECLARATION(orte_data_value_t);
#define ORTE_DATA_VALUE_EMPTY {{OBJ_CLASS(orte_data_value_t),0}, ORTE_UNDEF, NULL}
/* structured-unstructured data flags */
#define ORTE_DSS_STRUCTURED true
#define ORTE_DSS_UNSTRUCTURED false
/*
* ORTE type corresponding to size_t
*/
#if SIZEOF_SIZE_T == 1
#define DSS_TYPE_SIZE_T ORTE_UINT8
#elif SIZEOF_SIZE_T == 2
#define DSS_TYPE_SIZE_T ORTE_UINT16
#elif SIZEOF_SIZE_T == 4
#define DSS_TYPE_SIZE_T ORTE_UINT32
#elif SIZEOF_SIZE_T == 8
#define DSS_TYPE_SIZE_T ORTE_UINT64
#else
#error Unsupported size_t size!
#endif
/*
* ORTE type corresponding to bool
*/
#if SIZEOF_BOOL == 1
#define DSS_TYPE_BOOL ORTE_UINT8
#elif SIZEOF_BOOL == 2
#define DSS_TYPE_BOOL ORTE_UINT16
#elif SIZEOF_BOOL == 4
#define DSS_TYPE_BOOL ORTE_UINT32
#elif SIZEOF_BOOL == 8
#define DSS_TYPE_BOOL ORTE_UINT64
#else
#error Unsupported bool size!
#endif
/*
* ORTE type corresponding to int and unsigned int
*/
#if SIZEOF_INT == 1
#define DSS_TYPE_INT ORTE_INT8
#define DSS_TYPE_UINT ORTE_UINT8
#elif SIZEOF_INT == 2
#define DSS_TYPE_INT ORTE_INT16
#define DSS_TYPE_UINT ORTE_UINT16
#elif SIZEOF_INT == 4
#define DSS_TYPE_INT ORTE_INT32
#define DSS_TYPE_UINT ORTE_UINT32
#elif SIZEOF_INT == 8
#define DSS_TYPE_INT ORTE_INT64
#define DSS_TYPE_UINT ORTE_UINT64
#else
#error Unsupported int size!
#endif
/*
* ORTE type corresponding to pid_t
*/
#if SIZEOF_PID_T == 1
#define DSS_TYPE_PID_T ORTE_UINT8
#elif SIZEOF_PID_T == 2
#define DSS_TYPE_PID_T ORTE_UINT16
#elif SIZEOF_PID_T == 4
#define DSS_TYPE_PID_T ORTE_UINT32
#elif SIZEOF_PID_T == 8
#define DSS_TYPE_PID_T ORTE_UINT64
#else
#error Unsupported pid_t size!
#endif
/**
@ -40,7 +129,7 @@ extern "C" {
struct orte_buffer_t {
/** First member must be the object's parent */
opal_object_t parent;
/** Start of my memory */
char *base_ptr;
/** Where the next data will be packed to (within the allocated
@ -49,7 +138,7 @@ extern "C" {
/** Where the next data will be unpacked from (within the
allocated memory starting as base_ptr) */
char *unpack_ptr;
/** Number of bytes allocated (starting at base_ptr),
typically in multiples of orte_dps_pages, but may not be
if the buffer was initialized with orte_dps_load(). */
@ -69,9 +158,9 @@ extern "C" {
/** formalize the declaration */
OMPI_DECLSPEC OBJ_CLASS_DECLARATION (orte_buffer_t);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTE_DPS_TYPES_H */
#endif /* ORTE_DSS_TYPES_H */

668
orte/dss/dss_unpack.c Обычный файл
Просмотреть файл

@ -0,0 +1,668 @@
/*
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/include/orte_types.h"
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "opal/util/output.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/dss/dss_internal.h"
int orte_dss_unpack(orte_buffer_t *buffer, void *dst, size_t *num_vals,
orte_data_type_t type)
{
int ret=ORTE_SUCCESS, rc=ORTE_SUCCESS;
size_t local_num, n=1;
orte_data_type_t local_type;
/* check for error */
if (NULL == buffer || NULL == dst || NULL == num_vals) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* if user provides a zero for num_vals, then there is no storage allocated
* so return an appropriate error
*/
if (0 == *num_vals) {
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_INADEQUATE_SPACE);
return ORTE_ERR_UNPACK_INADEQUATE_SPACE;
}
/* Unpack the declared number of values
* REMINDER: it is possible that the buffer is corrupted and that
* the DSS will *think* there is a proper size_t variable at the
* beginning of the unpack region - but that the value is bogus (e.g., just
* a byte field in a string array that so happens to have a value that
* matches the size_t data type flag). Therefore, this error check is
* NOT completely safe. This is true for ALL unpack functions, not just
* size_t as used here.
*/
if (ORTE_SUCCESS != (
rc = orte_dss_get_data_type(buffer, &local_type))) {
ORTE_ERROR_LOG(rc);
*num_vals = 0;
return rc;
}
if (ORTE_SIZE != local_type) { /* if the length wasn't first, then error */
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_FAILURE);
*num_vals = 0;
return ORTE_ERR_UNPACK_FAILURE;
}
if (ORTE_SUCCESS != (
rc = orte_dss_unpack_sizet(buffer, &local_num, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
*num_vals = 0;
return rc;
}
/* if the storage provided is inadequate, set things up
* to unpack as much as we can and to return an error code
* indicating that everything was not unpacked - the buffer
* is left in a state where it can not be further unpacked.
*/
if (local_num > *num_vals) {
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_INADEQUATE_SPACE);
local_num = *num_vals;
ret = ORTE_ERR_UNPACK_INADEQUATE_SPACE;
} else if (local_num < *num_vals) { /* more than enough storage */
*num_vals = local_num; /* let the user know how many we actually unpacked */
}
/* Unpack the value(s) */
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dst, &local_num, type))) {
ORTE_ERROR_LOG(rc);
*num_vals = 0;
}
if (ORTE_SUCCESS != ret) {
return ret;
}
return rc;
}
int orte_dss_unpack_buffer(orte_buffer_t *buffer, void *dst, size_t *num_vals,
orte_data_type_t type)
{
int rc;
orte_data_type_t local_type;
orte_dss_type_info_t *info;
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_buffer( %p, %p, %lu, %d )\n", buffer, dst, *num_vals, (int)type ) );
/* Unpack the declared data type */
if (ORTE_SUCCESS != (rc = orte_dss_get_data_type(buffer, &local_type))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* if the data types don't match, then return an error */
if (type != local_type) {
ORTE_ERROR_LOG(ORTE_ERR_PACK_MISMATCH);
return ORTE_ERR_PACK_MISMATCH;
}
/* Lookup the unpack function for this type and call it */
if (NULL == (info = orte_pointer_array_get_item(orte_dss_types, type))) {
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_FAILURE);
return ORTE_ERR_UNPACK_FAILURE;
}
if (ORTE_SUCCESS != (rc = info->odti_unpack_fn(buffer, dst, num_vals, type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
/* UNPACK GENERIC SYSTEM TYPES */
/*
* BOOL
*/
int orte_dss_unpack_bool(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int ret;
/* turn this off for now - just a prototype to think about */
#if 0
orte_data_type_t remote_type;
bool *tf = (bool*)dest;
uint8_t *tfi8;
uint16_t *tfi16;
uint32_t *tfi32;
uint64_t *tfi64;
/* see what type was actually packed */
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
/* see if we have a size mismatch */
if ((SIZEOF_BOOL == 1 && remote_type != ORTE_INT8) ||
(SIZEOF_BOOL == 2 && remote_type != ORTE_INT16) ||
(SIZEOF_BOOL == 4 && remote_type != ORTE_INT32) ||
(SIZEOF_BOOL == 8 && remote_type != ORTE_INT64)) {
/* type mismatch exists - need to do something more complex */
/* allocate enough space for the remote variables to be unpacked,
* unpack the buffer to the new destination, and then converty the
* remote value to the local type
*/
switch(remote_type) {
case ORTE_INT8:
new_dest = (void*)malloc(*num_vals);
if (NULL == new_dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (
ret = orte_dss_unpack_buffer(buffer, new_dest, num_vals, remote_type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
tfi8 = (uint8_t*)new_dest;
for (i=0; i < *num_vals; i++) {
*tf = (bool)*tfi8;
tf++;
tfi8++;
}
free(new_dest);
break;
case ORTE_INT16:
new_dest = (void*)malloc(*num_vals * 2);
if (NULL == new_dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (
ret = orte_dss_unpack_buffer(buffer, new_dest, num_vals, remote_type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
tfi16 = (uint16_t*)new_dest;
for (i=0; i < *num_vals; i++) {
*tf = (bool)*tfi16;
tf++;
tfi16++;
}
free(new_dest);
break;
case ORTE_INT32:
new_dest = (void*)malloc(*num_vals * 4);
if (NULL == new_dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (
ret = orte_dss_unpack_buffer(buffer, new_dest, num_vals, remote_type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
tfi32 = (uint32_t*)new_dest;
for (i=0; i < *num_vals; i++) {
*tf = (bool)*tfi32;
tf++;
tfi32++;
}
free(new_dest);
break;
case ORTE_INT64:
new_dest = (void*)malloc(*num_vals * 8);
if (NULL == new_dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (
ret = orte_dss_unpack_buffer(buffer, new_dest, num_vals, remote_type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
tfi64 = (uint64_t*)new_dest;
for (i=0; i < *num_vals; i++) {
*tf = (bool)*tfi64;
tf++;
tfi64++;
}
free(new_dest);
break;
}
} else { /* no size mismatch, so just go ahead and unpack */
if (ORTE_SUCCESS != (
ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_BOOL))) {
ORTE_ERROR_LOG(ret);
}
}
#endif
if (ORTE_SUCCESS != (
ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_BOOL))) {
ORTE_ERROR_LOG(ret);
}
return ret;
}
/*
* INT
*/
int orte_dss_unpack_int(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and unpack the real type */
if (ORTE_SUCCESS != (
ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_INT))) {
ORTE_ERROR_LOG(ret);
}
return ret;
}
/*
* SIZE_T
*/
int orte_dss_unpack_sizet(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and unpack the real type */
if (ORTE_SUCCESS != (
ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(ret);
}
return ret;
}
/*
* PID_T
*/
int orte_dss_unpack_pid(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int ret;
/* Turn around and unpack the real type */
if (ORTE_SUCCESS != (
ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_PID_T))) {
ORTE_ERROR_LOG(ret);
}
return ret;
}
/* UNPACK FUNCTIONS FOR NON-GENERIC SYSTEM TYPES */
/*
* NULL
*/
int orte_dss_unpack_null(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_null * %d\n", (int)*num_vals ) );
/* check to see if there's enough data in buffer */
if (orte_dss_too_small(buffer, *num_vals)) {
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER);
return ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* unpack the data */
memcpy(dest, buffer->unpack_ptr, *num_vals);
/* update buffer pointer */
buffer->unpack_ptr += *num_vals;
return ORTE_SUCCESS;
}
/*
* BYTE, CHAR, INT8
*/
int orte_dss_unpack_byte(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_byte * %d\n", (int)*num_vals ) );
/* check to see if there's enough data in buffer */
if (orte_dss_too_small(buffer, *num_vals)) {
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER);
return ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* unpack the data */
memcpy(dest, buffer->unpack_ptr, *num_vals);
/* update buffer pointer */
buffer->unpack_ptr += *num_vals;
return ORTE_SUCCESS;
}
int orte_dss_unpack_int16(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
size_t i;
uint16_t tmp, *desttmp = (uint16_t*) dest;
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_int16 * %d\n", (int)*num_vals ) );
/* check to see if there's enough data in buffer */
if (orte_dss_too_small(buffer, (*num_vals)*sizeof(tmp))) {
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER);
return ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* unpack the data */
for (i = 0; i < (*num_vals); ++i) {
memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
desttmp[i] = ntohs(tmp);
buffer->unpack_ptr += sizeof(tmp);
}
return ORTE_SUCCESS;
}
int orte_dss_unpack_int32(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
size_t i;
uint32_t tmp, *desttmp = (uint32_t*) dest;
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_int32 * %d\n", (int)*num_vals ) );
/* check to see if there's enough data in buffer */
if (orte_dss_too_small(buffer, (*num_vals)*sizeof(tmp))) {
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER);
return ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* unpack the data */
for (i = 0; i < (*num_vals); ++i) {
memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
desttmp[i] = ntohl(tmp);
buffer->unpack_ptr += sizeof(tmp);
}
return ORTE_SUCCESS;
}
int orte_dss_unpack_int64(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
size_t i;
uint32_t tmp, *desttmp = (uint32_t*) dest;
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_int64 * %d\n", (int)*num_vals ) );
/* check to see if there's enough data in buffer */
if (orte_dss_too_small(buffer, 2*(*num_vals)*sizeof(tmp))) {
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER);
return ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
}
/* unpack the data */
for (i = 0; i < (2 * (*num_vals)); i += 2) {
memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
desttmp[i] = ntohl(tmp);
buffer->unpack_ptr += sizeof(tmp);
memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
desttmp[i+1] = ntohl(tmp);
buffer->unpack_ptr += sizeof(tmp);
}
return ORTE_SUCCESS;
}
int orte_dss_unpack_string(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type)
{
int ret;
size_t i, len, n=1;
char **sdest = (char**) dest;
for (i = 0; i < (*num_vals); ++i) {
if (ORTE_SUCCESS != (ret = orte_dss_unpack_sizet(buffer, &len, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
if (0 == len) { /* zero-length string - unpack the NULL */
sdest[i] = NULL;
} else {
sdest[i] = malloc(len);
if (NULL == sdest[i]) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (ret = orte_dss_unpack_byte(buffer, sdest[i], &len, ORTE_BYTE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
}
}
return ORTE_SUCCESS;
}
/* UNPACK FUNCTIONS FOR GENERIC ORTE TYPES */
/*
* ORTE_DATA_TYPE
*/
int orte_dss_unpack_data_type(orte_buffer_t *buffer, void *dest, size_t *num,
orte_data_type_t type)
{
size_t required;
int rc;
required = sizeof(orte_data_type_t);
switch (required) {
case 1:
if (ORTE_SUCCESS != (
rc = orte_dss_unpack_byte(buffer, dest, num, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
}
break;
case 2:
if (ORTE_SUCCESS != (
rc = orte_dss_unpack_int16(buffer, dest, num, ORTE_INT16))) {
ORTE_ERROR_LOG(rc);
}
break;
case 4:
if (ORTE_SUCCESS != (
rc = orte_dss_unpack_int32(buffer, dest, num, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
}
break;
case 8:
if (ORTE_SUCCESS != (
rc = orte_dss_unpack_int64(buffer, dest, num, ORTE_INT64))) {
ORTE_ERROR_LOG(rc);
}
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
return rc;
}
/*
* ORTE_DAEMON_CMD
*/
int orte_dss_unpack_daemon_cmd(orte_buffer_t *buffer, void *dest, size_t *num,
orte_data_type_t type)
{
size_t required;
int rc;
required = sizeof(orte_daemon_cmd_flag_t);
switch (required) {
case 1:
if (ORTE_SUCCESS != (
rc = orte_dss_unpack_byte(buffer, dest, num, ORTE_BYTE))) {
ORTE_ERROR_LOG(rc);
}
break;
case 2:
if (ORTE_SUCCESS != (
rc = orte_dss_unpack_int16(buffer, dest, num, ORTE_INT16))) {
ORTE_ERROR_LOG(rc);
}
break;
case 4:
if (ORTE_SUCCESS != (
rc = orte_dss_unpack_int32(buffer, dest, num, ORTE_INT32))) {
ORTE_ERROR_LOG(rc);
}
break;
case 8:
if (ORTE_SUCCESS != (
rc = orte_dss_unpack_int64(buffer, dest, num, ORTE_INT64))) {
ORTE_ERROR_LOG(rc);
}
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
return rc;
}
/*
* ORTE_DATA_VALUE
*/
int orte_dss_unpack_data_value(orte_buffer_t *buffer, void *dest, size_t *num,
orte_data_type_t type)
{
orte_dss_type_info_t *info;
orte_data_value_t **ddv;
size_t i, n;
int ret;
ddv = (orte_data_value_t **) dest;
for (i = 0; i < *num; ++i) {
ddv[i] = OBJ_NEW(orte_data_value_t);
if (NULL == ddv[i]) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* see what the data type is */
if (ORTE_SUCCESS != (ret = orte_dss_get_data_type(buffer, &(ddv[i]->type)))) {
ORTE_ERROR_LOG(ret);
return ret;
}
/* get enough memory to hold it */
if (ORTE_SUCCESS != (ret = orte_dss.size(&n, NULL, ddv[i]->type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
ddv[i]->data = (void*)malloc(n);
if (NULL == ddv[i]->data) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* Lookup the unpack function for this type and call it */
if (NULL == (info = orte_pointer_array_get_item(orte_dss_types, ddv[i]->type))) {
ORTE_ERROR_LOG(ORTE_ERR_PACK_FAILURE);
return ORTE_ERR_PACK_FAILURE;
}
if (info->odti_structured) {
n=1;
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, &(ddv[i]->data), &n, ddv[i]->type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
} else {
n=1;
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, ddv[i]->data, &n, ddv[i]->type))) {
ORTE_ERROR_LOG(ret);
return ret;
}
}
}
return ORTE_SUCCESS;
}
/*
* ORTE_BYTE_OBJECT
*/
int orte_dss_unpack_byte_object(orte_buffer_t *buffer, void *dest, size_t *num,
orte_data_type_t type)
{
int ret;
size_t i, n, m=1;
orte_byte_object_t **dbyteptr;
dbyteptr = (orte_byte_object_t**)dest;
n = *num;
for(i=0; i<n; i++) {
/* unpack object size in bytes */
if (ORTE_SUCCESS != (ret = orte_dss_unpack_sizet(buffer, &(dbyteptr[i]->size), &m, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
if (0 < dbyteptr[i]->size) {
dbyteptr[i]->bytes = (uint8_t*)malloc(dbyteptr[i]->size);
if (NULL == dbyteptr[i]->bytes) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (ret = orte_dss_unpack_byte(buffer, (dbyteptr[i]->bytes),
&(dbyteptr[i]->size), ORTE_BYTE))) {
ORTE_ERROR_LOG(ret);
return ret;
}
}
}
return ORTE_SUCCESS;
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -23,6 +23,11 @@
#define ORTE_ERR_BASE OPAL_ERR_MAX
/* define the results values for comparisons so we can change them in only one place */
#define ORTE_VALUE1_GREATER -1
#define ORTE_VALUE2_GREATER +1
#define ORTE_EQUAL 0
enum {
/* Error codes inherited from OPAL. Still enum values so that we
get the nice debugger help. */
@ -52,40 +57,38 @@ enum {
ORTE_ERR_FILE_OPEN_FAILURE = OPAL_ERR_FILE_OPEN_FAILURE,
/* error codes specific to ORTE - don't forget to update
orte/rutime/orte_init.c when adding new error codes */
ORTE_ERR_RECV_LESS_THAN_POSTED = (ORTE_ERR_BASE - 1),
ORTE_ERR_RECV_MORE_THAN_POSTED = (ORTE_ERR_BASE - 2),
ORTE_ERR_NO_MATCH_YET = (ORTE_ERR_BASE - 3),
ORTE_ERR_BUFFER = (ORTE_ERR_BASE - 4),
ORTE_ERR_REQUEST = (ORTE_ERR_BASE - 5),
ORTE_ERR_NO_CONNECTION_ALLOWED = (ORTE_ERR_BASE - 6),
ORTE_ERR_CONNECTION_REFUSED = (ORTE_ERR_BASE - 7),
ORTE_ERR_CONNECTION_FAILED = (ORTE_ERR_BASE - 8),
ORTE_STARTUP_DETECTED = (ORTE_ERR_BASE - 9),
ORTE_SHUTDOWN_DETECTED = (ORTE_ERR_BASE - 10),
ORTE_PROC_STARTING = (ORTE_ERR_BASE - 11),
ORTE_PROC_STOPPED = (ORTE_ERR_BASE - 12),
ORTE_PROC_TERMINATING = (ORTE_ERR_BASE - 13),
ORTE_PROC_ALIVE = (ORTE_ERR_BASE - 14),
ORTE_PROC_RUNNING = (ORTE_ERR_BASE - 15),
ORTE_PROC_KILLED = (ORTE_ERR_BASE - 16),
ORTE_PROC_EXITED = (ORTE_ERR_BASE - 17),
ORTE_NODE_UP = (ORTE_ERR_BASE - 18),
ORTE_NODE_DOWN = (ORTE_ERR_BASE - 19),
ORTE_NODE_BOOTING = (ORTE_ERR_BASE - 21),
ORTE_NODE_ERROR = (ORTE_ERR_BASE - 22),
ORTE_PACK_MISMATCH = (ORTE_ERR_BASE - 23),
ORTE_ERR_PACK_FAILURE = (ORTE_ERR_BASE - 24),
ORTE_ERR_UNPACK_FAILURE = (ORTE_ERR_BASE - 25),
ORTE_ERR_COMM_FAILURE = (ORTE_ERR_BASE - 26),
ORTE_UNPACK_INADEQUATE_SPACE = (ORTE_ERR_BASE - 27),
ORTE_UNPACK_READ_PAST_END_OF_BUFFER = (ORTE_ERR_BASE - 28),
ORTE_ERR_GPR_DATA_CORRUPT = (ORTE_ERR_BASE - 29),
ORTE_ERR_TYPE_MISMATCH = (ORTE_ERR_BASE - 30)
orte/util/error_strings.c when adding new error codes!!
Otherwise, the error reporting system will potentially crash,
or at the least not be able to report the new error correctly.
*/
ORTE_ERR_RECV_LESS_THAN_POSTED = (ORTE_ERR_BASE - 1),
ORTE_ERR_RECV_MORE_THAN_POSTED = (ORTE_ERR_BASE - 2),
ORTE_ERR_NO_MATCH_YET = (ORTE_ERR_BASE - 3),
ORTE_ERR_BUFFER = (ORTE_ERR_BASE - 4),
ORTE_ERR_REQUEST = (ORTE_ERR_BASE - 5),
ORTE_ERR_NO_CONNECTION_ALLOWED = (ORTE_ERR_BASE - 6),
ORTE_ERR_CONNECTION_REFUSED = (ORTE_ERR_BASE - 7),
ORTE_ERR_CONNECTION_FAILED = (ORTE_ERR_BASE - 8),
ORTE_ERR_PACK_MISMATCH = (ORTE_ERR_BASE - 9),
ORTE_ERR_PACK_FAILURE = (ORTE_ERR_BASE - 10),
ORTE_ERR_UNPACK_FAILURE = (ORTE_ERR_BASE - 11),
ORTE_ERR_COMM_FAILURE = (ORTE_ERR_BASE - 12),
ORTE_ERR_UNPACK_INADEQUATE_SPACE = (ORTE_ERR_BASE - 13),
ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER = (ORTE_ERR_BASE - 14),
ORTE_ERR_GPR_DATA_CORRUPT = (ORTE_ERR_BASE - 15),
ORTE_ERR_TYPE_MISMATCH = (ORTE_ERR_BASE - 16),
ORTE_ERR_COMPARE_FAILURE = (ORTE_ERR_BASE - 17),
ORTE_ERR_COPY_FAILURE = (ORTE_ERR_BASE - 18),
ORTE_ERR_UNKNOWN_DATA_TYPE = (ORTE_ERR_BASE - 19),
ORTE_ERR_DATA_TYPE_REDEF = (ORTE_ERR_BASE - 20),
ORTE_ERR_DATA_OVERWRITE_ATTEMPT = (ORTE_ERR_BASE - 21),
ORTE_ERR_OPERATION_UNSUPPORTED = (ORTE_ERR_BASE - 22)
};
#define ORTE_ERR_MAX (ORTE_ERR_BASE - 100)
/* include the prototype for the error-to-string converter */
const char * orte_err2str(int errnum);
#endif /* ORTE_CONSTANTS_H */

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

@ -28,15 +28,12 @@
/**
* Supported datatypes for messaging and storage operations.
*
* ANY CHANGES TO THESE DEFINITIONS MUST BE REFLECTED IN THE TEXT ARRAY
* orte_data_strings DEFINED IN src/runtime/orte_init.c.
*
*/
typedef uint8_t orte_data_type_t ;
#define ORTE_DPS_ID_MAX UINT8_MAX
#define ORTE_DSS_ID_MAX UINT8_MAX
#define ORTE_UNDEF (orte_data_type_t) 0 /**< type hasn't been defined yet */
#define ORTE_BYTE (orte_data_type_t) 1 /**< a byte of data */
#define ORTE_BOOL (orte_data_type_t) 2 /**< boolean */
#define ORTE_STRING (orte_data_type_t) 3 /**< a NULL terminated string */
@ -54,51 +51,49 @@ typedef uint8_t orte_data_type_t ;
#define ORTE_UINT16 (orte_data_type_t) 13 /**< a 16-bit unsigned integer */
#define ORTE_UINT32 (orte_data_type_t) 14 /**< a 32-bit unsigned integer */
#define ORTE_UINT64 (orte_data_type_t) 15 /**< a 64-bit unsigned integer */
/* all the floating point flavors */
#define ORTE_FLOAT (orte_data_type_t) 16 /**< single-precision float */
#define ORTE_FLOAT4 (orte_data_type_t) 17 /**< 4-byte float - usually equiv to single */
#define ORTE_DOUBLE (orte_data_type_t) 18 /**< double-precision float */
#define ORTE_FLOAT8 (orte_data_type_t) 19 /**< 8-byte float - usually equiv to double */
#define ORTE_LONG_DOUBLE (orte_data_type_t) 20 /**< long-double precision float */
#define ORTE_FLOAT12 (orte_data_type_t) 21 /**< 12-byte float - used as long-double on some systems */
#define ORTE_FLOAT16 (orte_data_type_t) 22 /**< 16-byte float - used as long-double on some systems */
/* we don't support floating point types */
/* orte-specific typedefs - grouped according to the subystem that handles
* their packing/unpacking */
/* General types - packing/unpacking handled within DPS */
#define ORTE_BYTE_OBJECT (orte_data_type_t) 23 /**< byte object structure */
#define ORTE_DATA_TYPE (orte_data_type_t) 24 /**< data type */
#define ORTE_NULL (orte_data_type_t) 25 /**< don't interpret data type */
/* General types - packing/unpacking handled within DSS */
#define ORTE_BYTE_OBJECT (orte_data_type_t) 16 /**< byte object structure */
#define ORTE_DATA_TYPE (orte_data_type_t) 17 /**< data type */
#define ORTE_NULL (orte_data_type_t) 18 /**< don't interpret data type */
#define ORTE_DATA_VALUE (orte_data_type_t) 19 /**< data value */
/* Name Service types */
#define ORTE_NAME (orte_data_type_t) 26 /**< an ompi_process_name_t */
#define ORTE_VPID (orte_data_type_t) 27 /**< a vpid */
#define ORTE_JOBID (orte_data_type_t) 28 /**< a jobid */
#define ORTE_JOBGRP (orte_data_type_t) 29 /**< a job group */
#define ORTE_CELLID (orte_data_type_t) 30 /**< a cellid */
#define ORTE_NAME (orte_data_type_t) 20 /**< an ompi_process_name_t */
#define ORTE_VPID (orte_data_type_t) 21 /**< a vpid */
#define ORTE_JOBID (orte_data_type_t) 22 /**< a jobid */
#define ORTE_JOBGRP (orte_data_type_t) 23 /**< a job group */
#define ORTE_CELLID (orte_data_type_t) 24 /**< a cellid */
/* SOH types */
#define ORTE_NODE_STATE (orte_data_type_t) 31 /**< node status flag */
#define ORTE_PROC_STATE (orte_data_type_t) 32 /**< process/resource status */
#define ORTE_JOB_STATE (orte_data_type_t) 33 /**< job status flag */
#define ORTE_EXIT_CODE (orte_data_type_t) 34 /**< process exit code */
#define ORTE_NODE_STATE (orte_data_type_t) 25 /**< node status flag */
#define ORTE_PROC_STATE (orte_data_type_t) 26 /**< process/resource status */
#define ORTE_JOB_STATE (orte_data_type_t) 27 /**< job status flag */
#define ORTE_EXIT_CODE (orte_data_type_t) 28 /**< process exit code */
/* GPR types */
#define ORTE_KEYVAL (orte_data_type_t) 35 /**< registry key-value pair */
#define ORTE_GPR_NOTIFY_ACTION (orte_data_type_t) 36 /**< registry notify action */
#define ORTE_GPR_TRIGGER_ACTION (orte_data_type_t) 37 /**< registry trigger action */
#define ORTE_GPR_CMD (orte_data_type_t) 38 /**< registry command */
#define ORTE_GPR_SUBSCRIPTION_ID (orte_data_type_t) 39 /**< registry notify id tag */
#define ORTE_GPR_TRIGGER_ID (orte_data_type_t) 40 /**< registry notify id tag */
#define ORTE_GPR_VALUE (orte_data_type_t) 41 /**< registry return value */
#define ORTE_GPR_ADDR_MODE (orte_data_type_t) 42 /**< Addressing mode for registry cmds */
#define ORTE_GPR_SUBSCRIPTION (orte_data_type_t) 43 /**< describes data returned by subscription */
#define ORTE_GPR_TRIGGER (orte_data_type_t) 44 /**< describes trigger conditions */
#define ORTE_GPR_NOTIFY_DATA (orte_data_type_t) 45 /**< data returned from a subscription */
#define ORTE_GPR_NOTIFY_MSG (orte_data_type_t) 46 /**< notify message containing notify_data objects */
#define ORTE_GPR_NOTIFY_MSG_TYPE (orte_data_type_t) 47 /**< notify message type (subscription or trigger) */
#define ORTE_GPR_KEYVAL (orte_data_type_t) 29 /**< registry key-value pair */
#define ORTE_GPR_NOTIFY_ACTION (orte_data_type_t) 30 /**< registry notify action */
#define ORTE_GPR_TRIGGER_ACTION (orte_data_type_t) 31 /**< registry trigger action */
#define ORTE_GPR_CMD (orte_data_type_t) 32 /**< registry command */
#define ORTE_GPR_SUBSCRIPTION_ID (orte_data_type_t) 33 /**< registry notify id tag */
#define ORTE_GPR_TRIGGER_ID (orte_data_type_t) 34 /**< registry notify id tag */
#define ORTE_GPR_VALUE (orte_data_type_t) 35 /**< registry return value */
#define ORTE_GPR_ADDR_MODE (orte_data_type_t) 36 /**< Addressing mode for registry cmds */
#define ORTE_GPR_SUBSCRIPTION (orte_data_type_t) 37 /**< describes data returned by subscription */
#define ORTE_GPR_TRIGGER (orte_data_type_t) 38 /**< describes trigger conditions */
#define ORTE_GPR_NOTIFY_DATA (orte_data_type_t) 39 /**< data returned from a subscription */
#define ORTE_GPR_NOTIFY_MSG (orte_data_type_t) 40 /**< notify message containing notify_data objects */
#define ORTE_GPR_NOTIFY_MSG_TYPE (orte_data_type_t) 41 /**< notify message type (subscription or trigger) */
/* Resource Manager types */
#define ORTE_APP_CONTEXT (orte_data_type_t) 48 /**< argv and enviro arrays */
#define ORTE_APP_CONTEXT_MAP (orte_data_type_t) 49 /**< application context mapping array */
#define ORTE_APP_CONTEXT (orte_data_type_t) 42 /**< argv and enviro arrays */
#define ORTE_APP_CONTEXT_MAP (orte_data_type_t) 43 /**< application context mapping array */
/* DAEMON communication type */
#define ORTE_DAEMON_CMD (orte_data_type_t) 44 /**< command flag for communicating with the daemon */
/* define the starting point for dynamically assigning data types */
#define ORTE_DPS_ID_DYNAMIC 60
#define ORTE_DSS_ID_DYNAMIC 60
/* define a structure to hold generic byte objects */
typedef struct {
@ -106,4 +101,7 @@ typedef struct {
uint8_t *bytes;
} orte_byte_object_t;
/* define the orted command flag type */
typedef uint16_t orte_daemon_cmd_flag_t;
#endif

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

@ -24,10 +24,15 @@ headers += \
libmca_gpr_la_SOURCES += \
base/gpr_base_open.c \
base/gpr_base_close.c \
base/gpr_base_create_value_keyval.c \
base/gpr_base_select.c \
base/gpr_base_simplified_put.c \
base/gpr_base_simplified_subscribe.c \
base/gpr_base_xfer_payload.c \
base/data_type_support/gpr_data_type_compare_fns.c \
base/data_type_support/gpr_data_type_copy_fns.c \
base/data_type_support/gpr_data_type_print_fns.c \
base/data_type_support/gpr_data_type_release_fns.c \
base/data_type_support/gpr_data_type_size_fns.c \
base/data_type_support/gpr_data_type_packing_fns.c \
base/data_type_support/gpr_data_type_unpacking_fns.c \
base/unpack_api_response/gpr_base_unpack_cleanup.c \

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

@ -68,14 +68,14 @@
#include "opal/threads/condition.h"
#include "opal/class/opal_list.h"
#include "dps/dps_types.h"
#include "orte/dss/dss_types.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/base/mca_base_param.h"
#include "mca/rml/rml_types.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
#include "orte/mca/rml/rml_types.h"
#include "mca/gpr/gpr.h"
#include "orte/mca/gpr/gpr.h"
/*
* Global functions for MCA overall collective open and close
@ -110,6 +110,7 @@ extern "C" {
#define ORTE_GPR_CLEANUP_PROC_CMD (uint8_t) 21
#define ORTE_GPR_DUMP_A_TRIGGER_CMD (uint8_t) 22
#define ORTE_GPR_DUMP_A_SUBSCRIPTION_CMD (uint8_t) 23
#define ORTE_GPR_DUMP_SEGMENT_SIZE_CMD (uint8_t) 24
#define ORTE_GPR_ERROR (uint8_t)0xff
typedef uint8_t orte_gpr_cmd_flag_t;
@ -119,17 +120,26 @@ typedef uint8_t orte_gpr_cmd_flag_t;
OMPI_DECLSPEC int orte_gpr_base_select(void);
OMPI_DECLSPEC int orte_gpr_base_close(void);
int orte_gpr_base_create_value(orte_gpr_value_t **value,
orte_gpr_addr_mode_t addr_mode,
char *segment,
size_t cnt, /**< Number of keyval objects */
size_t num_tokens);
int orte_gpr_base_create_keyval(orte_gpr_keyval_t **keyval,
char *key,
orte_data_type_t type,
void *data);
OMPI_DECLSPEC int orte_gpr_base_put_1(orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens,
char *key, orte_data_type_t type,
orte_gpr_value_union_t value);
char *key, orte_data_value_t *value);
OMPI_DECLSPEC int orte_gpr_base_put_N(orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens,
size_t n, char **keys,
orte_data_type_t *types,
orte_gpr_value_union_t *data_values);
orte_data_value_t **data_values);
OMPI_DECLSPEC int orte_gpr_base_subscribe_1(orte_gpr_subscription_id_t *id,
char *trig_name,
@ -215,10 +225,10 @@ typedef uint8_t orte_gpr_cmd_flag_t;
orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys);
OMPI_DECLSPEC int orte_gpr_base_pack_get_conditional(orte_buffer_t *cmd,
orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys,
size_t num_conditions, orte_gpr_keyval_t **conditions);
orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys,
size_t num_conditions, orte_gpr_keyval_t **conditions);
OMPI_DECLSPEC int orte_gpr_base_unpack_get(orte_buffer_t *buffer, int *ret,
size_t *cnt, orte_gpr_value_t ***values);
@ -235,9 +245,9 @@ typedef uint8_t orte_gpr_cmd_flag_t;
orte_gpr_subscription_id_t id);
OMPI_DECLSPEC int orte_gpr_base_pack_dump_callbacks(orte_buffer_t *cmd);
OMPI_DECLSPEC int orte_gpr_base_print_dump(orte_buffer_t *buffer, int output_id);
OMPI_DECLSPEC void orte_gpr_base_dump_keyval_value(orte_buffer_t *buffer,
OMPI_DECLSPEC int orte_gpr_base_dump_keyval_value(orte_buffer_t *buffer,
orte_gpr_keyval_t *iptr);
OMPI_DECLSPEC int orte_gpr_base_pack_dump_segment_size(orte_buffer_t *cmd, char *segment);
OMPI_DECLSPEC int orte_gpr_base_dump_notify_msg(orte_buffer_t *buffer,
orte_gpr_notify_message_t *msg);
OMPI_DECLSPEC int orte_gpr_base_dump_notify_data(orte_buffer_t *buffer,
@ -339,10 +349,123 @@ int orte_gpr_base_unpack_notify_data(orte_buffer_t *buffer, void *dest,
int orte_gpr_base_unpack_notify_msg(orte_buffer_t *buffer, void *dest,
size_t *num_vals, orte_data_type_t type);
/* general utilities */
OMPI_DECLSPEC int orte_gpr_base_xfer_payload(orte_gpr_value_union_t *dest,
orte_gpr_value_union_t *src,
orte_data_type_t type);
/* GPR DATA TYPE RELEASE FUNCTIONS */
void orte_gpr_base_std_release(orte_data_value_t *value);
void orte_gpr_base_std_obj_release(orte_data_value_t *value);
/* GPR DATA TYPE COMPARE FUNCTIONS */
int orte_gpr_base_compare_cmd(orte_gpr_cmd_flag_t *value1,
orte_gpr_cmd_flag_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_subscription_id(orte_gpr_subscription_id_t *value1,
orte_gpr_subscription_id_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_trigger_id(orte_gpr_trigger_id_t *value1,
orte_gpr_trigger_id_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_notify_action(orte_gpr_notify_action_t *value1,
orte_gpr_notify_action_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_trigger_action(orte_gpr_trigger_action_t *value1,
orte_gpr_trigger_action_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_notify_msg_type(orte_gpr_notify_msg_type_t *value1,
orte_gpr_notify_msg_type_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_addr_mode(orte_gpr_addr_mode_t *value1,
orte_gpr_addr_mode_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_keyval(orte_gpr_keyval_t *value1,
orte_gpr_keyval_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_gpr_value(orte_gpr_value_t *value1,
orte_gpr_value_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_subscription(orte_gpr_subscription_t *value1,
orte_gpr_subscription_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_trigger(orte_gpr_trigger_t *value1,
orte_gpr_trigger_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_notify_data(orte_gpr_notify_data_t *value1,
orte_gpr_notify_data_t *value2,
orte_data_type_t type);
int orte_gpr_base_compare_notify_msg(orte_gpr_notify_message_t *value1,
orte_gpr_notify_message_t *value2,
orte_data_type_t type);
/* GPR DATA TYPE COPY FUNCTIONS */
int orte_gpr_base_copy_cmd(orte_gpr_cmd_flag_t **dest, orte_gpr_cmd_flag_t *src, orte_data_type_t type);
int orte_gpr_base_copy_subscription_id(orte_gpr_subscription_id_t **dest, orte_gpr_subscription_id_t *src, orte_data_type_t type);
int orte_gpr_base_copy_trigger_id(orte_gpr_trigger_id_t **dest, orte_gpr_trigger_id_t *src, orte_data_type_t type);
int orte_gpr_base_copy_notify_action(orte_gpr_notify_action_t **dest, orte_gpr_notify_action_t *src, orte_data_type_t type);
int orte_gpr_base_copy_trigger_action(orte_gpr_trigger_action_t **dest, orte_gpr_trigger_action_t *src, orte_data_type_t type);
int orte_gpr_base_copy_notify_msg_type(orte_gpr_notify_msg_type_t **dest, orte_gpr_notify_msg_type_t *src, orte_data_type_t type);
int orte_gpr_base_copy_addr_mode(orte_gpr_addr_mode_t **dest, orte_gpr_addr_mode_t *src, orte_data_type_t type);
int orte_gpr_base_copy_keyval(orte_gpr_keyval_t **dest, orte_gpr_keyval_t *src, orte_data_type_t type);
int orte_gpr_base_copy_gpr_value(orte_gpr_value_t **dest, orte_gpr_value_t *src, orte_data_type_t type);
int orte_gpr_base_copy_subscription(orte_gpr_subscription_t **dest, orte_gpr_subscription_t *src, orte_data_type_t type);
int orte_gpr_base_copy_trigger(orte_gpr_trigger_t **dest, orte_gpr_trigger_t *src, orte_data_type_t type);
int orte_gpr_base_copy_notify_data(orte_gpr_notify_data_t **dest, orte_gpr_notify_data_t *src, orte_data_type_t type);
int orte_gpr_base_copy_notify_msg(orte_gpr_notify_message_t **dest, orte_gpr_notify_message_t *src, orte_data_type_t type);
/* GPR DATA TYPE SIZE FUNCTIONS */
int orte_gpr_base_std_size(size_t *size, void *src, orte_data_type_t type);
int orte_gpr_base_size_keyval(size_t *size, orte_gpr_keyval_t *src, orte_data_type_t type);
int orte_gpr_base_size_gpr_value(size_t *size, orte_gpr_value_t *src, orte_data_type_t type);
int orte_gpr_base_size_subscription(size_t *size, orte_gpr_subscription_t *src, orte_data_type_t type);
int orte_gpr_base_size_trigger(size_t *size, orte_gpr_trigger_t *src, orte_data_type_t type);
int orte_gpr_base_size_notify_data(size_t *size, orte_gpr_notify_data_t *src, orte_data_type_t type);
int orte_gpr_base_size_notify_msg(size_t *size, orte_gpr_notify_message_t *src, orte_data_type_t type);
/* GPR DATA TYPE PRINT FUNCTIONS */
int orte_gpr_base_std_print(char **output, char *prefix, void *src, orte_data_type_t type);
int orte_gpr_base_print_keyval(char **output, char *prefix, orte_gpr_keyval_t *src, orte_data_type_t type);
int orte_gpr_base_print_gpr_value(char **output, char *prefix, orte_gpr_value_t *value, orte_data_type_t type);
int orte_gpr_base_print_subscription(char **output, char *prefix, orte_gpr_subscription_t *sub, orte_data_type_t type);
int orte_gpr_base_print_trigger(char **output, char *prefix, orte_gpr_trigger_t *trig, orte_data_type_t type);
int orte_gpr_base_print_notify_data(char **output, char *prefix, orte_gpr_notify_data_t *data, orte_data_type_t type);
int orte_gpr_base_print_notify_msg(char **output, char *prefix, orte_gpr_notify_message_t *msg, orte_data_type_t type);
/*
* globals that might be needed inside the gpr

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

@ -0,0 +1,173 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/include/orte_constants.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
/*
* NUMERIC COMPARE FUNCTIONS
*/
int orte_gpr_base_compare_cmd(orte_gpr_cmd_flag_t *value1,
orte_gpr_cmd_flag_t *value2,
orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_gpr_base_compare_subscription_id(orte_gpr_subscription_id_t *value1,
orte_gpr_subscription_id_t *value2,
orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_gpr_base_compare_trigger_id(orte_gpr_trigger_id_t *value1,
orte_gpr_trigger_id_t *value2,
orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_gpr_base_compare_notify_action(orte_gpr_notify_action_t *value1,
orte_gpr_notify_action_t *value2,
orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_gpr_base_compare_trigger_action(orte_gpr_trigger_action_t *value1,
orte_gpr_trigger_action_t *value2,
orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_gpr_base_compare_notify_msg_type(orte_gpr_notify_msg_type_t *value1,
orte_gpr_notify_msg_type_t *value2,
orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
int orte_gpr_base_compare_addr_mode(orte_gpr_addr_mode_t *value1,
orte_gpr_addr_mode_t *value2,
orte_data_type_t type)
{
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
return ORTE_EQUAL;
}
/* NON-NUMERIC COMPARE FUNCTIONS */
int orte_gpr_base_compare_keyval(orte_gpr_keyval_t *value1,
orte_gpr_keyval_t *value2,
orte_data_type_t type)
{
int rc;
/* check to see if the keys are the same */
if (0 != (rc = strcmp(value1->key, value2->key))) {
if (0 < rc) return ORTE_VALUE1_GREATER;
return ORTE_VALUE2_GREATER;
}
/* okay, keys are the same - compare the values using their native comparators */
return orte_dss.compare(value1->value, value2->value, ORTE_DATA_VALUE);
}
int orte_gpr_base_compare_gpr_value(orte_gpr_value_t *value1,
orte_gpr_value_t *value2,
orte_data_type_t type)
{
/* no real way to do this right now */
ORTE_ERROR_LOG(ORTE_ERR_COMPARE_FAILURE);
return ORTE_EQUAL;
}
int orte_gpr_base_compare_subscription(orte_gpr_subscription_t *value1,
orte_gpr_subscription_t *value2,
orte_data_type_t type)
{
/* no real way to do this right now */
ORTE_ERROR_LOG(ORTE_ERR_COMPARE_FAILURE);
return ORTE_EQUAL;
}
int orte_gpr_base_compare_trigger(orte_gpr_trigger_t *value1,
orte_gpr_trigger_t *value2,
orte_data_type_t type)
{
/* no real way to do this right now */
ORTE_ERROR_LOG(ORTE_ERR_COMPARE_FAILURE);
return ORTE_EQUAL;
}
int orte_gpr_base_compare_notify_data(orte_gpr_notify_data_t *value1,
orte_gpr_notify_data_t *value2,
orte_data_type_t type)
{
/* no real way to do this right now */
ORTE_ERROR_LOG(ORTE_ERR_COMPARE_FAILURE);
return ORTE_EQUAL;
}
int orte_gpr_base_compare_notify_msg(orte_gpr_notify_message_t *value1,
orte_gpr_notify_message_t *value2,
orte_data_type_t type)
{
/* no real way to do this right now */
ORTE_ERROR_LOG(ORTE_ERR_COMPARE_FAILURE);
return ORTE_EQUAL;
}

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

@ -0,0 +1,398 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
/*
* COPY FUNCTIONS FOR EVERYTHING NON-STRUCTURED
*/
int orte_gpr_base_copy_cmd(orte_gpr_cmd_flag_t **dest, orte_gpr_cmd_flag_t *src, orte_data_type_t type)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)dest, (void*)src, ORTE_GPR_CMD_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
return ORTE_SUCCESS;
}
int orte_gpr_base_copy_subscription_id(orte_gpr_subscription_id_t **dest, orte_gpr_subscription_id_t *src, orte_data_type_t type)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)dest, (void*)src, ORTE_GPR_SUBSCRIPTION_ID_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
return ORTE_SUCCESS;
}
int orte_gpr_base_copy_trigger_id(orte_gpr_trigger_id_t **dest, orte_gpr_trigger_id_t *src, orte_data_type_t type)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)dest, (void*)src, ORTE_GPR_TRIGGER_ID_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
return ORTE_SUCCESS;
}
int orte_gpr_base_copy_notify_action(orte_gpr_notify_action_t **dest, orte_gpr_notify_action_t *src, orte_data_type_t type)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)dest, (void*)src, ORTE_GPR_NOTIFY_ACTION_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
return ORTE_SUCCESS;
}
int orte_gpr_base_copy_trigger_action(orte_gpr_trigger_action_t **dest, orte_gpr_trigger_action_t *src, orte_data_type_t type)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)dest, (void*)src, ORTE_GPR_TRIGGER_ACTION_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
return ORTE_SUCCESS;
}
int orte_gpr_base_copy_notify_msg_type(orte_gpr_notify_msg_type_t **dest, orte_gpr_notify_msg_type_t *src, orte_data_type_t type)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)dest, (void*)src, ORTE_GPR_NOTIFY_MSG_TYPE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
return ORTE_SUCCESS;
}
int orte_gpr_base_copy_addr_mode(orte_gpr_addr_mode_t **dest, orte_gpr_addr_mode_t *src, orte_data_type_t type)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)dest, (void*)src, ORTE_GPR_ADDR_MODE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
return ORTE_SUCCESS;
}
/* COPY FUNCTIONS FOR COMPLEX TYPES */
/* KEYVAL */
int orte_gpr_base_copy_keyval(orte_gpr_keyval_t **dest, orte_gpr_keyval_t *src, orte_data_type_t type)
{
orte_gpr_keyval_t *kval;
int rc;
/* create the new object */
kval = OBJ_NEW(orte_gpr_keyval_t);
if (NULL == kval) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
kval->value = OBJ_NEW(orte_data_value_t);
if (NULL == kval->value) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (NULL != src->key) {
kval->key = strdup(src->key);
}
/* if there is data in the src, copy it */
if (NULL != src->value) {
kval->value->type = src->value->type;
/* copy the data itself - use the appropriate copy function here */
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)&(kval->value->data), src->value->data, src->value->type))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(kval);
*dest = NULL;
return rc;
}
}
*dest = kval;
return ORTE_SUCCESS;
}
/* VALUE */
int orte_gpr_base_copy_gpr_value(orte_gpr_value_t **dest, orte_gpr_value_t *src, orte_data_type_t type)
{
int rc;
orte_gpr_keyval_t **kvals;
char **tokens;
size_t i;
/* create the new object */
*dest = OBJ_NEW(orte_gpr_value_t);
if (NULL == *dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* copy the data into it */
(*dest)->addr_mode = src->addr_mode;
if (NULL != src->segment) {
(*dest)->segment = strdup(src->segment);
}
(*dest)->cnt = src->cnt;
;
/* copy the keyvals - use the appropriate copy function here */
if (0 < src->cnt) {
kvals = (orte_gpr_keyval_t**)malloc(src->cnt * sizeof(orte_gpr_keyval_t*)); /* allocate space for the pointers */
if (NULL == kvals) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_RELEASE(*dest);
return ORTE_ERR_OUT_OF_RESOURCE;
}
(*dest)->keyvals = kvals;
for (i=0; i < src->cnt; i++) {
if (ORTE_SUCCESS != (rc = orte_gpr_base_copy_keyval(&kvals[i],
src->keyvals[i], ORTE_GPR_KEYVAL))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(*dest);
return rc;
}
}
}
(*dest)->num_tokens = src->num_tokens;
/* copy the tokens - use the appropriate copy function here */
if (0 < src->num_tokens) {
tokens = (char**)malloc(src->num_tokens * sizeof(char*)); /* allocate space for the pointers */
if (NULL == tokens) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_RELEASE(*dest);
return ORTE_ERR_OUT_OF_RESOURCE;
}
(*dest)->tokens = tokens;
for (i=0; i < src->num_tokens; i++) {
tokens[i] = strdup(src->tokens[i]);
}
}
return ORTE_SUCCESS;
}
/* SUBSCRIPTION */
int orte_gpr_base_copy_subscription(orte_gpr_subscription_t **dest, orte_gpr_subscription_t *src, orte_data_type_t type)
{
size_t i;
orte_gpr_value_t **values;
int rc;
/* create the new object */
*dest = OBJ_NEW(orte_gpr_subscription_t);
if (NULL == *dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (NULL != src->name) {
(*dest)->name = strdup(src->name);
}
(*dest)->id = src->id;
(*dest)->action = src->action;
(*dest)->cnt = src->cnt;
/* copy the values - use the appropriate copy function here */
if (0 < src->cnt) {
values = (orte_gpr_value_t**)malloc(src->cnt * sizeof(orte_gpr_value_t*));
if (NULL == values) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_RELEASE(*dest);
return ORTE_ERR_OUT_OF_RESOURCE;
}
(*dest)->values = values;
for (i=0; i < src->cnt; i++) {
if (ORTE_SUCCESS != (rc = orte_gpr_base_copy_gpr_value(&values[i], src->values[i], ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(*dest);
return rc;
}
}
}
(*dest)->cbfunc = src->cbfunc;
(*dest)->user_tag = src->user_tag;
return ORTE_SUCCESS;
}
/* TRIGGER */
int orte_gpr_base_copy_trigger(orte_gpr_trigger_t **dest, orte_gpr_trigger_t *src, orte_data_type_t type)
{
size_t i;
orte_gpr_value_t **values;
int rc;
/* create the new object */
*dest = OBJ_NEW(orte_gpr_trigger_t);
if (NULL == *dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (NULL != src->name) {
(*dest)->name = strdup(src->name);
}
(*dest)->id = src->id;
(*dest)->action = src->action;
(*dest)->cnt = src->cnt;
/* copy the values - use the appropriate copy function here */
if (0 < src->cnt) {
values = (orte_gpr_value_t**)malloc(src->cnt * sizeof(orte_gpr_value_t*));
if (NULL == values) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_RELEASE(*dest);
return ORTE_ERR_OUT_OF_RESOURCE;
}
(*dest)->values = values;
for (i=0; i < src->cnt; i++) {
if (ORTE_SUCCESS != (rc = orte_gpr_base_copy_gpr_value(&values[i], src->values[i], ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(*dest);
return rc;
}
}
}
(*dest)->cbfunc = src->cbfunc;
(*dest)->user_tag = src->user_tag;
return ORTE_SUCCESS;
}
/* NOTIFY DATA */
int orte_gpr_base_copy_notify_data(orte_gpr_notify_data_t **dest, orte_gpr_notify_data_t *src, orte_data_type_t type)
{
size_t j, k, index;
orte_gpr_value_t **val, *ptr;
int rc;
/* create the new object */
*dest = OBJ_NEW(orte_gpr_notify_data_t);
if (NULL == *dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* copy the data to it */
if (NULL != src->target) {
(*dest)->target = strdup(src->target);
}
(*dest)->id = src->id;
(*dest)->remove = src->remove;
(*dest)->cnt = src->cnt;
/* copy the values */
val = (orte_gpr_value_t**)(src->values)->addr;
for (j=0, k=0; j < src->cnt &&
k < (src->values)->size; k++) {
if (NULL != val[k]) {
j++;
/* copy the value object */
if (ORTE_SUCCESS != (rc = orte_gpr_base_copy_gpr_value(&ptr, val[k], ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(*dest);
return rc;
}
/* ...and add it to the pointer array */
if (ORTE_SUCCESS != (rc = orte_pointer_array_add(&index, (*dest)->values, ptr))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(*dest);
return rc;
}
}
}
return ORTE_SUCCESS;
}
/* NOTIFY MSG */
int orte_gpr_base_copy_notify_msg(orte_gpr_notify_message_t **dest, orte_gpr_notify_message_t *src, orte_data_type_t type)
{
size_t j, k, index;
orte_gpr_notify_data_t **val, *ptr;
int rc;
/* create the new object */
*dest = OBJ_NEW(orte_gpr_notify_message_t);
if (NULL == *dest) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
(*dest)->msg_type = src->msg_type;
if (NULL != src->target) {
(*dest)->target = strdup(src->target);
}
(*dest)->id = src->id;
(*dest)->remove = src->remove;
(*dest)->cnt = src->cnt;
/* copy the notify data entries */
val = (orte_gpr_notify_data_t**)(src->data)->addr;
for (j=0, k=0; j < src->cnt &&
k < (src->data)->size; k++) {
if (NULL != val[k]) {
j++;
/* copy the data object */
if (ORTE_SUCCESS != (rc = orte_gpr_base_copy_notify_data(&ptr, val[k], ORTE_GPR_NOTIFY_DATA))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(*dest);
return rc;
}
/* ...and add it to the pointer array */
if (ORTE_SUCCESS != (rc = orte_pointer_array_add(&index, (*dest)->data, ptr))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(*dest);
return rc;
}
}
}
return ORTE_SUCCESS;
}

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

@ -26,7 +26,7 @@
#include "opal/util/trace.h"
#include "mca/errmgr/errmgr.h"
#include "dps/dps_internal.h"
#include "dss/dss_internal.h"
#include "mca/gpr/base/base.h"
@ -39,8 +39,8 @@ int orte_gpr_base_pack_cmd(orte_buffer_t *buffer, void *src,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, src, num_vals, ORTE_GPR_CMD_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, src, num_vals, ORTE_GPR_CMD_T))) {
ORTE_ERROR_LOG(rc);
}
@ -56,8 +56,8 @@ int orte_gpr_base_pack_subscription_id(orte_buffer_t *buffer, void *src,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, src, num_vals, ORTE_GPR_SUBSCRIPTION_ID_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, src, num_vals, ORTE_GPR_SUBSCRIPTION_ID_T))) {
ORTE_ERROR_LOG(rc);
}
@ -73,8 +73,8 @@ int orte_gpr_base_pack_trigger_id(orte_buffer_t *buffer, void *src,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, src, num_vals, ORTE_GPR_TRIGGER_ID_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, src, num_vals, ORTE_GPR_TRIGGER_ID_T))) {
ORTE_ERROR_LOG(rc);
}
@ -90,8 +90,8 @@ int orte_gpr_base_pack_notify_action(orte_buffer_t *buffer, void *src,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, src, num_vals, ORTE_GPR_NOTIFY_ACTION_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, src, num_vals, ORTE_GPR_NOTIFY_ACTION_T))) {
ORTE_ERROR_LOG(rc);
}
@ -107,8 +107,8 @@ int orte_gpr_base_pack_trigger_action(orte_buffer_t *buffer, void *src,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, src, num_vals, ORTE_GPR_TRIGGER_ACTION_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, src, num_vals, ORTE_GPR_TRIGGER_ACTION_T))) {
ORTE_ERROR_LOG(rc);
}
@ -124,8 +124,8 @@ int orte_gpr_base_pack_addr_mode(orte_buffer_t *buffer, void *src,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, src, num_vals, ORTE_GPR_ADDR_MODE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, src, num_vals, ORTE_GPR_ADDR_MODE_T))) {
ORTE_ERROR_LOG(rc);
}
@ -141,8 +141,8 @@ int orte_gpr_base_pack_notify_msg_type(orte_buffer_t *buffer, void *src,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, src, num_vals, ORTE_GPR_NOTIFY_MSG_TYPE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, src, num_vals, ORTE_GPR_NOTIFY_MSG_TYPE_T))) {
ORTE_ERROR_LOG(rc);
}
@ -159,33 +159,33 @@ int orte_gpr_base_pack_keyval(orte_buffer_t *buffer, void *src,
int rc;
orte_gpr_keyval_t **keyval;
size_t i;
char null=0x00;
OPAL_TRACE(4);
/* array of pointers to keyval objects - need to pack the
objects */
keyval = (orte_gpr_keyval_t**) src;
for (i=0; i < num_vals; i++) {
/* pack the key */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(keyval[i]->key)), 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the data type so we can read it for unpacking */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, &(keyval[i]->type), 1,
ORTE_DATA_TYPE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the value */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, &(keyval[i]->value), 1,
keyval[i]->type))) {
ORTE_ERROR_LOG(rc);
return rc;
/* if there is a data value, then pack it */
if (NULL != keyval[i]->value) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, &(keyval[i]->value), 1, ORTE_DATA_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
} else { /* otherwise, pack a NULL so we know not to unpack one */
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, &null, 1, ORTE_NULL))) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
}
@ -203,34 +203,34 @@ int orte_gpr_base_pack_value(orte_buffer_t *buffer, void *src,
size_t i;
OPAL_TRACE(4);
/* array of pointers to value objects - need to pack the objects */
values = (orte_gpr_value_t**) src;
for (i=0; i<num_vals; i++) {
/* pack the address mode */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(values[i]->addr_mode)), 1, ORTE_GPR_ADDR_MODE))) {
ORTE_ERROR_LOG(rc);
return ORTE_ERROR;
}
/* pack the segment name */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(values[i]->segment)), 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return ORTE_ERROR;
}
/* pack the number of tokens so we can read it for unpacking */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
(void*)(&(values[i]->num_tokens)), 1, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(values[i]->num_tokens)), 1, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return ORTE_ERROR;
}
/* if there are tokens, pack them */
if (0 < values[i]->num_tokens) {
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)((values[i]->tokens)), values[i]->num_tokens, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return ORTE_ERROR;
@ -238,16 +238,16 @@ int orte_gpr_base_pack_value(orte_buffer_t *buffer, void *src,
}
/* pack the number of keyval pairs so we can read it for unpacking */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
(void*)(&(values[i]->cnt)), 1, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(values[i]->cnt)), 1, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return ORTE_ERROR;
}
/* if there are keyval pairs, pack them */
if (0 < values[i]->cnt) {
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
(void*)((values[i]->keyvals)), values[i]->cnt, ORTE_KEYVAL))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)((values[i]->keyvals)), values[i]->cnt, ORTE_GPR_KEYVAL))) {
ORTE_ERROR_LOG(rc);
return ORTE_ERROR;
}
@ -268,41 +268,41 @@ int orte_gpr_base_pack_subscription(orte_buffer_t *buffer, void *src,
size_t i;
OPAL_TRACE(4);
/* array of pointers to subscription objects - need to pack the objects */
subs = (orte_gpr_subscription_t**) src;
for (i=0; i<num_vals; i++) {
/* pack the subscription name */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(subs[i]->name)), 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the subscription id */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(subs[i]->id)), 1, ORTE_GPR_SUBSCRIPTION_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the notify action */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(subs[i]->action)), 1, ORTE_GPR_NOTIFY_ACTION))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the number of values so we can read it for unpacking */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
(void*)(&(subs[i]->cnt)), 1, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(subs[i]->cnt)), 1, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* if there are values, pack them */
if (0 < subs[i]->cnt) {
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)((subs[i]->values)), subs[i]->cnt, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
@ -326,41 +326,41 @@ int orte_gpr_base_pack_trigger(orte_buffer_t *buffer, void *src,
size_t i;
OPAL_TRACE(4);
/* array of pointers to trigger objects - need to pack the objects */
trigs = (orte_gpr_trigger_t**) src;
for (i=0; i<num_vals; i++) {
/* pack the trigger name */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(trigs[i]->name)), 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the trigger id */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(trigs[i]->id)), 1, ORTE_GPR_TRIGGER_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the trigger action */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(trigs[i]->action)), 1, ORTE_GPR_TRIGGER_ACTION))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the number of values so we can read it for unpacking */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
(void*)(&(trigs[i]->cnt)), 1, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(trigs[i]->cnt)), 1, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* if there are values, pack the values */
if (0 < trigs[i]->cnt) {
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)((trigs[i]->values)), trigs[i]->cnt, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
@ -383,36 +383,36 @@ int orte_gpr_base_pack_notify_data(orte_buffer_t *buffer, void *src,
size_t i, j, k;
OPAL_TRACE(4);
/* array of pointers to notify data objects - need to pack the objects */
data = (orte_gpr_notify_data_t**) src;
for (i=0; i<num_vals; i++) {
/* pack the subscription name */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(data[i]->target)), 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the subscription number */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(data[i]->id)), 1, ORTE_GPR_SUBSCRIPTION_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the remove flag */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(data[i]->remove)), 1, ORTE_BOOL))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the number of values so we can read it for unpacking */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
(void*)(&(data[i]->cnt)), 1, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(data[i]->cnt)), 1, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -424,7 +424,7 @@ int orte_gpr_base_pack_notify_data(orte_buffer_t *buffer, void *src,
j < (data[i]->values)->size; j++) {
if (NULL != values[j]) {
k++;
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, &values[j],
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, &values[j],
1, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
@ -450,43 +450,43 @@ int orte_gpr_base_pack_notify_msg(orte_buffer_t *buffer, void *src,
size_t i, j, k;
OPAL_TRACE(4);
/* array of messages */
msg = (orte_gpr_notify_message_t**) src;
for (i=0; i<num_vals; i++) {
/* pack the message type */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(msg[i]->msg_type)), 1, ORTE_GPR_NOTIFY_MSG_TYPE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the trigger name */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(msg[i]->target)), 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the trigger number */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(msg[i]->id)), 1, ORTE_GPR_TRIGGER_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the remove flag */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(msg[i]->remove)), 1, ORTE_BOOL))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack the number of datagrams so we can read it for unpacking */
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer,
(void*)(&(msg[i]->cnt)), 1, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer,
(void*)(&(msg[i]->cnt)), 1, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -504,7 +504,7 @@ int orte_gpr_base_pack_notify_msg(orte_buffer_t *buffer, void *src,
j < (msg[i]->data)->size; j++) {
if (NULL != data[j]) {
k++;
if (ORTE_SUCCESS != (rc = orte_dps_pack_buffer(buffer, &(data[j]),
if (ORTE_SUCCESS != (rc = orte_dss_pack_buffer(buffer, &(data[j]),
1, ORTE_GPR_NOTIFY_DATA))) {
ORTE_ERROR_LOG(rc);
return rc;

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

@ -0,0 +1,568 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
static void orte_gpr_base_quick_print(char **output, char *type_name, char *prefix, void *src, size_t src_size);
/*
* STANDARD PRINT FUNCTION - WORKS FOR EVERYTHING NON-STRUCTURED
*/
int orte_gpr_base_std_print(char **output, char *prefix, void *src, orte_data_type_t type)
{
/* set default result */
*output = NULL;
switch(type) {
case ORTE_GPR_CMD:
orte_gpr_base_quick_print(output, "ORTE_GPR_CMD", prefix, src, sizeof(orte_gpr_cmd_flag_t));
break;
case ORTE_GPR_SUBSCRIPTION_ID:
orte_gpr_base_quick_print(output, "ORTE_GPR_SUBSCRIPTION_ID", prefix, src, sizeof(orte_gpr_subscription_id_t));
break;
case ORTE_GPR_TRIGGER_ID:
orte_gpr_base_quick_print(output, "ORTE_GPR_TRIGGER_ID", prefix, src, sizeof(orte_gpr_trigger_id_t));
break;
case ORTE_GPR_NOTIFY_ACTION:
orte_gpr_base_quick_print(output, "ORTE_GPR_NOTIFY_ACTION", prefix, src, sizeof(orte_gpr_notify_action_t));
break;
case ORTE_GPR_TRIGGER_ACTION:
orte_gpr_base_quick_print(output, "ORTE_GPR_TRIGGER_ACTION", prefix, src, sizeof(orte_gpr_trigger_action_t));
break;
case ORTE_GPR_NOTIFY_MSG_TYPE:
orte_gpr_base_quick_print(output, "ORTE_GPR_NOTIFY_MSG_TYPE", prefix, src, sizeof(orte_gpr_notify_msg_type_t));
break;
case ORTE_GPR_ADDR_MODE:
orte_gpr_base_quick_print(output, "ORTE_GPR_ADDR_MODE", prefix, src, sizeof(orte_gpr_addr_mode_t));
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_UNKNOWN_DATA_TYPE);
return ORTE_ERR_UNKNOWN_DATA_TYPE;
}
return ORTE_SUCCESS;
}
/* PRINT FUNCTIONS FOR COMPLEX TYPES */
/* KEYVAL */
int orte_gpr_base_print_keyval(char **output, char *prefix, orte_gpr_keyval_t *src, orte_data_type_t type)
{
char *tmp, *tmp2, *pfx, *prefx;
int rc;
/* set default result */
*output = NULL;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
if (NULL == src->key) {
asprintf(&tmp, "%sData for keyval: NULL key\n", prefx);
} else {
asprintf(&tmp, "%sData for keyval: Key: %s\n", prefx, src->key);
}
asprintf(&pfx, "%s\t", prefx);
if (ORTE_SUCCESS != (rc = orte_dss.print(&tmp2, pfx, src->value, ORTE_DATA_VALUE))) {
ORTE_ERROR_LOG(rc);
free(pfx);
free(tmp);
return rc;
}
asprintf(output, "%s%s\n", tmp, tmp2);
free(pfx);
free(tmp);
free(tmp2);
return ORTE_SUCCESS;
}
/* VALUE */
int orte_gpr_base_print_gpr_value(char **output, char *prefix, orte_gpr_value_t *value, orte_data_type_t type)
{
orte_gpr_addr_mode_t addr;
char *tmp, *tmp2, *tmp3, *pfx, *prefx;
size_t j;
int rc;
/* set default result */
*output = NULL;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
if (NULL == value->segment) {
asprintf(&tmp, "%sValue from NULL segment name - %lu keyvals",
prefx, (unsigned long) value->cnt);
} else {
asprintf(&tmp, "%sValue from segment %s with %lu keyvals",
prefx, value->segment, (unsigned long) value->cnt);
}
if (NULL == value->tokens) {
asprintf(&tmp2, "%s\n%s\tNULL tokens (wildcard)", tmp, prefx);
free(tmp);
} else {
asprintf(&tmp2, "%s\n%s\t%lu Tokens returned", tmp, prefx, (unsigned long) value->num_tokens);
free(tmp);
for (j=0; j < value->num_tokens; j++) {
if (NULL == value->tokens[j]) {
asprintf(&tmp, "%s\n%s\t\tToken %lu: NULL token pointer", tmp2, prefx, (unsigned long) j);
} else {
asprintf(&tmp, "%s\n%s\t\tToken %lu: %s", tmp2, prefx, (unsigned long) j, value->tokens[j]);
}
free(tmp2);
tmp2 = tmp;
}
}
addr = value->addr_mode;
asprintf(&tmp, "%s\n%s\tToken addressing mode:", tmp2, prefx);
free(tmp2);
if (0x0000 == (0x00ff & addr)) {
asprintf(&tmp2, "%s\n%s\t\tNONE\n", tmp, prefx);
free(tmp);
tmp = tmp2;
} else {
if (ORTE_GPR_TOKENS_AND & addr) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TOKENS_AND", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_TOKENS_OR & addr) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TOKENS_OR", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_TOKENS_XAND & addr) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TOKENS_XAND", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_TOKENS_XOR & addr) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TOKENS_XOR", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_TOKENS_NOT & addr) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TOKENS_NOT", tmp, prefx);
free(tmp);
tmp = tmp2;
}
}
asprintf(&tmp2, "%s\n%s\tKey addressing mode:", tmp, prefx);
free(tmp);
tmp = tmp2;
if (0x0000 == (0xff00 & addr)) {
asprintf(&tmp2, "%s\n%s\t\tNONE\n", tmp, prefx);
free(tmp);
tmp = tmp2;
} else {
if (ORTE_GPR_KEYS_AND & addr) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_KEYS_AND", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_KEYS_OR & addr) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_KEYS_OR", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_KEYS_XAND & addr) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_KEYS_XAND", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_KEYS_XOR & addr) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_KEYS_XOR", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_KEYS_NOT & addr) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_KEYS_NOT", tmp, prefx);
free(tmp);
tmp = tmp2;
}
}
/* indent another level for keyvals */
asprintf(&pfx, "%s\t", prefx);
for (j=0; j < value->cnt; j++) {
if (ORTE_SUCCESS != (rc = orte_gpr_base_print_keyval(&tmp2, pfx,
(void*)(value->keyvals[j]), ORTE_GPR_KEYVAL))) {
ORTE_ERROR_LOG(rc);
free(tmp);
free(pfx);
return rc;
}
asprintf(&tmp3, "%s\n%s", tmp, tmp2);
free(tmp);
free(tmp2);
tmp = tmp3;
}
/* put results in final location */
*output = tmp;
return ORTE_SUCCESS;
}
/* SUBSCRIPTION */
int orte_gpr_base_print_subscription(char **output, char *prefix, orte_gpr_subscription_t *sub, orte_data_type_t type)
{
int rc;
char *tmp, *tmp2, *tmp3, *pfx, *prefx;
size_t j;
/* set default result */
*output = NULL;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
if (NULL == sub->name) {
asprintf(&tmp, "%sSubscription - NO NAME\tid: %lu", prefx, (unsigned long) sub->id);
} else {
asprintf(&tmp, "%sSubscription - Name: %s\tid: %lu", prefx, sub->name, (unsigned long) sub->id);
}
asprintf(&tmp2, "%s\n%s\tAction flags:", tmp, prefx);
free(tmp);
tmp = tmp2;
if (ORTE_GPR_NOTIFY_NONE == sub->action) {
asprintf(&tmp2, "%s\n%s\t\tNONE\n", tmp, prefx);
free(tmp);
tmp = tmp2;
} else {
if (ORTE_GPR_NOTIFY_VALUE_CHG_TO & sub->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_VALUE_CHG_TO", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_NOTIFY_VALUE_CHG_FRM & sub->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_VALUE_CHG_FRM", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_NOTIFY_ADD_ENTRY & sub->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_ADD_ENTRY", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_NOTIFY_DEL_ENTRY & sub->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_DEL_ENTRY", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_NOTIFY_PRE_EXISTING & sub->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_PRE_EXISTING", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_NOTIFY_STARTS_AFTER_TRIG & sub->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_STARTS_AFTER_TRIG", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_NOTIFY_DELETE_AFTER_TRIG & sub->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_DELETE_AFTER_TRIG", tmp, prefx);
free(tmp);
tmp = tmp2;
}
}
/* indent another level for values */
asprintf(&pfx, "%s\t", prefx);
for (j=0; j < sub->cnt; j++) {
if (ORTE_SUCCESS != (rc = orte_gpr_base_print_gpr_value(&tmp2, pfx, (void*)(sub->values[j]), ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
free(tmp);
free(pfx);
return rc;
}
asprintf(&tmp3, "%s\n%s", tmp, tmp2);
free(tmp);
free(tmp2);
tmp = tmp3;
}
/* put results in final location */
*output = tmp;
return ORTE_SUCCESS;
}
/* TRIGGER */
int orte_gpr_base_print_trigger(char **output, char *prefix, orte_gpr_trigger_t *trig, orte_data_type_t type)
{
int rc;
char *tmp, *tmp2, *tmp3, *pfx, *prefx;
size_t j;
/* set default result */
*output = NULL;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
if (NULL == trig->name) {
asprintf(&tmp, "%sTrigger - NO NAME\tid: %lu", prefx, (unsigned long) trig->id);
} else {
asprintf(&tmp, "%sTrigger - Name: %s\tid: %lu", prefx, trig->name, (unsigned long) trig->id);
}
asprintf(&tmp2, "%s\n%s\tAction flags:", tmp, prefx);
free(tmp);
tmp = tmp2;
if (0x00 == trig->action) {
asprintf(&tmp2, "%s\n%s\t\tNONE\n", tmp, prefx);
free(tmp);
tmp = tmp2;
} else {
if (ORTE_GPR_TRIG_INCLUDE_TRIG_CNTRS & trig->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TRIG_INCLUDE_TRIG_CNTRS", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_TRIG_ONE_SHOT & trig->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TRIG_ONE_SHOT", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_TRIG_ROUTE_DATA_THRU_ME & trig->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TRIG_ROUTE_DATA_THRU_ME", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_TRIG_AT_LEVEL & trig->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TRIG_AT_LEVEL", tmp, prefx);
free(tmp);
tmp = tmp2;
}
if (ORTE_GPR_TRIG_CMP_LEVELS & trig->action) {
asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TRIG_CMP_LEVELS", tmp, prefx);
free(tmp);
tmp = tmp2;
}
}
/* indent another level for values */
asprintf(&pfx, "%s\t", prefx);
for (j=0; j < trig->cnt; j++) {
if (ORTE_SUCCESS != (rc = orte_gpr_base_print_gpr_value(&tmp2, pfx, (void*)(trig->values[j]), ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
free(tmp);
free(pfx);
return rc;
}
asprintf(&tmp3, "%s\n%s", tmp, tmp2);
free(tmp);
free(tmp2);
tmp = tmp3;
}
/* put results in final location */
*output = tmp;
return ORTE_SUCCESS;
}
/* NOTIFY DATA */
int orte_gpr_base_print_notify_data(char **output, char *prefix, orte_gpr_notify_data_t *data, orte_data_type_t type)
{
char *tmp, *tmp2, *tmp3, *pfx, *prefx;
size_t i, j;
orte_gpr_value_t **values;
int rc;
/* set default result */
*output = NULL;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
if (NULL != data->target) {
asprintf(&tmp, "%sNotify Data: %lu values going to subscription target %s", prefx,
(unsigned long) data->cnt, data->target);
} else {
asprintf(&tmp, "%sNotify Data: %lu values going to subscription num %lu", prefx,
(unsigned long) data->cnt, (unsigned long) data->id);
}
values = (orte_gpr_value_t**)(data->values)->addr;
if (0 < data->cnt) {
/* indent another level for values */
asprintf(&pfx, "%s\t", prefx);
for (i=0, j=0; j < data->cnt &&
i < (data->values)->size; i++) {
if (NULL != values[i]) {
j++;
if (ORTE_SUCCESS != (rc = orte_gpr_base_print_gpr_value(&tmp2, pfx, (void*)values[i], ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
free(tmp);
return rc;
}
asprintf(&tmp3, "%s\n%s", tmp, tmp2);
free(tmp2);
tmp = tmp3;
}
}
}
/* put results in final location */
*output = tmp;
return ORTE_SUCCESS;
}
/* NOTIFY MSG */
int orte_gpr_base_print_notify_msg(char **output, char *prefix, orte_gpr_notify_message_t *msg, orte_data_type_t type)
{
char *tmp, *tmp2, *tmp3, *pfx, *prefx;
size_t i, j;
orte_gpr_notify_data_t **data;
int rc;
/* set default result */
*output = NULL;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
if (ORTE_GPR_TRIGGER_MSG == msg->msg_type) {
asprintf(&tmp, "%sTRIGGER message", prefx);
} else if (ORTE_GPR_SUBSCRIPTION_MSG == msg->msg_type) {
asprintf(&tmp, "%sSUBSCRIPTION message", prefx);
}
if (NULL == msg->target) {
asprintf(&tmp2, "%s\n%s\tTrigger target: NULL", tmp, prefx);
} else {
asprintf(&tmp2, "%s\n%s\tTrigger target: %s", tmp, prefx, msg->target);
}
free(tmp);
asprintf(&tmp, "%s\n%s\tTrigger id: %lu", tmp2, prefx, (unsigned long)msg->id);
free(tmp2);
asprintf(&tmp2, "%s\n%s\t%lu Notify data structures in message", tmp2, prefx,
(unsigned long) msg->cnt);
free(tmp);
tmp = tmp2;
if (0 < msg->cnt) {
/* indent another level for notify data */
asprintf(&pfx, "%s\t", prefx);
data = (orte_gpr_notify_data_t**)(msg->data)->addr;
for (i=0, j=0; j < msg->cnt &&
i < (msg->data)->size; i++) {
if (NULL != data[i]) {
j++;
if (ORTE_SUCCESS != (rc = orte_gpr_base_print_notify_data(&tmp2, pfx, (void*)data[i], ORTE_GPR_NOTIFY_DATA))) {
ORTE_ERROR_LOG(rc);
free(tmp);
return rc;
}
asprintf(&tmp3, "%s\n%s", tmp, tmp2);
free(tmp2);
tmp = tmp3;
}
}
}
/* put results in final location */
*output = tmp;
return ORTE_SUCCESS;
}
static void orte_gpr_base_quick_print(char **output, char *type_name, char *prefix, void *src, size_t src_size)
{
char *prefx;
uint8_t *ui8;
uint16_t *ui16;
uint32_t *ui32;
#ifdef HAVE_INT64_T
uint64_t *ui64;
#endif
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
switch(src_size) {
case 1:
ui8 = (uint8_t*)src;
asprintf(output, "%sData type: %s\tValue: %d", prefx, type_name, (int) *ui8);
break;
case 2:
ui16 = (uint16_t*)src;
asprintf(output, "%sData type: %s\tValue: %d", prefx, type_name, (int) *ui16);
break;
case 4:
ui32 = (uint32_t*)src;
asprintf(output, "%sData type: %s\tValue: %lu", prefx, type_name, (unsigned long) *ui32);
break;
#ifdef HAVE_INT64_T
case 8:
ui64 = (uint64_t*)src;
asprintf(output, "%sData type: %s\tValue: %lu", prefx, type_name, (unsigned long) *ui64);
break;
#endif
default:
return;
}
return;
}

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

@ -0,0 +1,44 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
/*
* STANDARD RELEASE FUNCTION - WORKS FOR EVERYTHING NON-STRUCTURED
*/
void orte_gpr_base_std_release(orte_data_value_t *value)
{
free(value->data);
value->data = NULL;
}
/*
* STANDARD OBJECT RELEASE FUNCTION - WORKS FOR EVERYTHING STRUCTURED
*/
void orte_gpr_base_std_obj_release(orte_data_value_t *value)
{
OBJ_RELEASE(value->data);
}

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

@ -0,0 +1,293 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
/*
* STANDARD SIZE FUNCTION - WORKS FOR EVERYTHING NON-STRUCTURED
*/
int orte_gpr_base_std_size(size_t *size, void *src, orte_data_type_t type)
{
switch(type) {
case ORTE_GPR_CMD:
*size = sizeof(orte_gpr_cmd_flag_t);
break;
case ORTE_GPR_SUBSCRIPTION_ID:
*size = sizeof(orte_gpr_subscription_id_t);
break;
case ORTE_GPR_TRIGGER_ID:
*size = sizeof(orte_gpr_trigger_id_t);
break;
case ORTE_GPR_NOTIFY_ACTION:
*size = sizeof(orte_gpr_notify_action_t);
break;
case ORTE_GPR_TRIGGER_ACTION:
*size = sizeof(orte_gpr_trigger_action_t);
break;
case ORTE_GPR_NOTIFY_MSG_TYPE:
*size = sizeof(orte_gpr_notify_msg_type_t);
break;
case ORTE_GPR_ADDR_MODE:
*size = sizeof(orte_gpr_addr_mode_t);
break;
default:
*size = 0;
ORTE_ERROR_LOG(ORTE_ERR_UNKNOWN_DATA_TYPE);
return ORTE_ERR_UNKNOWN_DATA_TYPE;
}
return ORTE_SUCCESS;
}
/* SIZE FUNCTIONS FOR COMPLEX TYPES */
/* KEYVAL */
int orte_gpr_base_size_keyval(size_t *size, orte_gpr_keyval_t *src, orte_data_type_t type)
{
size_t data_size;
int rc;
/* account for the object itself */
*size = sizeof(orte_gpr_keyval_t);
/* if the src is NULL, then that's the only thing we return */
if (NULL == src) return ORTE_SUCCESS;
/*...and its payload */
if (NULL != src->key) {
*size += strlen(src->key);
}
/* size the data itself - use the appropriate size function here */
if (ORTE_SUCCESS != (rc = orte_dss.size(&data_size, src->value, ORTE_DATA_VALUE))) {
ORTE_ERROR_LOG(rc);
*size = 0;
return rc;
}
*size += data_size;
return ORTE_SUCCESS;
}
/* VALUE */
int orte_gpr_base_size_gpr_value(size_t *size, orte_gpr_value_t *src, orte_data_type_t type)
{
size_t i, data_size;
int rc;
/* account for the object itself */
*size = sizeof(orte_gpr_value_t);
/* if the src is NULL, then that's the only thing we return */
if (NULL == src) return ORTE_SUCCESS;
/*...and its payload */
if (NULL != src->segment) {
*size += strlen(src->segment);
}
/* size the keyvals - use the appropriate size function here */
if (0 < src->cnt) {
for (i=0; i < src->cnt; i++) {
*size += sizeof(orte_gpr_keyval_t*); /* account for size of object pointer */
if (ORTE_SUCCESS != (rc = orte_gpr_base_size_keyval(&data_size, src->keyvals[i],
ORTE_GPR_KEYVAL))) {
ORTE_ERROR_LOG(rc);
*size = 0;
return rc;
}
*size += data_size;
}
}
/* size the tokens - use the appropriate size function here */
if (0 < src->num_tokens) {
for (i=0; i < src->num_tokens; i++) {
*size += sizeof(char*); /* account for size of string pointer */
if (NULL != src->tokens[i]) {
*size += strlen(src->tokens[i]);
}
}
}
return ORTE_SUCCESS;
}
/* SUBSCRIPTION */
int orte_gpr_base_size_subscription(size_t *size, orte_gpr_subscription_t *src, orte_data_type_t type)
{
size_t i, data_size;
int rc;
/* account for the object itself */
*size = sizeof(orte_gpr_subscription_t);
/* if the src is NULL, then that's the only thing we return */
if (NULL == src) return ORTE_SUCCESS;
/*...and its payload */
if (NULL != src->name) {
*size += strlen(src->name);
}
/* size the values - use the appropriate size function here */
if (0 < src->cnt) {
for (i=0; i < src->cnt; i++) {
*size += sizeof(orte_gpr_value_t*); /* account for object pointer */
if (ORTE_SUCCESS != (rc = orte_gpr_base_size_gpr_value(&data_size, src->values[i], ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
*size = 0;
return rc;
}
*size += data_size;
}
}
return ORTE_SUCCESS;
}
/* TRIGGER */
int orte_gpr_base_size_trigger(size_t *size, orte_gpr_trigger_t *src, orte_data_type_t type)
{
size_t i, data_size;
int rc;
/* account for the object itself */
*size = sizeof(orte_gpr_trigger_t);
/* if the src is NULL, then that's the only thing we return */
if (NULL == src) return ORTE_SUCCESS;
/*...and its payload */
if (NULL != src->name) {
*size += strlen(src->name);
}
/* size the values - use the appropriate size function here */
if (0 < src->cnt) {
for (i=0; i < src->cnt; i++) {
*size += sizeof(orte_gpr_value_t*); /* account for object pointer */
if (ORTE_SUCCESS != (rc = orte_gpr_base_size_gpr_value(&data_size, src->values[i], ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
*size = 0;
return rc;
}
*size += data_size;
}
}
return ORTE_SUCCESS;
}
/* NOTIFY DATA */
int orte_gpr_base_size_notify_data(size_t *size, orte_gpr_notify_data_t *src, orte_data_type_t type)
{
size_t j, k, data_size;
orte_gpr_value_t **val;
int rc;
/* account for the object itself */
*size = sizeof(orte_gpr_notify_data_t);
/* if the src is NULL, then that's the only thing we return */
if (NULL == src) return ORTE_SUCCESS;
/*...and its payload */
if (NULL != src->target) {
*size += strlen(src->target);
}
*size += sizeof(orte_pointer_array_t); /* account for size of pointer array object */
*size += (src->values)->size * sizeof(void*); /* account for size of pointer array storage */
/* size the value entries */
if (0 < src->cnt) {
val = (orte_gpr_value_t**)(src->values)->addr;
for (j=0, k=0; j < src->cnt &&
k < (src->values)->size; k++) {
if (NULL != val[k]) {
j++;
/* account for size of value */
if (ORTE_SUCCESS != (rc = orte_gpr_base_size_gpr_value(&data_size, val[k], ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
*size = 0;
return rc;
}
*size += data_size;
}
}
}
return ORTE_SUCCESS;
}
/* NOTIFY MSG */
int orte_gpr_base_size_notify_msg(size_t *size, orte_gpr_notify_message_t *src, orte_data_type_t type)
{
size_t j, k, data_size;
orte_gpr_notify_data_t **val;
int rc;
/* account for the object itself */
*size = sizeof(orte_gpr_notify_message_t);
/* if the src is NULL, then that's the only thing we return */
if (NULL == src) return ORTE_SUCCESS;
/*...and its payload */
if (NULL != src->target) {
*size += strlen(src->target);
}
*size += sizeof(orte_pointer_array_t); /* account for size of pointer array object */
*size += (src->data)->size * sizeof(void*); /* account for size of pointer array storage */
/* size the notify data entries */
if (0 < src->cnt) {
val = (orte_gpr_notify_data_t**)(src->data)->addr;
for (j=0, k=0; j < src->cnt &&
k < (src->data)->size; k++) {
if (NULL != val[k]) {
j++;
/* account for size of notify data */
if (ORTE_SUCCESS != (rc = orte_gpr_base_size_notify_data(&data_size, val[k], ORTE_GPR_NOTIFY_DATA))) {
ORTE_ERROR_LOG(rc);
*size = 0;
return rc;
}
*size += data_size;
}
}
}
return ORTE_SUCCESS;
}

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

@ -26,7 +26,7 @@
#include "opal/util/trace.h"
#include "mca/errmgr/errmgr.h"
#include "dps/dps_internal.h"
#include "dss/dss_internal.h"
#include "mca/gpr/base/base.h"
@ -39,8 +39,8 @@ int orte_gpr_base_unpack_cmd(orte_buffer_t *buffer, void *dest,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_CMD_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_CMD_T))) {
ORTE_ERROR_LOG(rc);
}
@ -56,8 +56,8 @@ int orte_gpr_base_unpack_subscription_id(orte_buffer_t *buffer, void *dest,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_SUBSCRIPTION_ID_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_SUBSCRIPTION_ID_T))) {
ORTE_ERROR_LOG(rc);
}
@ -73,8 +73,8 @@ int orte_gpr_base_unpack_trigger_id(orte_buffer_t *buffer, void *dest,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_TRIGGER_ID_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_TRIGGER_ID_T))) {
ORTE_ERROR_LOG(rc);
}
@ -90,8 +90,8 @@ int orte_gpr_base_unpack_notify_action(orte_buffer_t *buffer, void *dest,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_NOTIFY_ACTION_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_NOTIFY_ACTION_T))) {
ORTE_ERROR_LOG(rc);
}
@ -107,8 +107,8 @@ int orte_gpr_base_unpack_trigger_action(orte_buffer_t *buffer, void *dest,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_TRIGGER_ACTION_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_TRIGGER_ACTION_T))) {
ORTE_ERROR_LOG(rc);
}
@ -124,8 +124,8 @@ int orte_gpr_base_unpack_notify_msg_type(orte_buffer_t *buffer, void *dest,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_NOTIFY_MSG_TYPE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_NOTIFY_MSG_TYPE_T))) {
ORTE_ERROR_LOG(rc);
}
@ -141,8 +141,8 @@ int orte_gpr_base_unpack_addr_mode(orte_buffer_t *buffer, void *dest,
int rc;
OPAL_TRACE(4);
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_ADDR_MODE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_ADDR_MODE_T))) {
ORTE_ERROR_LOG(rc);
}
@ -158,9 +158,11 @@ int orte_gpr_base_unpack_keyval(orte_buffer_t *buffer, void *dest,
int rc;
orte_gpr_keyval_t **keyval;
size_t i, max_n=1;
orte_data_type_t dt;
char null;
OPAL_TRACE(4);
/* unpack into an array of keyval objects */
keyval = (orte_gpr_keyval_t**) dest;
for (i=0; i < *num_vals; i++) {
@ -172,24 +174,29 @@ int orte_gpr_base_unpack_keyval(orte_buffer_t *buffer, void *dest,
}
/* unpack the key */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(keyval[i]->key),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(keyval[i]->key),
&max_n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the data type so we can unpack the value */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(keyval[i]->type),
&max_n, ORTE_DATA_TYPE))) {
/* check to see if a NULL is the next item - if so, then there is no data value */
if (ORTE_SUCCESS != (rc = orte_dss_peek_type(buffer, &dt))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the value */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(keyval[i]->value),
&max_n, keyval[i]->type))) {
ORTE_ERROR_LOG(rc);
return rc;
if (ORTE_NULL == dt) { /* NULL is stored - unpack it and move on */
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &null, &max_n, ORTE_NULL))) {
ORTE_ERROR_LOG(rc);
return rc;
}
} else {/* unpack the data value */
max_n = 1;
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(keyval[i]->value),
&max_n, ORTE_DATA_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
}
@ -207,7 +214,7 @@ int orte_gpr_base_unpack_value(orte_buffer_t *buffer, void *dest,
size_t i, max_n=1;
OPAL_TRACE(4);
/* unpack into array of value objects */
values = (orte_gpr_value_t**) dest;
for (i=0; i < *num_vals; i++) {
@ -219,22 +226,22 @@ int orte_gpr_base_unpack_value(orte_buffer_t *buffer, void *dest,
}
/* unpack the address mode */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(values[i]->addr_mode),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(values[i]->addr_mode),
&max_n, ORTE_GPR_ADDR_MODE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the segment name */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(values[i]->segment),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(values[i]->segment),
&max_n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* get the number of tokens */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(values[i]->num_tokens),
&max_n, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(values[i]->num_tokens),
&max_n, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -248,7 +255,7 @@ int orte_gpr_base_unpack_value(orte_buffer_t *buffer, void *dest,
}
/* and unpack them */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, values[i]->tokens,
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, values[i]->tokens,
&(values[i]->num_tokens), ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
@ -256,8 +263,8 @@ int orte_gpr_base_unpack_value(orte_buffer_t *buffer, void *dest,
}
/* get the number of keyval pairs */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(values[i]->cnt),
&max_n, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(values[i]->cnt),
&max_n, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -271,8 +278,8 @@ int orte_gpr_base_unpack_value(orte_buffer_t *buffer, void *dest,
}
/* unpack the keyval pairs */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, values[i]->keyvals,
&(values[i]->cnt), ORTE_KEYVAL))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, values[i]->keyvals,
&(values[i]->cnt), ORTE_GPR_KEYVAL))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -293,7 +300,7 @@ int orte_gpr_base_unpack_subscription(orte_buffer_t *buffer, void *dest,
size_t i, max_n=1;
OPAL_TRACE(4);
/* unpack into array of subscription objects */
subs = (orte_gpr_subscription_t**) dest;
for (i=0; i < *num_vals; i++) {
@ -305,29 +312,29 @@ int orte_gpr_base_unpack_subscription(orte_buffer_t *buffer, void *dest,
}
/* unpack the subscription name */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(subs[i]->name),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(subs[i]->name),
&max_n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the subscription id */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(subs[i]->id),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(subs[i]->id),
&max_n, ORTE_GPR_SUBSCRIPTION_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the subscription action */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(subs[i]->action),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(subs[i]->action),
&max_n, ORTE_GPR_NOTIFY_ACTION))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* get the number of values */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(subs[i]->cnt),
&max_n, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(subs[i]->cnt),
&max_n, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -341,7 +348,7 @@ int orte_gpr_base_unpack_subscription(orte_buffer_t *buffer, void *dest,
}
/* and unpack them */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, subs[i]->values,
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, subs[i]->values,
&(subs[i]->cnt), ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
@ -367,7 +374,7 @@ int orte_gpr_base_unpack_trigger(orte_buffer_t *buffer, void *dest,
size_t i, max_n=1;
OPAL_TRACE(4);
/* unpack into array of trigger objects */
trigs = (orte_gpr_trigger_t**) dest;
for (i=0; i < *num_vals; i++) {
@ -379,29 +386,29 @@ int orte_gpr_base_unpack_trigger(orte_buffer_t *buffer, void *dest,
}
/* unpack the trigger name */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(trigs[i]->name),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(trigs[i]->name),
&max_n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the trigger id */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(trigs[i]->id),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(trigs[i]->id),
&max_n, ORTE_GPR_TRIGGER_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the trigger action */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(trigs[i]->action),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(trigs[i]->action),
&max_n, ORTE_GPR_TRIGGER_ACTION))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* get the number of values */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(trigs[i]->cnt),
&max_n, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(trigs[i]->cnt),
&max_n, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -415,7 +422,7 @@ int orte_gpr_base_unpack_trigger(orte_buffer_t *buffer, void *dest,
}
/* and unpack them */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, trigs[i]->values,
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, trigs[i]->values,
&(trigs[i]->cnt), ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
@ -438,7 +445,7 @@ int orte_gpr_base_unpack_notify_data(orte_buffer_t *buffer, void *dest,
size_t i, j, max_n=1;
OPAL_TRACE(4);
/* unpack into array of notify_data objects */
data = (orte_gpr_notify_data_t**) dest;
@ -451,29 +458,29 @@ int orte_gpr_base_unpack_notify_data(orte_buffer_t *buffer, void *dest,
}
/* unpack the subscription name */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(data[i]->target),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(data[i]->target),
&max_n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the subscription number */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(data[i]->id),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(data[i]->id),
&max_n, ORTE_GPR_SUBSCRIPTION_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the remove flag */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(data[i]->remove),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(data[i]->remove),
&max_n, ORTE_BOOL))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* get the number of values */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(data[i]->cnt),
&max_n, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(data[i]->cnt),
&max_n, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -487,7 +494,7 @@ int orte_gpr_base_unpack_notify_data(orte_buffer_t *buffer, void *dest,
values = (orte_gpr_value_t**)(data[i]->values)->addr;
for (j=0; j < data[i]->cnt; j++) {
max_n = 1;
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(values[j]),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(values[j]),
&max_n, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
@ -512,7 +519,7 @@ int orte_gpr_base_unpack_notify_msg(orte_buffer_t *buffer, void *dest,
size_t i, j, max_n=1;
OPAL_TRACE(4);
/* unpack into array of notify_data objects */
msg = (orte_gpr_notify_message_t**) dest;
@ -525,36 +532,36 @@ int orte_gpr_base_unpack_notify_msg(orte_buffer_t *buffer, void *dest,
}
/* unpack the message type */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(msg[i]->msg_type),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(msg[i]->msg_type),
&max_n, ORTE_GPR_NOTIFY_MSG_TYPE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the trigger name */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(msg[i]->target),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(msg[i]->target),
&max_n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the trigger number */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(msg[i]->id),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(msg[i]->id),
&max_n, ORTE_GPR_TRIGGER_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* unpack the remove flag */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(msg[i]->remove),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(msg[i]->remove),
&max_n, ORTE_BOOL))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* get the number of datagrams */
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(msg[i]->cnt),
&max_n, DPS_TYPE_SIZE_T))) {
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(msg[i]->cnt),
&max_n, DSS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -568,7 +575,7 @@ int orte_gpr_base_unpack_notify_msg(orte_buffer_t *buffer, void *dest,
data = (orte_gpr_notify_data_t**)(msg[i]->data)->addr;
for (j=0; j < msg[i]->cnt; j++) {
max_n = 1;
if (ORTE_SUCCESS != (rc = orte_dps_unpack_buffer(buffer, &(data[j]),
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(data[j]),
&max_n, ORTE_GPR_NOTIFY_DATA))) {
ORTE_ERROR_LOG(rc);
return rc;

125
orte/mca/gpr/base/gpr_base_create_value_keyval.c Исполняемый файл
Просмотреть файл

@ -0,0 +1,125 @@
/* -*- C -*-
*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file
*
*/
#include "orte_config.h"
#include "orte/include/orte_constants.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
int orte_gpr_base_create_value(orte_gpr_value_t **value,
orte_gpr_addr_mode_t addr_mode,
char *segment,
size_t cnt, /**< Number of keyval objects */
size_t num_tokens)
{
orte_gpr_value_t *val;
OPAL_TRACE(1);
*value = OBJ_NEW(orte_gpr_value_t);
if (NULL == *value) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
val = *value;
/* get space for the specified number of keyvals */
if (0 < cnt) {
val->keyvals = (orte_gpr_keyval_t**)malloc(cnt * sizeof(orte_gpr_keyval_t*));
if (NULL == val->keyvals) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_RELEASE(val);
return ORTE_ERR_OUT_OF_RESOURCE;
}
}
/* get space for the specified number of tokens */
if (0 < num_tokens) {
val->tokens = (char**)malloc(num_tokens * sizeof(char*));
if (NULL == val->tokens) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_RELEASE(val);
return ORTE_ERR_OUT_OF_RESOURCE;
}
}
val->addr_mode = addr_mode;
if (NULL != segment) {
val->segment = strdup(segment);
}
val->cnt = cnt;
val->num_tokens = num_tokens;
return ORTE_SUCCESS;
}
int orte_gpr_base_create_keyval(orte_gpr_keyval_t **keyval,
char *key,
orte_data_type_t type,
void *data)
{
orte_gpr_keyval_t *kv;
int rc;
OPAL_TRACE(1);
*keyval = OBJ_NEW(orte_gpr_keyval_t);
if (NULL == *keyval) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
kv = *keyval;
/* if the type is ORTE_UNDEF, then we don't actually want to create a data_value. This
* is the case, for example, when we are doing subscriptions as the keyval is used simply
* to transmit the key - the data_value field must remain NULL
*/
if (ORTE_UNDEF != type) {
kv->value = OBJ_NEW(orte_data_value_t);
if (NULL == kv->value) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_RELEASE(kv);
return ORTE_ERR_OUT_OF_RESOURCE;
}
kv->value->type = type;
if (NULL != data) {
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)&(kv->value->data), data, type))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(kv);
return rc;
}
}
}
if (NULL != key) {
kv->key = strdup(key);
}
return ORTE_SUCCESS;
}

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

@ -23,7 +23,7 @@
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -55,30 +55,15 @@
static void orte_gpr_keyval_construct(orte_gpr_keyval_t* keyval)
{
keyval->key = NULL;
keyval->type = ORTE_NULL;
keyval->value.i32 = 0;
keyval->value = NULL;
}
/* destructor - used to free any resources held by instance */
static void orte_gpr_keyval_destructor(orte_gpr_keyval_t* keyval)
{
orte_byte_object_t *byteptr;
if (NULL != keyval->key) {
free(keyval->key);
}
if (ORTE_BYTE_OBJECT == keyval->type) {
byteptr = &(keyval->value.byteobject);
if (NULL != byteptr->bytes) {
free(byteptr->bytes);
}
} else if (ORTE_STRING == keyval->type) {
if (NULL != keyval->value.strptr)
free(keyval->value.strptr);
} else if (ORTE_APP_CONTEXT == keyval->type) {
if (NULL != keyval->value.app_context)
OBJ_RELEASE(keyval->value.app_context);
}
if (NULL != keyval->key) free(keyval->key);
if (NULL != keyval->value) OBJ_RELEASE(keyval->value);
}
/* define instance of opal_class_t */
@ -316,7 +301,7 @@ int orte_gpr_base_open(void)
orte_data_type_t tmp;
OPAL_TRACE(5);
/* Debugging / verbose output */
param = mca_base_param_reg_int_name("gpr_base", "verbose",
@ -340,104 +325,182 @@ int orte_gpr_base_open(void)
/* register the base data types with the DPS */
tmp = ORTE_GPR_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_cmd,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_cmd,
orte_gpr_base_unpack_cmd,
(orte_dss_copy_fn_t)orte_gpr_base_copy_cmd,
(orte_dss_compare_fn_t)orte_gpr_base_compare_cmd,
(orte_dss_size_fn_t)orte_gpr_base_std_size,
(orte_dss_print_fn_t)orte_gpr_base_std_print,
(orte_dss_release_fn_t)orte_gpr_base_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_GPR_CMD", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_SUBSCRIPTION_ID;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_subscription_id,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_subscription_id,
orte_gpr_base_unpack_subscription_id,
(orte_dss_copy_fn_t)orte_gpr_base_copy_subscription_id,
(orte_dss_compare_fn_t)orte_gpr_base_compare_subscription_id,
(orte_dss_size_fn_t)orte_gpr_base_std_size,
(orte_dss_print_fn_t)orte_gpr_base_std_print,
(orte_dss_release_fn_t)orte_gpr_base_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_GPR_SUBSCRIPTION_ID", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_TRIGGER_ID;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_trigger_id,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_trigger_id,
orte_gpr_base_unpack_trigger_id,
(orte_dss_copy_fn_t)orte_gpr_base_copy_trigger_id,
(orte_dss_compare_fn_t)orte_gpr_base_compare_trigger_id,
(orte_dss_size_fn_t)orte_gpr_base_std_size,
(orte_dss_print_fn_t)orte_gpr_base_std_print,
(orte_dss_release_fn_t)orte_gpr_base_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_GPR_TRIGGER_ID", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_NOTIFY_ACTION;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_notify_action,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_notify_action,
orte_gpr_base_unpack_notify_action,
(orte_dss_copy_fn_t)orte_gpr_base_copy_notify_action,
(orte_dss_compare_fn_t)orte_gpr_base_compare_notify_action,
(orte_dss_size_fn_t)orte_gpr_base_std_size,
(orte_dss_print_fn_t)orte_gpr_base_std_print,
(orte_dss_release_fn_t)orte_gpr_base_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_GPR_NOTIFY_ACTION", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_TRIGGER_ACTION;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_trigger_action,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_trigger_action,
orte_gpr_base_unpack_trigger_action,
(orte_dss_copy_fn_t)orte_gpr_base_copy_trigger_action,
(orte_dss_compare_fn_t)orte_gpr_base_compare_trigger_action,
(orte_dss_size_fn_t)orte_gpr_base_std_size,
(orte_dss_print_fn_t)orte_gpr_base_std_print,
(orte_dss_release_fn_t)orte_gpr_base_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_GPR_TRIGGER_ACTION", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_NOTIFY_MSG_TYPE;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_notify_msg_type,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_notify_msg_type,
orte_gpr_base_unpack_notify_msg_type,
(orte_dss_copy_fn_t)orte_gpr_base_copy_notify_msg_type,
(orte_dss_compare_fn_t)orte_gpr_base_compare_notify_msg_type,
(orte_dss_size_fn_t)orte_gpr_base_std_size,
(orte_dss_print_fn_t)orte_gpr_base_std_print,
(orte_dss_release_fn_t)orte_gpr_base_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_GPR_NOTIFY_MSG_TYPE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_ADDR_MODE;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_addr_mode,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_addr_mode,
orte_gpr_base_unpack_addr_mode,
(orte_dss_copy_fn_t)orte_gpr_base_copy_addr_mode,
(orte_dss_compare_fn_t)orte_gpr_base_compare_addr_mode,
(orte_dss_size_fn_t)orte_gpr_base_std_size,
(orte_dss_print_fn_t)orte_gpr_base_std_print,
(orte_dss_release_fn_t)orte_gpr_base_std_release,
ORTE_DSS_UNSTRUCTURED,
"ORTE_GPR_ADDR_MODE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_KEYVAL;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_keyval,
tmp = ORTE_GPR_KEYVAL;
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_keyval,
orte_gpr_base_unpack_keyval,
"ORTE_KEYVAL", &tmp))) {
(orte_dss_copy_fn_t)orte_gpr_base_copy_keyval,
(orte_dss_compare_fn_t)orte_gpr_base_compare_keyval,
(orte_dss_size_fn_t)orte_gpr_base_size_keyval,
(orte_dss_print_fn_t)orte_gpr_base_print_keyval,
(orte_dss_release_fn_t)orte_gpr_base_std_obj_release,
ORTE_DSS_STRUCTURED,
"ORTE_GPR_KEYVAL", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_VALUE;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_value,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_value,
orte_gpr_base_unpack_value,
(orte_dss_copy_fn_t)orte_gpr_base_copy_gpr_value,
(orte_dss_compare_fn_t)orte_gpr_base_compare_gpr_value,
(orte_dss_size_fn_t)orte_gpr_base_size_gpr_value,
(orte_dss_print_fn_t)orte_gpr_base_print_gpr_value,
(orte_dss_release_fn_t)orte_gpr_base_std_obj_release,
ORTE_DSS_STRUCTURED,
"ORTE_GPR_VALUE", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_SUBSCRIPTION;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_subscription,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_subscription,
orte_gpr_base_unpack_subscription,
(orte_dss_copy_fn_t)orte_gpr_base_copy_subscription,
(orte_dss_compare_fn_t)orte_gpr_base_compare_subscription,
(orte_dss_size_fn_t)orte_gpr_base_size_subscription,
(orte_dss_print_fn_t)orte_gpr_base_print_subscription,
(orte_dss_release_fn_t)orte_gpr_base_std_obj_release,
ORTE_DSS_STRUCTURED,
"ORTE_GPR_SUBSCRIPTION", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_TRIGGER;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_trigger,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_trigger,
orte_gpr_base_unpack_trigger,
(orte_dss_copy_fn_t)orte_gpr_base_copy_trigger,
(orte_dss_compare_fn_t)orte_gpr_base_compare_trigger,
(orte_dss_size_fn_t)orte_gpr_base_size_trigger,
(orte_dss_print_fn_t)orte_gpr_base_print_trigger,
(orte_dss_release_fn_t)orte_gpr_base_std_obj_release,
ORTE_DSS_STRUCTURED,
"ORTE_GPR_TRIGGER", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_NOTIFY_DATA;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_notify_data,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_notify_data,
orte_gpr_base_unpack_notify_data,
(orte_dss_copy_fn_t)orte_gpr_base_copy_notify_data,
(orte_dss_compare_fn_t)orte_gpr_base_compare_notify_data,
(orte_dss_size_fn_t)orte_gpr_base_size_notify_data,
(orte_dss_print_fn_t)orte_gpr_base_print_notify_data,
(orte_dss_release_fn_t)orte_gpr_base_std_obj_release,
ORTE_DSS_STRUCTURED,
"ORTE_GPR_NOTIFY_DATA", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;
}
tmp = ORTE_GPR_NOTIFY_MSG;
if (ORTE_SUCCESS != (rc = orte_dps.register_type(orte_gpr_base_pack_notify_msg,
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_gpr_base_pack_notify_msg,
orte_gpr_base_unpack_notify_msg,
(orte_dss_copy_fn_t)orte_gpr_base_copy_notify_msg,
(orte_dss_compare_fn_t)orte_gpr_base_compare_notify_msg,
(orte_dss_size_fn_t)orte_gpr_base_size_notify_msg,
(orte_dss_print_fn_t)orte_gpr_base_print_notify_msg,
(orte_dss_release_fn_t)orte_gpr_base_std_obj_release,
ORTE_DSS_STRUCTURED,
"ORTE_GPR_NOTIFY_MSG", &tmp))) {
ORTE_ERROR_LOG(rc);
return rc;

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

@ -4,17 +4,17 @@
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file
/** @file
*
*/
@ -24,7 +24,7 @@
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -32,48 +32,47 @@
int orte_gpr_base_put_1(orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens,
char *key, orte_data_type_t type,
orte_gpr_value_union_t data_value)
char *key, orte_data_value_t *data_value)
{
orte_gpr_value_t *values;
orte_gpr_value_t value = { {OBJ_CLASS(opal_object_t),0},
ORTE_GPR_TOKENS_AND,
NULL, 0, NULL, 0, NULL };
orte_gpr_value_t value = ORTE_GPR_VALUE_EMPTY;
orte_gpr_keyval_t *keyvals;
orte_gpr_keyval_t keyval = { {OBJ_CLASS(opal_object_t),0},
NULL,
0 };
orte_gpr_keyval_t keyval = ORTE_GPR_KEYVAL_EMPTY;
orte_data_value_t dval = ORTE_DATA_VALUE_EMPTY;
size_t i;
int rc;
OPAL_TRACE(1);
value.addr_mode = addr_mode;
value.segment = segment;
value.cnt = 1;
keyvals = &keyval;
value.keyvals = &keyvals;
keyval.key = key;
keyval.type = type;
keyval.value = data_value;
keyval.value = &dval;
dval.type = data_value->type;
if (ORTE_SUCCESS != (rc = orte_dss.set(&dval, data_value->data, data_value->type))) {
ORTE_ERROR_LOG(rc);
return rc;
}
value.tokens = tokens;
/* must count the number of tokens */
if (NULL == tokens) {
value.num_tokens = 0;
} else {
value.num_tokens = 0;
if (NULL != tokens) {
for (i=0; NULL != tokens[i]; i++) {
(value.num_tokens)++;
}
}
values = &value;
/* put the value on the registry */
if (ORTE_SUCCESS != (rc = orte_gpr.put(1, &values))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* no memory to clean up since we didn't allocate any */
return ORTE_SUCCESS;
}
@ -82,63 +81,47 @@ int orte_gpr_base_put_1(orte_gpr_addr_mode_t addr_mode,
int orte_gpr_base_put_N(orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens,
size_t n, char **keys,
orte_data_type_t *types,
orte_gpr_value_union_t *data_values)
orte_data_value_t **data_values)
{
orte_gpr_value_t *values;
orte_gpr_value_t value = { {OBJ_CLASS(opal_object_t),0},
ORTE_GPR_TOKENS_AND,
NULL, 0, NULL, 0, NULL };
size_t i, j;
orte_gpr_value_t *value;
size_t i, num_tokens;
int rc;
OPAL_TRACE(1);
value.addr_mode = addr_mode;
value.segment = segment;
value.cnt = n;
value.keyvals = (orte_gpr_keyval_t**)malloc(n * sizeof(orte_gpr_keyval_t*));
if (NULL == value.keyvals) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
for (i=0; i < n; i++) {
value.keyvals[i] = OBJ_NEW(orte_gpr_keyval_t);
if (NULL == value.keyvals[i]) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
for (j=0; j < i; j++) OBJ_RELEASE(value.keyvals[j]);
free(value.keyvals);
return ORTE_ERR_OUT_OF_RESOURCE;
}
value.keyvals[i]->key = keys[i];
value.keyvals[i]->type = types[i];
value.keyvals[i]->value = data_values[i];
}
value.tokens = tokens;
/* must count the number of tokens */
if (NULL == tokens) {
value.num_tokens = 0;
} else {
num_tokens = 0;
if (NULL != tokens) {
for (i=0; NULL != tokens[i]; i++) {
(value.num_tokens)++;
num_tokens++;
}
}
values = &value;
if (ORTE_SUCCESS != (rc = orte_gpr_base_create_value(&value, addr_mode, segment, n, num_tokens))) {
ORTE_ERROR_LOG(rc);
return rc;
}
for (i=0; i < n; i++) {
if (ORTE_SUCCESS != (rc = orte_gpr_base_create_keyval(&(value->keyvals[i]), keys[i], data_values[i]->type, data_values[i]->data))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(value);
return rc;
}
}
for (i=0; i < value->num_tokens; i++) {
value->tokens[i] = strdup(tokens[i]);
}
/* put the value on the registry */
if (ORTE_SUCCESS != (rc = orte_gpr.put(1, &values))) {
if (ORTE_SUCCESS != (rc = orte_gpr.put(1, &value))) {
ORTE_ERROR_LOG(rc);
}
/* clean up memory - very carefully!
* We can't use the object destructors because we didn't
* copy input data fields into the objects. Thus, only
* release the data that we explicitly allocated
*/
for (i=0; i < n; i++) free(value.keyvals[i]);
free(value.keyvals);
/* clean up memory */
OBJ_RELEASE(value);
return rc;
}

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

@ -24,7 +24,7 @@
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -42,22 +42,17 @@ int orte_gpr_base_subscribe_1(orte_gpr_subscription_id_t *id,
{
orte_gpr_value_t *values;
orte_gpr_keyval_t *keyvals;
orte_gpr_keyval_t keyval = { {OBJ_CLASS(opal_object_t),0},
NULL, ORTE_NULL };
orte_gpr_value_t value = { {OBJ_CLASS(opal_object_t),0},
ORTE_GPR_TOKENS_AND,
NULL, 0, NULL, 0, NULL };
orte_gpr_keyval_t keyval = ORTE_GPR_KEYVAL_EMPTY;
orte_gpr_value_t value = ORTE_GPR_VALUE_EMPTY;
orte_gpr_subscription_t *subs;
orte_gpr_subscription_t sub = { {OBJ_CLASS(opal_object_t),0},
NULL, 0, 0, 0, NULL, 0, NULL };
orte_gpr_subscription_t sub = ORTE_GPR_SUBSCRIPTION_EMPTY;
orte_gpr_trigger_t *trigs;
orte_gpr_trigger_t trig = { {OBJ_CLASS(opal_object_t),0},
NULL, 0, 0, 0, NULL, 0, NULL };
orte_gpr_trigger_t trig = ORTE_GPR_TRIGGER_EMPTY;
size_t i;
int rc;
OPAL_TRACE(1);
/* assemble the subscription object */
subs = &sub;
sub.name = sub_name;
@ -76,9 +71,8 @@ int orte_gpr_base_subscribe_1(orte_gpr_subscription_id_t *id,
value.tokens = tokens;
/* must count the number of tokens */
if (NULL == tokens) {
value.num_tokens = 0;
} else {
value.num_tokens = 0;
if (NULL != tokens) {
for (i=0; NULL != tokens[i]; i++) {
(value.num_tokens)++;
}
@ -122,86 +116,86 @@ int orte_gpr_base_subscribe_N(orte_gpr_subscription_id_t *id,
orte_gpr_notify_cb_fn_t cbfunc,
void *user_tag)
{
orte_gpr_value_t *values;
orte_gpr_value_t value = { {OBJ_CLASS(opal_object_t),0},
ORTE_GPR_TOKENS_AND,
NULL, 0, NULL, 0, NULL };
orte_gpr_subscription_t *subs;
orte_gpr_subscription_t sub = { {OBJ_CLASS(opal_object_t),0},
NULL, 0, 0, 0, NULL, 0, NULL };
orte_gpr_trigger_t *trigs;
orte_gpr_trigger_t trig = { {OBJ_CLASS(opal_object_t),0},
NULL, 0, 0, 0, NULL, 0, NULL };
size_t i, j;
orte_gpr_subscription_t *sub;
orte_gpr_trigger_t *trig;
size_t i, num_tokens;
int rc;
OPAL_TRACE(1);
/* assemble the subscription object */
subs = &sub;
sub.name = sub_name;
sub.action = action;
sub.cnt = 1;
values = &value;
sub.values = &values;
sub.cbfunc = cbfunc;
sub.user_tag = user_tag;
value.addr_mode = addr_mode;
value.segment = segment;
value.cnt = n;
value.keyvals = (orte_gpr_keyval_t**)malloc(n * sizeof(orte_gpr_keyval_t*));
if (NULL == value.keyvals) {
sub = OBJ_NEW(orte_gpr_subscription_t);
if (NULL == sub) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
for (i=0; i < n; i++) {
value.keyvals[i] = OBJ_NEW(orte_gpr_keyval_t);
if (NULL == value.keyvals[i]) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
for (j=0; j < i; j++) OBJ_RELEASE(value.keyvals[j]);
free(value.keyvals);
return ORTE_ERR_OUT_OF_RESOURCE;
if (NULL != sub_name) {
sub->name = strdup(sub_name);
}
sub->action = action;
sub->cnt = 1;
sub->cbfunc = cbfunc;
sub->user_tag = user_tag;
/* must count the number of tokens */
num_tokens = 0;
if (NULL != tokens) {
for (i=0; NULL != tokens[i]; i++) {
num_tokens++;
}
value.keyvals[i]->key = keys[i];
}
value.tokens = tokens;
/* must count the number of tokens */
if (NULL == tokens) {
value.num_tokens = 0;
} else {
for (i=0; NULL != tokens[i]; i++) {
(value.num_tokens)++;
/* create the value object */
sub->values = (orte_gpr_value_t**)malloc(sizeof(orte_gpr_value_t*));
if (NULL == sub->values) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_RELEASE(sub);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = orte_gpr_base_create_value(&(sub->values[0]), addr_mode, segment, n, num_tokens))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(sub);
return rc;
}
for (i=0; i < n; i++) {
if (ORTE_SUCCESS != (rc = orte_gpr_base_create_keyval(&(sub->values[0]->keyvals[i]), keys[i], ORTE_UNDEF, NULL))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(sub);
return rc;
}
}
/* copy the tokens */
for (i=0; i < sub->values[0]->num_tokens; i++) {
sub->values[0]->tokens[i] = strdup(tokens[i]);
}
/* send the subscription */
if (NULL == trig_name) { /* no trigger provided */
if (ORTE_SUCCESS != (rc = orte_gpr.subscribe(1, &subs, 0, NULL))) {
if (ORTE_SUCCESS != (rc = orte_gpr.subscribe(1, &sub, 0, NULL))) {
ORTE_ERROR_LOG(rc);
}
} else {
trigs = &trig;
trig.name = trig_name;
if (ORTE_SUCCESS != (rc = orte_gpr.subscribe(1, &subs, 1, &trigs))) {
trig = OBJ_NEW(orte_gpr_trigger_t);
if (NULL == trig) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_RELEASE(sub);
return ORTE_ERR_OUT_OF_RESOURCE;
}
trig->name = strdup(trig_name);
if (ORTE_SUCCESS != (rc = orte_gpr.subscribe(1, &sub, 1, &trig))) {
ORTE_ERROR_LOG(rc);
}
OBJ_RELEASE(trig);
}
/* clean up memory - very carefully!
* We can't use the object destructors because we didn't
* copy input data fields into the objects. Thus, only
* release the data that we explicitly allocated
*/
for (i=0; i < n; i++) free(value.keyvals[i]);
free(value.keyvals);
/* return the subscription id */
*id = sub.id;
*id = sub->id;
/* clean up memory */
OBJ_RELEASE(sub);
return rc;
}
@ -218,18 +212,12 @@ int orte_gpr_base_define_trigger(orte_gpr_trigger_id_t *id,
orte_gpr_trigger_cb_fn_t cbfunc,
void *user_tag)
{
orte_gpr_value_t *values;
orte_gpr_value_t value = { {OBJ_CLASS(opal_object_t),0},
ORTE_GPR_TOKENS_AND,
NULL, 0, NULL, 0, NULL };
orte_gpr_trigger_t *trigs;
orte_gpr_trigger_t trig = { {OBJ_CLASS(opal_object_t),0},
NULL, 0, 0, 0, NULL, 0, NULL };
size_t i, j;
orte_gpr_trigger_t *trig;
size_t i, num_tokens;
int rc;
OPAL_TRACE(1);
/* check for error - this function can only be used to define triggers
* that compare their values to each other. It cannot be used to define
* triggers that fire when reaching a specified value as there is no
@ -241,60 +229,61 @@ int orte_gpr_base_define_trigger(orte_gpr_trigger_id_t *id,
}
/* assemble the trigger object */
trigs = &trig;
trig.name = trig_name;
trig.action = action;
trig.cnt = 1;
values = &value;
trig.values = &values;
trig.cbfunc = cbfunc;
trig.user_tag = user_tag;
value.addr_mode = addr_mode;
value.segment = segment;
value.cnt = n;
value.keyvals = (orte_gpr_keyval_t**)malloc(n * sizeof(orte_gpr_keyval_t*));
if (NULL == value.keyvals) {
trig = OBJ_NEW(orte_gpr_trigger_t);
if (NULL == trig) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
for (i=0; i < n; i++) {
value.keyvals[i] = OBJ_NEW(orte_gpr_keyval_t);
if (NULL == value.keyvals[i]) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
for (j=0; j < i; j++) OBJ_RELEASE(value.keyvals[j]);
free(value.keyvals);
return ORTE_ERR_OUT_OF_RESOURCE;
if (NULL != trig_name) {
trig->name = strdup(trig_name);
}
trig->action = action;
trig->cnt = 1;
trig->cbfunc = cbfunc;
trig->user_tag = user_tag;
/* must count the number of tokens */
num_tokens = 0;
if (NULL != tokens) {
for (i=0; NULL != tokens[i]; i++) {
num_tokens++;
}
value.keyvals[i]->key = keys[i];
}
value.tokens = tokens;
/* must count the number of tokens */
if (NULL == tokens) {
value.num_tokens = 0;
} else {
for (i=0; NULL != tokens[i]; i++) {
(value.num_tokens)++;
/* create the value object */
trig->values = (orte_gpr_value_t**)malloc(sizeof(orte_gpr_value_t*));
if (NULL == trig->values) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = orte_gpr_base_create_value(&(trig->values[0]), addr_mode, segment, n, num_tokens))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(trig);
return rc;
}
for (i=0; i < n; i++) {
if (ORTE_SUCCESS != (rc = orte_gpr_base_create_keyval(&(trig->values[0]->keyvals[i]), keys[i], ORTE_UNDEF, NULL))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(trig);
return rc;
}
}
for (i=0; i < trig->values[0]->num_tokens; i++) {
trig->values[0]->tokens[i] = strdup(tokens[i]);
}
/* send the subscription */
if (ORTE_SUCCESS != (rc = orte_gpr.subscribe(0, NULL, 1, &trigs))) {
if (ORTE_SUCCESS != (rc = orte_gpr.subscribe(0, NULL, 1, &trig))) {
ORTE_ERROR_LOG(rc);
}
/* clean up memory - very carefully!
* We can't use the object destructors because we didn't
* copy input data fields into the objects. Thus, only
* release the data that we explicitly allocated
*/
for (i=0; i < n; i++) free(value.keyvals[i]);
free(value.keyvals);
/* return the subscription id */
*id = trig.id;
*id = trig->id;
/* clean up memory */
OBJ_RELEASE(trig);
return rc;
}
@ -311,85 +300,78 @@ int orte_gpr_base_define_trigger_level(orte_gpr_trigger_id_t *id,
orte_gpr_trigger_cb_fn_t cbfunc,
void *user_tag)
{
orte_gpr_value_t *values;
orte_gpr_value_t value = { {OBJ_CLASS(opal_object_t),0},
ORTE_GPR_TOKENS_AND,
NULL, 0, NULL, 0, NULL };
orte_gpr_trigger_t *trigs;
orte_gpr_trigger_t trig = { {OBJ_CLASS(opal_object_t),0},
NULL, 0, 0, 0, NULL, 0, NULL };
size_t i, j;
orte_gpr_trigger_t *trig;
size_t i, num_tokens;
int rc;
OPAL_TRACE(1);
/* check for error - this function can only be used to define triggers
* that fire at a specified level. It cannot be used to define
* triggers that compare their values to each other
*/
if (ORTE_GPR_TRIG_CMP_LEVELS & action) {
if (ORTE_GPR_TRIG_CMP_LEVELS & action || NULL == trig_name) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* assemble the trigger object */
trigs = &trig;
trig.name = trig_name;
trig.action = action;
trig.cnt = 1;
values = &value;
trig.values = &values;
trig.cbfunc = cbfunc;
trig.user_tag = user_tag;
value.addr_mode = addr_mode;
value.segment = segment;
value.cnt = n;
value.keyvals = (orte_gpr_keyval_t**)malloc(n * sizeof(orte_gpr_keyval_t*));
if (NULL == value.keyvals) {
trig = OBJ_NEW(orte_gpr_trigger_t);
if (NULL == trig) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
for (i=0; i < n; i++) {
value.keyvals[i] = OBJ_NEW(orte_gpr_keyval_t);
if (NULL == value.keyvals[i]) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
for (j=0; j < i; j++) OBJ_RELEASE(value.keyvals[j]);
free(value.keyvals);
return ORTE_ERR_OUT_OF_RESOURCE;
if (NULL != trig_name) {
trig->name = strdup(trig_name);
}
trig->action = action;
trig->cnt = 1;
trig->cbfunc = cbfunc;
trig->user_tag = user_tag;
/* must count the number of tokens */
num_tokens = 0;
if (NULL != tokens) {
for (i=0; NULL != tokens[i]; i++) {
num_tokens++;
}
value.keyvals[i]->key = keys[i];
value.keyvals[i]->type = ORTE_SIZE;
value.keyvals[i]->value.size = levels[i];
}
value.tokens = tokens;
/* must count the number of tokens */
if (NULL == tokens) {
value.num_tokens = 0;
} else {
for (i=0; NULL != tokens[i]; i++) {
(value.num_tokens)++;
/* create the value object */
trig->values = (orte_gpr_value_t**)malloc(sizeof(orte_gpr_value_t*));
if (NULL == trig->values) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = orte_gpr_base_create_value(&(trig->values[0]), addr_mode, segment, n, num_tokens))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(trig);
return rc;
}
for (i=0; i < n; i++) {
if (ORTE_SUCCESS != (rc = orte_gpr_base_create_keyval(&(trig->values[0]->keyvals[i]), keys[i], ORTE_SIZE, &(levels[i])))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(trig);
return rc;
}
}
for (i=0; i < trig->values[0]->num_tokens; i++) {
trig->values[0]->tokens[i] = strdup(tokens[i]);
}
/* send the subscription */
if (ORTE_SUCCESS != (rc = orte_gpr.subscribe(0, NULL, 1, &trigs))) {
if (ORTE_SUCCESS != (rc = orte_gpr.subscribe(0, NULL, 1, &trig))) {
ORTE_ERROR_LOG(rc);
}
/* clean up memory - very carefully!
* We can't use the object destructors because we didn't
* copy input data fields into the objects. Thus, only
* release the data that we explicitly allocated
*/
for (i=0; i < n; i++) free(value.keyvals[i]);
free(value.keyvals);
/* return the subscription id */
*id = trig.id;
*id = trig->id;
/* clean up memory */
OBJ_RELEASE(trig);
return rc;
}

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

@ -1,194 +0,0 @@
/*
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "include/constants.h"
#include "opal/util/argv.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "mca/errmgr/errmgr.h"
#include "mca/gpr/base/base.h"
int orte_gpr_base_xfer_payload(orte_gpr_value_union_t *dest,
orte_gpr_value_union_t *src,
orte_data_type_t type)
{
size_t i;
OPAL_TRACE(3);
switch(type) {
case ORTE_STRING:
dest->strptr = strdup(src->strptr);
if (NULL == dest->strptr) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
break;
case ORTE_SIZE:
dest->size = src->size;
break;
case ORTE_BOOL:
dest->tf_flag = src->tf_flag;
break;
case ORTE_PID:
dest->pid = src->pid;
break;
case ORTE_INT:
dest->intval = src->intval;
break;
case ORTE_UINT8:
dest->ui8 = src->ui8;
break;
case ORTE_UINT16:
dest->ui16 = src->ui16;
break;
case ORTE_UINT32:
dest->ui32 = src->ui32;
break;
#ifdef HAVE_INT64_T
case ORTE_UINT64:
dest->ui64 = src->ui64;
break;
#endif
case ORTE_INT8:
dest->i8 = src->i8;
break;
case ORTE_INT16:
dest->i16 = src->i16;
break;
case ORTE_INT32:
dest->i32 = src->i32;
break;
#ifdef HAVE_INT64_T
case ORTE_INT64:
dest->i64 = src->i64;
break;
#endif
case ORTE_BYTE_OBJECT:
(dest->byteobject).size = (src->byteobject).size;
(dest->byteobject).bytes = (uint8_t*)malloc((dest->byteobject).size);
if (NULL == (dest->byteobject).bytes) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
memcpy((dest->byteobject).bytes, (src->byteobject).bytes, (dest->byteobject).size);
break;
case ORTE_NAME:
dest->proc = src->proc;;
break;
case ORTE_VPID:
dest->vpid = src->vpid;
break;
case ORTE_JOBID:
dest->jobid = src->jobid;
break;
case ORTE_CELLID:
dest->cellid = src->cellid;
break;
case ORTE_NODE_STATE:
dest->node_state = src->node_state;
break;
case ORTE_PROC_STATE:
dest->proc_state = src->proc_state;
break;
case ORTE_JOB_STATE:
dest->job_state = src->job_state;
break;
case ORTE_EXIT_CODE:
dest->exit_code = src->exit_code;
break;
case ORTE_APP_CONTEXT:
if(NULL == src->app_context) {
dest->app_context = NULL;
break;
}
dest->app_context = OBJ_NEW(orte_app_context_t);
dest->app_context->idx = src->app_context->idx;
if(NULL != src->app_context->app) {
dest->app_context->app = strdup(src->app_context->app);
} else {
dest->app_context->app = NULL;
}
dest->app_context->num_procs = src->app_context->num_procs;
dest->app_context->argc = src->app_context->argc;
dest->app_context->argv = opal_argv_copy(src->app_context->argv);
dest->app_context->num_env = src->app_context->num_env;
dest->app_context->env = opal_argv_copy(src->app_context->env);
if(NULL != src->app_context->cwd) {
dest->app_context->cwd = strdup(src->app_context->cwd);
} else {
dest->app_context->cwd = NULL;
}
dest->app_context->num_map = src->app_context->num_map;
if (NULL != src->app_context->map_data) {
dest->app_context->map_data = (orte_app_context_map_t **) malloc(sizeof(orte_app_context_map_t *) * src->app_context->num_map);
for (i = 0; i < src->app_context->num_map; ++i) {
dest->app_context->map_data[i] =
OBJ_NEW(orte_app_context_map_t);
dest->app_context->map_data[i]->map_type =
src->app_context->map_data[i]->map_type;
dest->app_context->map_data[i]->map_data =
strdup(src->app_context->map_data[i]->map_data);
}
} else {
dest->app_context->map_data = NULL;
}
if (NULL != src->app_context->prefix_dir) {
dest->app_context->prefix_dir =
strdup(src->app_context->prefix_dir);
}
break;
case ORTE_NULL:
break;
default:
return ORTE_ERR_BAD_PARAM;
break;
}
return ORTE_SUCCESS;
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -31,7 +31,7 @@
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -42,15 +42,15 @@ int orte_gpr_base_pack_increment_value(orte_buffer_t *cmd, orte_gpr_value_t *val
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_INCREMENT_VALUE_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &value, 1, ORTE_GPR_VALUE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &value, 1, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -65,15 +65,15 @@ int orte_gpr_base_pack_decrement_value(orte_buffer_t *cmd, orte_gpr_value_t *val
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_DECREMENT_VALUE_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &value, 1, ORTE_GPR_VALUE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &value, 1, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -29,7 +29,7 @@
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/gpr/base/base.h"
@ -39,15 +39,15 @@ int orte_gpr_base_pack_cleanup_job(orte_buffer_t *buffer, orte_jobid_t jobid)
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_CLEANUP_JOB_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &command, 1, ORTE_GPR_CMD))) {
return rc;
if (ORTE_SUCCESS != (rc = orte_dss.pack(buffer, &command, 1, ORTE_GPR_CMD))) {
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &jobid, 1, ORTE_JOBID))) {
return rc;
if (ORTE_SUCCESS != (rc = orte_dss.pack(buffer, &jobid, 1, ORTE_JOBID))) {
return rc;
}
return ORTE_SUCCESS;
@ -60,15 +60,15 @@ int orte_gpr_base_pack_cleanup_proc(orte_buffer_t *buffer, orte_process_name_t *
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_CLEANUP_PROC_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &command, 1, ORTE_GPR_CMD))) {
return rc;
if (ORTE_SUCCESS != (rc = orte_dss.pack(buffer, &command, 1, ORTE_GPR_CMD))) {
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(buffer, proc, 1, ORTE_NAME))) {
return rc;
if (ORTE_SUCCESS != (rc = orte_dss.pack(buffer, proc, 1, ORTE_NAME))) {
return rc;
}
return ORTE_SUCCESS;

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -25,7 +25,7 @@
#include "orte/include/orte_constants.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -36,15 +36,15 @@ int orte_gpr_base_pack_delete_segment(orte_buffer_t *cmd, char *segment)
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_DELETE_SEGMENT_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
return rc;
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &segment, 1, ORTE_STRING))) {
return rc;
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &segment, 1, ORTE_STRING))) {
return rc;
}
return ORTE_SUCCESS;
@ -53,7 +53,7 @@ int orte_gpr_base_pack_delete_segment(orte_buffer_t *cmd, char *segment)
int orte_gpr_base_pack_delete_entries(orte_buffer_t *cmd,
orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys)
char *segment, char **tokens, char **keys)
{
orte_gpr_cmd_flag_t command;
char **ptr;
@ -61,19 +61,19 @@ int orte_gpr_base_pack_delete_entries(orte_buffer_t *cmd,
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_DELETE_ENTRIES_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
return rc;
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &mode, 1, ORTE_GPR_ADDR_MODE))) {
return rc;
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &mode, 1, ORTE_GPR_ADDR_MODE))) {
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &segment, 1, ORTE_STRING))) {
return rc;
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &segment, 1, ORTE_STRING))) {
return rc;
}
/* compute number of tokens */
@ -83,18 +83,18 @@ int orte_gpr_base_pack_delete_entries(orte_buffer_t *cmd,
ptr = tokens;
n = 0;
while (NULL != ptr[n]) {
n++;
n++;
}
}
/* pack number of tokens */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &n, 1, ORTE_SIZE))) {
return rc;
}
/* pack tokens ONLY if n > 0 */
if (0 < n) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, tokens, n, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, tokens, n, ORTE_STRING))) {
return rc;
}
}
@ -110,13 +110,13 @@ int orte_gpr_base_pack_delete_entries(orte_buffer_t *cmd,
}
/* pack number of keys */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &n, 1, ORTE_SIZE))) {
return rc;
}
/* pack keys ONLY if n > 0 */
if (0 < n) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, keys, n, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, keys, n, ORTE_STRING))) {
return rc;
}
}
@ -130,19 +130,19 @@ int orte_gpr_base_pack_index(orte_buffer_t *cmd, char *segment)
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_INDEX_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
return rc;
}
/* it's okay to pack a NULL string, so pack the segment regardless */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &segment, 1, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &segment, 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
return rc;
}
return ORTE_SUCCESS;
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -30,7 +30,7 @@
#include "opal/util/trace.h"
#include "orte/include/orte_constants.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -40,10 +40,10 @@ int orte_gpr_base_pack_dump_all(orte_buffer_t *cmd)
orte_gpr_cmd_flag_t command;
OPAL_TRACE(3);
command = ORTE_GPR_DUMP_ALL_CMD;
return orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD);
return orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD);
}
int orte_gpr_base_pack_dump_segments(orte_buffer_t *cmd, char *segment)
@ -52,15 +52,15 @@ int orte_gpr_base_pack_dump_segments(orte_buffer_t *cmd, char *segment)
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_DUMP_SEGMENTS_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &segment, 1, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &segment, 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -74,15 +74,15 @@ int orte_gpr_base_pack_dump_triggers(orte_buffer_t *cmd, orte_gpr_trigger_id_t s
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_DUMP_TRIGGERS_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &start, 1, ORTE_GPR_TRIGGER_ID))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &start, 1, ORTE_GPR_TRIGGER_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -95,15 +95,15 @@ int orte_gpr_base_pack_dump_subscriptions(orte_buffer_t *cmd, orte_gpr_subscript
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_DUMP_SUBSCRIPTIONS_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &start, 1, ORTE_GPR_SUBSCRIPTION_ID))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &start, 1, ORTE_GPR_SUBSCRIPTION_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -116,20 +116,20 @@ int orte_gpr_base_pack_dump_a_trigger(orte_buffer_t *cmd, char *name, orte_gpr_t
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_DUMP_A_TRIGGER_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &name, 1, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &id, 1, ORTE_GPR_TRIGGER_ID))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &name, 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &id, 1, ORTE_GPR_TRIGGER_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -143,20 +143,20 @@ int orte_gpr_base_pack_dump_a_subscription(orte_buffer_t *cmd, char *name,
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_DUMP_A_SUBSCRIPTION_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &name, 1, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &id, 1, ORTE_GPR_SUBSCRIPTION_ID))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &name, 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &id, 1, ORTE_GPR_SUBSCRIPTION_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -169,8 +169,31 @@ int orte_gpr_base_pack_dump_callbacks(orte_buffer_t *cmd)
orte_gpr_cmd_flag_t command;
OPAL_TRACE(3);
command = ORTE_GPR_DUMP_CALLBACKS_CMD;
return orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD);
return orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD);
}
int orte_gpr_base_pack_dump_segment_size(orte_buffer_t *cmd, char *segment)
{
orte_gpr_cmd_flag_t command;
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_DUMP_SEGMENT_SIZE_CMD;
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &segment, 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
return ORTE_SUCCESS;
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -31,7 +31,7 @@
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
@ -44,15 +44,15 @@ int orte_gpr_base_pack_put(orte_buffer_t *cmd,
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_PUT_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, values, cnt, ORTE_GPR_VALUE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, values, cnt, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -62,8 +62,8 @@ int orte_gpr_base_pack_put(orte_buffer_t *cmd,
int orte_gpr_base_pack_get(orte_buffer_t *cmd,
orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys)
orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys)
{
orte_gpr_cmd_flag_t command;
char **ptr;
@ -71,20 +71,20 @@ int orte_gpr_base_pack_get(orte_buffer_t *cmd,
size_t n;
OPAL_TRACE(3);
command = ORTE_GPR_GET_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &mode, 1, ORTE_GPR_ADDR_MODE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &mode, 1, ORTE_GPR_ADDR_MODE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &segment, 1, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &segment, 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -99,13 +99,13 @@ int orte_gpr_base_pack_get(orte_buffer_t *cmd,
}
/* pack number of tokens */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &n, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (n > 0) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, tokens, n, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, tokens, n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -121,13 +121,13 @@ int orte_gpr_base_pack_get(orte_buffer_t *cmd,
}
/* pack number of keys */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &n, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (n > 0) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, keys, n, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, keys, n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -137,9 +137,9 @@ int orte_gpr_base_pack_get(orte_buffer_t *cmd,
}
int orte_gpr_base_pack_get_conditional(orte_buffer_t *cmd,
orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys,
size_t num_conditions, orte_gpr_keyval_t **conditions)
orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys,
size_t num_conditions, orte_gpr_keyval_t **conditions)
{
orte_gpr_cmd_flag_t command;
char **ptr;
@ -147,20 +147,20 @@ int orte_gpr_base_pack_get_conditional(orte_buffer_t *cmd,
size_t n;
OPAL_TRACE(3);
command = ORTE_GPR_GET_CONDITIONAL_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &mode, 1, ORTE_GPR_ADDR_MODE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &mode, 1, ORTE_GPR_ADDR_MODE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &segment, 1, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &segment, 1, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -175,13 +175,13 @@ int orte_gpr_base_pack_get_conditional(orte_buffer_t *cmd,
}
/* pack number of tokens */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &n, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (n > 0) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, tokens, n, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, tokens, n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -197,29 +197,29 @@ int orte_gpr_base_pack_get_conditional(orte_buffer_t *cmd,
}
/* pack number of keys */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &n, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &n, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (n > 0) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, keys, n, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, keys, n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
/* pack number of conditions */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &num_conditions, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &num_conditions, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* pack conditions */
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, conditions, num_conditions, ORTE_KEYVAL))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, conditions, num_conditions, ORTE_GPR_KEYVAL))) {
ORTE_ERROR_LOG(rc);
return rc;
}
return ORTE_SUCCESS;
}

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

@ -31,7 +31,7 @@
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -47,7 +47,7 @@ int orte_gpr_base_pack_subscribe(orte_buffer_t *cmd,
size_t zero=0;
OPAL_TRACE(3);
command = ORTE_GPR_SUBSCRIBE_CMD;
/* can't be both NULL */
@ -56,19 +56,19 @@ int orte_gpr_base_pack_subscribe(orte_buffer_t *cmd,
return ORTE_ERR_BAD_PARAM;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* see if there are subscriptions - if so, pack them */
if (NULL != subscriptions) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, subscriptions, num_subs, ORTE_GPR_SUBSCRIPTION))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, subscriptions, num_subs, ORTE_GPR_SUBSCRIPTION))) {
ORTE_ERROR_LOG(rc);
return rc;
}
} else {
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &zero, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &zero, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -79,12 +79,12 @@ int orte_gpr_base_pack_subscribe(orte_buffer_t *cmd,
* so check for it here and record a "zero" if nothing is there
*/
if (NULL != trigs && 0 < num_trigs) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, trigs, num_trigs, ORTE_GPR_TRIGGER))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, trigs, num_trigs, ORTE_GPR_TRIGGER))) {
ORTE_ERROR_LOG(rc);
return rc;
}
} else {
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &zero, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &zero, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -101,14 +101,14 @@ int orte_gpr_base_pack_unsubscribe(orte_buffer_t *cmd,
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_UNSUBSCRIBE_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &id, 1, ORTE_GPR_SUBSCRIPTION_ID))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &id, 1, ORTE_GPR_SUBSCRIPTION_ID))) {
return rc;
}
@ -121,14 +121,14 @@ int orte_gpr_base_pack_cancel_trigger(orte_buffer_t *cmd, orte_gpr_trigger_id_t
int rc;
OPAL_TRACE(3);
command = ORTE_GPR_CANCEL_TRIGGER_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &command, 1, ORTE_GPR_CMD))) {
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(cmd, &id, 1, ORTE_GPR_TRIGGER_ID))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(cmd, &id, 1, ORTE_GPR_TRIGGER_ID))) {
return rc;
}

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

@ -31,67 +31,37 @@
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "opal/util/output.h"
#include "orte/mca/gpr/base/base.h"
static void orte_gpr_base_dump_data(orte_buffer_t *buffer, orte_gpr_notify_data_t *data);
static void orte_gpr_base_dump_load_string(orte_buffer_t *buffer, char **tmp);
int orte_gpr_base_dump_notify_msg(orte_buffer_t *buffer,
orte_gpr_notify_message_t *msg)
{
char *tmp_out;
orte_gpr_notify_data_t **data;
size_t i, j;
int rc;
OPAL_TRACE(3);
asprintf(&tmp_out, "\nDUMP OF NOTIFY MESSAGE STRUCTURE");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (NULL == msg) {
asprintf(&tmp_out, "NULL msg pointer");
asprintf(&tmp_out, "\tNULL msg pointer");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
return ORTE_SUCCESS;
}
if (ORTE_GPR_TRIGGER_MSG == msg->msg_type) {
asprintf(&tmp_out, "TRIGGER message");
} else if (ORTE_GPR_SUBSCRIPTION_MSG == msg->msg_type) {
asprintf(&tmp_out, "SUBSCRIPTION message");
if (ORTE_SUCCESS != (rc = orte_dss.print(&tmp_out, "\t", msg, ORTE_GPR_NOTIFY_MSG))) {
ORTE_ERROR_LOG(rc);
return rc;
}
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (NULL == msg->target) {
asprintf(&tmp_out, "\tTrigger target: NULL");
} else {
asprintf(&tmp_out, "\tTrigger target: %s", msg->target);
}
orte_gpr_base_dump_load_string(buffer, &tmp_out);
asprintf(&tmp_out, "\tTrigger id: %ld", (long)msg->id);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
asprintf(&tmp_out, "\t%lu Notify data structures in message",
(unsigned long) msg->cnt);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (0 < msg->cnt) {
data = (orte_gpr_notify_data_t**)(msg->data)->addr;
for (i=0, j=0; j < msg->cnt &&
i < (msg->data)->size; i++) {
if (NULL != data[i]) {
asprintf(&tmp_out, "\nDump of notify data structure number %lu",
(unsigned long) j);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
orte_gpr_base_dump_data(buffer, data[i]);
j++;
}
}
}
return ORTE_SUCCESS;
}
@ -100,304 +70,82 @@ int orte_gpr_base_dump_notify_data(orte_buffer_t *buffer,
orte_gpr_notify_data_t *data)
{
char *tmp_out;
int rc;
OPAL_TRACE(3);
asprintf(&tmp_out, "\nDUMP OF NOTIFY DATA STRUCTURE");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (NULL == data) {
asprintf(&tmp_out, "NULL data pointer");
asprintf(&tmp_out, "\tNULL data pointer");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
return ORTE_SUCCESS;
}
orte_gpr_base_dump_data(buffer, data);
return ORTE_SUCCESS;
}
static void orte_gpr_base_dump_data(orte_buffer_t *buffer,
orte_gpr_notify_data_t *data)
{
char *tmp_out;
orte_gpr_value_t **values;
size_t i, j;
OPAL_TRACE(3);
if (NULL != data->target) {
asprintf(&tmp_out, "%lu values going to subscription target %s",
(unsigned long) data->cnt, data->target);
} else {
asprintf(&tmp_out, "%lu values going to subscription num %lu",
(unsigned long) data->cnt, (unsigned long) data->id);
if (ORTE_SUCCESS != (rc = orte_dss.print(&tmp_out, "\t", data, ORTE_GPR_NOTIFY_DATA))) {
ORTE_ERROR_LOG(rc);
return rc;
}
orte_gpr_base_dump_load_string(buffer, &tmp_out);
values = (orte_gpr_value_t**)(data->values)->addr;
if (0 < data->cnt) {
for (i=0, j=0; j < data->cnt &&
i < (data->values)->size; i++) {
if (NULL != values[i]) {
j++;
asprintf(&tmp_out, "\nData for value %lu", (unsigned long) j);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
orte_gpr_base_dump_value(buffer, values[i]);
}
}
}
return ORTE_SUCCESS;
}
int orte_gpr_base_dump_value(orte_buffer_t *buffer, orte_gpr_value_t *value)
{
char *tmp_out;
orte_gpr_addr_mode_t addr;
size_t j;
int rc;
OPAL_TRACE(3);
if (NULL == value->segment) {
asprintf(&tmp_out, "\tNULL segment name in value - %lu keyvals",
(unsigned long) value->cnt);
} else {
asprintf(&tmp_out, "\tValue from segment %s with %lu keyvals",
value->segment, (unsigned long) value->cnt);
}
asprintf(&tmp_out, "\nDUMP OF GPR VALUE STRUCTURE");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
addr = value->addr_mode;
if (NULL == value->tokens) {
asprintf(&tmp_out, "\tNULL tokens (wildcard)");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
} else {
asprintf(&tmp_out, "\t%lu Tokens returned",
(unsigned long) value->num_tokens);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
for (j=0; j < value->num_tokens; j++) {
if (NULL == value->tokens[j]) {
asprintf(&tmp_out, "\tToken %lu: NULL token pointer",
(unsigned long) j);
} else {
asprintf(&tmp_out, "\tToken %lu: %s", (unsigned long) j,
value->tokens[j]);
}
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
}
asprintf(&tmp_out, "\tToken addressing mode:");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (ORTE_GPR_TOKENS_AND & addr) {
asprintf(&tmp_out, "\t\tORTE_GPR_TOKENS_AND");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
if (ORTE_GPR_TOKENS_OR & addr) {
asprintf(&tmp_out, "\t\tORTE_GPR_TOKENS_OR");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
if (ORTE_GPR_TOKENS_XAND & addr) {
asprintf(&tmp_out, "\t\tORTE_GPR_TOKENS_XAND");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
if (ORTE_GPR_TOKENS_XOR & addr) {
asprintf(&tmp_out, "\t\tORTE_GPR_TOKENS_XOR");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
if (ORTE_GPR_TOKENS_NOT & addr) {
asprintf(&tmp_out, "\t\tORTE_GPR_TOKENS_NOT");
if (NULL == value) {
asprintf(&tmp_out, "\tNULL pointer");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
return ORTE_SUCCESS;
}
asprintf(&tmp_out, "\n\tKey addressing mode:");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (0x0000 == addr) {
asprintf(&tmp_out, "\t\tNONE");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
if (ORTE_GPR_KEYS_AND & addr) {
asprintf(&tmp_out, "\t\tORTE_GPR_KEYS_AND");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
if (ORTE_GPR_KEYS_OR & addr) {
asprintf(&tmp_out, "\t\tORTE_GPR_KEYS_OR");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
if (ORTE_GPR_KEYS_XAND & addr) {
asprintf(&tmp_out, "\t\tORTE_GPR_KEYS_XAND");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
if (ORTE_GPR_KEYS_XOR & addr) {
asprintf(&tmp_out, "\t\tORTE_GPR_KEYS_XOR");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
if (ORTE_GPR_KEYS_NOT & addr) {
asprintf(&tmp_out, "\t\tORTE_GPR_KEYS_NOT");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (ORTE_SUCCESS != (rc = orte_dss.print(&tmp_out, "", value, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
for (j=0; j < value->cnt; j++) {
if (NULL == (value->keyvals[j])->key) {
asprintf(&tmp_out, "\t\tData for keyval %lu: NULL key",
(unsigned long) j);
} else {
asprintf(&tmp_out, "\t\tData for keyval %lu: Key: %s",
(unsigned long) j, (value->keyvals[j])->key);
}
orte_gpr_base_dump_load_string(buffer, &tmp_out);
return ORTE_SUCCESS;
}
int orte_gpr_base_dump_keyval_value(orte_buffer_t *buffer, orte_gpr_keyval_t *iptr)
{
char *tmp_out;
int rc;
asprintf(&tmp_out, "\nDUMP OF GPR KEYVAL STRUCTURE");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (NULL == iptr) {
asprintf(&tmp_out, "\tNULL pointer");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
orte_gpr_base_dump_keyval_value(buffer, value->keyvals[j]);
return ORTE_SUCCESS;
}
if (ORTE_SUCCESS != (rc = orte_dss.print(&tmp_out, "", iptr, ORTE_GPR_KEYVAL))) {
ORTE_ERROR_LOG(rc);
return rc;
}
orte_gpr_base_dump_load_string(buffer, &tmp_out);
return ORTE_SUCCESS;
}
void orte_gpr_base_dump_keyval_value(orte_buffer_t *buffer, orte_gpr_keyval_t *iptr)
{
char *tmp_out;
OPAL_TRACE(3);
switch(iptr->type) {
case ORTE_BYTE:
asprintf(&tmp_out, "\t\t\tData type: ORTE_BYTE: no value field");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_BOOL:
asprintf(&tmp_out, "\t\t\tData type: ORTE_BOOL: no value field");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_STRING:
asprintf(&tmp_out, "\t\t\tData type: ORTE_STRING\tValue: %s", iptr->value.strptr);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_SIZE:
asprintf(&tmp_out, "\t\t\tData type: ORTE_SIZE:\tValue: %lu",
(unsigned long) iptr->value.size);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_PID:
asprintf(&tmp_out, "\t\t\tData type: ORTE_PID:\tValue: %lu", (unsigned long)iptr->value.pid);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_INT:
asprintf(&tmp_out, "\t\t\tData type: ORTE_INT: no value field");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_UINT8:
asprintf(&tmp_out, "\t\t\tData type: ORTE_UINT8\tValue: %u", (int)iptr->value.ui8);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_UINT16:
asprintf(&tmp_out, "\t\t\tData type: ORTE_UINT16\tValue: %u", (int)iptr->value.ui16);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_UINT32:
asprintf(&tmp_out, "\t\t\tData type: ORTE_UINT32\tValue: %u", (int)iptr->value.ui32);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
#ifdef HAVE_INT64_T
case ORTE_UINT64:
asprintf(&tmp_out, "\t\t\tData type: ORTE_UINT64\tValue: %u", (int)iptr->value.ui64);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
#endif
case ORTE_INT8:
asprintf(&tmp_out, "\t\t\tData type: ORTE_INT8\tValue: %d", (int)iptr->value.i8);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_INT16:
asprintf(&tmp_out, "\t\t\tData type: ORTE_INT16\tValue: %d", (int)iptr->value.i16);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_INT32:
asprintf(&tmp_out, "\t\t\tData type: ORTE_INT32\tValue: %d", (int)iptr->value.i32);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
#ifdef HAVE_INT64_T
case ORTE_INT64:
asprintf(&tmp_out, "\t\t\tData type: ORTE_INT64\tValue: %d", (int)iptr->value.i64);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
#endif
case ORTE_BYTE_OBJECT:
asprintf(&tmp_out, "\t\t\tData type: ORTE_BYTE_OBJECT\tSize: %lu",
(unsigned long) (iptr->value.byteobject).size);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_NAME:
asprintf(&tmp_out, "\t\t\tData type: ORTE_NAME\tValue: [%lu,%lu,%lu]",
ORTE_NAME_ARGS(&(iptr->value.proc)));
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_VPID:
asprintf(&tmp_out, "\t\t\tData type: ORTE_VPID\tValue: %lu",
(unsigned long) iptr->value.vpid);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_JOBID:
asprintf(&tmp_out, "\t\t\tData type: ORTE_JOBID\tValue: %lu",
(unsigned long) iptr->value.jobid);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_CELLID:
asprintf(&tmp_out, "\t\t\tData type: ORTE_CELLID\tValue: %lu",
(unsigned long) iptr->value.cellid);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_NODE_STATE:
asprintf(&tmp_out, "\t\t\tData type: ORTE_NODE_STATE\tValue: %d", (int)iptr->value.node_state);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_PROC_STATE:
asprintf(&tmp_out, "\t\t\tData type: ORTE_PROC_STATE\tValue: %d", (int)iptr->value.proc_state);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_EXIT_CODE:
asprintf(&tmp_out, "\t\t\tData type: ORTE_EXIT_CODE\tValue: %d", (int)iptr->value.exit_code);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_NULL:
asprintf(&tmp_out, "\t\t\tData type: ORTE_NULL");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_APP_CONTEXT:
asprintf(&tmp_out, "\t\t\tData type: ORTE_APP_CONTEXT");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
default:
asprintf(&tmp_out, "\t\t\tData type: UNKNOWN");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
}
}
static void orte_gpr_base_dump_load_string(orte_buffer_t *buffer, char **tmp)
{
orte_dps.pack(buffer, tmp, 1, ORTE_STRING);
orte_dss.pack(buffer, tmp, 1, ORTE_STRING);
free(*tmp);
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -29,7 +29,7 @@
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "dps/dps.h"
#include "dss/dss.h"
#include "mca/errmgr/errmgr.h"
#include "opal/util/output.h"
@ -43,14 +43,14 @@ int orte_gpr_base_print_dump(orte_buffer_t *buffer, int output_id)
int rc;
n = 1;
while (ORTE_SUCCESS == orte_dps.peek(buffer, &type, &n)) {
if (ORTE_SUCCESS !=
(rc = orte_dps.unpack(buffer, &line, &n, ORTE_STRING))) {
while (ORTE_SUCCESS == orte_dss.peek(buffer, &type, &n)) {
if (ORTE_SUCCESS !=
(rc = orte_dss.unpack(buffer, &line, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
opal_output(output_id, "%s", line);
free(line);
opal_output(output_id, "%s", line);
free(line);
n=1;
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -31,7 +31,7 @@
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -41,22 +41,22 @@ int orte_gpr_base_unpack_increment_value(orte_buffer_t *cmd, int *ret)
orte_gpr_cmd_flag_t command;
int rc;
size_t n;
OPAL_TRACE(3);
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(cmd, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_INCREMENT_VALUE_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(cmd, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -72,20 +72,20 @@ int orte_gpr_base_unpack_decrement_value(orte_buffer_t *cmd, int *ret)
size_t n;
OPAL_TRACE(3);
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(cmd, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_DECREMENT_VALUE_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(cmd, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -31,7 +31,7 @@
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -41,22 +41,22 @@ int orte_gpr_base_unpack_cleanup_job(orte_buffer_t *cmd, int *ret)
orte_gpr_cmd_flag_t command;
int rc;
size_t n;
OPAL_TRACE(3);
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(cmd, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_CLEANUP_JOB_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(cmd, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -69,22 +69,22 @@ int orte_gpr_base_unpack_cleanup_proc(orte_buffer_t *cmd, int *ret)
orte_gpr_cmd_flag_t command;
int rc;
size_t n;
OPAL_TRACE(3);
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(cmd, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_CLEANUP_PROC_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(cmd, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -25,7 +25,7 @@
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -38,22 +38,22 @@ int orte_gpr_base_unpack_delete_segment(orte_buffer_t *buffer, int *ret)
size_t n;
OPAL_TRACE(3);
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_DELETE_SEGMENT_CMD != command) {
if (ORTE_GPR_DELETE_SEGMENT_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
return ORTE_ERR_COMM_FAILURE;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
return rc;
}
return ORTE_SUCCESS;
}
@ -66,20 +66,20 @@ int orte_gpr_base_unpack_delete_entries(orte_buffer_t *buffer, int *ret)
size_t n;
OPAL_TRACE(3);
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_DELETE_ENTRIES_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -95,44 +95,44 @@ int orte_gpr_base_unpack_index(orte_buffer_t *buffer, int *ret, size_t *cnt, cha
int rc;
OPAL_TRACE(3);
*cnt = 0;
*index = NULL;
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_INDEX_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.peek(buffer, &type, &n))) {
if (ORTE_SUCCESS != (rc = orte_dss.peek(buffer, &type, &n))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_STRING != type) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
}
if (0 < n) {
*index = (char **)malloc(n*sizeof(char*));
if (NULL == *index) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, *index, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, *index, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -31,7 +31,7 @@
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -43,25 +43,25 @@ int orte_gpr_base_unpack_put(orte_buffer_t *buffer, int *ret)
size_t n;
OPAL_TRACE(3);
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_PUT_CMD != command) {
if (ORTE_GPR_PUT_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
return ORTE_ERR_COMM_FAILURE;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
return rc;
}
return ORTE_SUCCESS;
return ORTE_SUCCESS;
}
@ -73,13 +73,13 @@ int orte_gpr_base_unpack_get(orte_buffer_t *buffer, int *ret, size_t *cnt, orte_
size_t n, num;
OPAL_TRACE(3);
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_GET_CMD != command && ORTE_GPR_GET_CONDITIONAL_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
@ -87,11 +87,11 @@ int orte_gpr_base_unpack_get(orte_buffer_t *buffer, int *ret, size_t *cnt, orte_
/* find out how many values came back */
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &num, &n, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &num, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* if there were some, then get them */
if (0 < num) {
*values = (orte_gpr_value_t**)malloc(num*sizeof(orte_gpr_value_t*));
@ -99,17 +99,17 @@ int orte_gpr_base_unpack_get(orte_buffer_t *buffer, int *ret, size_t *cnt, orte_
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, *values, &num, ORTE_GPR_VALUE))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, *values, &num, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
free(*values);
return rc;
}
}
/* unpack the response code */
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -5,14 +5,14 @@
* 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,
* 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$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
/** @file:
@ -31,7 +31,7 @@
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/base/base.h"
@ -44,20 +44,20 @@ int orte_gpr_base_unpack_subscribe(orte_buffer_t *buffer, int *ret)
int rc;
OPAL_TRACE(3);
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_SUBSCRIBE_CMD != command) {
if (ORTE_GPR_SUBSCRIBE_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
return ORTE_ERR_COMM_FAILURE;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -73,22 +73,22 @@ int orte_gpr_base_unpack_unsubscribe(orte_buffer_t *buffer, int *ret)
int rc;
OPAL_TRACE(3);
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_UNSUBSCRIBE_CMD != command) {
if (ORTE_GPR_UNSUBSCRIBE_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
return ORTE_ERR_COMM_FAILURE;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
return rc;
}
return ORTE_SUCCESS;
@ -101,20 +101,20 @@ int orte_gpr_base_unpack_cancel_trigger(orte_buffer_t *buffer, int *ret)
int rc;
OPAL_TRACE(3);
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_GPR_CANCEL_TRIGGER_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, ret, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, ret, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -37,16 +37,16 @@
#include <sys/types.h>
#include "include/orte_constants.h"
#include "orte/include/orte_constants.h"
#include "opal/class/opal_list.h"
#include "mca/mca.h"
#include "mca/ns/ns_types.h"
#include "mca/rml/rml_types.h"
#include "opal/mca/mca.h"
#include "orte/mca/ns/ns_types.h"
#include "orte/mca/rml/rml_types.h"
#include "dps/dps_types.h"
#include "mca/gpr/gpr_types.h"
#include "mca/rml/rml_types.h"
#include "orte/dss/dss_types.h"
#include "orte/mca/gpr/gpr_types.h"
#include "orte/mca/rml/rml_types.h"
#if defined(c_plusplus) || defined(__cplusplus)
@ -251,14 +251,12 @@ typedef int (*orte_gpr_base_module_put_fn_t)(size_t cnt, orte_gpr_value_t **valu
/* simplified version of the put command */
typedef int (*orte_gpr_base_module_put_1_fn_t)(orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens,
char *key, orte_data_type_t type,
orte_gpr_value_union_t value);
char *key, orte_data_value_t *value);
typedef int (*orte_gpr_base_module_put_N_fn_t)(orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens,
size_t n, char **keys,
orte_data_type_t *types,
orte_gpr_value_union_t *data_values);
orte_data_value_t **data_values);
/*
@ -605,6 +603,8 @@ typedef int (*orte_gpr_base_module_dump_notify_data_fn_t)(orte_gpr_notify_data_t
typedef int (*orte_gpr_base_module_dump_value_fn_t)(orte_gpr_value_t *value, int output_id);
typedef int (*orte_gpr_base_module_dump_segment_size_fn_t)(char *segment, int output_id);
/*
* Increment value
* This function increments the stored value of an existing registry entry by one. Failure
@ -620,21 +620,6 @@ typedef int (*orte_gpr_base_module_increment_value_fn_t)(orte_gpr_value_t *value
typedef int (*orte_gpr_base_module_decrement_value_fn_t)(orte_gpr_value_t *value);
/* Transfer a payload between keyval values
* Because the data type of the value dictates how it must be transferred, it can be
* a burden to transfer the payload. This function centralizes that action so it only
* need be defined once.
*
* @param dest The address of the value union where the data is to be placed.
* @param src The address of the value union currently holding the data.
* @param type The type of the data
*
* @retval ORTE_SUCCESS Operation successfully completed.
* @retval ORTE_ERROR(s) Operation failed, returning the provided error code.
*/
typedef int (*orte_gpr_base_module_xfer_payload_fn_t)(orte_gpr_value_union_t *dest,
orte_gpr_value_union_t *src, orte_data_type_t type);
/* Deliver a notify message
* To support the broadcast of stage gate messages that supply all subscribed
* data in a single message, we have to provide an API that allows the xcast
@ -648,6 +633,41 @@ typedef int (*orte_gpr_base_module_xfer_payload_fn_t)(orte_gpr_value_union_t *de
typedef int (*orte_gpr_base_module_deliver_notify_msg_t)(orte_gpr_notify_message_t *msg);
/* Create a gpr value structure
* To make it easier for users, this function will create an orte_gpr_value_t structure,
* including performing all the error checks to ensure adequate memory is available.
*
* Any data that the caller wishes to provide will be pre-loaded into the returned value.
* The function will allocate space for the value object and for the number of keyvals
* and tokens to be stored in the object. If the caller wishes to allocate that space
* themselves, or does not want space allocated for those purposes, then just pass a
* value of "0" (zero) and the function will not allocate memory to those areas. Likewise,
* a value of NULL for segment will cause the function to ignore that field in the
* value object.
*
* @retval ORTE_SUCCESS Value structure successfully created
* @retval ORTE_XXXX Appropriate error code indicating problem encountered.
*/
typedef int (*orte_gpr_base_module_create_value_fn_t)(orte_gpr_value_t **value,
orte_gpr_addr_mode_t addr_mode,
char *segment,
size_t cnt, /**< Number of keyval objects */
size_t num_tokens);
/* Create a keyval object
* To make it easier for users, this function will create an orte_gpr_keyval_t object,
* including performing all the error checks to ensure adequate memory is available.
*
* Any data that the caller provides will be copied into the returned keyval object.
* If key or data are set to NULL, then those fields will be left to their default NULL
* values.
*
* @retval ORTE_SUCCESS Value structure successfully created
* @retval ORTE_XXXX Appropriate error code indicating problem encountered.
*/
typedef int (*orte_gpr_base_module_create_keyval_fn_t)(orte_gpr_keyval_t **keyval,
char *key,
orte_data_type_t type,
void *data);
/*
* Ver 1.0.0
*/
@ -670,8 +690,9 @@ struct orte_gpr_base_module_1_0_0_t {
orte_gpr_base_module_delete_segment_nb_fn_t delete_segment_nb;
orte_gpr_base_module_index_nb_fn_t index_nb;
/* GENERAL OPERATIONS */
orte_gpr_base_module_create_value_fn_t create_value;
orte_gpr_base_module_create_keyval_fn_t create_keyval;
orte_gpr_base_module_preallocate_segment_fn_t preallocate_segment;
orte_gpr_base_module_xfer_payload_fn_t xfer_payload;
orte_gpr_base_module_deliver_notify_msg_t deliver_notify_msg;
/* ARITHMETIC OPERATIONS */
orte_gpr_base_module_increment_value_fn_t increment_value;
@ -701,6 +722,7 @@ struct orte_gpr_base_module_1_0_0_t {
orte_gpr_base_module_dump_notify_msg_fn_t dump_notify_msg;
orte_gpr_base_module_dump_notify_data_fn_t dump_notify_data;
orte_gpr_base_module_dump_value_fn_t dump_value;
orte_gpr_base_module_dump_segment_size_fn_t dump_segment_size;
/* CLEANUP OPERATIONS */
orte_gpr_base_module_cleanup_job_fn_t cleanup_job;
orte_gpr_base_module_cleanup_proc_fn_t cleanup_process;

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

@ -31,19 +31,19 @@
#define ORTE_GPR_TYPES_H_
#include "orte_config.h"
#include "include/orte_types.h"
#include "orte/include/orte_types.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "mca/schema/schema.h"
#include "orte/mca/schema/schema.h"
#include "opal/class/opal_object.h"
#include "class/orte_pointer_array.h"
#include "dps/dps_types.h"
#include "mca/ns/ns_types.h"
#include "mca/rmgr/rmgr_types.h"
#include "mca/soh/soh_types.h"
#include "orte/class/orte_pointer_array.h"
#include "orte/dss/dss_types.h"
#include "orte/mca/ns/ns_types.h"
#include "orte/mca/rmgr/rmgr_types.h"
#include "orte/mca/soh/soh_types.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
@ -68,7 +68,7 @@ typedef uint8_t orte_gpr_notify_action_t;
#define ORTE_GPR_NOTIFY_ACTION_T ORTE_UINT8
typedef size_t orte_gpr_subscription_id_t;
#define ORTE_GPR_SUBSCRIPTION_ID_T DPS_TYPE_SIZE_T
#define ORTE_GPR_SUBSCRIPTION_ID_T DSS_TYPE_SIZE_T
#define ORTE_GPR_SUBSCRIPTION_ID_MAX SIZE_MAX
@ -85,7 +85,7 @@ typedef uint8_t orte_gpr_trigger_action_t;
#define ORTE_GPR_TRIGGER_ACTION_T ORTE_UINT8
typedef size_t orte_gpr_trigger_id_t;
#define ORTE_GPR_TRIGGER_ID_T DPS_TYPE_SIZE_T
#define ORTE_GPR_TRIGGER_ID_T DSS_TYPE_SIZE_T
#define ORTE_GPR_TRIGGER_ID_MAX SIZE_MAX
@ -117,48 +117,17 @@ typedef uint16_t orte_gpr_addr_mode_t;
/*
* typedefs
*/
typedef union { /* shared storage for the value */
char *strptr;
size_t size;
bool tf_flag;
pid_t pid;
int intval;
uint8_t ui8;
uint16_t ui16;
uint32_t ui32;
#ifdef HAVE_INT64_T
uint64_t ui64;
#endif
int8_t i8;
int16_t i16;
int32_t i32;
#ifdef HAVE_INT64_T
int64_t i64;
#endif
orte_byte_object_t byteobject;
orte_process_name_t proc;
orte_vpid_t vpid;
orte_jobid_t jobid;
/* orte_jobgrp_t jobgrp; */
orte_cellid_t cellid;
orte_node_state_t node_state;
orte_proc_state_t proc_state;
orte_job_state_t job_state;
orte_exit_code_t exit_code;
orte_app_context_t *app_context;
} orte_gpr_value_union_t;
/*
* Key-value pairs for registry operations
*/
typedef struct {
opal_object_t super; /* required for this to be an object */
char *key; /* string key for this value */
orte_data_type_t type; /* the type of value stored */
orte_gpr_value_union_t value;
orte_data_value_t *value; /* value */
} orte_gpr_keyval_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(orte_gpr_keyval_t);
#define ORTE_GPR_KEYVAL_EMPTY {{OBJ_CLASS(orte_gpr_keyval_t),0}, NULL, NULL}
/** Return value structure for registry requests.
@ -183,6 +152,7 @@ typedef struct {
} orte_gpr_value_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(orte_gpr_value_t);
#define ORTE_GPR_VALUE_EMPTY {{OBJ_CLASS(orte_gpr_value_t),0}, 0, NULL, 0, NULL, 0, NULL}
/** Return structure for notification messages
* A notification message contains data from each registered subscription structure.
@ -258,6 +228,7 @@ typedef struct {
} orte_gpr_subscription_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(orte_gpr_subscription_t);
#define ORTE_GPR_SUBSCRIPTION_EMPTY {{OBJ_CLASS(orte_gpr_subscription_t),0}, NULL, ORTE_GPR_SUBSCRIPTION_ID_MAX, 0, 0, NULL, 0, NULL}
/** Structure for registering triggers
* A trigger causes the associated subscriptions to be executed at a specified event,
@ -278,6 +249,7 @@ typedef struct {
} orte_gpr_trigger_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(orte_gpr_trigger_t);
#define ORTE_GPR_TRIGGER_EMPTY {{OBJ_CLASS(orte_gpr_trigger_t),0}, NULL, ORTE_GPR_TRIGGER_ID_MAX, 0, 0, NULL, 0, NULL}
#if defined(c_plusplus) || defined(__cplusplus)
}

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

@ -61,6 +61,23 @@ orte_gpr_null_cleanup_proc(orte_process_name_t * proc)
return ORTE_SUCCESS;
}
static int orte_gpr_null_create_value(orte_gpr_value_t **value,
orte_gpr_addr_mode_t addr_mode,
char *segment,
size_t cnt, /**< Number of keyval objects */
size_t num_tokens)
{
return ORTE_SUCCESS;
}
static int orte_gpr_null_create_keyval(orte_gpr_keyval_t **keyval,
char *key,
orte_data_type_t type,
void *data)
{
return ORTE_SUCCESS;
}
static int
orte_gpr_null_preallocate_segment(char *name, size_t num_slots)
{
@ -234,6 +251,12 @@ orte_gpr_null_dump_value(orte_gpr_value_t * value, int output_id)
return ORTE_SUCCESS;
}
static int
orte_gpr_null_dump_segment_size(char *segment, int output_id)
{
return ORTE_SUCCESS;
}
static int
orte_gpr_null_increment_value(orte_gpr_value_t * value)
{
@ -246,18 +269,9 @@ orte_gpr_null_decrement_value(orte_gpr_value_t * value)
return ORTE_SUCCESS;
}
static int
orte_gpr_null_xfer_payload(orte_gpr_value_union_t * dest,
orte_gpr_value_union_t * src,
orte_data_type_t type)
{
return ORTE_SUCCESS;
}
static int orte_gpr_null_put_1(orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens,
char *key, orte_data_type_t type,
orte_gpr_value_union_t value)
char *key, orte_data_value_t value)
{
return ORTE_SUCCESS;
}
@ -266,8 +280,7 @@ static int orte_gpr_null_put_1(orte_gpr_addr_mode_t addr_mode,
static int orte_gpr_null_put_N(orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens,
size_t n, char **keys,
orte_data_type_t *types,
orte_gpr_value_union_t *data_values)
orte_data_value_t *data_values)
{
return ORTE_SUCCESS;
}
@ -374,8 +387,9 @@ orte_gpr_base_module_t orte_gpr_null_module = {
orte_gpr_null_delete_segment_nb,
orte_gpr_null_index_nb,
/* GENERAL OPERATIONS */
orte_gpr_null_create_value,
orte_gpr_null_create_keyval,
orte_gpr_null_preallocate_segment,
orte_gpr_null_xfer_payload,
orte_gpr_null_deliver_notify_msg,
/* ARITHMETIC OPERATIONS */
orte_gpr_null_increment_value,
@ -405,6 +419,7 @@ orte_gpr_base_module_t orte_gpr_null_module = {
orte_gpr_null_dump_notify_msg,
orte_gpr_null_dump_notify_data,
orte_gpr_null_dump_value,
orte_gpr_null_dump_segment_size,
/* CLEANUP OPERATIONS */
orte_gpr_null_cleanup_job,
orte_gpr_null_cleanup_proc

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

@ -26,7 +26,7 @@
#include "include/orte_types.h"
#include "opal/class/opal_object.h"
#include "class/orte_pointer_array.h"
#include "dps/dps_types.h"
#include "dss/dss_types.h"
#include "util/proc_info.h"
#include "mca/gpr/base/base.h"
@ -210,6 +210,8 @@ int orte_gpr_proxy_dump_notify_data(orte_gpr_notify_data_t *data, int output_id)
int orte_gpr_proxy_dump_value(orte_gpr_value_t *value, int output_id);
int orte_gpr_proxy_dump_segment_size(char *segment, int output_id);
/*
* General operations
*/

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

@ -28,7 +28,7 @@
#include "orte_config.h"
#include "include/orte_constants.h"
#include "dps/dps_types.h"
#include "dss/dss_types.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "util/proc_info.h"

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

@ -30,7 +30,7 @@
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "opal/util/trace.h"
#include "dps/dps_types.h"
#include "dss/dss_types.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/ns_types.h"

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

@ -29,7 +29,7 @@
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "dps/dps.h"
#include "dss/dss.h"
#include "opal/util/output.h"
#include "util/proc_info.h"
@ -85,8 +85,9 @@ static orte_gpr_base_module_t orte_gpr_proxy = {
orte_gpr_proxy_delete_segment_nb,
orte_gpr_proxy_index_nb,
/* GENERAL OPERATIONS */
orte_gpr_base_create_value,
orte_gpr_base_create_keyval,
orte_gpr_proxy_preallocate_segment,
orte_gpr_base_xfer_payload,
orte_gpr_proxy_deliver_notify_msg,
/* ARITHMETIC OPERATIONS */
orte_gpr_proxy_increment_value,
@ -116,6 +117,7 @@ static orte_gpr_base_module_t orte_gpr_proxy = {
orte_gpr_proxy_dump_notify_msg,
orte_gpr_proxy_dump_notify_data,
orte_gpr_proxy_dump_value,
orte_gpr_proxy_dump_segment_size,
/* CLEANUP OPERATIONS */
orte_gpr_proxy_cleanup_job,
orte_gpr_proxy_cleanup_proc
@ -367,7 +369,7 @@ void orte_gpr_proxy_notify_recv(int status, orte_process_name_t* sender,
int rc;
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
@ -384,7 +386,7 @@ void orte_gpr_proxy_notify_recv(int status, orte_process_name_t* sender,
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &msg, &n, ORTE_GPR_NOTIFY_MSG))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, &msg, &n, ORTE_GPR_NOTIFY_MSG))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(msg);
goto RETURN_ERROR;

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

@ -29,7 +29,7 @@
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "dps/dps.h"
#include "dss/dss.h"
#include "opal/util/output.h"
#include "util/proc_info.h"
@ -68,7 +68,7 @@ int orte_gpr_proxy_begin_compound_cmd(void)
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(orte_gpr_proxy_globals.compound_cmd, &command,
if (ORTE_SUCCESS != (rc = orte_dss.pack(orte_gpr_proxy_globals.compound_cmd, &command,
1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
orte_gpr_proxy_globals.compound_cmd_mode = false;
@ -135,7 +135,7 @@ int orte_gpr_proxy_exec_compound_cmd(void)
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(answer);
goto CLEANUP;
@ -149,7 +149,7 @@ int orte_gpr_proxy_exec_compound_cmd(void)
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(answer, &response, &n, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(answer, &response, &n, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
}

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

@ -23,7 +23,7 @@
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "dps/dps.h"
#include "dss/dss.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "util/proc_info.h"

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

@ -29,7 +29,7 @@
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "dps/dps.h"
#include "dss/dss.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "util/proc_info.h"

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

@ -37,13 +37,13 @@
#include <libgen.h>
#endif
#include "include/orte_constants.h"
#include "orte/include/orte_constants.h"
#include "dps/dps.h"
#include "mca/errmgr/errmgr.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "mca/oob/oob_types.h"
#include "mca/rml/rml.h"
#include "orte/mca/oob/oob_types.h"
#include "orte/mca/rml/rml.h"
#include "gpr_proxy.h"
@ -88,7 +88,7 @@ int orte_gpr_proxy_dump_all(int output_id)
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(answer);
return rc;
@ -149,7 +149,7 @@ int orte_gpr_proxy_dump_segments(char *segment, int output_id)
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(answer);
return rc;
@ -210,7 +210,7 @@ int orte_gpr_proxy_dump_triggers(orte_gpr_trigger_id_t start, int output_id)
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(answer);
return rc;
@ -271,7 +271,7 @@ int orte_gpr_proxy_dump_subscriptions(orte_gpr_subscription_id_t start, int outp
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(answer);
return rc;
@ -334,7 +334,7 @@ int orte_gpr_proxy_dump_a_trigger(char *name,
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(answer);
return rc;
@ -398,7 +398,7 @@ int orte_gpr_proxy_dump_a_subscription(char *name,
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(answer);
return rc;
@ -460,7 +460,7 @@ int orte_gpr_proxy_dump_callbacks(int output_id)
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(answer);
return rc;
@ -555,3 +555,64 @@ int orte_gpr_proxy_dump_value(orte_gpr_value_t *value, int output_id)
OBJ_RELEASE(answer);
return rc;
}
int orte_gpr_proxy_dump_segment_size(char *segment, int output_id)
{
orte_gpr_cmd_flag_t command;
orte_buffer_t *cmd;
orte_buffer_t *answer;
int rc;
size_t n;
if (orte_gpr_proxy_globals.compound_cmd_mode) {
return orte_gpr_base_pack_dump_segment_size(orte_gpr_proxy_globals.compound_cmd, segment);
}
cmd = OBJ_NEW(orte_buffer_t);
if (NULL == cmd) { /* got a problem */
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = orte_gpr_base_pack_dump_segment_size(cmd, segment))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(cmd);
return rc;
}
if (0 > orte_rml.send_buffer(orte_process_info.gpr_replica, cmd, ORTE_RML_TAG_GPR, 0)) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
}
answer = OBJ_NEW(orte_buffer_t);
if (NULL == answer) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (0 > orte_rml.recv_buffer(orte_process_info.gpr_replica, answer, ORTE_RML_TAG_GPR)) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
return ORTE_ERR_COMM_FAILURE;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dss.unpack(answer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(answer);
return rc;
}
if (ORTE_GPR_DUMP_SEGMENT_SIZE_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
OBJ_RELEASE(answer);
return ORTE_ERR_COMM_FAILURE;
}
if (ORTE_SUCCESS != (rc = orte_gpr_base_print_dump(answer, output_id))) {
ORTE_ERROR_LOG(rc);
}
OBJ_RELEASE(answer);
return rc;
}

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

@ -28,7 +28,7 @@
#include "orte_config.h"
#include "include/orte_constants.h"
#include "dps/dps_types.h"
#include "dss/dss_types.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "util/proc_info.h"

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

@ -87,7 +87,8 @@ orte_gpr_proxy_enter_trigger(size_t cnt, orte_gpr_trigger_t **trigs)
j < (orte_gpr_proxy_globals.triggers)->size; j++) {
if (NULL != tptr[j]) {
k++;
if (0 == strcmp(tptr[j]->name, trigs[i]->name)) {
if (NULL != tptr[j]->name &&
0 == strcmp(tptr[j]->name, trigs[i]->name)) {
/* same name - trigger is already on list */
if (NULL != tptr[j]->callback || NULL == trigs[i]->cbfunc) {
/* ignore these cases */

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

@ -28,7 +28,7 @@
#include "orte_config.h"
#include "include/orte_constants.h"
#include "dps/dps_types.h"
#include "dss/dss_types.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "util/proc_info.h"

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

@ -28,7 +28,7 @@
#include "orte_config.h"
#include "include/orte_constants.h"
#include "dps/dps.h"
#include "dss/dss.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "util/proc_info.h"

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

@ -162,6 +162,8 @@ int orte_gpr_replica_dump_notify_data(orte_gpr_notify_data_t *data, int output_i
int orte_gpr_replica_dump_value(orte_gpr_value_t *value, int output_id);
int orte_gpr_replica_dump_segment_size(char *segment, int output_id);
/*
* General functions
*/

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

@ -27,14 +27,14 @@
#include "orte_config.h"
#include "dps/dps.h"
#include "opal/util/output.h"
#include "util/proc_info.h"
#include "mca/ns/ns_types.h"
#include "mca/errmgr/errmgr.h"
#include "orte/dss/dss_types.h"
#include "orte/util/proc_info.h"
#include "orte/mca/ns/ns_types.h"
#include "orte/mca/errmgr/errmgr.h"
#include "mca/gpr/replica/api_layer/gpr_replica_api.h"
#include "orte/mca/gpr/replica/api_layer/gpr_replica_api.h"
int orte_gpr_replica_dump_all(int output_id)
{
@ -393,3 +393,30 @@ int orte_gpr_replica_dump_value(orte_gpr_value_t *value, int output_id)
OBJ_RELEASE(answer);
return rc;
}
int orte_gpr_replica_dump_segment_size(char *segment, int output_id)
{
orte_buffer_t *buffer;
int rc;
OPAL_THREAD_LOCK(&orte_gpr_replica_globals.mutex);
buffer = OBJ_NEW(orte_buffer_t);
if (NULL == buffer) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = orte_gpr_replica_dump_segment_size_fn(buffer, segment))) {
ORTE_ERROR_LOG(rc);
}
if (ORTE_SUCCESS == rc) {
orte_gpr_base_print_dump(buffer, output_id);
}
OBJ_RELEASE(buffer);
OPAL_THREAD_UNLOCK(&orte_gpr_replica_globals.mutex);
return rc;
}

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

@ -30,9 +30,10 @@
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "util/proc_info.h"
#include "mca/ns/ns_types.h"
#include "mca/errmgr/errmgr.h"
#include "orte/dss/dss.h"
#include "orte/util/proc_info.h"
#include "orte/mca/ns/ns_types.h"
#include "orte/mca/errmgr/errmgr.h"
#include "gpr_replica_api.h"
@ -227,7 +228,7 @@ int orte_gpr_replica_get_conditional(orte_gpr_addr_mode_t addr_mode,
/* convert conditions to itagvals */
conds = (orte_gpr_replica_itagval_t**)malloc(num_conditions*sizeof(orte_gpr_replica_itagval_t*));
memset(conds, 0, num_conditions*sizeof(orte_gpr_replica_itagval_t*)); /* init the space */
if (NULL == conds) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
@ -236,24 +237,31 @@ int orte_gpr_replica_get_conditional(orte_gpr_addr_mode_t addr_mode,
conds[i] = OBJ_NEW(orte_gpr_replica_itagval_t);
if (NULL == conds[i]) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
rc = ORTE_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
if (ORTE_SUCCESS != (rc = orte_gpr_replica_create_itag(&(conds[i]->itag), seg, conditions[i]->key))) {
goto CLEANUP;
}
conds[i]->type = conditions[i]->type;
if (ORTE_SUCCESS != (rc = orte_gpr_base_xfer_payload(
&(conds[i]->value), &(conditions[i]->value), conds[i]->type))) {
conds[i]->value = OBJ_NEW(orte_data_value_t);
if (NULL == conds[i]->value) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
rc = ORTE_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
conds[i]->value->type = conditions[i]->value->type;
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)&((conds[i]->value)->data), conditions[i]->value->data, conds[i]->value->type))) {
ORTE_ERROR_LOG(rc);
goto CLEANUP;
}
}
if (ORTE_SUCCESS != (rc = orte_gpr_replica_get_conditional_fn(addr_mode, seg,
tokentags, num_tokens, keytags, num_keys,
num_conditions, conds,
cnt, values))) {
goto CLEANUP;
ORTE_ERROR_LOG(rc);
goto CLEANUP;
}
CLEANUP:
@ -269,7 +277,7 @@ CLEANUP:
if (NULL != conds[i]) OBJ_RELEASE(conds[i]);
}
if (NULL != conds) free(conds);
OPAL_THREAD_UNLOCK(&orte_gpr_replica_globals.mutex);
return rc;

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

@ -29,7 +29,7 @@
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss_types.h"
#include "orte/mca/ns/ns.h"
#include "orte/mca/errmgr/errmgr.h"

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

@ -29,7 +29,7 @@
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/replica/communications/gpr_replica_comm.h"
@ -45,13 +45,13 @@ int orte_gpr_replica_recv_increment_value_cmd(orte_buffer_t *cmd, orte_buffer_t
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, &value, &n, ORTE_GPR_VALUE))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(cmd, &value, &n, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
ret = rc;
goto RETURN_ERROR;
@ -94,7 +94,7 @@ int orte_gpr_replica_recv_increment_value_cmd(orte_buffer_t *cmd, orte_buffer_t
}
RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -113,13 +113,13 @@ int orte_gpr_replica_recv_decrement_value_cmd(orte_buffer_t *cmd, orte_buffer_t
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(cmd, &value, &n, ORTE_GPR_VALUE))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(cmd, &value, &n, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
ret = rc;
goto RETURN_ERROR;
@ -162,7 +162,7 @@ int orte_gpr_replica_recv_decrement_value_cmd(orte_buffer_t *cmd, orte_buffer_t
}
RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -29,7 +29,7 @@
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/replica/communications/gpr_replica_comm.h"
@ -44,13 +44,13 @@ int orte_gpr_replica_recv_cleanup_job_cmd(orte_buffer_t *input_buffer,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &jobid, &n, ORTE_JOBID))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &jobid, &n, ORTE_JOBID))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -62,7 +62,7 @@ int orte_gpr_replica_recv_cleanup_job_cmd(orte_buffer_t *input_buffer,
}
RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -81,13 +81,13 @@ int orte_gpr_replica_recv_cleanup_proc_cmd(orte_buffer_t *input_buffer,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &proc, &n, ORTE_NAME))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &proc, &n, ORTE_NAME))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -99,7 +99,7 @@ int orte_gpr_replica_recv_cleanup_proc_cmd(orte_buffer_t *input_buffer,
}
RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -29,7 +29,7 @@
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "opal/util/output.h"
#include "orte/mca/gpr/replica/communications/gpr_replica_comm.h"
@ -62,9 +62,9 @@ int orte_gpr_replica_process_command_buffer(orte_buffer_t *input_buffer,
rc = ORTE_SUCCESS;
ret = ORTE_SUCCESS;
while (ORTE_SUCCESS == orte_dps.peek(input_buffer, &type, &num_vals)) {
while (ORTE_SUCCESS == orte_dss.peek(input_buffer, &type, &num_vals)) {
if (ORTE_SUCCESS !=
orte_dps.unpack(input_buffer, &command, &n, ORTE_GPR_CMD)) {
orte_dss.unpack(input_buffer, &command, &n, ORTE_GPR_CMD)) {
break;
}
switch(command) {
@ -299,6 +299,15 @@ int orte_gpr_replica_process_command_buffer(orte_buffer_t *input_buffer,
case ORTE_GPR_DUMP_SEGMENT_SIZE_CMD: /***** DUMP *****/
if (ORTE_SUCCESS != (ret = orte_gpr_replica_recv_dump_segment_size_cmd(input_buffer, answer))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
break;
case ORTE_GPR_INCREMENT_VALUE_CMD: /***** INCREMENT_VALUE *****/
if (orte_gpr_replica_globals.debug) {
@ -361,7 +370,7 @@ int orte_gpr_replica_process_command_buffer(orte_buffer_t *input_buffer,
default: /**** UNRECOGNIZED COMMAND ****/
command = ORTE_GPR_ERROR;
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, (void*)&command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, (void*)&command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
@ -380,13 +389,13 @@ int orte_gpr_replica_process_command_buffer(orte_buffer_t *input_buffer,
}
command = ORTE_GPR_COMPOUND_CMD;
if (ORTE_SUCCESS != (rc = orte_dps.pack(*output_buffer, (void*)&command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(*output_buffer, (void*)&command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
ret = ORTE_SUCCESS;
if (ORTE_SUCCESS != (rc = orte_dps.pack(*output_buffer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(*output_buffer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
@ -404,14 +413,14 @@ RETURN_ERROR:
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc2 = orte_dps.pack(answer, (void*)&command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc2 = orte_dss.pack(answer, (void*)&command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc2);
}
if (ORTE_SUCCESS != ret) {
orte_dps.pack(answer, &ret, 1, ORTE_INT);
orte_dss.pack(answer, &ret, 1, ORTE_INT);
return rc;
}
orte_dps.pack(answer, &rc, 1, ORTE_INT);
orte_dss.pack(answer, &rc, 1, ORTE_INT);
return rc;
}

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

@ -130,6 +130,8 @@ int orte_gpr_replica_recv_dump_a_subscription_cmd(orte_buffer_t *input_buffer,
int orte_gpr_replica_recv_dump_callbacks_cmd(orte_buffer_t *answer);
int orte_gpr_replica_recv_dump_segment_size_cmd(orte_buffer_t *input_buffer, orte_buffer_t *answer);
int orte_gpr_replica_recv_get_startup_msg_cmd(orte_buffer_t *input_buffer,
orte_buffer_t *answer);

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

@ -29,7 +29,7 @@
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/replica/communications/gpr_replica_comm.h"
@ -41,7 +41,7 @@ int orte_gpr_replica_recv_compound_cmd(orte_buffer_t *output_buffer)
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
}
return rc;

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

@ -29,7 +29,7 @@
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/replica/communications/gpr_replica_comm.h"
@ -44,13 +44,13 @@ int orte_gpr_replica_recv_delete_segment_cmd(orte_buffer_t *buffer, orte_buffer_
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, &segment, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(buffer, &segment, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -67,7 +67,7 @@ int orte_gpr_replica_recv_delete_segment_cmd(orte_buffer_t *buffer, orte_buffer_
RETURN_ERROR:
if (NULL != segment) free(segment);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -87,25 +87,25 @@ int orte_gpr_replica_recv_delete_entries_cmd(orte_buffer_t *buffer, orte_buffer_
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, &addr_mode, &n, ORTE_GPR_ADDR_MODE))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(buffer, &addr_mode, &n, ORTE_GPR_ADDR_MODE))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, &segment, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(buffer, &segment, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, &num_tokens, &n, ORTE_SIZE))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(buffer, &num_tokens, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -119,14 +119,14 @@ int orte_gpr_replica_recv_delete_entries_cmd(orte_buffer_t *buffer, orte_buffer_
ret = ORTE_ERR_OUT_OF_RESOURCE;
goto RETURN_ERROR;
}
if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, tokens, &num_tokens, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(buffer, tokens, &num_tokens, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, &num_keys, &n, ORTE_SIZE))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(buffer, &num_keys, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -140,7 +140,7 @@ int orte_gpr_replica_recv_delete_entries_cmd(orte_buffer_t *buffer, orte_buffer_
ret = ORTE_ERR_OUT_OF_RESOURCE;
goto RETURN_ERROR;
}
if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, keys, &num_keys, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(buffer, keys, &num_keys, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -200,7 +200,7 @@ int orte_gpr_replica_recv_delete_entries_cmd(orte_buffer_t *buffer, orte_buffer_
free(key_itags);
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -220,12 +220,12 @@ int orte_gpr_replica_recv_index_cmd(orte_buffer_t *buffer,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (ret = orte_dps.peek(buffer, &type, &n))) {
if (ORTE_SUCCESS != (ret = orte_dss.peek(buffer, &type, &n))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -233,7 +233,7 @@ int orte_gpr_replica_recv_index_cmd(orte_buffer_t *buffer,
if (ORTE_STRING != type) { /* get index of segment names */
seg = NULL;
} else {
if (ORTE_SUCCESS != (ret = orte_dps.unpack(buffer, &segment, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(buffer, &segment, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -249,14 +249,14 @@ int orte_gpr_replica_recv_index_cmd(orte_buffer_t *buffer,
goto RETURN_ERROR;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &cnt, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &cnt, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
ret = rc;
goto RETURN_PACK_ERROR;
}
if (0 < cnt) { /* got a non-zero answer back */
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, index, cnt, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, index, cnt, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
ret = rc;
goto RETURN_PACK_ERROR;
@ -266,7 +266,7 @@ int orte_gpr_replica_recv_index_cmd(orte_buffer_t *buffer,
RETURN_ERROR:
/* ensure that the minimum response is generated */
cnt = 0;
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &cnt, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &cnt, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
ret = rc;
}
@ -283,7 +283,7 @@ RETURN_PACK_ERROR:
free(index);
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -29,7 +29,7 @@
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/replica/communications/gpr_replica_comm.h"
@ -42,7 +42,7 @@ int orte_gpr_replica_recv_dump_all_cmd(orte_buffer_t *answer)
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -64,13 +64,13 @@ int orte_gpr_replica_recv_dump_segments_cmd(orte_buffer_t *input_buffer, orte_bu
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(input_buffer, &segment, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, &segment, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -92,13 +92,13 @@ int orte_gpr_replica_recv_dump_triggers_cmd(orte_buffer_t *input_buffer,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(input_buffer, &start, &n, ORTE_GPR_TRIGGER_ID))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, &start, &n, ORTE_GPR_TRIGGER_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -121,13 +121,13 @@ int orte_gpr_replica_recv_dump_subscriptions_cmd(orte_buffer_t *input_buffer,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(input_buffer, &start, &n, ORTE_GPR_SUBSCRIPTION_ID))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, &start, &n, ORTE_GPR_SUBSCRIPTION_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -152,19 +152,19 @@ int orte_gpr_replica_recv_dump_a_trigger_cmd(orte_buffer_t *input_buffer,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(input_buffer, &name, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, &name, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(input_buffer, &id, &n, ORTE_GPR_TRIGGER_ID))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, &id, &n, ORTE_GPR_TRIGGER_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -218,19 +218,19 @@ int orte_gpr_replica_recv_dump_a_subscription_cmd(orte_buffer_t *input_buffer,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(input_buffer, &name, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, &name, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(input_buffer, &id, &n, ORTE_GPR_SUBSCRIPTION_ID))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, &id, &n, ORTE_GPR_SUBSCRIPTION_ID))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -280,7 +280,7 @@ int orte_gpr_replica_recv_dump_callbacks_cmd(orte_buffer_t *answer)
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -292,3 +292,30 @@ int orte_gpr_replica_recv_dump_callbacks_cmd(orte_buffer_t *answer)
}
return rc;
}
int orte_gpr_replica_recv_dump_segment_size_cmd(orte_buffer_t *input_buffer, orte_buffer_t *answer)
{
orte_gpr_cmd_flag_t command=ORTE_GPR_DUMP_SEGMENT_SIZE_CMD;
char *segment;
size_t n;
int rc;
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n=1;
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, &segment, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_gpr_replica_dump_segment_size_fn(answer, segment);
if (ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
}
return rc;
}

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

@ -29,7 +29,7 @@
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/replica/communications/gpr_replica_comm.h"
@ -46,13 +46,13 @@ int orte_gpr_replica_recv_put_cmd(orte_buffer_t *buffer, orte_buffer_t *answer)
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
cnt = 1;
if (ORTE_SUCCESS != (rc = orte_dps.peek(buffer, &type, &cnt))) {
if (ORTE_SUCCESS != (rc = orte_dss.peek(buffer, &type, &cnt))) {
ORTE_ERROR_LOG(rc);
ret = rc;
goto RETURN_ERROR;
@ -71,7 +71,7 @@ int orte_gpr_replica_recv_put_cmd(orte_buffer_t *buffer, orte_buffer_t *answer)
goto RETURN_ERROR;
}
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, values, &cnt, ORTE_GPR_VALUE))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(buffer, values, &cnt, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
free(values);
ret = rc;
@ -130,7 +130,7 @@ int orte_gpr_replica_recv_put_cmd(orte_buffer_t *buffer, orte_buffer_t *answer)
free(values);
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(answer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(answer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -153,25 +153,25 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &addr_mode, &n, ORTE_GPR_ADDR_MODE))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &addr_mode, &n, ORTE_GPR_ADDR_MODE))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &segment, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &segment, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &num_tokens, &n, ORTE_SIZE))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &num_tokens, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -184,7 +184,7 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
goto RETURN_ERROR;
}
n = num_tokens;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, tokens, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, tokens, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
free(tokens);
goto RETURN_ERROR;
@ -194,7 +194,7 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &num_keys, &n, ORTE_SIZE))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &num_keys, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -207,7 +207,7 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
goto RETURN_ERROR;
}
n = num_keys;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, keys, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, keys, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -247,14 +247,14 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
RETURN_ERROR:
/* pack the number of values */
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &cnt, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &cnt, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
ret = rc;
}
/* pack the answer into the output output_buffer */
if (0 < cnt) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, values, cnt, ORTE_GPR_VALUE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, values, cnt, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
ret = rc;
}
@ -295,7 +295,7 @@ int orte_gpr_replica_recv_get_cmd(orte_buffer_t *input_buffer,
}
/* pack response code */
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
}
@ -319,25 +319,25 @@ int orte_gpr_replica_recv_get_conditional_cmd(orte_buffer_t *input_buffer,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &addr_mode, &n, ORTE_GPR_ADDR_MODE))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &addr_mode, &n, ORTE_GPR_ADDR_MODE))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &segment, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &segment, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &num_tokens, &n, ORTE_SIZE))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &num_tokens, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -350,7 +350,7 @@ int orte_gpr_replica_recv_get_conditional_cmd(orte_buffer_t *input_buffer,
goto RETURN_ERROR;
}
n = num_tokens;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, tokens, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, tokens, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
free(tokens);
goto RETURN_ERROR;
@ -360,7 +360,7 @@ int orte_gpr_replica_recv_get_conditional_cmd(orte_buffer_t *input_buffer,
}
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &num_keys, &n, ORTE_SIZE))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &num_keys, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -373,7 +373,7 @@ int orte_gpr_replica_recv_get_conditional_cmd(orte_buffer_t *input_buffer,
goto RETURN_ERROR;
}
n = num_keys;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, keys, &n, ORTE_STRING))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, keys, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
@ -383,25 +383,24 @@ int orte_gpr_replica_recv_get_conditional_cmd(orte_buffer_t *input_buffer,
/* get number of conditions */
n = 1;
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, &num_conditions, &n, ORTE_SIZE))) {
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, &num_conditions, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
/* allocate space for them */
conditions = (orte_gpr_keyval_t**)malloc(num_conditions * sizeof(orte_gpr_keyval_t*));
if (NULL == conditions) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
goto RETURN_ERROR;
}
/* get conditions */
if(NULL == (conditions = malloc(sizeof(orte_gpr_keyval_t*)*num_conditions))) {
ret = ORTE_ERR_OUT_OF_RESOURCE;
if (ORTE_SUCCESS != (ret = orte_dss.unpack(input_buffer, conditions, &num_conditions, ORTE_GPR_KEYVAL))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
memset(conditions, 0, sizeof(orte_gpr_keyval_t*)*num_conditions);
if (ORTE_SUCCESS != (ret = orte_dps.unpack(input_buffer, conditions, &num_conditions, ORTE_KEYVAL))) {
ORTE_ERROR_LOG(ret);
goto RETURN_ERROR;
}
/* find the segment */
if (ORTE_SUCCESS != (ret = orte_gpr_replica_find_seg(&seg, true, segment))) {
ORTE_ERROR_LOG(ret);
@ -439,9 +438,13 @@ int orte_gpr_replica_recv_get_conditional_cmd(orte_buffer_t *input_buffer,
if (ORTE_SUCCESS != (rc = orte_gpr_replica_create_itag(&(conds[i]->itag), seg, conditions[i]->key))) {
goto RETURN_ERROR;
}
conds[i]->type = conditions[i]->type;
if (ORTE_SUCCESS != (rc = orte_gpr_base_xfer_payload(
&(conds[i]->value), &(conditions[i]->value), conds[i]->type))) {
conds[i]->value = OBJ_NEW(orte_data_value_t);
if (NULL == conds[i]->value) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
goto RETURN_ERROR;
}
conds[i]->value->type = conditions[i]->value->type;
if (ORTE_SUCCESS != (rc = orte_dss.copy(&((conds[i]->value)->data), conditions[i]->value->data, conds[i]->value->type))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
@ -459,14 +462,14 @@ int orte_gpr_replica_recv_get_conditional_cmd(orte_buffer_t *input_buffer,
RETURN_ERROR:
/* pack the number of values */
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &cnt, 1, ORTE_SIZE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &cnt, 1, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
ret = rc;
}
/* pack the answer into the output output_buffer */
if (0 < cnt) {
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, values, cnt, ORTE_GPR_VALUE))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, values, cnt, ORTE_GPR_VALUE))) {
ORTE_ERROR_LOG(rc);
ret = rc;
}
@ -523,8 +526,8 @@ int orte_gpr_replica_recv_get_conditional_cmd(orte_buffer_t *input_buffer,
free(conditions);
}
/* pack response code */
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) {
/* pack response code */
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
}

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

@ -31,7 +31,7 @@
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/ns/ns_types.h"
#include "orte/mca/rml/rml.h"
@ -62,12 +62,12 @@ int orte_gpr_replica_remote_notify(orte_process_name_t *recipient,
OBJ_CONSTRUCT(&buffer, orte_buffer_t);
if (ORTE_SUCCESS != (rc = orte_dps.pack(&buffer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.pack(&buffer, &message, 1, ORTE_GPR_NOTIFY_MSG))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(&buffer, &message, 1, ORTE_GPR_NOTIFY_MSG))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -27,7 +27,7 @@
*/
#include "orte_config.h"
#include "orte/dps/dps.h"
#include "orte/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/util/proc_info.h"
#include "opal/util/output.h"
@ -48,12 +48,12 @@ int orte_gpr_replica_recv_subscribe_cmd(orte_process_name_t* sender,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps.peek(input_buffer, &type, &n))) {
if (ORTE_SUCCESS != (rc = orte_dss.peek(input_buffer, &type, &n))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
@ -69,7 +69,7 @@ int orte_gpr_replica_recv_subscribe_cmd(orte_process_name_t* sender,
* and continue on
*/
n=1;
if (ORTE_SUCCESS != orte_dps.unpack(input_buffer, &num_subs, &n, ORTE_SIZE)) {
if (ORTE_SUCCESS != orte_dss.unpack(input_buffer, &num_subs, &n, ORTE_SIZE)) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
@ -88,7 +88,7 @@ int orte_gpr_replica_recv_subscribe_cmd(orte_process_name_t* sender,
goto RETURN_ERROR;
}
if (ORTE_SUCCESS != (rc = orte_dps.unpack(input_buffer, subscriptions, &n, ORTE_GPR_SUBSCRIPTION))) {
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, subscriptions, &n, ORTE_GPR_SUBSCRIPTION))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
@ -102,7 +102,7 @@ int orte_gpr_replica_recv_subscribe_cmd(orte_process_name_t* sender,
goto RETURN_ERROR;
}
if (ORTE_SUCCESS != (rc = orte_dps.peek(input_buffer, &type, &n))) {
if (ORTE_SUCCESS != (rc = orte_dss.peek(input_buffer, &type, &n))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
@ -118,7 +118,7 @@ int orte_gpr_replica_recv_subscribe_cmd(orte_process_name_t* sender,
* and continue on
*/
n=1;
if (ORTE_SUCCESS != orte_dps.unpack(input_buffer, &num_trigs, &n, ORTE_SIZE)) {
if (ORTE_SUCCESS != orte_dss.unpack(input_buffer, &num_trigs, &n, ORTE_SIZE)) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
@ -137,7 +137,7 @@ int orte_gpr_replica_recv_subscribe_cmd(orte_process_name_t* sender,
goto RETURN_ERROR;
}
if (ORTE_SUCCESS != orte_dps.unpack(input_buffer, trigs, &n, ORTE_GPR_TRIGGER)) {
if (ORTE_SUCCESS != orte_dss.unpack(input_buffer, trigs, &n, ORTE_GPR_TRIGGER)) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
@ -176,7 +176,7 @@ int orte_gpr_replica_recv_subscribe_cmd(orte_process_name_t* sender,
if (NULL != trigs) free(trigs);
}
if (ORTE_SUCCESS != (ret = orte_dps.pack(output_buffer, &rc, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (ret = orte_dss.pack(output_buffer, &rc, 1, ORTE_INT))) {
ORTE_ERROR_LOG(ret);
return ret;
}
@ -195,13 +195,13 @@ int orte_gpr_replica_recv_unsubscribe_cmd(orte_process_name_t *sender,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(input_buffer, &sub_number, &n,
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, &sub_number, &n,
ORTE_GPR_SUBSCRIPTION_ID))) {
ORTE_ERROR_LOG(rc);
ret = rc;
@ -214,7 +214,7 @@ int orte_gpr_replica_recv_unsubscribe_cmd(orte_process_name_t *sender,
}
RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -234,13 +234,13 @@ int orte_gpr_replica_recv_cancel_trigger_cmd(orte_process_name_t *sender,
OPAL_TRACE(3);
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &command, 1, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
return rc;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(input_buffer, &trig_number, &n,
if (ORTE_SUCCESS != (rc = orte_dss.unpack(input_buffer, &trig_number, &n,
ORTE_GPR_TRIGGER_ID))) {
ORTE_ERROR_LOG(rc);
ret = rc;
@ -253,7 +253,7 @@ int orte_gpr_replica_recv_cancel_trigger_cmd(orte_process_name_t *sender,
}
RETURN_ERROR:
if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) {
if (ORTE_SUCCESS != (rc = orte_dss.pack(output_buffer, &ret, 1, ORTE_INT))) {
ORTE_ERROR_LOG(rc);
return rc;
}

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

@ -87,46 +87,10 @@ int orte_gpr_replica_increment_value_fn(orte_gpr_addr_mode_t addr_mode,
k < (orte_gpr_replica_globals.srch_ival)->size; k++) { /* for each found keyval */
if (NULL != ival[k]) {
n++;
switch (ival[k]->type) {
case ORTE_SIZE:
ival[k]->value.size++;
break;
case ORTE_UINT8:
ival[k]->value.ui8++;
break;
case ORTE_UINT16:
ival[k]->value.ui16++;
break;
case ORTE_UINT32:
ival[k]->value.ui32++;
break;
#ifdef HAVE_INT64_T
case ORTE_UINT64:
ival[k]->value.ui64++;
break;
case ORTE_INT64:
ival[k]->value.i64++;
break;
#endif
case ORTE_INT8:
ival[k]->value.ui32++;
break;
case ORTE_INT16:
ival[k]->value.i16++;
break;
case ORTE_INT32:
ival[k]->value.i32++;
break;
}
if (ORTE_SUCCESS != (rc = orte_dss.increment(ival[k]->value))) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
}
}
@ -171,7 +135,7 @@ int orte_gpr_replica_decrement_value_fn(orte_gpr_addr_mode_t addr_mode,
}
/* otherwise, go through list of containers. For each one,
find the entry and then add one to its value */
find the entry and then subtract one from its value */
cptr = (orte_gpr_replica_container_t**)(orte_gpr_replica_globals.srch_cptr)->addr;
for (j=0, m=0; m < orte_gpr_replica_globals.num_srch_cptr &&
j < (orte_gpr_replica_globals.srch_cptr)->size; j++) { /* for each container */
@ -187,46 +151,10 @@ int orte_gpr_replica_decrement_value_fn(orte_gpr_addr_mode_t addr_mode,
k < (orte_gpr_replica_globals.srch_ival)->size; k++) { /* for each found keyval */
if (NULL != ival[k]) {
n++;
switch (ival[k]->type) {
case ORTE_SIZE:
ival[k]->value.size--;
break;
case ORTE_UINT8:
ival[k]->value.ui8--;
break;
case ORTE_UINT16:
ival[k]->value.ui16--;
break;
case ORTE_UINT32:
ival[k]->value.ui32--;
break;
#ifdef HAVE_INT64_T
case ORTE_UINT64:
ival[k]->value.ui64--;
break;
case ORTE_INT64:
ival[k]->value.i64--;
break;
#endif
case ORTE_INT8:
ival[k]->value.ui32--;
break;
case ORTE_INT16:
ival[k]->value.i16--;
break;
case ORTE_INT32:
ival[k]->value.i32--;
break;
}
if (ORTE_SUCCESS != (rc = orte_dss.decrement(ival[k]->value))) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
}
} else {

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

@ -27,17 +27,17 @@
#include "orte_config.h"
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "orte/include/orte_constants.h"
#include "orte/include/orte_types.h"
#include "dps/dps.h"
#include "orte/dss/dss.h"
#include "opal/util/output.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/ns_types.h"
#include "mca/soh/soh_types.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/ns/ns_types.h"
#include "orte/mca/soh/soh_types.h"
#include "mca/gpr/replica/transition_layer/gpr_replica_tl.h"
#include "orte/mca/gpr/replica/transition_layer/gpr_replica_tl.h"
#include "gpr_replica_fn.h"
static void orte_gpr_replica_dump_load_string(orte_buffer_t *buffer, char **tmp);
@ -45,6 +45,8 @@ static void orte_gpr_replica_dump_load_string(orte_buffer_t *buffer, char **tmp)
void orte_gpr_replica_dump_itagval_value(orte_buffer_t *buffer,
orte_gpr_replica_itagval_t *iptr);
static int orte_gpr_replica_get_segment_size_fn(size_t *segsize, orte_gpr_replica_segment_t *seg);
int orte_gpr_replica_dump_all_fn(orte_buffer_t *buffer)
{
@ -757,135 +759,129 @@ int orte_gpr_replica_dump_subscription(orte_buffer_t *buffer,
void orte_gpr_replica_dump_itagval_value(orte_buffer_t *buffer,
orte_gpr_replica_itagval_t *iptr)
{
char tmp[132], *tmp2;
char *tmp;
int rc;
tmp2 = tmp;
switch(iptr->type) {
case ORTE_BYTE:
sprintf(tmp, "\t\tData type: ORTE_BYTE");
break;
case ORTE_BOOL:
sprintf(tmp, "\t\tData type: ORTE_BOOL\tValue: %s", iptr->value.tf_flag ? "TRUE" : "FALSE");
break;
case ORTE_STRING:
sprintf(tmp, "\t\tData type: ORTE_STRING\tValue: %s", iptr->value.strptr);
break;
case ORTE_SIZE:
sprintf(tmp, "\t\tData type: ORTE_SIZE\tValue: %lu",
(unsigned long) iptr->value.size);
break;
case ORTE_PID:
sprintf(tmp, "\t\tData type: ORTE_PID\tValue: %lu", (unsigned long)iptr->value.pid);
break;
case ORTE_INT:
sprintf(tmp, "\t\tData type: ORTE_INT\tValue: %d", (int)iptr->value.i32);
break;
case ORTE_UINT8:
sprintf(tmp, "\t\tData type: ORTE_UINT8\tValue: %d", (int)iptr->value.ui8);
break;
case ORTE_UINT16:
sprintf(tmp, "\t\tData type: ORTE_UINT16\tValue: %d", (int)iptr->value.ui16);
break;
case ORTE_UINT32:
sprintf(tmp, "\t\tData type: ORTE_UINT32\tValue: %d", (int)iptr->value.ui32);
break;
#ifdef HAVE_INT64_T
case ORTE_UINT64:
sprintf(tmp, "\t\tData type: ORTE_UINT64\tValue: %d", (int)iptr->value.ui64);
break;
#endif
case ORTE_INT8:
sprintf(tmp, "\t\tData type: ORTE_INT8\tValue: %d", (int)iptr->value.i8);
break;
case ORTE_INT16:
sprintf(tmp, "\t\tData type: ORTE_INT16\tValue: %d", (int)iptr->value.i16);
break;
case ORTE_INT32:
sprintf(tmp, "\t\tData type: ORTE_INT32\tValue: %d", (int)iptr->value.i32);
break;
#ifdef HAVE_INT64_T
case ORTE_INT64:
sprintf(tmp, "\t\tData type: ORTE_INT64\tValue: %d", (int)iptr->value.i64);
break;
#endif
case ORTE_BYTE_OBJECT:
sprintf(tmp, "\t\tData type: ORTE_BYTE_OBJECT\tSize: %lu",
(unsigned long) (iptr->value.byteobject).size);
break;
case ORTE_NAME:
sprintf(tmp, "\t\tData type: ORTE_NAME\tValue: [%lu,%lu,%lu]",
ORTE_NAME_ARGS(&(iptr->value.proc)));
break;
case ORTE_VPID:
sprintf(tmp, "\t\tData type: ORTE_VPID\tValue: %lu",
(unsigned long) iptr->value.vpid);
break;
case ORTE_JOBID:
sprintf(tmp, "\t\tData type: ORTE_JOBID\tValue: %lu",
(unsigned long) iptr->value.jobid);
break;
case ORTE_CELLID:
sprintf(tmp, "\t\tData type: ORTE_CELLID\tValue: %lu",
(unsigned long) iptr->value.cellid);
break;
case ORTE_NODE_STATE:
sprintf(tmp, "\t\tData type: ORTE_NODE_STATE\tValue: %d", (int)iptr->value.node_state);
break;
case ORTE_PROC_STATE:
sprintf(tmp, "\t\tData type: ORTE_PROC_STATE\tValue: %d", (int)iptr->value.proc_state);
break;
case ORTE_JOB_STATE:
sprintf(tmp, "\t\tData type: ORTE_JOB_STATE\tValue: %d", (int)iptr->value.job_state);
break;
case ORTE_EXIT_CODE:
sprintf(tmp, "\t\tData type: ORTE_EXIT_CODE\tValue: %d", (int)iptr->value.exit_code);
break;
case ORTE_NULL:
sprintf(tmp, "\t\tData type: ORTE_NULL");
break;
case ORTE_APP_CONTEXT:
sprintf(tmp, "\t\tData type: ORTE_APP_CONTEXT");
break;
default:
sprintf(tmp, "\t\tData type: UNKNOWN");
break;
if (ORTE_SUCCESS != (rc = orte_dss.print(&tmp, "\t\t\t", iptr->value, ORTE_DATA_VALUE))) {
ORTE_ERROR_LOG(rc);
return;
}
if (NULL == buffer) {
opal_output(0, "%s", tmp);
} else {
orte_gpr_replica_dump_load_string(buffer, &tmp2);
orte_gpr_replica_dump_load_string(buffer, &tmp);
}
free(tmp);
}
int orte_gpr_replica_dump_segment_size_fn(orte_buffer_t *buffer, char *segment)
{
orte_gpr_replica_segment_t **seg, *segptr;
size_t i, m, segsize, total;
char tmp[100], *tptr;
int rc;
tptr = tmp;
/* if segment = NULL, loop through all segments */
if (NULL == segment) {
seg = (orte_gpr_replica_segment_t**)(orte_gpr_replica.segments)->addr;
total = 0;
for (i=0, m=0; m < orte_gpr_replica.num_segs &&
i < (orte_gpr_replica.segments)->size; i++) {
if (NULL != seg[i]) {
m++;
if (ORTE_SUCCESS != (rc = orte_gpr_replica_get_segment_size_fn(&segsize, seg[i]))) {
ORTE_ERROR_LOG(rc);
return rc;
}
total += segsize;
}
}
sprintf(tmp, "Total registry size: %lu bytes", (unsigned long)total);
orte_gpr_replica_dump_load_string(buffer, &tptr);
return ORTE_SUCCESS;
}
/* otherwise, get the size of just the one specified */
if (ORTE_SUCCESS != (rc = orte_gpr_replica_find_seg(&segptr, false, segment))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_gpr_replica_get_segment_size_fn(&segsize, segptr))) {
ORTE_ERROR_LOG(rc);
return rc;
}
sprintf(tmp, "Size of segment %s: %lu bytes", segment, (unsigned long)segsize);
orte_gpr_replica_dump_load_string(buffer, &tptr);
return ORTE_SUCCESS;
}
static void orte_gpr_replica_dump_load_string(orte_buffer_t *buffer, char **tmp)
{
orte_dps.pack(buffer, tmp, 1, ORTE_STRING);
orte_dss.pack(buffer, tmp, 1, ORTE_STRING);
}
static int orte_gpr_replica_get_segment_size_fn(size_t *segsize, orte_gpr_replica_segment_t *seg)
{
size_t data_size, isize, i, j, k, m;
char **dict;
orte_gpr_replica_container_t **cptr;
orte_gpr_replica_itagval_t **iptr;
int rc;
data_size = strlen(seg->name);
data_size += 2*sizeof(orte_gpr_replica_itag_t); /* itag, num_dict_entries */
data_size += (seg->dict)->size * sizeof(void*); /* account for size of pointer array */
dict = (char**)(seg->dict)->addr;
for (i=0, j=0; j < seg->num_dict_entries &&
i < (seg->dict)->size; i++) {
if (NULL != dict[i]) {
j++;
data_size += strlen(dict[i]) + 1;
}
}
data_size += sizeof(size_t); /* num_containers */
cptr = (orte_gpr_replica_container_t**)(seg->containers)->addr;
for (i=0, j=0; j < (seg->num_containers) &&
i < (seg->containers)->size; i++) {
if (NULL != cptr[i]) {
j++;
data_size += sizeof(size_t); /* index */
data_size += cptr[i]->num_itags * sizeof(orte_gpr_replica_itag_t); /* itags array */
data_size += sizeof(size_t); /* num_itags */
data_size += (cptr[i]->itagvals)->size * sizeof(void*); /* account for size of pointer array */
data_size += sizeof(size_t); /* num_itagvals */
iptr = (orte_gpr_replica_itagval_t**)(cptr[i]->itagvals)->addr;
for (k=0, m=0; m < cptr[i]->num_itagvals &&
k < (cptr[i]->itagvals)->size; k++) {
if (NULL != iptr[k]) {
m++;
data_size += sizeof(size_t); /* index */
data_size += sizeof(orte_gpr_replica_itag_t);
data_size += sizeof(orte_data_type_t);
if (ORTE_SUCCESS != (rc = orte_dss.size(&isize, iptr[k]->value->data, iptr[k]->value->type))) {
ORTE_ERROR_LOG(rc);
*segsize = 0;
return rc;
}
data_size += isize;
}
}
data_size += 3*sizeof(size_t);
data_size += (cptr[i]->itaglist).array_size * sizeof(unsigned char*);
}
}
*segsize = data_size;
return ORTE_SUCCESS;
}

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

@ -147,7 +147,9 @@ int orte_gpr_replica_dump_trigger(orte_buffer_t *buffer,
int orte_gpr_replica_dump_subscription(orte_buffer_t *buffer,
orte_gpr_replica_subscription_t *sub);
int orte_gpr_replica_dump_callbacks_fn(orte_buffer_t *buffer);
int orte_gpr_replica_dump_callbacks_fn(orte_buffer_t *buffer);
int orte_gpr_replica_dump_segment_size_fn(orte_buffer_t *buffer, char *segment);
/*
* ********* INTERNAL UTILITY FUNCTIONS **********
@ -180,9 +182,6 @@ int orte_gpr_replica_update_keyval(orte_gpr_replica_itagval_t **iptr,
orte_gpr_keyval_t *kptr);
int orte_gpr_replica_compare_values(int *cmp, orte_gpr_replica_itagval_t *ival1,
orte_gpr_replica_itagval_t *ival2);
int orte_gpr_replica_purge_itag(orte_gpr_replica_segment_t *seg,
orte_gpr_replica_itag_t itag);
@ -193,8 +192,6 @@ int orte_gpr_replica_search_container(orte_gpr_replica_addr_mode_t addr_mode,
bool orte_gpr_replica_value_in_container(orte_gpr_replica_container_t *cptr,
orte_gpr_replica_itagval_t *iptr);
int orte_gpr_replica_get_value(void *value, orte_gpr_replica_itagval_t *ival);
int orte_gpr_replica_delete_itagval(orte_gpr_replica_segment_t *seg,
orte_gpr_replica_container_t *cptr,
orte_gpr_replica_itagval_t *iptr);

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

@ -93,7 +93,7 @@ orte_gpr_replica_enter_local_trigger(size_t cnt, orte_gpr_trigger_t **trigs)
j < (orte_gpr_replica_globals.local_triggers)->size; j++) {
if (NULL != tptr[j]) {
k++;
if (0 == strcmp(tptr[j]->name, trigs[i]->name)) {
if (NULL != tptr[j]->name && 0 == strcmp(tptr[j]->name, trigs[i]->name)) {
/* same name - trigger is already on list */
if (NULL != tptr[j]->callback || NULL == trigs[i]->cbfunc) {
/* ignore these cases */

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