1
1

Commit 1 of 4 to bring in the hetero branch to the trunk. Merged in

from:

svn merge -r5440:5448 https://svn.open-mpi.org/svn/ompi/tmp/hetero .

This commit was SVN r5549.

The following SVN revisions from the original message are invalid or
inconsistent and therefore were not cross-referenced:
  r5440
  r5448
Этот коммит содержится в:
Jeff Squyres 2005-05-01 00:47:35 +00:00
родитель 261df8bbdf
Коммит 462adee81a
68 изменённых файлов: 3117 добавлений и 1146 удалений

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

@ -157,7 +157,7 @@ unset msg
# The list of MCA types (it's fixed)
AC_MSG_CHECKING([for MCA types])
found_types="common allocator coll errmgr gpr io iof mpool ns oob pls pml ptl ras rds rmaps rmgr rml soh topo"
found_types="common allocator coll dps errmgr gpr io iof mpool ns oob pls pml ptl ras rds rmaps rmgr rml soh topo"
AC_MSG_RESULT([$found_types])
# Get the list of all the non-configure MCA components that were found by
@ -480,10 +480,10 @@ AC_SUBST(MCA_oob_STATIC_SUBDIRS)
AC_SUBST(MCA_oob_DSO_SUBDIRS)
AC_SUBST(MCA_oob_STATIC_LTLIBS)
AC_SUBST(MCA_errmgr_ALL_SUBDIRS)
AC_SUBST(MCA_errmgr_STATIC_SUBDIRS)
AC_SUBST(MCA_errmgr_DSO_SUBDIRS)
AC_SUBST(MCA_errmgr_STATIC_LTLIBS)
AC_SUBST(MCA_dps_ALL_SUBDIRS)
AC_SUBST(MCA_dps_STATIC_SUBDIRS)
AC_SUBST(MCA_dps_DSO_SUBDIRS)
AC_SUBST(MCA_dps_STATIC_LTLIBS)
AC_SUBST(MCA_errmgr_ALL_SUBDIRS)
AC_SUBST(MCA_errmgr_STATIC_SUBDIRS)
@ -578,6 +578,11 @@ AC_SUBST(MCA_ptl_STATIC_SUBDIRS)
AC_SUBST(MCA_ptl_DSO_SUBDIRS)
AC_SUBST(MCA_ptl_STATIC_LTLIBS)
AC_SUBST(MCA_schema_ALL_SUBDIRS)
AC_SUBST(MCA_schema_STATIC_SUBDIRS)
AC_SUBST(MCA_schema_DSO_SUBDIRS)
AC_SUBST(MCA_schema_STATIC_LTLIBS)
AC_SUBST(MCA_topo_ALL_SUBDIRS)
AC_SUBST(MCA_topo_STATIC_SUBDIRS)
AC_SUBST(MCA_topo_DSO_SUBDIRS)
@ -805,4 +810,4 @@ else
echo "config.status: creating src/mca/$1/$1_direct_call.h"
fi
rm src/mca/$1/$1_direct_call.h.template])
])
])

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

@ -1316,6 +1316,10 @@ AC_DEFINE_UNQUOTED(OMPI_OFFSET_DATATYPE, $MPI_OFFSET_DATATYPE, [MPI datatype cor
AC_WORDS_BIGENDIAN
# Size of pid_t
AC_CHECK_SIZEOF(pid_t)
# all: SYSV semaphores
# all: SYSV shared memory
# all: size of FD_SET
@ -1667,6 +1671,8 @@ AC_CONFIG_FILES([
src/mca/base/Makefile
src/mca/common/Makefile
src/mca/dps/Makefile
src/mca/dps/base/Makefile
src/mca/errmgr/Makefile
src/mca/errmgr/base/Makefile
src/mca/iof/Makefile
@ -1689,6 +1695,8 @@ AC_CONFIG_FILES([
src/mca/rmaps/base/Makefile
src/mca/rmgr/Makefile
src/mca/rmgr/base/Makefile
src/mca/schema/Makefile
src/mca/schema/base/Makefile
src/mca/soh/Makefile
src/mca/soh/base/Makefile
@ -1711,6 +1719,7 @@ AC_CONFIG_FILES([
src/dynamic-mca/common/Makefile
src/dynamic-mca/dps/Makefile
src/dynamic-mca/errmgr/Makefile
src/dynamic-mca/iof/Makefile
src/dynamic-mca/gpr/Makefile
@ -1721,6 +1730,7 @@ AC_CONFIG_FILES([
src/dynamic-mca/rds/Makefile
src/dynamic-mca/rmaps/Makefile
src/dynamic-mca/rmgr/Makefile
src/dynamic-mca/schema/Makefile
src/dynamic-mca/soh/Makefile
src/dynamic-mca/Makefile
@ -1756,7 +1766,7 @@ AC_CONFIG_FILES([
test/Makefile
test/asm/Makefile
test/class/Makefile
test/dps/Makefile
test/mca/dps/Makefile
test/mca/Makefile
test/mca/gpr/Makefile
test/mca/ns/Makefile
@ -1764,6 +1774,7 @@ AC_CONFIG_FILES([
test/mca/ras/Makefile
test/mca/rds/Makefile
test/mca/rmaps/Makefile
test/mca/schema/Makefile
test/runtime/Makefile
test/support/Makefile
test/threads/Makefile

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

@ -21,6 +21,7 @@
#define ORTE_CONFIG_H_
#include "ompi_config.h"
#include "ompi_stdint.h"
#define ORTE_DECLSPEC OMPI_DECLSPEC
#endif

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

@ -102,7 +102,6 @@ SUBDIRS = \
attribute \
communicator \
datatype \
dps \
errhandler \
event \
file \
@ -133,7 +132,6 @@ libmpi_la_LIBADD = \
class/liblfc.la \
communicator/libcommunicator.la \
datatype/libdatatype.la \
dps/libdps.la \
errhandler/liberrhandler.la \
event/libevent.la \
file/libfile.la \
@ -143,6 +141,7 @@ libmpi_la_LIBADD = \
mca/allocator/base/libmca_allocator_base.la $(MCA_allocator_STATIC_LTLIBS) \
mca/coll/base/libmca_coll_base.la $(MCA_coll_STATIC_LTLIBS) \
$(MCA_common_STATIC_LTLIBS) \
mca/dps/base/libmca_dps_base.la $(MCA_dps_STATIC_LTLIBS) \
mca/errmgr/base/libmca_errmgr_base.la \
mca/gpr/base/pack_api_cmd/libmca_gpr_base_pack.la \
mca/gpr/base/unpack_api_response/libmca_gpr_base_unpack.la \
@ -160,6 +159,7 @@ libmpi_la_LIBADD = \
mca/rmaps/base/libmca_rmaps_base.la $(MCA_rmaps_STATIC_LTLIBS) \
mca/rmgr/base/libmca_orte_rmgr_base.la $(MCA_rmgr_STATIC_LTLIBS) \
mca/rml/base/libmca_rml_base.la $(MCA_rml_STATIC_LTLIBS) \
mca/schema/base/libmca_schema_base.la $(MCA_schema_STATIC_LTLIBS) \
mca/soh/base/libmca_soh_base.la $(MCA_soh_STATIC_LTLIBS) \
mca/topo/base/libmca_topo_base.la $(MCA_topo_STATIC_LTLIBS) \
mpi/c/libmpi_c.la $(c_mpi_lib) $(c_pmpi_lib) \

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

@ -175,7 +175,7 @@ void ompi_attr_create_predefined_callback(
void *cbdata)
{
int err;
int32_t i, j;
size_t i, j;
orte_gpr_keyval_t **keyval;
orte_gpr_value_t **value;
orte_jobid_t job;

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

@ -64,8 +64,8 @@ void orte_pointer_array_destruct(orte_pointer_array_t *array)
* initialize an array object
*/
int orte_pointer_array_init(orte_pointer_array_t **array,
int initial_allocation,
int max_size, int block_size)
size_t initial_allocation,
size_t max_size, size_t block_size)
{
size_t num_bytes;
@ -110,12 +110,12 @@ int orte_pointer_array_init(orte_pointer_array_t **array,
* @param table Pointer to orte_pointer_array_t object (IN)
* @param ptr Pointer to be added to table (IN)
*
* @return Array index where ptr is inserted or OMPI_ERROR if it fails
* @param (OUT) Array index where ptr is inserted
* @return ORTE_ERROR_code if it fails
*/
int orte_pointer_array_add(orte_pointer_array_t *table, void *ptr)
int orte_pointer_array_add(size_t *location, orte_pointer_array_t *table, void *ptr)
{
int i;
int index;
size_t i, index;
if (0) {
ompi_output(0,"orte_pointer_array_add: IN: "
@ -175,7 +175,8 @@ int orte_pointer_array_add(orte_pointer_array_t *table, void *ptr)
}
OMPI_THREAD_UNLOCK(&(table->lock));
return index;
*location = index;
return ORTE_SUCCESS;
}
/**
@ -189,7 +190,7 @@ int orte_pointer_array_add(orte_pointer_array_t *table, void *ptr)
*
* Assumption: NULL element is free element.
*/
int orte_pointer_array_set_item(orte_pointer_array_t *table, int index,
int orte_pointer_array_set_item(orte_pointer_array_t *table, size_t index,
void * value)
{
assert(table != NULL);
@ -228,7 +229,7 @@ int orte_pointer_array_set_item(orte_pointer_array_t *table, int index,
table->number_free--;
/* Reset lowest_free if required */
if ( index == table->lowest_free ) {
int i;
size_t i;
table->lowest_free=table->size;
for ( i=index; i<table->size; i++) {
@ -252,7 +253,7 @@ int orte_pointer_array_set_item(orte_pointer_array_t *table, int index,
else {
/* Reset lowest_free if required */
if ( index == table->lowest_free ) {
int i;
size_t i;
table->lowest_free=table->size;
for ( i=index; i<table->size; i++) {
@ -293,7 +294,7 @@ int orte_pointer_array_set_item(orte_pointer_array_t *table, int index,
* a value, unless the previous value is NULL ( equiv. to free ).
*/
bool orte_pointer_array_test_and_set_item (orte_pointer_array_t *table,
int index, void *value)
size_t index, void *value)
{
assert(table != NULL);
assert(index >= 0);
@ -330,7 +331,7 @@ bool orte_pointer_array_test_and_set_item (orte_pointer_array_t *table,
table->number_free--;
/* Reset lowest_free if required */
if ( index == table->lowest_free ) {
int i;
size_t i;
table->lowest_free = table->size;
for ( i=index; i<table->size; i++) {
@ -356,8 +357,7 @@ bool orte_pointer_array_test_and_set_item (orte_pointer_array_t *table,
static bool grow_table(orte_pointer_array_t *table)
{
int new_size;
int i;
size_t new_size, i;
void *p;
/* Ensure that we have room to grow -- stay less than

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

@ -47,15 +47,15 @@ struct orte_pointer_array_t {
optimization to know where to search for the first free slot.
It does \em not necessarily imply indices all above this index
are not taken! */
int lowest_free;
size_t lowest_free;
/** number of free elements in the list */
int number_free;
size_t number_free;
/** size of list, i.e. number of elements in addr */
int size;
size_t size;
/** maximum size list is allowed to reach */
int max_size;
size_t max_size;
/** growth steps for list */
int block_size;
size_t block_size;
/** pointer to array of pointers */
void **addr;
};
@ -82,8 +82,8 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(orte_pointer_array_t);
*
*/
OMPI_DECLSPEC int orte_pointer_array_init(orte_pointer_array_t **array,
int initial_allocation,
int max_size, int block_size);
size_t initial_allocation,
size_t max_size, size_t block_size);
/**
* Add a pointer to the array (Grow the array, if need be)
@ -91,10 +91,10 @@ OMPI_DECLSPEC int orte_pointer_array_init(orte_pointer_array_t **array,
* @param array Pointer to array (IN)
* @param ptr Pointer value (IN)
*
* @return Index of inserted array element. Return value of
* (-1) indicates an error.
* @param (OUT) Index of inserted array element.
* @return Return value less than zero indicates an error.
*/
OMPI_DECLSPEC int orte_pointer_array_add(orte_pointer_array_t *array, void *ptr);
OMPI_DECLSPEC int orte_pointer_array_add(size_t *index, orte_pointer_array_t *array, void *ptr);
/**
* Set the value of an element in array
@ -106,7 +106,7 @@ OMPI_DECLSPEC int orte_pointer_array_add(orte_pointer_array_t *array, void *ptr)
* @return Error code. (-1) indicates an error.
*/
OMPI_DECLSPEC int orte_pointer_array_set_item(orte_pointer_array_t *array,
int index, void *value);
size_t index, void *value);
/**
* Get the value of an element in array
@ -118,7 +118,7 @@ OMPI_DECLSPEC int orte_pointer_array_set_item(orte_pointer_array_t *array,
*/
static inline void *orte_pointer_array_get_item(orte_pointer_array_t *table,
int index)
size_t index)
{
void *p;
OMPI_THREAD_LOCK(&(table->lock));
@ -138,7 +138,7 @@ static inline void *orte_pointer_array_get_item(orte_pointer_array_t *table,
* Simple inline function to return the size of the array in order to
* hide the member field from external users.
*/
static inline int orte_pointer_array_get_size(orte_pointer_array_t *array)
static inline size_t orte_pointer_array_get_size(orte_pointer_array_t *array)
{
return array->size;
}
@ -156,7 +156,7 @@ static inline int orte_pointer_array_get_size(orte_pointer_array_t *array)
*/
static inline void orte_pointer_array_clear(orte_pointer_array_t *array)
{
int i;
size_t i;
OMPI_THREAD_LOCK(&(array->lock));
for (i=0; i < array->size; i++) {
array->addr[i] = NULL;
@ -179,7 +179,7 @@ static inline void orte_pointer_array_clear(orte_pointer_array_t *array)
*/
static inline void orte_pointer_array_free_clear(orte_pointer_array_t *array)
{
int i;
size_t i;
OMPI_THREAD_LOCK(&(array->lock));
for (i=0; i < array->size; i++) {
if (NULL != array->addr[i]) free(array->addr[i]);
@ -206,7 +206,7 @@ static inline void orte_pointer_array_free_clear(orte_pointer_array_t *array)
* a value, unless the previous value is NULL ( equiv. to free ).
*/
OMPI_DECLSPEC bool orte_pointer_array_test_and_set_item (orte_pointer_array_t *table,
int index,
size_t index,
void *value);
#if defined(c_plusplus) || defined(__cplusplus)
}

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

@ -114,7 +114,8 @@ int ompi_comm_namepublish ( char *service_name, char *port_name )
value->tokens[1] = NULL;
value->num_tokens = 1;
value->keyvals = (orte_gpr_keyval_t**)malloc(sizeof(orte_gpr_keyval_t *));
value->keyvals = (orte_gpr_keyval_t **)malloc(sizeof(orte_gpr_keyval_t *));
value->cnt = 1;
value->keyvals[0] = OBJ_NEW(orte_gpr_keyval_t);
@ -136,7 +137,7 @@ char* ompi_comm_namelookup ( char *service_name )
char *token[2], *key[2];
orte_gpr_keyval_t **keyvals=NULL;
orte_gpr_value_t **values;
int cnt=0;
size_t cnt=0;
char *stmp=NULL;
int ret;

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

@ -1,663 +0,0 @@
/*
* 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$
*/
/*
* DPS Buffer Operations
*/
/** @file:
*
*/
#include "orte_config.h"
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include <string.h>
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "util/output.h"
#include "mca/gpr/gpr_types.h"
#include "mca/ns/ns_types.h"
#include "mca/rmgr/rmgr_types.h"
#include "dps/dps_internal.h"
/**
* DPS_PACK_VALUE
*/
int orte_dps_pack(orte_buffer_t *buffer, void *src,
size_t num_vals,
orte_data_type_t type)
{
int rc;
void *dst;
int32_t op_size=0;
size_t num_bytes, hdr_bytes;
/* hdr_bytes = header for each packed type. */
/* num_bytes = packed size of data type. */
/* op_size = total size = (num_bytes+hdr_bytes) */
/* check for error */
if (!buffer || !src || 0 >= num_vals) {
return (ORTE_ERROR);
}
dst = buffer->data_ptr; /* get location in buffer */
/* check for size of generic data types so they can be properly
packed NOTE we convert the generic data type flag to a hard
type for storage to handle heterogeneity */
if (ORTE_INT == type) {
type = DPS_TYPE_INT;
} else if (ORTE_UINT == type) {
type = DPS_TYPE_UINT;
} else if (ORTE_SIZE == type) {
type = DPS_TYPE_SIZE_T;
}
/* calculate the required memory size for this operation */
if (0 == (op_size = orte_dps_memory_required(src, num_vals, type))) {
/* got error */
return ORTE_ERROR;
}
/* add in the correct space for the pack type */
hdr_bytes = orte_dps_memory_required(NULL, 1, ORTE_DATA_TYPE);
/* add in the space to store the number of values */
hdr_bytes += sizeof(size_t);
/* total space needed */
op_size += hdr_bytes;
/* check to see if current buffer has enough room */
if (op_size > buffer->space) { /* need to extend the buffer */
if (ORTE_SUCCESS != (rc = orte_dps_buffer_extend(buffer, op_size))) {
/* got an error */
return rc;
}
/* need to reset the dst since it could have moved */
dst = buffer->data_ptr;
}
/* store the data type */
if (ORTE_SUCCESS != (rc = orte_dps_pack_nobuffer(dst, &type, 1,
ORTE_DATA_TYPE, &num_bytes))) {
return rc;
}
dst = (void *)((char*)dst + num_bytes);
/* store the number of values as uint32_t */
if (ORTE_SUCCESS != (rc = orte_dps_pack_nobuffer(dst, &num_vals, 1,
DPS_TYPE_SIZE_T, &num_bytes))) {
return rc;
}
dst = (void *)((char*)dst + num_bytes);
/* pack the data */
if (ORTE_SUCCESS != (rc = orte_dps_pack_nobuffer(dst, src, num_vals,
type, &num_bytes))) {
return rc;
}
#if OMPI_ENABLE_DEBUG
/* debugging */
if (num_bytes+sizeof(size_t)+orte_dps_memory_required(NULL, 1, ORTE_DATA_TYPE) != (size_t)op_size) {
fprintf(stderr,"orte_dps_pack: Ops, num_bytes %d + headers %d = %d, but op_size was %d?!\n",
(int)num_bytes, (int)hdr_bytes, (int)(num_bytes+hdr_bytes), (int)op_size);
}
/* fflush(stdout); fflush(stderr); */
/* fprintf(stderr,"packed total of %d bytes. Hdr %d datatype %d\n", op_size, hdr_bytes, num_bytes); */
/* fflush(stdout); fflush(stderr); */
#endif
/* ok, we managed to pack some more stuff, so update all ptrs/cnts */
buffer->data_ptr = (void*)((char*)dst + num_bytes);
buffer->len += op_size;
buffer->toend += op_size;
buffer->space -= op_size;
return ORTE_SUCCESS;
}
int orte_dps_pack_nobuffer(void *dst, void *src, size_t num_vals,
orte_data_type_t type, size_t *num_bytes)
{
size_t i, len, n, elementsize;
char *dptr; /* my moving destination pointer */
uint16_t tmp_16; /* temp location of converted data */
uint32_t tmp_32; /* temp location of converted data */
orte_process_name_t tmp_procname; /* temp location of converted data */
uint16_t * s16;
uint32_t * s32;
bool *bool_src;
uint8_t *bool_dst;
uint8_t *dbyte;
char **str;
orte_process_name_t *sn;
orte_byte_object_t *sbyteptr;
orte_gpr_keyval_t **keyval;
orte_gpr_value_t **values;
orte_app_context_t **app_context;
orte_app_context_map_t **app_context_map;
orte_gpr_subscription_t **subs;
orte_gpr_notify_data_t **data;
/* initialize the number of bytes */
*num_bytes = 0;
/* pack the data */
switch(type) {
case ORTE_DATA_TYPE:
case ORTE_NODE_STATE:
case ORTE_PROC_STATE:
case ORTE_BYTE:
case ORTE_INT8:
case ORTE_UINT8:
memcpy(dst, src, num_vals);
*num_bytes = num_vals;
break;
case ORTE_NOTIFY_ACTION:
case ORTE_GPR_ADDR_MODE:
case ORTE_GPR_CMD:
case ORTE_INT16:
case ORTE_UINT16:
dptr = (char *) dst;
s16 = (uint16_t *) src;
elementsize = sizeof (uint16_t);
for (i=0; i<num_vals; i++) {
/* convert the host order to network order */
tmp_16 = htons(*s16);
memcpy (dptr, (char*) &tmp_16, elementsize);
dptr+=elementsize;
s16++;
}
*num_bytes = num_vals * elementsize;
break;
case ORTE_VPID:
case ORTE_JOBID:
case ORTE_CELLID:
case ORTE_GPR_NOTIFY_ID:
case ORTE_EXIT_CODE:
case ORTE_INT32:
case ORTE_UINT32:
dptr = (char *) dst;
s32 = (uint32_t *) src;
elementsize = sizeof (uint32_t);
for (i=0; i<num_vals; i++) {
/* convert the host order to network order */
tmp_32 = htonl(*s32);
memcpy (dptr, (char*) &tmp_32, elementsize);
dptr+=elementsize;
s32++;
}
*num_bytes = num_vals * elementsize;
break;
case ORTE_INT64:
case ORTE_UINT64:
dptr = (char *) dst;
s32 = (uint32_t *) src;
for (i=0; i<num_vals; i++) {
/* convert the host order to network order */
tmp_32 = htonl(*s32);
memcpy (dptr, (char*) &tmp_32, sizeof(uint32_t));
dptr += sizeof(uint32_t);
s32++;
/* do it twice to get 64 bits */
tmp_32 = htonl(*s32);
memcpy (dptr, (char*) &tmp_32, sizeof(uint32_t));
dptr += sizeof(uint32_t);
s32++;
}
*num_bytes = num_vals * sizeof(uint64_t);;
break;
case ORTE_FLOAT:
case ORTE_FLOAT4:
case ORTE_FLOAT8:
case ORTE_FLOAT12:
case ORTE_FLOAT16:
case ORTE_DOUBLE:
case ORTE_LONG_DOUBLE:
return ORTE_ERR_NOT_IMPLEMENTED;
break;
case ORTE_BOOL:
bool_src = (bool *) src;
bool_dst = (uint8_t *) dst;
for (i=0; i<num_vals; i++) {
/* pack native bool as uint8_t */
*bool_dst = *bool_src ? (uint8_t)true : (uint8_t)false;
bool_dst++;
bool_src++;
}
*num_bytes = num_vals * sizeof(uint8_t);
break;
case ORTE_STRING:
str = (char **) src;
dptr = (char *) dst;
elementsize = sizeof (uint32_t);
for (i=0; i<num_vals; i++) {
len = strlen(str[i]); /* exclude the null terminator */
tmp_32 = htonl(len);
memcpy (dptr, (char*) &tmp_32, elementsize); /* copy str len to buffer */
dptr+=elementsize;
memcpy(dptr, str[i], len); /* copy str to buffer */
dptr+=len;
*num_bytes += len + elementsize;
}
break;
case ORTE_NAME:
sn = (orte_process_name_t*) src;
dptr = (char *) dst;
elementsize = sizeof (orte_process_name_t);
for (i=0; i<num_vals; i++) {
tmp_procname.cellid = htonl(sn->cellid);
tmp_procname.jobid = htonl(sn->jobid);
tmp_procname.vpid = htonl(sn->vpid);
memcpy (dptr, (char*) &tmp_procname, elementsize); /* copy converted proc name to buffer */
dptr+=elementsize;
sn++;
}
*num_bytes = num_vals * sizeof(orte_process_name_t);
break;
case ORTE_BYTE_OBJECT:
sbyteptr = (orte_byte_object_t *) src;
dbyte = (uint8_t *) dst;
elementsize = sizeof (uint32_t);
for (i=0; i<num_vals; i++) {
/* pack number of bytes */
tmp_32 = htonl(sbyteptr->size);
memcpy (dbyte, (char*) &tmp_32, elementsize); /* copy byte count to buffer */
dbyte += elementsize;
*num_bytes += elementsize;
/* pack actual bytes */
memcpy(dbyte, sbyteptr->bytes, sbyteptr->size);
dbyte += sbyteptr->size;
*num_bytes += sbyteptr->size;
sbyteptr++;
}
break;
case ORTE_KEYVAL:
/* array of pointers to keyval objects - need to pack the
objects */
keyval = (orte_gpr_keyval_t**) src;
/* use temp count of bytes packed 'n'. Must add these to
num_bytes at each stage */
for (i=0; i < num_vals; i++) {
/* pack the key */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(keyval[i]->key)), 1, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the data type so we can read it for unpacking */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst, &(keyval[i]->type), 1,
ORTE_DATA_TYPE, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the value */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst, &(keyval[i]->value), 1,
keyval[i]->type, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
}
break;
case ORTE_GPR_VALUE:
/* 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 */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(values[i]->addr_mode)), 1, ORTE_GPR_ADDR_MODE, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the segment name */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(values[i]->segment)), 1, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the number of tokens so we can read it for unpacking */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(values[i]->num_tokens)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* if there are tokens, pack them */
if (0 < values[i]->num_tokens) {
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)((values[i]->tokens)), values[i]->num_tokens, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
}
/* pack the number of keyval pairs so we can read it for unpacking */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(values[i]->cnt)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the keyval pairs */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)((values[i]->keyvals)), values[i]->cnt, ORTE_KEYVAL, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
}
break;
case ORTE_APP_CONTEXT:
/* array of pointers to orte_app_context objects - need to pack the objects a set of fields at a time */
app_context = (orte_app_context_t**) src;
for (i=0; i < num_vals; i++) {
n = 0; /* must always start count at zero! */
/* pack the application index (for multiapp jobs) */
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(app_context[i]->idx)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the application name */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(app_context[i]->app)), 1, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the number of processes */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(app_context[i]->num_procs)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the number of entries in the argv array */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(app_context[i]->argc)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* if there are entries, pack the argv entries */
if (0 < app_context[i]->argc) {
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(app_context[i]->argv), app_context[i]->argc, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
}
/* pack the number of entries in the enviro array */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(app_context[i]->num_env)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* if there are entries, pack the enviro entries */
if (0 < app_context[i]->num_env) {
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(app_context[i]->env), app_context[i]->num_env, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
}
/* pack the cwd */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(app_context[i]->cwd)), 1, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* Pack the map data */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(app_context[i]->num_map)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes += n;
if (app_context[i]->num_map > 0) {
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(app_context[i]->map_data), app_context[i]->num_map, ORTE_APP_CONTEXT_MAP, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes += n;
}
}
break;
case ORTE_APP_CONTEXT_MAP:
app_context_map = (orte_app_context_map_t**) src;
for (i=0; i < num_vals; i++) {
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(app_context_map[i]->map_type)), 1, ORTE_UINT8, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes += n;
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(app_context_map[i]->map_data)), 1, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes += n;
}
break;
case ORTE_GPR_SUBSCRIPTION:
/* 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 address mode */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(subs[i]->addr_mode)), 1, ORTE_GPR_ADDR_MODE, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the segment name */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(subs[i]->segment)), 1, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the number of tokens so we can read it for unpacking */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(subs[i]->num_tokens)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* if there are tokens, pack them */
if (0 < subs[i]->num_tokens) {
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)((subs[i]->tokens)), subs[i]->num_tokens, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
}
/* pack the number of keys so we can read it for unpacking */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(subs[i]->num_keys)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* if there are keys, pack them */
if (0 < subs[i]->num_keys) {
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)((subs[i]->keys)), subs[i]->num_keys, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
}
/* skip the pointers for cb_func and user_tag */
}
break;
case ORTE_GPR_NOTIFY_DATA:
/* 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 callback number */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(data[i]->cb_num)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the address mode */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(data[i]->addr_mode)), 1, ORTE_GPR_ADDR_MODE, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the segment name */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(data[i]->segment)), 1, ORTE_STRING, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* pack the number of values so we can read it for unpacking */
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)(&(data[i]->cnt)), 1, ORTE_INT32, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
/* if there are values, pack the values */
if (0 < data[i]->cnt) {
n = 0;
if (ORTE_SUCCESS != orte_dps_pack_nobuffer(dst,
(void*)((data[i]->values)), data[i]->cnt, ORTE_GPR_VALUE, &n)) {
return ORTE_ERROR;
}
dst = (void*)((char*)dst + n);
*num_bytes+=n;
}
}
break;
case ORTE_NULL:
break;
default:
return ORTE_ERR_BAD_PARAM;
}
return ORTE_SUCCESS;
}

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

@ -20,6 +20,7 @@ SUBDIRS = \
common \
allocator \
coll \
dps \
errmgr \
gpr \
io \
@ -35,5 +36,6 @@ SUBDIRS = \
rds \
rmaps \
rmgr \
schema \
soh \
topo

26
src/dynamic-mca/dps/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,26 @@
#
# 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 $(top_srcdir)/config/Makefile.options
SUBDIRS = $(MCA_dps_DSO_SUBDIRS)
DISTCLEANFILES = $(SUBDIRS)
# Every directory under here is a sym link to something in the main
# src/mca tree. Hence, we don't want to distribute anything under
# here.
DIST_SUBDIRS =

26
src/dynamic-mca/schema/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,26 @@
#
# 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 $(top_srcdir)/config/Makefile.options
SUBDIRS = $(MCA_schema_DSO_SUBDIRS)
DISTCLEANFILES = $(SUBDIRS)
# Every directory under here is a sym link to something in the main
# src/mca tree. Hence, we don't want to distribute anything under
# here.
DIST_SUBDIRS =

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

@ -51,7 +51,7 @@ enum {
OMPI_PROC_ALIVE = -29,
OMPI_PROC_RUNNING = -30,
OMPI_PROC_KILLED = -31,
OMPI_PROC_EXITED = -32,
OMPI_PROC_EXITED = -32,
OMPI_NODE_UP = -33,
OMPI_NODE_DOWN = -34,
OMPI_NODE_BOOTING = -35,
@ -62,7 +62,10 @@ enum {
OMPI_ERR_COMM_FAILURE = -40,
OMPI_UNPACK_INADEQUATE_SPACE = -41,
OMPI_UNPACK_READ_PAST_END_OF_BUFFER = -42,
OMPI_ERR_NOT_AVAILABLE = -43
OMPI_ERR_NOT_AVAILABLE = -43,
OMPI_ERR_GPR_DATA_CORRUPT = -44,
OMPI_ERR_PERM = -45, /* no permission */
OMPI_ERR_TYPE_MISMATCH = -46
};
#define OMPI_NAMESPACE_SEGMENT "ompi-namespace"

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

@ -69,7 +69,8 @@ enum {
ORTE_UNPACK_READ_PAST_END_OF_BUFFER = -42,
ORTE_ERR_NOT_AVAILABLE = -43,
ORTE_ERR_GPR_DATA_CORRUPT = -44,
ORTE_ERR_PERM /* no permission */
ORTE_ERR_PERM = -45, /* no permission */
ORTE_ERR_TYPE_MISMATCH = -46
};
#endif /* ORTE_CONSTANTS_H */

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

@ -100,18 +100,18 @@ extern char *orte_error_strings[];
*/
typedef int (*orte_schema_get_proc_tokens_fn_t)(
char ***tokens,
int32_t* num_tokens,
size_t* num_tokens,
orte_process_name_t *proc);
typedef int (*orte_schema_get_node_tokens_fn_t)(
char ***tokens,
int32_t* num_tokens,
size_t* num_tokens,
orte_cellid_t cellid,
char *nodename);
typedef int (*orte_schema_get_cell_tokens_fn_t)(
char ***tokens,
int32_t* num_tokens,
size_t* num_tokens,
orte_cellid_t cellid);
typedef int (*orte_schema_get_job_segment_name_fn_t)(char **name, orte_jobid_t jobid);

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

@ -33,47 +33,48 @@ typedef uint8_t orte_data_type_t ;
#define ORTE_BOOL (orte_data_type_t) 2 /**< boolean */
#define ORTE_STRING (orte_data_type_t) 3 /**< a NULL terminated string */
#define ORTE_SIZE (orte_data_type_t) 4 /**< the generic size_t */
#define ORTE_PID (orte_data_type_t) 5 /**< process pid */
/* all the integer flavors */
#define ORTE_INT (orte_data_type_t) 5 /**< generic integer */
#define ORTE_INT8 (orte_data_type_t) 6 /**< an 8-bit integer */
#define ORTE_INT16 (orte_data_type_t) 7 /**< a 16-bit integer */
#define ORTE_INT32 (orte_data_type_t) 8 /**< a 32-bit integer */
#define ORTE_INT64 (orte_data_type_t) 9 /**< a 64-bit integer */
#define ORTE_INT (orte_data_type_t) 6 /**< generic integer */
#define ORTE_INT8 (orte_data_type_t) 7 /**< an 8-bit integer */
#define ORTE_INT16 (orte_data_type_t) 8 /**< a 16-bit integer */
#define ORTE_INT32 (orte_data_type_t) 9 /**< a 32-bit integer */
#define ORTE_INT64 (orte_data_type_t) 10 /**< a 64-bit integer */
/* all the unsigned integer flavors */
#define ORTE_UINT (orte_data_type_t) 10 /**< generic unsigned integer */
#define ORTE_UINT8 (orte_data_type_t) 11 /**< an 8-bit unsigned integer */
#define ORTE_UINT16 (orte_data_type_t) 12 /**< a 16-bit unsigned integer */
#define ORTE_UINT32 (orte_data_type_t) 13 /**< a 32-bit unsigned integer */
#define ORTE_UINT64 (orte_data_type_t) 14 /**< a 64-bit unsigned integer */
#define ORTE_UINT (orte_data_type_t) 11 /**< generic unsigned integer */
#define ORTE_UINT8 (orte_data_type_t) 12 /**< an 8-bit unsigned integer */
#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) 15 /**< single-precision float */
#define ORTE_FLOAT4 (orte_data_type_t) 16 /**< 4-byte float - usually equiv to single */
#define ORTE_DOUBLE (orte_data_type_t) 17 /**< double-precision float */
#define ORTE_FLOAT8 (orte_data_type_t) 18 /**< 8-byte float - usually equiv to double */
#define ORTE_LONG_DOUBLE (orte_data_type_t) 19 /**< long-double precision float */
#define ORTE_FLOAT12 (orte_data_type_t) 20 /**< 12-byte float - used as long-double on some systems */
#define ORTE_FLOAT16 (orte_data_type_t) 21 /**< 16-byte float - used as long-double on some systems */
#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 */
/* orte-specific typedefs */
#define ORTE_NAME (orte_data_type_t) 22 /**< an ompi_process_name_t */
#define ORTE_VPID (orte_data_type_t) 23 /**< a vpid */
#define ORTE_JOBID (orte_data_type_t) 24 /**< a jobid */
#define ORTE_CELLID (orte_data_type_t) 25 /**< a cellid */
#define ORTE_NODE_STATE (orte_data_type_t) 26 /**< node status flag */
#define ORTE_PROC_STATE (orte_data_type_t) 27 /**< process/resource status */
#define ORTE_EXIT_CODE (orte_data_type_t) 28 /**< process exit code */
#define ORTE_BYTE_OBJECT (orte_data_type_t) 29 /**< byte object structure */
#define ORTE_KEYVAL (orte_data_type_t) 30 /**< registry key-value pair */
#define ORTE_NOTIFY_ACTION (orte_data_type_t) 31 /**< registry notify action */
#define ORTE_GPR_CMD (orte_data_type_t) 32 /**< registry command */
#define ORTE_GPR_NOTIFY_ID (orte_data_type_t) 33 /**< registry notify id tag */
#define ORTE_GPR_VALUE (orte_data_type_t) 34 /**< registry return value */
#define ORTE_DATA_TYPE (orte_data_type_t) 35 /**< data type */
#define ORTE_APP_CONTEXT (orte_data_type_t) 36 /**< argv and enviro arrays */
#define ORTE_APP_CONTEXT_MAP (orte_data_type_t) 37 /**< application context mapping array */
#define ORTE_GPR_ADDR_MODE (orte_data_type_t) 38 /**< Addressing mode for registry cmds */
#define ORTE_GPR_SUBSCRIPTION (orte_data_type_t) 39 /**< describes data returned by subscription */
#define ORTE_GPR_NOTIFY_DATA (orte_data_type_t) 40 /**< data returned from a subscription */
#define ORTE_NULL (orte_data_type_t) 41 /**< don't interpret data type */
#define ORTE_NAME (orte_data_type_t) 23 /**< an ompi_process_name_t */
#define ORTE_VPID (orte_data_type_t) 24 /**< a vpid */
#define ORTE_JOBID (orte_data_type_t) 25 /**< a jobid */
#define ORTE_CELLID (orte_data_type_t) 26 /**< a cellid */
#define ORTE_NODE_STATE (orte_data_type_t) 27 /**< node status flag */
#define ORTE_PROC_STATE (orte_data_type_t) 28 /**< process/resource status */
#define ORTE_EXIT_CODE (orte_data_type_t) 29 /**< process exit code */
#define ORTE_BYTE_OBJECT (orte_data_type_t) 30 /**< byte object structure */
#define ORTE_KEYVAL (orte_data_type_t) 31 /**< registry key-value pair */
#define ORTE_NOTIFY_ACTION (orte_data_type_t) 32 /**< registry notify action */
#define ORTE_GPR_CMD (orte_data_type_t) 33 /**< registry command */
#define ORTE_GPR_NOTIFY_ID (orte_data_type_t) 34 /**< registry notify id tag */
#define ORTE_GPR_VALUE (orte_data_type_t) 35 /**< registry return value */
#define ORTE_DATA_TYPE (orte_data_type_t) 36 /**< data type */
#define ORTE_APP_CONTEXT (orte_data_type_t) 37 /**< argv and enviro arrays */
#define ORTE_APP_CONTEXT_MAP (orte_data_type_t) 38 /**< application context mapping array */
#define ORTE_GPR_ADDR_MODE (orte_data_type_t) 39 /**< Addressing mode for registry cmds */
#define ORTE_GPR_SUBSCRIPTION (orte_data_type_t) 40 /**< describes data returned by subscription */
#define ORTE_GPR_NOTIFY_DATA (orte_data_type_t) 41 /**< data returned from a subscription */
#define ORTE_NULL (orte_data_type_t) 42 /**< don't interpret data type */
typedef struct {
@ -116,23 +117,23 @@ typedef struct {
/** Parent object */
ompi_object_t super;
/** Unique index when multiple apps per job */
int32_t idx;
size_t idx;
/** Absolute pathname of argv[0] */
char *app;
/** Number of copies of this process that are to be launched */
int32_t num_procs;
size_t num_procs;
/** Length of the argv array, not including final NULL entry */
int32_t argc;
int argc;
/** Standard argv-style array, including a final NULL pointer */
char **argv;
/** Length of the env array, not including the final NULL entry */
int32_t num_env;
size_t num_env;
/** Standard environ-style array, including a final NULL pointer */
char **env;
/** Current working directory for this app */
char *cwd;
/** Length of the map_data array, not including the final NULL entry */
int32_t num_map;
size_t num_map;
/** Mapping data about how this app should be laid out across CPUs
/ nodes */
orte_app_context_map_t **map_data;

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

@ -23,6 +23,7 @@ SUBDIRS = \
base \
coll \
common \
dps \
errmgr \
io \
iof \
@ -38,6 +39,7 @@ SUBDIRS = \
rds \
rmaps \
rmgr \
schema \
soh \
topo

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

@ -200,7 +200,7 @@ static void mca_base_modex_registry_callback(
orte_gpr_notify_data_t* data,
void* cbdata)
{
int32_t i, j;
size_t i, j;
orte_gpr_keyval_t **keyval;
ompi_proc_t *proc;
ompi_proc_t **new_procs = NULL;

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

@ -16,28 +16,18 @@
include $(top_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libdps.la
SUBDIRS = base $(MCA_dps_STATIC_SUBDIRS)
DIST_SUBDIRS = base $(MCA_dps_ALL_SUBDIRS)
# Source code files
headers = \
dps.h \
dps_types.h \
dps_internal.h
libdps_la_SOURCES = \
$(headers) \
orte_dps_open_close.c \
dps_pack.c \
dps_unpack.c \
dps_peek.c \
dps_load_unload.c \
dps_internal_functions.c
headers = dps.h \
dps_types.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/dps
ompidir = $(includedir)/openmpi/mca/dps
ompi_HEADERS = $(headers)
else
ompidir = $(includedir)

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

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

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

212
src/mca/dps/base/dps_pack_native_types.c Обычный файл
Просмотреть файл

@ -0,0 +1,212 @@
/*
* 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 <stdio.h>
#include <sys/types.h>
#include <math.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include "util/output.h"
#include "mca/gpr/gpr_types.h"
#include "mca/ns/ns_types.h"
#include "mca/rmgr/rmgr_types.h"
#include "dps/dps_internal.h"
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
int orte_dps_pack_system_types(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
int rc;
/* CHECK FOR A GENERIC SYSTEM TYPE */
real_type = orte_dps_get_real_type(type);
if (real_type != type) {
if (ORTE_SUCCESS != (rc = orte_dps_store_data_type(buffer, real_type))) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
/* now pack the native values */
if (ORTE_SUCCESS != (rc = orte_dps_pack_native_types(buffer, src, num_vals, real_type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
int orte_dps_pack_native_types(orte_buffer_t *buffer, void *src,
size_t num_vals, orte_data_type_t type)
{
switch(type) {
case ORTE_BYTE:
case ORTE_INT8:
case ORTE_UINT8:
/* check to see if buffer needs extending */
if (NULL == (dst = orte_dps_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 the buffer counters and pointers */
buffer->data_ptr = (void*)((char*)dst + num_vals);
buffer->len += num_vals;
buffer->space -= num_vals;
buffer->toend += num_vals;
return ORTE_SUCCESS;
case ORTE_INT16:
case ORTE_UINT16:
elementsize = sizeof (uint16_t);
/* check to see if buffer needs extending */
if (NULL == (dst = orte_dps_buffer_extend(buffer, elementsize*num_vals))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE);
}
/* store the data */
dptr = (char *) dst;
s16 = (uint16_t *) src;
for (i=0; i<num_vals; i++) {
/* convert the host order to network order */
tmp_16 = htons(*s16);
memcpy (dptr, (char*) &tmp_16, elementsize);
dptr+=elementsize;
s16++;
}
/* update the buffer counters and pointers */
buffer->data_ptr = (void*)dptr;
buffer->len += elementsize*num_vals;
buffer->space -= elementsize*num_vals;
buffer->toend += elementsize*num_vals;
return ORTE_SUCCESS;
case ORTE_INT32:
case ORTE_UINT32:
elementsize = sizeof (uint32_t);
/* check to see if buffer needs extending */
if (NULL == (dst = orte_dps_buffer_extend(buffer, elementsize*num_vals))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE);
}
/* store the data */
dptr = (char *) dst;
s32 = (uint32_t *) src;
for (i=0; i<num_vals; i++) {
/* convert the host order to network order */
tmp_32 = htonl(*s32);
memcpy (dptr, (char*) &tmp_32, elementsize);
dptr+=elementsize;
s32++;
}
/* update the buffer counters and pointers */
buffer->data_ptr = (void*)dptr;
buffer->len += elementsize*num_vals;
buffer->space -= elementsize*num_vals;
buffer->toend += elementsize*num_vals;
return ORTE_SUCCESS;
case ORTE_INT64:
case ORTE_UINT64:
elementsize = 2*sizeof (uint32_t);
/* check to see if buffer needs extending */
if (NULL == (dst = orte_dps_buffer_extend(buffer, elementsize*num_vals))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE);
}
/* store the data */
dptr = (char *) dst;
s32 = (uint32_t *) src;
for (i=0; i<num_vals; i++) {
/* convert the host order to network order */
tmp_32 = htonl(*s32);
memcpy (dptr, (char*) &tmp_32, sizeof(uint32_t));
dptr += sizeof(uint32_t);
s32++;
/* do it twice to get 64 bits */
tmp_32 = htonl(*s32);
memcpy (dptr, (char*) &tmp_32, sizeof(uint32_t));
dptr += sizeof(uint32_t);
s32++;
}
/* update the buffer counters and pointers */
buffer->data_ptr = (void*)dptr;
buffer->len += elementsize*num_vals;
buffer->space -= elementsize*num_vals;
buffer->toend += elementsize*num_vals;
return ORTE_SUCCESS;
case ORTE_FLOAT:
case ORTE_FLOAT4:
case ORTE_FLOAT8:
case ORTE_FLOAT12:
case ORTE_FLOAT16:
case ORTE_DOUBLE:
case ORTE_LONG_DOUBLE:
ORTE_ERROR_LOG(ORTE_ERR_NOT_IMPLEMENTED);
return ORTE_ERR_NOT_IMPLEMENTED;
break;
case ORTE_STRING:
str = (char **) src;
for (i=0; i<num_vals; i++) {
len = strlen(str[i]); /* exclude the null terminator */
/* store the size data type */
if (ORTE_SUCCESS != (rc = orte_dps_store_data_type(buffer, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* store the real size data type */
if (ORTE_SUCCESS != (rc = orte_dps_store_data_type(buffer, DPS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* store the length */
if (ORTE_SUCCESS != (rc =
orte_dps_pack_buffer(buffer, &len, 1, DPS_TYPE_SIZE_T))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* check to see if buffer needs extending */
if (NULL == (dst = orte_dps_buffer_extend(buffer, len))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE);
}
dptr = (char*)dst;
memcpy(dptr, str[i], len); /* copy str to buffer */
/* update the buffer counters and pointers */
buffer->data_ptr = (void*)(dptr + len);
buffer->len += len;
buffer->space -= len;
buffer->toend += len;
}
return ORTE_SUCCESS;
}
}

192
src/mca/dps/base/dps_pack_orte_types.c Обычный файл
Просмотреть файл

@ -0,0 +1,192 @@
/*
* 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 "ompi_config.h"
#include <stdio.h>
#include <sys/types.h>
#include <math.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include "util/output.h"
#include "mca/gpr/gpr_types.h"
#include "mca/ns/ns_types.h"
#include "mca/rmgr/rmgr_types.h"
#include "dps/dps_internal.h"
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
int orte_dps_pack_name(orte_buffer_t *buffer,
orte_process_name_t *proc,
size_t num_vals)
{
orte_cellid_t cellid;
orte_jobid_t jobid;
orte_vpid_t vpid;
size_t i;
int rc;
for (i=0; i<num_vals; i++) {
if (ORTE_SUCCESS != (rc = orte_ns.get_cellid(&cellid, proc))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps_pack_cellid(buffer,
&cellid, 1))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_ns.get_jobid(&jobid, proc))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps_pack_jobid(buffer,
&jobid, 1))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_ns.get_vpid(&vpid, proc))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_dps_pack_vpid(buffer,
&vpid, 1))) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
return ORTE_SUCCESS;
}
int orte_dps_pack_cellid(orte_buffer_t *buffer,
orte_cellid_t *cellid,
size_t num_vals)
{
orte_data_type_t real_type;
int rc;
real_type = orte_dps_real_type(ORTE_CELLID);
if (ORTE_SUCCESS != (rc = orte_dps_pack_native_types(buffer,
(void*)cellid, num_vals, real_type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
int orte_dps_pack_jobid(orte_buffer_t *buffer,
orte_jobid_t *jobid,
size_t num_vals)
{
orte_data_type_t real_type;
int rc;
real_type = orte_dps_real_type(ORTE_JOBID);
if (ORTE_SUCCESS != (rc = orte_dps_pack_native_types(buffer,
(void*)jobid, num_vals, real_type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
int orte_dps_pack_vpid(orte_buffer_t *buffer,
orte_vpid_t *vpid,
size_t num_vals)
{
orte_data_type_t real_type;
int rc;
real_type = orte_dps_real_type(ORTE_VPID);
if (ORTE_SUCCESS != (rc = orte_dps_pack_native_types(buffer,
(void*)vpid, num_vals, real_type))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
int orte_dps_pack_node_state(orte_buffer_t *buffer,
orte_node_state_t *state,
size_t num_vals)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dps_pack_native_types(buffer,
(void*)state, num_vals, ORTE_UINT8))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
int orte_dps_pack_proc_state(orte_buffer_t *buffer,
orte_proc_state_t *state,
size_t num_vals)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dps_pack_native_types(buffer,
(void*)state, num_vals, ORTE_UINT8))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
int orte_dps_pack_gpr_addr_mode(orte_buffer_t *buffer,
orte_gpr_addr_mode_t *mode,
size_t num_vals)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dps_pack_native_types(buffer,
(void*)mode, num_vals, ORTE_UINT16))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
int orte_dps_pack_gpr_cmd(orte_buffer_t *buffer,
orte_gpr_cmd_t *cmd,
size_t num_vals)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dps_pack_native_types(buffer,
(void*)cmd, num_vals, ORTE_UINT16))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
int orte_dps_pack_notify_action(orte_buffer_t *buffer,
orte_notify_action_t *action,
size_t num_vals)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_dps_pack_native_types(buffer,
(void*)action, num_vals, ORTE_UINT16))) {
ORTE_ERROR_LOG(rc);
}
return rc;
}

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

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

@ -168,6 +168,7 @@ int orte_dps_unpack_nobuffer(void *dst, void *src, size_t num_vals,
case ORTE_DATA_TYPE:
case ORTE_NODE_STATE:
case ORTE_PROC_STATE:
case ORTE_EXIT_CODE:
case ORTE_BYTE:
case ORTE_INT8:
case ORTE_UINT8:
@ -208,7 +209,6 @@ int orte_dps_unpack_nobuffer(void *dst, void *src, size_t num_vals,
case ORTE_JOBID:
case ORTE_CELLID:
case ORTE_GPR_NOTIFY_ID:
case ORTE_EXIT_CODE:
case ORTE_INT32:
case ORTE_UINT32:

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

@ -62,6 +62,7 @@ size_t orte_dps_memory_required(void *src, size_t num_vals, orte_data_type_t typ
case ORTE_DATA_TYPE:
case ORTE_NODE_STATE:
case ORTE_PROC_STATE:
case ORTE_EXIT_CODE:
case ORTE_BOOL:
case ORTE_BYTE:
case ORTE_INT8:
@ -79,7 +80,6 @@ size_t orte_dps_memory_required(void *src, size_t num_vals, orte_data_type_t typ
case ORTE_JOBID:
case ORTE_CELLID:
case ORTE_GPR_NOTIFY_ID:
case ORTE_EXIT_CODE:
case ORTE_INT32:
case ORTE_UINT32:
return (size_t)(num_vals * sizeof(uint32_t));

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

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

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

@ -41,9 +41,9 @@
#include "class/ompi_list.h"
#define ORTE_NAME_ARGS(n) \
((NULL == n) ? -1 : (n)->cellid), \
((NULL == n) ? -1 : (n)->jobid), \
((NULL == n) ? -1 : (n)->vpid)
((NULL == n) ? -1 : (ssize_t)(n)->cellid), \
((NULL == n) ? -1 : (ssize_t)(n)->jobid), \
((NULL == n) ? -1 : (ssize_t)(n)->vpid)
/*
@ -59,18 +59,18 @@
/*
* define maximum value for id's in any field
*/
#define ORTE_CELLID_MAX INT32_MAX
#define ORTE_JOBID_MAX INT32_MAX
#define ORTE_VPID_MAX INT32_MAX
#define ORTE_CELLID_MAX SIZE_MAX
#define ORTE_JOBID_MAX SIZE_MAX
#define ORTE_VPID_MAX SIZE_MAX
/*
* general typedefs & structures
*/
/** Set the allowed range for ids in each space
*/
typedef int32_t orte_jobid_t;
typedef int32_t orte_cellid_t;
typedef int32_t orte_vpid_t;
typedef size_t orte_jobid_t;
typedef size_t orte_cellid_t;
typedef size_t orte_vpid_t;
typedef uint8_t orte_ns_cmp_bitmask_t; /**< Bit mask for comparing process names */
typedef uint16_t orte_ns_cmd_flag_t;

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

@ -480,7 +480,7 @@ void mca_oob_tcp_registry_callback(
orte_gpr_notify_data_t* data,
void* cbdata)
{
int32_t i;
size_t i;
if(mca_oob_tcp_component.tcp_debug > 1) {
ompi_output(0, "[%d,%d,%d] mca_oob_tcp_registry_callback\n",
ORTE_NAME_ARGS(orte_process_info.my_name));
@ -493,7 +493,7 @@ void mca_oob_tcp_registry_callback(
orte_buffer_t buffer;
mca_oob_tcp_addr_t* addr, *existing;
mca_oob_tcp_peer_t* peer;
int32_t j;
size_t j;
for(j = 0; j < value->cnt; j++) {

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

@ -39,7 +39,8 @@ int orte_pls_base_set_proc_pid(const orte_process_name_t* name, pid_t pid)
orte_gpr_keyval_t kv_pid = {{OBJ_CLASS(orte_gpr_keyval_t),0},ORTE_PROC_PID_KEY,ORTE_UINT32};
orte_gpr_keyval_t kv_state = {{OBJ_CLASS(orte_gpr_keyval_t),0},ORTE_PROC_STATE_KEY,ORTE_PROC_STATE};
orte_gpr_keyval_t* keyvals[2];
int i, rc;
size_t i;
int rc;
if(ORTE_SUCCESS != (rc = orte_schema.get_job_segment_name(&value.segment, name->jobid))) {
ORTE_ERROR_LOG(rc);
@ -81,10 +82,10 @@ int orte_pls_base_get_proc_pid(const orte_process_name_t* name, pid_t* pid)
{
char *segment;
char **tokens;
int num_tokens;
size_t num_tokens;
char *keys[2];
orte_gpr_value_t** values = NULL;
int i, num_values = 0;
size_t i, num_values = 0;
int rc;
/* query the job segment on the registry */
@ -141,14 +142,14 @@ cleanup:
}
/**
* Retreive all process pids for the specified job.
* Retrieve all process pids for the specified job.
*/
int orte_pls_base_get_proc_pids(orte_jobid_t jobid, pid_t **pids, size_t* num_pids)
{
char *segment;
char *keys[2];
orte_gpr_value_t** values = NULL;
int i, num_values = 0;
size_t i, num_values = 0;
int rc;
/* query the job segment on the registry */
@ -208,7 +209,8 @@ int orte_pls_base_set_node_pid(orte_cellid_t cellid, char* node_name, orte_jobid
orte_gpr_keyval_t kv_pid = {{OBJ_CLASS(orte_gpr_keyval_t),0},ORTE_PROC_PID_KEY,ORTE_UINT32};
orte_gpr_keyval_t* keyvals[1];
char* jobid_string;
int i, rc;
size_t i;
int rc;
if(ORTE_SUCCESS != (rc = orte_schema.get_node_tokens(&value.tokens, &value.num_tokens, cellid, node_name)))
return rc;
@ -249,7 +251,7 @@ int orte_pls_base_get_node_pids(orte_jobid_t jobid, pid_t **pids, size_t* num_pi
{
char *keys[2];
orte_gpr_value_t** values = NULL;
int i, num_values = 0;
size_t i, num_values = 0;
int rc;
char *jobid_string;

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

@ -286,7 +286,7 @@ int orte_pls_fork_terminate_job(orte_jobid_t jobid)
char *segment;
char *keys[3];
orte_gpr_value_t** values = NULL;
int i, k, num_values = 0;
size_t i, k, num_values = 0;
int rc;
/* query the job segment on the registry */

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

@ -184,7 +184,8 @@ static int orte_pls_rsh_set_node_name(orte_ras_base_node_t* node, orte_jobid_t j
orte_gpr_keyval_t kv_name = {{OBJ_CLASS(orte_gpr_keyval_t),0},ORTE_NODE_BOOTPROXY_KEY,ORTE_NAME};
orte_gpr_keyval_t* keyvals[1];
char* jobid_string;
int i, rc;
size_t i;
int rc;
if(ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&jobid_string, jobid))) {
ORTE_ERROR_LOG(rc);
@ -463,7 +464,7 @@ int orte_pls_rsh_terminate_job(orte_jobid_t jobid)
char *keys[2];
char *jobid_string;
orte_gpr_value_t** values = NULL;
int i, j, num_values = 0;
size_t i, j, num_values = 0;
int rc;
if(ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&jobid_string, jobid))) {

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

@ -61,7 +61,7 @@ OBJ_CLASS_INSTANCE(
int orte_ras_base_node_query(ompi_list_t* nodes)
{
int i, cnt;
size_t i, cnt;
orte_gpr_value_t** values;
int rc;
@ -80,7 +80,7 @@ int orte_ras_base_node_query(ompi_list_t* nodes)
for(i=0; i<cnt; i++) {
orte_gpr_value_t* value = values[i];
orte_ras_base_node_t* node = OBJ_NEW(orte_ras_base_node_t);
int k;
size_t k;
for(k=0; k<value->cnt; k++) {
orte_gpr_keyval_t* keyval = value->keyvals[k];
@ -133,7 +133,7 @@ int orte_ras_base_node_query_alloc(ompi_list_t* nodes, orte_jobid_t jobid)
ORTE_CELLID_KEY,
NULL
};
int i, cnt;
size_t i, cnt;
orte_gpr_value_t** values;
char* jobid_str;
int rc;
@ -158,7 +158,7 @@ int orte_ras_base_node_query_alloc(ompi_list_t* nodes, orte_jobid_t jobid)
for(i=0; i<cnt; i++) {
orte_gpr_value_t* value = values[i];
orte_ras_base_node_t* node = OBJ_NEW(orte_ras_base_node_t);
int k;
size_t k;
for(k=0; k<value->cnt; k++) {
orte_gpr_keyval_t* keyval = value->keyvals[k];
@ -209,7 +209,8 @@ int orte_ras_base_node_insert(ompi_list_t* nodes)
{
ompi_list_item_t* item;
orte_gpr_value_t **values;
int rc, num_values, i, j;
int rc;
size_t num_values, i, j;
orte_ras_base_node_t* node;
num_values = ompi_list_get_size(nodes);
@ -363,7 +364,8 @@ int orte_ras_base_node_assign(ompi_list_t* nodes, orte_jobid_t jobid)
{
ompi_list_item_t* item;
orte_gpr_value_t **values;
int rc, num_values, i, j;
int rc;
size_t num_values, i, j;
orte_ras_base_node_t* node;
char* jobid_str;

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

@ -121,32 +121,32 @@ OBJ_CLASS_INSTANCE(
static int orte_rmaps_value_compare(orte_gpr_value_t** val1, orte_gpr_value_t** val2)
{
int32_t i;
int32_t app1 = -1;
int32_t app2 = -1;
int32_t rank1 = -1;
int32_t rank2 = -1;
size_t i;
size_t app1 = 0;
size_t app2 = 0;
size_t rank1 = 0;
size_t rank2 = 0;
orte_gpr_value_t* value;
for(i=0, value=*val1; i<value->cnt; i++) {
orte_gpr_keyval_t* keyval = value->keyvals[i];
if(strcmp(keyval->key, ORTE_PROC_RANK_KEY) == 0) {
rank1 = keyval->value.i32;
rank1 = keyval->value.size;
continue;
}
if(strcmp(keyval->key, ORTE_PROC_APP_CONTEXT_KEY) == 0) {
app1 = keyval->value.i32;
app1 = keyval->value.size;
continue;
}
}
for(i=0, value=*val2; i<value->cnt; i++) {
orte_gpr_keyval_t* keyval = value->keyvals[i];
if(strcmp(keyval->key, ORTE_PROC_RANK_KEY) == 0) {
rank1 = keyval->value.i32;
rank1 = keyval->value.size;
continue;
}
if(strcmp(keyval->key, ORTE_PROC_APP_CONTEXT_KEY) == 0) {
app1 = keyval->value.i32;
app1 = keyval->value.size;
continue;
}
}
@ -204,7 +204,7 @@ int orte_rmaps_base_get_map(orte_jobid_t jobid, ompi_list_t* mapping_list)
char* segment = NULL;
char* jobid_str = NULL;
orte_gpr_value_t** values;
int32_t v, num_values;
size_t v, num_values;
int rc;
char* keys[] = {
ORTE_PROC_RANK_KEY,
@ -263,7 +263,7 @@ int orte_rmaps_base_get_map(orte_jobid_t jobid, ompi_list_t* mapping_list)
orte_rmaps_base_map_t* map = NULL;
orte_rmaps_base_proc_t* proc;
char* node_name = NULL;
int32_t kv;
size_t kv;
proc = OBJ_NEW(orte_rmaps_base_proc_t);
if(NULL == proc) {
@ -274,7 +274,7 @@ int orte_rmaps_base_get_map(orte_jobid_t jobid, ompi_list_t* mapping_list)
for(kv = 0; kv<value->cnt; kv++) {
orte_gpr_keyval_t* keyval = value->keyvals[kv];
if(strcmp(keyval->key, ORTE_PROC_RANK_KEY) == 0) {
proc->proc_rank = keyval->value.i32;
proc->proc_rank = keyval->value.size;
continue;
}
if(strcmp(keyval->key, ORTE_PROC_NAME_KEY) == 0) {
@ -282,8 +282,8 @@ int orte_rmaps_base_get_map(orte_jobid_t jobid, ompi_list_t* mapping_list)
continue;
}
if(strcmp(keyval->key, ORTE_PROC_APP_CONTEXT_KEY) == 0) {
int32_t app_index = keyval->value.i32;
if(app_index >= (int32_t)num_context) {
size_t app_index = keyval->value.size;
if(app_index >= num_context) {
ompi_output(0, "orte_rmaps_base_get_map: invalid context\n");
rc = ORTE_ERR_BAD_PARAM;
goto cleanup;
@ -352,7 +352,7 @@ int orte_rmaps_base_get_node_map(
char* segment = NULL;
char* jobid_str = NULL;
orte_gpr_value_t** values;
int32_t v, num_values;
size_t v, num_values;
int rc;
char* keys[] = {
ORTE_PROC_RANK_KEY,
@ -412,7 +412,7 @@ int orte_rmaps_base_get_node_map(
orte_rmaps_base_map_t* map = NULL;
orte_rmaps_base_proc_t* proc;
char* node_name = NULL;
int32_t kv;
size_t kv;
proc = OBJ_NEW(orte_rmaps_base_proc_t);
if(NULL == proc) {
@ -423,7 +423,7 @@ int orte_rmaps_base_get_node_map(
for(kv = 0; kv<value->cnt; kv++) {
orte_gpr_keyval_t* keyval = value->keyvals[kv];
if(strcmp(keyval->key, ORTE_PROC_RANK_KEY) == 0) {
proc->proc_rank = keyval->value.i32;
proc->proc_rank = keyval->value.size;
continue;
}
if(strcmp(keyval->key, ORTE_PROC_NAME_KEY) == 0) {
@ -431,8 +431,8 @@ int orte_rmaps_base_get_node_map(
continue;
}
if(strcmp(keyval->key, ORTE_PROC_APP_CONTEXT_KEY) == 0) {
int32_t app_index = keyval->value.i32;
if(app_index >= (int32_t)num_context) {
size_t app_index = keyval->value.size;
if(app_index >= num_context) {
ompi_output(0, "orte_rmaps_base_get_map: invalid context\n");
rc = ORTE_ERR_BAD_PARAM;
goto cleanup;
@ -573,8 +573,8 @@ int orte_rmaps_base_set_map(orte_jobid_t jobid, ompi_list_t* mapping_list)
/* initialize keyvals */
keyvals[0]->key = strdup(ORTE_PROC_RANK_KEY);
keyvals[0]->type = ORTE_INT32;
keyvals[0]->value.i32 = proc->proc_rank;
keyvals[0]->type = ORTE_SIZE;
keyvals[0]->value.size = proc->proc_rank;
keyvals[1]->key = strdup(ORTE_PROC_NAME_KEY);
keyvals[1]->type = ORTE_NAME;
@ -585,8 +585,8 @@ int orte_rmaps_base_set_map(orte_jobid_t jobid, ompi_list_t* mapping_list)
keyvals[2]->value.strptr = strdup(proc->proc_node->node_name);
keyvals[3]->key = strdup(ORTE_PROC_APP_CONTEXT_KEY);
keyvals[3]->type = ORTE_INT32;
keyvals[3]->value.i32 = map->app->idx;
keyvals[3]->type = ORTE_SIZE;
keyvals[3]->value.size = map->app->idx;
keyvals[4]->key = strdup(ORTE_PROC_STATE_KEY);
keyvals[4]->type = ORTE_PROC_STATE;
@ -663,7 +663,7 @@ int orte_rmaps_base_get_vpid_range(orte_jobid_t jobid, orte_vpid_t *start, orte_
char *tokens[2];
char *keys[3];
orte_gpr_value_t** values = NULL;
int i, num_values = 0;
size_t i, num_values = 0;
int rc;
/* query the job segment on the registry */

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

@ -67,7 +67,7 @@ struct orte_rmaps_base_proc_t {
ompi_list_item_t super;
orte_rmaps_base_node_t* proc_node;
orte_process_name_t proc_name;
int proc_rank;
size_t proc_rank;
};
typedef struct orte_rmaps_base_proc_t orte_rmaps_base_proc_t;

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

@ -137,7 +137,7 @@ int orte_rmgr_base_get_app_context(
char *tokens[2];
char *keys[2];
orte_gpr_value_t** values = NULL;
int i, num_values = 0, index = 0;
size_t i, num_values = 0, index = 0;
int rc;
/* create the job segment on the registry */
@ -170,7 +170,7 @@ int orte_rmgr_base_get_app_context(
for(i=0; i<num_values; i++) {
orte_gpr_value_t* value = values[i];
orte_gpr_keyval_t** keyvals = value->keyvals;
int k;
size_t k;
for(k=0; k < value->cnt; k++) {
orte_gpr_keyval_t* keyval = keyvals[k];
(*app_context)[index++] = keyval->value.app_context;
@ -201,7 +201,7 @@ int orte_rmgr_base_get_job_slots(orte_jobid_t jobid, size_t* proc_slots)
char *tokens[2];
char *keys[2];
orte_gpr_value_t** values = NULL;
int i, num_values = 0;
size_t i, num_values = 0;
int rc;
/* query the job segment on the registry */
@ -268,9 +268,9 @@ int orte_rmgr_base_set_job_slots(orte_jobid_t jobid, size_t proc_slots)
tokens[0] = ORTE_JOB_GLOBALS;
tokens[1] = NULL;
keyval.type = ORTE_UINT32;
keyval.type = ORTE_SIZE;
keyval.key = ORTE_JOB_SLOTS_KEY;
keyval.value.ui32 = proc_slots;
keyval.value.size = proc_slots;
keyvals[0] = &keyval;
value.addr_mode = ORTE_GPR_OVERWRITE;

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

@ -81,7 +81,7 @@ static void orte_app_context_construct(orte_app_context_t* app_context)
/* destructor - used to free any resources held by instance */
static void orte_app_context_destructor(orte_app_context_t* app_context)
{
int i;
size_t i;
if (NULL != app_context->app) {
free (app_context->app);

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

@ -38,7 +38,9 @@
int orte_rmgr_base_proc_stage_gate_init(orte_jobid_t job)
{
int i, rc, num_counters=6;
size_t i, num_counters=6;
orte_gpr_notify_id_t subnum;
int rc;
orte_gpr_value_t *values, value, trig, *trigs;
orte_gpr_subscription_t sub, *subs;
char* keys[] = {
@ -82,8 +84,8 @@ int orte_rmgr_base_proc_stage_gate_init(orte_jobid_t job)
return ORTE_ERR_OUT_OF_RESOURCE;
}
value.keyvals[i]->key = strdup(keys[i]);
value.keyvals[i]->type = ORTE_UINT32;
value.keyvals[i]->value.ui32 = 0;
value.keyvals[i]->type = ORTE_SIZE;
value.keyvals[i]->value.size = 0;
}
values = &value;
@ -95,7 +97,9 @@ int orte_rmgr_base_proc_stage_gate_init(orte_jobid_t job)
}
OBJ_DESTRUCT(&value);
/* for the trigger, we want the counter values returned to us
/* for the trigger, we want the counter values returned to us AND
* information on VPID_START so we can generate the list of peers
* to receive the xcast messages for barrier release.
* setup subscriptions for that purpose. we'll enter the precise data
* keys when we are ready to register the subscription - for now,
* do all the basic stuff
@ -115,14 +119,15 @@ int orte_rmgr_base_proc_stage_gate_init(orte_jobid_t job)
}
sub.tokens[0] = strdup(ORTE_JOB_GLOBALS); /* the counters are in the job's globals container */
sub.num_tokens = 1;
sub.keys = (char**)malloc(sizeof(char*)*3);
sub.num_keys = 3;
sub.keys = (char**)malloc(sizeof(char*) * sub.num_keys);
if (NULL == sub.keys) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
OBJ_DESTRUCT(&sub);
return ORTE_ERR_OUT_OF_RESOURCE;
}
sub.num_keys = 2;
sub.keys[1] = strdup(ORTE_JOB_SLOTS_KEY);
sub.keys[2] = strdup(ORTE_JOB_VPID_START_KEY);
sub.cbfunc = orte_rmgr_base_proc_stage_gate_mgr;
sub.user_tag = NULL;
@ -205,7 +210,7 @@ int orte_rmgr_base_proc_stage_gate_init(orte_jobid_t job)
ORTE_GPR_TRIG_ALL_CMP,
1, &subs,
1, &trigs,
&rc);
&subnum);
if(ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
@ -257,8 +262,8 @@ int orte_rmgr_base_proc_stage_gate_init(orte_jobid_t job)
OBJ_DESTRUCT(&trig);
return ORTE_ERR_OUT_OF_RESOURCE;
}
trig.keyvals[0]->type = ORTE_INT32;
trig.keyvals[0]->value.i32 = 1; /* trigger on the first process that aborts */
trig.keyvals[0]->type = ORTE_SIZE;
trig.keyvals[0]->value.size = 1; /* trigger on the first process that aborts */
subs = &sub;
trigs = &trig;
@ -266,7 +271,7 @@ int orte_rmgr_base_proc_stage_gate_init(orte_jobid_t job)
ORTE_GPR_TRIG_ALL_AT,
1, &subs,
1, &trigs,
&rc);
&subnum);
if (ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
@ -288,7 +293,10 @@ void orte_rmgr_base_proc_stage_gate_mgr(orte_gpr_notify_data_t *data,
orte_gpr_value_t **values;
orte_gpr_keyval_t **kvals;
orte_process_name_t *recipients;
int i, j, n, k, rc;
size_t i, j, n=0;
orte_vpid_t k=0;
int rc;
bool found_slots=false, found_start=false;
orte_buffer_t msg;
orte_jobid_t job;
@ -302,31 +310,36 @@ void orte_rmgr_base_proc_stage_gate_mgr(orte_gpr_notify_data_t *data,
* procs in this job
*/
values = data->values;
n = -1; k = 0;
for (i=0; i < data->cnt && (0 > n || 0 > k); i++) {
for (i=0; i < data->cnt && (!found_slots || !found_start); i++) {
kvals = values[i]->keyvals;
/* check to see if ORTE_JOB_GLOBALS is the token */
if (NULL != values[i]->tokens &&
0 == strcmp(ORTE_JOB_GLOBALS, values[i]->tokens[0])) {
/* find the ORTE_JOB_SLOTS_KEY and the ORTE_JOB_VPID_START_KEY keyval */
for (j=0; j < values[i]->cnt && (0 > n); j++) {
if (NULL != kvals[j] && 0 > n &&
for (j=0; j < values[i]->cnt && (!found_slots || !found_start); j++) {
if (NULL != kvals[j] && !found_slots &&
0 == strcmp(ORTE_JOB_SLOTS_KEY, kvals[j]->key)) {
n = (int)(kvals[j]->value.ui32);
n = kvals[j]->value.size;
found_slots = true;
}
if (NULL != kvals[j] && 0 > k &&
if (NULL != kvals[j] && !found_start &&
0 == strcmp(ORTE_JOB_VPID_START_KEY, kvals[j]->key)) {
k = (int)(kvals[j]->value.ui32);
k = kvals[j]->value.vpid;
found_start = true;
}
}
}
}
if (0 > n) {
if (!found_slots) {
ORTE_ERROR_LOG(ORTE_ERR_GPR_DATA_CORRUPT);
return;
}
if (!found_start) {
ORTE_ERROR_LOG(ORTE_ERR_GPR_DATA_CORRUPT);
return;
}
/* now can generate the list of recipients */
recipients = (orte_process_name_t*)malloc(n * sizeof(orte_process_name_t));
for (i=0; i < n; i++) {
@ -337,7 +350,9 @@ void orte_rmgr_base_proc_stage_gate_mgr(orte_gpr_notify_data_t *data,
/* for the purposes of the stage gate manager, we don't actually have
* to determine anything from the message. All we have to do is respond
* by sending an xcast to all processes
* by sending an xcast to all processes. However, the buffer has to include
* at least one piece of data for the RML to function, so pack something
* meaningless.
*/
OBJ_CONSTRUCT(&msg, orte_buffer_t);
@ -379,7 +394,8 @@ void orte_rmgr_base_proc_stage_gate_mgr_abort(orte_gpr_notify_data_t *data,
int orte_rmgr_base_proc_stage_gate_subscribe(orte_jobid_t job, orte_gpr_notify_cb_fn_t cbfunc, void* cbdata)
{
int i, rc;
size_t i, sub_num;
int rc;
orte_gpr_value_t trig, *trigs;
orte_gpr_subscription_t sub, *subs;
char* keys[] = {
@ -390,7 +406,7 @@ int orte_rmgr_base_proc_stage_gate_subscribe(orte_jobid_t job, orte_gpr_notify_c
ORTE_PROC_NUM_FINALIZED,
ORTE_PROC_NUM_TERMINATED
};
int num_counters = sizeof(keys)/sizeof(keys[0]);
size_t num_counters = sizeof(keys)/sizeof(keys[0]);
/* for the trigger, we want the counter values returned to us
* setup subscriptions for that purpose. we'll enter the precise data
@ -494,7 +510,7 @@ int orte_rmgr_base_proc_stage_gate_subscribe(orte_jobid_t job, orte_gpr_notify_c
ORTE_GPR_TRIG_ALL_CMP,
1, &subs,
1, &trigs,
&rc);
&sub_num);
if(ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
@ -541,8 +557,8 @@ int orte_rmgr_base_proc_stage_gate_subscribe(orte_jobid_t job, orte_gpr_notify_c
OBJ_DESTRUCT(&trig);
return ORTE_ERR_OUT_OF_RESOURCE;
}
trig.keyvals[0]->type = ORTE_INT32;
trig.keyvals[0]->value.i32 = 1; /* trigger on the first process that aborts */
trig.keyvals[0]->type = ORTE_SIZE;
trig.keyvals[0]->value.size = 1; /* trigger on the first process that aborts */
subs = &sub;
trigs = &trig;
@ -550,7 +566,7 @@ int orte_rmgr_base_proc_stage_gate_subscribe(orte_jobid_t job, orte_gpr_notify_c
ORTE_GPR_TRIG_ALL_AT,
1, &subs,
1, &trigs,
&rc);
&sub_num);
if (ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);

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

@ -237,7 +237,8 @@ static void orte_rmgr_proxy_callback(orte_gpr_notify_data_t *data, void *cbdata)
orte_rmgr_cb_fn_t cbfunc = (orte_rmgr_cb_fn_t)cbdata;
orte_gpr_keyval_t** keyvals;
orte_jobid_t jobid;
int i, j, rc;
size_t i, j;
int rc;
/* get the jobid from the segment name */
if (ORTE_SUCCESS != (rc = orte_schema.extract_jobid_from_segment_name(&jobid, data->segment))) {

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

@ -170,7 +170,8 @@ static void orte_rmgr_urm_callback(orte_gpr_notify_data_t *data, void *cbdata)
orte_rmgr_cb_fn_t cbfunc = (orte_rmgr_cb_fn_t)cbdata;
orte_gpr_keyval_t** keyvals;
orte_jobid_t jobid;
int i, j, rc;
size_t i, j;
int rc;
/* get the jobid from the segment name */
if (ORTE_SUCCESS != (rc = orte_schema.extract_jobid_from_segment_name(&jobid, data->segment))) {
@ -340,3 +341,13 @@ static int orte_rmgr_urm_finalize(void)
return ORTE_SUCCESS;
}
static void orte_rmgr_urm_recv(
int status,
orte_process_name_t* peer,
orte_buffer_t* req,
orte_rml_tag_t tag,
void* cbdata)
{
return;
}

34
src/mca/schema/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,34 @@
#
# 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 $(top_srcdir)/config/Makefile.options
SUBDIRS = base $(MCA_schema_STATIC_SUBDIRS)
DIST_SUBDIRS = base $(MCA_schema_ALL_SUBDIRS)
# Source code files
headers = schema.h \
schema_types.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/mca/schema
ompi_HEADERS = $(headers)
else
ompidir = $(includedir)
endif

46
src/mca/schema/base/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
#
# 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 $(top_srcdir)/config/Makefile.options
SUBDIRS =
noinst_LTLIBRARIES = libmca_schema_base.la
# For VPATH builds, have to specify where static-modules.h will be found
AM_CPPFLAGS = -I$(top_builddir)/src
# Source code files
headers = \
base.h
libmca_schema_base_la_SOURCES = \
$(headers) \
schema_base_open.c \
schema_base_close.c \
schema_base_select.c
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/mca/schema/base
ompi_HEADERS = $(headers)
else
ompidir = $(includedir)
endif

180
src/mca/schema/base/base.h Обычный файл
Просмотреть файл

@ -0,0 +1,180 @@
/*
* 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:
*
* The Open MPI general purpose registry.
*
* The Open MPI system contains a general purpose registry for use by both
* applications and internal systems to dynamically share information. For
* speed purposes, the registry is divided into "segments", each labelled
* with an appropriate "token" string that describes its contents. Segments
* are automatically provided for the "universe" and for each MPI CommWorld.
* At this time, all segments may be accessed by any application within the universe, thus
* providing a mechanism for cross-CommWorld communications (with the requirement
* that all participating CommWorlds must reside within the same universe). In the future,
* some form of security may be provided to limit access privileges between
* segments.
*
* Within each registry segment, there exists a list of objects that have
* been "put" onto the registry. Each object must be tagged with at least
* one token, but may be tagged with as many tokens as the creator desires.
* Retrieval requests must specify the segment and at least one token, but
* can specify an arbitrary number of tokens to describe the search. The registry
* will return a list of all objects that meet the search criteria.
*
* Tokens are defined as character strings, thus allowing for clarity in
* the program. However, for speed purposes, tokens are translated into
* integer keys prior to storing an object. A table of token-key pairs
* is independently maintained for each registry segment. Users can obtain
* an index of tokens within a dictionary by requesting it through the orte_registry_index()
* function.
*
* The registry also provides a subscription capability whereby a caller
* can subscribe to a stored object and receive notification when various actions
* are performed on that object. Currently supported actions include modification,
* the addition of another subscriber, and deletion. Notifications are sent via
* the OOB communication channel.
*
*
*/
#ifndef ORTE_GPR_BASE_H_
#define ORTE_GRP_BASE_H_
/*
* includes
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "threads/mutex.h"
#include "threads/condition.h"
#include "class/ompi_list.h"
#include "dps/dps_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 "mca/gpr/gpr.h"
/*
* Global functions for MCA overall collective open and close
*/
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* packing type definitions for GPR-specific types
*/
/* CAUTION - any changes here must also change corresponding
* typedefs in gpr_types.h
*/
#define ORTE_GPR_PACK_CMD ORTE_GPR_CMD
#define ORTE_GPR_PACK_ACTION ORTE_NOTIFY_ACTION
#define ORTE_GPR_PACK_ADDR_MODE ORTE_UINT16
#define ORTE_GPR_PACK_SYNCHRO_MODE ORTE_SYNCHRO_MODE
#define ORTE_GPR_PACK_NOTIFY_ID ORTE_UINT32
OMPI_DECLSPEC int orte_gpr_base_open(void);
OMPI_DECLSPEC int orte_gpr_base_select(void);
OMPI_DECLSPEC int orte_gpr_base_close(void);
/* general usage functions */
OMPI_DECLSPEC int orte_gpr_base_pack_delete_segment(orte_buffer_t *cmd,
char *segment);
OMPI_DECLSPEC int orte_gpr_base_unpack_delete_segment(orte_buffer_t *buffer, int *ret);
OMPI_DECLSPEC int orte_gpr_base_pack_delete_entries(orte_buffer_t *buffer,
orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys);
OMPI_DECLSPEC int orte_gpr_base_unpack_delete_entries(orte_buffer_t *buffer, int *ret);
OMPI_DECLSPEC int orte_gpr_base_pack_index(orte_buffer_t *cmd, char *segment);
OMPI_DECLSPEC int orte_gpr_base_unpack_index(orte_buffer_t *cmd, int *ret, size_t *cnt,
char **index);
OMPI_DECLSPEC int orte_gpr_base_pack_subscribe(orte_buffer_t *cmd,
orte_gpr_notify_action_t action, size_t num_subs,
orte_gpr_subscription_t **subscriptions,
size_t num_trigs, orte_gpr_value_t **trig);
OMPI_DECLSPEC int orte_gpr_base_unpack_subscribe(orte_buffer_t *buffer, int *ret,
orte_gpr_notify_id_t *remote_idtag);
OMPI_DECLSPEC int orte_gpr_base_pack_unsubscribe(orte_buffer_t *cmd,
orte_gpr_notify_id_t remote_idtag);
OMPI_DECLSPEC int orte_gpr_base_unpack_unsubscribe(orte_buffer_t *buffer, int *ret);
OMPI_DECLSPEC int orte_gpr_base_pack_put(orte_buffer_t *cmd,
size_t cnt, orte_gpr_value_t **values);
OMPI_DECLSPEC int orte_gpr_base_unpack_put(orte_buffer_t *buffer, int *ret);
OMPI_DECLSPEC int orte_gpr_base_pack_get(orte_buffer_t *cmd,
orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys);
OMPI_DECLSPEC int orte_gpr_base_unpack_get(orte_buffer_t *buffer, int *ret,
size_t *cnt, orte_gpr_value_t ***values);
OMPI_DECLSPEC int orte_gpr_base_pack_dump_all(orte_buffer_t *cmd);
OMPI_DECLSPEC int orte_gpr_base_pack_dump_segments(orte_buffer_t *cmd);
OMPI_DECLSPEC int orte_gpr_base_pack_dump_triggers(orte_buffer_t *cmd);
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,
orte_gpr_keyval_t *iptr);
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,
orte_gpr_notify_data_t *data);
OMPI_DECLSPEC int orte_gpr_base_dump_value(orte_buffer_t *buffer,
orte_gpr_value_t *value);
OMPI_DECLSPEC int orte_gpr_base_pack_cleanup_job(orte_buffer_t *buffer,
orte_jobid_t jobid);
OMPI_DECLSPEC int orte_gpr_base_unpack_cleanup_job(orte_buffer_t *buffer, int *ret);
OMPI_DECLSPEC int orte_gpr_base_pack_cleanup_proc(orte_buffer_t *buffer,
orte_process_name_t *proc);
OMPI_DECLSPEC int orte_gpr_base_unpack_cleanup_proc(orte_buffer_t *buffer, int *ret);
OMPI_DECLSPEC int orte_gpr_base_pack_increment_value(orte_buffer_t *cmd, orte_gpr_value_t *value);
OMPI_DECLSPEC int orte_gpr_base_unpack_increment_value(orte_buffer_t *buffer, int *ret);
OMPI_DECLSPEC int orte_gpr_base_pack_decrement_value(orte_buffer_t *cmd, orte_gpr_value_t *value);
OMPI_DECLSPEC int orte_gpr_base_unpack_decrement_value(orte_buffer_t *buffer, int *ret);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
/*
* globals that might be needed inside the gpr
*/
extern int orte_gpr_base_output;
extern bool orte_gpr_base_selected;
extern ompi_list_t orte_gpr_base_components_available;
extern mca_gpr_base_component_t orte_gpr_base_selected_component;
#endif

40
src/mca/schema/base/schema_base_close.c Обычный файл
Просмотреть файл

@ -0,0 +1,40 @@
/*
* 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 "include/orte_constants.h"
#include "mca/gpr/base/base.h"
int orte_gpr_base_close(void)
{
/* If we have a selected component and module, then finalize it */
if (orte_gpr_base_selected) {
orte_gpr_base_selected_component.gpr_finalize();
}
/* Close all remaining available components (may be one if this is a
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
mca_base_components_close(orte_gpr_base_output,
&orte_gpr_base_components_available, NULL);
/* All done */
return ORTE_SUCCESS;
}

282
src/mca/schema/base/schema_base_open.c Обычный файл
Просмотреть файл

@ -0,0 +1,282 @@
/*
* 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 "include/orte_constants.h"
#include "include/constants.h"
#include "util/output.h"
#include "mca/gpr/base/base.h"
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* component's public mca_base_module_t struct.
*/
#include "mca/gpr/base/static-components.h"
/*
* globals
*/
/** KEYVAL **/
/* constructor - used to initialize state of keyval instance */
static void orte_gpr_keyval_construct(orte_gpr_keyval_t* keyval)
{
keyval->key = NULL;
keyval->type = 0;
keyval->value.i32 = 0;
}
/* 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);
}
}
/* define instance of ompi_class_t */
OBJ_CLASS_INSTANCE(
orte_gpr_keyval_t, /* type name */
ompi_object_t, /* parent "class" name */
orte_gpr_keyval_construct, /* constructor */
orte_gpr_keyval_destructor); /* destructor */
/** VALUE **/
/* constructor - used to initialize state of registry value instance */
static void orte_gpr_value_construct(orte_gpr_value_t* reg_val)
{
reg_val->addr_mode = 0;
reg_val->segment = NULL;
reg_val->cnt = 0;
reg_val->keyvals = NULL;
reg_val->num_tokens = 0;
reg_val->tokens = 0;
}
/* destructor - used to free any resources held by instance */
static void orte_gpr_value_destructor(orte_gpr_value_t* reg_val)
{
char **tokens;
size_t i;
if (NULL != reg_val->segment) free(reg_val->segment);
if (0 < reg_val->cnt && NULL != reg_val->keyvals) {
for (i=0; i < reg_val->cnt; i++) {
if (NULL != reg_val->keyvals[i])
OBJ_RELEASE(reg_val->keyvals[i]);
}
free(reg_val->keyvals);
}
if (0 < reg_val->num_tokens && NULL != reg_val->tokens) {
tokens = reg_val->tokens;
for (i=0; i < reg_val->num_tokens; i++) {
if(NULL != tokens[i])
free(tokens[i]);
}
free(tokens);
}
}
/* define instance of ompi_class_t */
OBJ_CLASS_INSTANCE(
orte_gpr_value_t, /* type name */
ompi_object_t, /* parent "class" name */
orte_gpr_value_construct, /* constructor */
orte_gpr_value_destructor); /* destructor */
/** NOTIFY DATA **/
/* constructor - used to initialize state of registry value instance */
static void orte_gpr_notify_data_construct(orte_gpr_notify_data_t* ptr)
{
ptr->cb_num = 0;
ptr->addr_mode = 0;
ptr->segment = NULL;
ptr->cnt = 0;
ptr->values = NULL;
}
/* destructor - used to free any resources held by instance */
static void orte_gpr_notify_data_destructor(orte_gpr_notify_data_t* ptr)
{
size_t i;
if (NULL != ptr->segment) free(ptr->segment);
if (0 < ptr->cnt && NULL != ptr->values) {
for (i=0; i < ptr->cnt; i++) {
if (NULL != ptr->values[i])
OBJ_RELEASE(ptr->values[i]);
}
free(ptr->values);
}
}
/* define instance of ompi_class_t */
OBJ_CLASS_INSTANCE(
orte_gpr_notify_data_t, /* type name */
ompi_object_t, /* parent "class" name */
orte_gpr_notify_data_construct, /* constructor */
orte_gpr_notify_data_destructor); /* destructor */
/** SUBSCRIPTION **/
/* constructor - used to initialize state of registry subscription instance */
static void orte_gpr_subscription_construct(orte_gpr_subscription_t* sub)
{
sub->addr_mode = 0;
sub->segment = NULL;
sub->num_tokens = 0;
sub->tokens = NULL;
sub->num_keys = 0;
sub->keys = NULL;
sub->cbfunc = NULL;
sub->user_tag = NULL;
}
/* destructor - used to free any resources held by instance */
static void orte_gpr_subscription_destructor(orte_gpr_subscription_t* sub)
{
char **tokens;
size_t i;
if (NULL != sub->segment) free(sub->segment);
if (0 < sub->num_tokens && NULL != sub->tokens) {
tokens = sub->tokens;
for (i=0; i < sub->num_tokens; i++) {
if(NULL != tokens[i])
free(tokens[i]);
}
free(sub->tokens);
}
if (0 < sub->num_keys && NULL != sub->keys) {
tokens = sub->keys;
for (i=0; i < sub->num_keys; i++) {
if(NULL != tokens[i])
free(tokens[i]);
}
free(sub->keys);
}
}
/* define instance of ompi_class_t */
OBJ_CLASS_INSTANCE(
orte_gpr_subscription_t, /* type name */
ompi_object_t, /* parent "class" name */
orte_gpr_subscription_construct, /* constructor */
orte_gpr_subscription_destructor); /* destructor */
/** NOTIFY MESSAGE */
/* constructor - used to initialize notify message instance */
static void orte_gpr_notify_message_construct(orte_gpr_notify_message_t* msg)
{
msg->idtag = 0;
msg->cnt = 0;
msg->data = NULL;
}
/* destructor - used to free any resources held by instance */
static void orte_gpr_notify_message_destructor(orte_gpr_notify_message_t* msg)
{
size_t i;
if (0 < msg->cnt && NULL != msg->data) {
for (i=0; i < msg->cnt; i++) {
if (NULL != msg->data[i]) OBJ_RELEASE(msg->data[i]);
}
free(msg->data);
}
}
/* define instance of ompi_class_t */
OBJ_CLASS_INSTANCE(
orte_gpr_notify_message_t, /* type name */
ompi_object_t, /* parent "class" name */
orte_gpr_notify_message_construct, /* constructor */
orte_gpr_notify_message_destructor); /* destructor */
/*
* Global variables
*/
int orte_gpr_base_output = -1;
orte_gpr_base_module_t orte_gpr;
bool orte_gpr_base_selected = false;
ompi_list_t orte_gpr_base_components_available;
mca_gpr_base_component_t orte_gpr_base_selected_component;
ompi_mutex_t orte_gpr_mutex;
/**
* Function for finding and opening either all MCA components, or the one
* that was specifically requested via a MCA parameter.
*/
int orte_gpr_base_open(void)
{
int param, value;
/* Debugging / verbose output */
param = mca_base_param_register_int("gpr", "base", "verbose",
NULL, 0);
mca_base_param_lookup_int(param, &value);
if (value != 0) {
orte_gpr_base_output = ompi_output_open(NULL);
} else {
orte_gpr_base_output = -1;
}
/* Open up all available components */
if (OMPI_SUCCESS !=
mca_base_components_open("gpr", 0, mca_gpr_base_static_components,
&orte_gpr_base_components_available, true)) {
return ORTE_ERROR;
}
/* All done */
return ORTE_SUCCESS;
}

95
src/mca/schema/base/schema_base_select.c Обычный файл
Просмотреть файл

@ -0,0 +1,95 @@
/*
* 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 "include/orte_constants.h"
#include "mca/gpr/base/base.h"
/**
* Function for selecting one component from all those that are
* available.
*/
int orte_gpr_base_select(void)
{
ompi_list_item_t *item;
mca_base_component_list_item_t *cli;
mca_gpr_base_component_t *component, *best_component = NULL;
orte_gpr_base_module_t *module, *best_module = NULL;
bool multi, hidden;
int priority, best_priority = -1;
/* Iterate through all the available components */
for (item = ompi_list_get_first(&orte_gpr_base_components_available);
item != ompi_list_get_end(&orte_gpr_base_components_available);
item = ompi_list_get_next(item)) {
cli = (mca_base_component_list_item_t *) item;
component = (mca_gpr_base_component_t *) cli->cli_component;
/* Call the component's init function and see if it wants to be
selected */
module = component->gpr_init(&multi, &hidden, &priority);
/* If we got a non-NULL module back, then the component wants to
be selected. So save its multi/hidden values and save the
module with the highest priority */
if (NULL != module) {
/* If this is the best one, save it */
if (priority > best_priority) {
/* If there was a previous best one, finalize */
if (NULL != best_component) {
best_component->gpr_finalize();
}
/* Save the new best one */
best_module = module;
best_component = component;
/* update the best priority */
best_priority = priority;
}
/* If it's not the best one, finalize it */
else {
component->gpr_finalize();
}
}
}
/* If we didn't find one to select, barf */
if (NULL == best_component) {
return ORTE_ERROR;
}
/* We have happiness -- save the component and module for later
usage */
orte_gpr = *best_module;
orte_gpr_base_selected_component = *best_component;
orte_gpr_base_selected = true;
/* all done */
return ORTE_SUCCESS;
}

45
src/mca/schema/default/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,45 @@
#
# 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$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
schema_default_component.c \
schema_default.c \
schema_default.h
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if OMPI_BUILD_schema_default_DSO
component_noinst =
component_install = mca_schema_default.la
else
component_noinst = libmca_schema_default.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_schema_default_la_SOURCES = $(sources)
mca_schema_default_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_schema_default_la_SOURCES =$(sources)
libmca_schema_default_la_LDFLAGS = -module -avoid-version

180
src/mca/schema/default/schema_default.c Обычный файл
Просмотреть файл

@ -0,0 +1,180 @@
/* -*- 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:
*
* Convenience functions for accessing the General Purpose Registry
*
*/
/*
* includes
*/
#include "orte_config.h"
#include <string.h>
#include "include/orte_constants.h"
#include "util/output.h"
#include "mca/ns/ns.h"
#include "mca/errmgr/errmgr.h"
#include "include/orte_schema.h"
int orte_schema_get_proc_tokens(char ***tokens, size_t* num_tokens, orte_process_name_t *proc);
int orte_schema_get_node_tokens(char ***tokens, size_t* num_tokens, orte_cellid_t cellid, char *nodename);
int orte_schema_get_cell_tokens(char ***tokens, size_t* num_tokens, orte_cellid_t cellid);
int orte_schema_get_job_segment_name(char **name, orte_jobid_t jobid);
int orte_schema_extract_jobid_from_segment_name(orte_jobid_t *jobid, char *name);
/*
* globals
*/
orte_schema_t orte_schema = {
orte_schema_get_proc_tokens,
orte_schema_get_node_tokens,
orte_schema_get_cell_tokens,
orte_schema_get_job_segment_name,
orte_schema_extract_jobid_from_segment_name
};
int orte_schema_open(void)
{
/* just here to ensure library gets loaded for dynamic setup */
return ORTE_SUCCESS;
}
int orte_schema_get_proc_tokens(char ***proc_tokens, size_t* num_tokens, orte_process_name_t *proc)
{
int rc;
char** tokens;
char* vpid_string;
tokens = (char**)malloc(3 * sizeof(char*));
if (NULL == tokens) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = orte_ns.get_proc_name_string(&tokens[0], proc))) {
ORTE_ERROR_LOG(rc);
goto CLEANUP;
}
if (ORTE_SUCCESS != (rc = orte_ns.get_vpid_string(&vpid_string, proc))) {
ORTE_ERROR_LOG(rc);
goto CLEANUP;
}
asprintf(&tokens[1], "%s-%s", ORTE_VPID_KEY, vpid_string);
free(vpid_string);
tokens[2] = NULL;
*proc_tokens = tokens;
if(num_tokens != NULL)
*num_tokens = 2;
return ORTE_SUCCESS;
CLEANUP:
if (NULL != tokens) {
if (NULL != tokens[0])
free(tokens[0]);
if (NULL != tokens[1])
free(tokens[1]);
free(tokens);
}
return rc;
}
int orte_schema_get_node_tokens(char ***node_tokens, size_t* num_tokens, orte_cellid_t cellid, char *nodename)
{
int rc;
char** tokens;
char* cellid_string;
tokens = (char**)malloc(3 * sizeof(char*));
if (NULL == tokens) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
if (ORTE_SUCCESS != (rc = orte_ns.convert_cellid_to_string(&cellid_string, cellid))) {
ORTE_ERROR_LOG(rc);
goto CLEANUP;
}
asprintf(&tokens[0], "%s-%s", ORTE_CELLID_KEY, cellid_string);
free(cellid_string);
tokens[1] = strdup(nodename);
tokens[2] = NULL;
*node_tokens = tokens;
if(num_tokens != NULL)
*num_tokens = 2;
return ORTE_SUCCESS;
CLEANUP:
if (NULL != tokens) {
if (NULL != tokens[0])
free(tokens[0]);
if (NULL != tokens[1])
free(tokens[1]);
free(tokens);
}
return rc;
}
int orte_schema_get_cell_tokens(char ***tokens, size_t* num_tokens, orte_cellid_t cellid)
{
return ORTE_ERR_NOT_IMPLEMENTED;
}
int orte_schema_get_job_segment_name(char **name, orte_jobid_t jobid)
{
char *jobidstring;
int rc;
if (ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&jobidstring, jobid))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (0 > asprintf(name, "%s-%s", ORTE_JOB_SEGMENT, jobidstring)) {
free(jobidstring);
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
free(jobidstring);
return ORTE_SUCCESS;
}
int orte_schema_extract_jobid_from_segment_name(orte_jobid_t *jobid, char *name)
{
char *jobstring;
orte_jobid_t job;
int rc;
jobstring = strrchr(name, '-');
if (NULL == jobstring) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
jobstring++;
if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_jobid(&job, jobstring))) {
ORTE_ERROR_LOG(rc);
ompi_output(0, "[%d,%d,%d] %s\n", ORTE_NAME_ARGS(orte_process_info.my_name), jobstring);
return rc;
}
*jobid = job;
return ORTE_SUCCESS;
}

214
src/mca/schema/default/schema_default.h Обычный файл
Просмотреть файл

@ -0,0 +1,214 @@
/* -*- 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$
*
*/
#ifndef ORTE_GPR_PROXY_H
#define ORTE_GPR_PROXY_H
#include "orte_config.h"
#include "include/orte_types.h"
#include "class/ompi_object.h"
#include "class/orte_pointer_array.h"
#include "dps/dps_types.h"
#include "util/proc_info.h"
#include "mca/gpr/base/base.h"
/*
* Module open / close
*/
int orte_gpr_proxy_open(void);
int orte_gpr_proxy_close(void);
/*
* Startup / Shutdown
*/
orte_gpr_base_module_t*
orte_gpr_proxy_component_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority);
int orte_gpr_proxy_module_init(void);
int orte_gpr_proxy_finalize(void);
/*
* proxy-local types
*/
typedef struct {
ompi_object_t super; /**< Allows this to be an object */
size_t index; /**< Index of this callback */
orte_gpr_notify_cb_fn_t callback; /**< Function to be called for notificaiton */
void *user_tag; /**< User-provided tag for callback function */
} orte_gpr_proxy_subscriber_t;
OBJ_CLASS_DECLARATION(orte_gpr_proxy_subscriber_t);
struct orte_gpr_proxy_notify_tracker_t {
ompi_object_t super; /**< Allows this to be an object */
orte_gpr_notify_id_t remote_idtag; /**< Remote ID tag of subscription */
orte_pointer_array_t *callbacks; /**< Array of registered callbacks for this subscription */
};
typedef struct orte_gpr_proxy_notify_tracker_t orte_gpr_proxy_notify_tracker_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(orte_gpr_proxy_notify_tracker_t);
#define ORTE_GPR_PROXY_MAX_SIZE INT32_MAX
#define ORTE_GPR_PROXY_BLOCK_SIZE 100
/*
* globals used within proxy component
*/
typedef struct {
int debug;
size_t block_size;
size_t max_size;
orte_pointer_array_t *notify_tracker;
ompi_mutex_t mutex;
bool compound_cmd_mode;
orte_buffer_t *compound_cmd;
ompi_mutex_t wait_for_compound_mutex;
ompi_condition_t compound_cmd_condition;
int compound_cmd_waiting;
} orte_gpr_proxy_globals_t;
extern orte_gpr_proxy_globals_t orte_gpr_proxy_globals;
/*
* Compound cmd functions
*/
int orte_gpr_proxy_begin_compound_cmd(void);
int orte_gpr_proxy_stop_compound_cmd(void);
int orte_gpr_proxy_exec_compound_cmd(void);
/*
* Arithmetic operations
*/
int orte_gpr_proxy_increment_value(orte_gpr_value_t *value);
int orte_gpr_proxy_decrement_value(orte_gpr_value_t *value);
/*
* Delete-index functions
*/
int orte_gpr_proxy_delete_segment(char *segment);
int orte_gpr_proxy_delete_segment_nb(char *segment,
orte_gpr_notify_cb_fn_t cbfunc, void *user_tag);
int orte_gpr_proxy_delete_entries(orte_gpr_addr_mode_t mode,
char *segment, char **tokens, char **keys);
int orte_gpr_proxy_delete_entries_nb(
orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens, char **keys,
orte_gpr_notify_cb_fn_t cbfunc, void *user_tag);
int orte_gpr_proxy_index(char *segment, size_t *cnt, char **index);
int orte_gpr_proxy_index_nb(char *segment,
orte_gpr_notify_cb_fn_t cbfunc, void *user_tag);
/*
* Cleanup functions
*/
int orte_gpr_proxy_cleanup_job(orte_jobid_t jobid);
int orte_gpr_proxy_cleanup_proc(orte_process_name_t *proc);
/*
* Put-get functions
*/
int orte_gpr_proxy_put(size_t cnt, orte_gpr_value_t **values);
int orte_gpr_proxy_put_nb(size_t cnt, orte_gpr_value_t **values,
orte_gpr_notify_cb_fn_t cbfunc, void *user_tag);
int orte_gpr_proxy_get(orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens, char **keys,
size_t *cnt, orte_gpr_value_t ***values);
int orte_gpr_proxy_get_nb(orte_gpr_addr_mode_t addr_mode,
char *segment, char **tokens, char **keys,
orte_gpr_notify_cb_fn_t cbfunc, void *user_tag);
/*
* Subscribe functions
*/
int orte_gpr_proxy_subscribe(orte_gpr_notify_action_t action,
size_t num_subs,
orte_gpr_subscription_t **subscriptions,
size_t num_trigs,
orte_gpr_value_t **trigs,
orte_gpr_notify_id_t *sub_number);
int orte_gpr_proxy_unsubscribe(orte_gpr_notify_id_t sub_number);
/*
* Diagnostic functions
*/
int orte_gpr_proxy_dump_all(int output_id);
int orte_gpr_proxy_dump_segments(int output_id);
int orte_gpr_proxy_dump_triggers(int output_id);
int orte_gpr_proxy_dump_callbacks(int output_id);
int orte_gpr_proxy_dump_notify_msg(orte_gpr_notify_message_t *msg, int output_id);
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);
/*
* General operations
*/
int orte_gpr_proxy_preallocate_segment(char *name, size_t num_slots);
/*
* Functions that interface to the replica
*/
void orte_gpr_proxy_notify_recv(int status, orte_process_name_t* sender,
orte_buffer_t *buffer, orte_rml_tag_t tag,
void* cbdata);
/*
* Internal functions
*/
int
orte_gpr_proxy_enter_notify_request(orte_gpr_notify_id_t *local_idtag,
size_t cnt, orte_gpr_subscription_t **subscriptions);
int
orte_gpr_proxy_remove_notify_request(orte_gpr_notify_id_t local_idtag,
orte_gpr_notify_id_t *remote_idtag);
int orte_gpr_proxy_set_remote_idtag(orte_gpr_notify_id_t local_idtag,
orte_gpr_notify_id_t remote_idtag);
#endif

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

@ -0,0 +1,378 @@
/* -*- 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:
*
* The Open MPI General Purpose Registry - Proxy component
*
*/
/*
* includes
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "dps/dps.h"
#include "util/output.h"
#include "util/proc_info.h"
#include "mca/ns/ns.h"
#include "mca/errmgr/errmgr.h"
#include "mca/oob/oob_types.h"
#include "mca/rml/rml.h"
#include "mca/errmgr/errmgr.h"
#include "gpr_proxy.h"
/*
* Struct of function pointers that need to be initialized
*/
mca_gpr_base_component_t mca_gpr_proxy_component = {
{
MCA_GPR_BASE_VERSION_1_0_0,
"proxy", /* MCA module name */
1, /* MCA module major version */
0, /* MCA module minor version */
0, /* MCA module release version */
orte_gpr_proxy_open, /* module open */
orte_gpr_proxy_close /* module close */
},
{
false /* checkpoint / restart */
},
orte_gpr_proxy_component_init, /* module init */
orte_gpr_proxy_finalize /* module shutdown */
};
/*
* setup the function pointers for the module
*/
static orte_gpr_base_module_t orte_gpr_proxy = {
/* INIT */
orte_gpr_proxy_module_init,
/* BLOCKING OPERATIONS */
orte_gpr_proxy_get,
orte_gpr_proxy_put,
orte_gpr_proxy_delete_entries,
orte_gpr_proxy_delete_segment,
orte_gpr_proxy_index,
/* NON-BLOCKING OPERATIONS */
orte_gpr_proxy_get_nb,
orte_gpr_proxy_put_nb,
orte_gpr_proxy_delete_entries_nb,
orte_gpr_proxy_delete_segment_nb,
orte_gpr_proxy_index_nb,
/* GENERAL OPERATIONS */
orte_gpr_proxy_preallocate_segment,
/* ARITHMETIC OPERATIONS */
orte_gpr_proxy_increment_value,
orte_gpr_proxy_decrement_value,
/* SUBSCRIBE OPERATIONS */
orte_gpr_proxy_subscribe,
orte_gpr_proxy_unsubscribe,
/* COMPOUND COMMANDS */
orte_gpr_proxy_begin_compound_cmd,
orte_gpr_proxy_stop_compound_cmd,
orte_gpr_proxy_exec_compound_cmd,
/* DIAGNOSTIC OPERATIONS */
orte_gpr_proxy_dump_all,
orte_gpr_proxy_dump_segments,
orte_gpr_proxy_dump_triggers,
orte_gpr_proxy_dump_callbacks,
orte_gpr_proxy_dump_notify_msg,
orte_gpr_proxy_dump_notify_data,
orte_gpr_proxy_dump_value,
/* CLEANUP OPERATIONS */
orte_gpr_proxy_cleanup_job,
orte_gpr_proxy_cleanup_proc
};
/*
* Whether or not we allowed this component to be selected
*/
static bool initialized = false;
/*
* globals needed within proxy component
*/
orte_gpr_proxy_globals_t orte_gpr_proxy_globals;
/* SUBSCRIBER */
/* constructor - used to initialize subscriber instance */
static void orte_gpr_proxy_subscriber_construct(orte_gpr_proxy_subscriber_t* req)
{
req->callback = NULL;
req->user_tag = NULL;
req->index = 0;
}
/* destructor - used to free any resources held by instance */
static void orte_gpr_proxy_subscriber_destructor(orte_gpr_proxy_subscriber_t* req)
{
}
/* define instance of ompi_class_t */
OBJ_CLASS_INSTANCE(
orte_gpr_proxy_subscriber_t, /* type name */
ompi_object_t, /* parent "class" name */
orte_gpr_proxy_subscriber_construct, /* constructor */
orte_gpr_proxy_subscriber_destructor); /* destructor */
/* NOTIFY TRACKER */
/* constructor - used to initialize notify message instance */
static void orte_gpr_proxy_notify_tracker_construct(orte_gpr_proxy_notify_tracker_t* req)
{
req->remote_idtag = ORTE_GPR_NOTIFY_ID_MAX;
orte_pointer_array_init(&(req->callbacks), orte_gpr_proxy_globals.block_size,
orte_gpr_proxy_globals.max_size,
orte_gpr_proxy_globals.block_size);
}
/* destructor - used to free any resources held by instance */
static void orte_gpr_proxy_notify_tracker_destructor(orte_gpr_proxy_notify_tracker_t* req)
{
}
/* define instance of ompi_class_t */
OBJ_CLASS_INSTANCE(
orte_gpr_proxy_notify_tracker_t, /* type name */
ompi_object_t, /* parent "class" name */
orte_gpr_proxy_notify_tracker_construct, /* constructor */
orte_gpr_proxy_notify_tracker_destructor); /* destructor */
/*
* Open the component
*/
int orte_gpr_proxy_open(void)
{
int id, tmp;
id = mca_base_param_register_int("gpr", "proxy", "debug", NULL, 0);
mca_base_param_lookup_int(id, &tmp);
if (tmp) {
orte_gpr_proxy_globals.debug = true;
} else {
orte_gpr_proxy_globals.debug = false;
}
id = mca_base_param_register_int("gpr", "proxy", "maxsize", NULL,
ORTE_GPR_PROXY_MAX_SIZE);
mca_base_param_lookup_int(id, &tmp);
orte_gpr_proxy_globals.max_size = (size_t)tmp;
id = mca_base_param_register_int("gpr", "proxy", "blocksize", NULL,
ORTE_GPR_PROXY_BLOCK_SIZE);
mca_base_param_lookup_int(id, &tmp);
orte_gpr_proxy_globals.block_size = (size_t)tmp;
return ORTE_SUCCESS;
}
/*
* Close the component
*/
int orte_gpr_proxy_close(void)
{
return ORTE_SUCCESS;
}
orte_gpr_base_module_t*
orte_gpr_proxy_component_init(bool *allow_multi_user_threads, bool *have_hidden_threads,
int *priority)
{
if (orte_gpr_proxy_globals.debug) {
ompi_output(0, "gpr_proxy_init called");
}
/* If we are NOT to host a replica, then we want to be selected, so do all
the setup and return the module */
if (NULL != orte_process_info.gpr_replica) {
if (orte_gpr_proxy_globals.debug) {
ompi_output(0, "gpr_proxy_init: proxy selected");
}
/* Return a module (choose an arbitrary, positive priority --
it's only relevant compared to other ns components). If
we're not the seed, then we don't want to be selected, so
return NULL. */
*priority = 10;
/* We allow multi user threads but don't have any hidden threads */
*allow_multi_user_threads = true;
*have_hidden_threads = false;
/* setup thread locks and condition variable */
OBJ_CONSTRUCT(&orte_gpr_proxy_globals.mutex, ompi_mutex_t);
OBJ_CONSTRUCT(&orte_gpr_proxy_globals.wait_for_compound_mutex, ompi_mutex_t);
OBJ_CONSTRUCT(&orte_gpr_proxy_globals.compound_cmd_condition, ompi_condition_t);
/* initialize the registry compound mode */
orte_gpr_proxy_globals.compound_cmd_mode = false;
orte_gpr_proxy_globals.compound_cmd_waiting = 0;
orte_gpr_proxy_globals.compound_cmd = NULL;
/* initialize the notify request tracker */
if (ORTE_SUCCESS != orte_pointer_array_init(&(orte_gpr_proxy_globals.notify_tracker),
orte_gpr_proxy_globals.block_size,
orte_gpr_proxy_globals.max_size,
orte_gpr_proxy_globals.block_size)) {
return NULL;
}
initialized = true;
return &orte_gpr_proxy;
} else {
return NULL;
}
}
int orte_gpr_proxy_module_init(void)
{
/* issue the non-blocking receive */
int rc;
rc = orte_rml.recv_buffer_nb(ORTE_RML_NAME_ANY, ORTE_RML_TAG_GPR_NOTIFY, 0, orte_gpr_proxy_notify_recv, NULL);
if(rc < 0) {
ORTE_ERROR_LOG(rc);
return rc;
}
return ORTE_SUCCESS;
}
/*
* finalize routine
*/
int orte_gpr_proxy_finalize(void)
{
if (orte_gpr_proxy_globals.debug) {
ompi_output(0, "finalizing gpr proxy");
}
if (initialized) {
initialized = false;
}
/* All done */
orte_rml.recv_cancel(ORTE_RML_NAME_ANY, ORTE_RML_TAG_GPR_NOTIFY);
return ORTE_SUCCESS;
}
/*
* handle notify messages from replicas
*/
void orte_gpr_proxy_notify_recv(int status, orte_process_name_t* sender,
orte_buffer_t *buffer, orte_rml_tag_t tag,
void* cbdata)
{
orte_gpr_cmd_flag_t command;
orte_gpr_notify_id_t id_tag;
orte_gpr_notify_data_t **data;
orte_gpr_proxy_notify_tracker_t *trackptr;
orte_gpr_proxy_subscriber_t **subs;
size_t n;
int rc;
size_t num_msgs, cnt, i, j, k;
if (orte_gpr_proxy_globals.debug) {
ompi_output(0, "[%d,%d,%d] gpr proxy: received trigger message",
ORTE_NAME_ARGS(orte_process_info.my_name));
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &command, &n, ORTE_GPR_CMD))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
if (ORTE_GPR_NOTIFY_CMD != command) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
goto RETURN_ERROR;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &num_msgs, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
for (k=0; k < num_msgs; k++) {
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &id_tag, &n, ORTE_GPR_NOTIFY_ID))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
/* locate request corresponding to this message */
trackptr = (orte_gpr_proxy_notify_tracker_t*)((orte_gpr_proxy_globals.notify_tracker)->addr[id_tag]);
if (NULL == trackptr) {
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
goto RETURN_ERROR;
}
n = 1;
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, &cnt, &n, ORTE_SIZE))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
if(cnt > 0) {
/* allocate space for the array */
data = (orte_gpr_notify_data_t**)malloc(cnt * sizeof(orte_gpr_notify_data_t*));
if (NULL == data) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
goto RETURN_ERROR;
}
if (ORTE_SUCCESS != (rc = orte_dps.unpack(buffer, data, &cnt, ORTE_GPR_NOTIFY_DATA))) {
ORTE_ERROR_LOG(rc);
goto RETURN_ERROR;
}
for (i=0; i < cnt; i++) {
/* locate the data callback */
subs = (orte_gpr_proxy_subscriber_t**)((trackptr->callbacks)->addr);
for (j=0; j < (trackptr->callbacks)->size; j++) {
if (NULL != subs[j] && subs[j]->index == data[i]->cb_num) {
/* process request */
subs[j]->callback(data[i], subs[j]->user_tag);
break;
}
}
}
}
}
RETURN_ERROR:
/* reissue non-blocking receive */
orte_rml.recv_buffer_nb(ORTE_RML_NAME_ANY, ORTE_RML_TAG_GPR_NOTIFY, 0, orte_gpr_proxy_notify_recv, NULL);
}

138
src/mca/schema/schema.h Обычный файл
Просмотреть файл

@ -0,0 +1,138 @@
/*
* 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$
*/
#ifndef ORTE_SCHEMA_H
#define ORTE_SCHEMA_H
#include "orte_config.h"
#include "include/orte_types.h"
#include "mca/ns/ns_types.h"
/*
* ORTE_DATA_NAME macro
* This macro is provided so that users can output an intelligible name for a data
* type during debugging. It is called by passing the data type into the macro and
* outputing the result via some print variant. For example, you can call it as:
* ompi_output(0, "data type: %s", ORTE_DATA_NAME(keyval.type));
*
* THE ACTUAL ARRAY IS INSTANTIATED IN runtime/ompi_init.c
*/
#define ORTE_DATA_NAME(n) orte_data_strings[n]
extern char *orte_data_strings[];
/*
* Similar to the above, this macro and array are used to output intelligible error
* messages. It is disturbing to think that we are still outputing error numbers and
* expecting users to look them up in the "big book" to find out what they represent.
* This macro allows the user to output an actual string representation of the error.
*
* * THE ACTUAL ARRAY IS INSTANTIATED IN runtime/ompi_init.c
*/
#define ORTE_ERROR_NAME(n) orte_error_strings[-1*n]
extern char *orte_error_strings[];
/*
* ORTE SEGMENT NAMES
* There are some predefined segments that are used across the entire ORTE system.
* These defines establish those names so everyone can access them, and so they
* can be easily changed if required.
*/
#define ORTE_JOB_SEGMENT "orte-job"
#define ORTE_NODE_SEGMENT "orte-node"
#define ORTE_RESOURCE_SEGMENT "orte-resources"
/*
* ORTE pre-defined tokens for special containers
*/
#define ORTE_JOB_GLOBALS "orte-job-globals"
/*
* ORTE-wide key names for storing/retrieving data from the registry.
* Subsystem-specific keys will be defined in each=/ subsystem's xxx_types.h file.
*/
#define ORTE_CELLID_KEY "orte-cellid"
#define ORTE_JOBID_KEY "orte-jobid"
#define ORTE_VPID_KEY "orte-vpid"
#define ORTE_NODE_NAME_KEY "orte-node-name"
#define ORTE_NODE_ARCH_KEY "orte-node-arch"
#define ORTE_NODE_STATE_KEY "orte-node-state"
#define ORTE_NODE_SLOTS_KEY "orte-node-slots"
#define ORTE_NODE_SLOTS_ALLOC_KEY "orte-node-slots-alloc"
#define ORTE_NODE_SLOTS_MAX_KEY "orte-node-slots-max"
#define ORTE_NODE_ALLOC_KEY "orte-node-alloc"
#define ORTE_NODE_BOOTPROXY_KEY "orte-node-bootproxy"
#define ORTE_JOB_APP_CONTEXT_KEY "orte-job-app-context"
#define ORTE_JOB_SLOTS_KEY "orte-job-slots" /**< number of procs in job */
#define ORTE_JOB_VPID_START_KEY "orte-job-vpid-start"
#define ORTE_JOB_VPID_RANGE_KEY "orte-job-vpid-range"
#define ORTE_JOB_IOF_KEY "orte-job-iof"
#define ORTE_PROC_NAME_KEY "orte-proc-name"
#define ORTE_PROC_RANK_KEY "orte-proc-rank"
#define ORTE_PROC_PID_KEY "orte-proc-pid"
#define ORTE_PROC_STATE_KEY "orte-proc-state"
#define ORTE_PROC_APP_CONTEXT_KEY "orte-proc-app-context"
#define ORTE_PROC_EXIT_CODE_KEY "orte-proc-exit-code"
#define ORTE_PROC_NUM_ALIVE "orte-proc-num-alive"
#define ORTE_PROC_NUM_ABORTED "orte-proc-num-aborted"
#define ORTE_PROC_NUM_AT_STG1 "orte-proc-num-stg1"
#define ORTE_PROC_NUM_AT_STG2 "orte-proc-num-stg2"
#define ORTE_PROC_NUM_AT_STG3 "orte-proc-num-stg3"
#define ORTE_PROC_NUM_FINALIZED "orte-proc-num-finalized"
#define ORTE_PROC_NUM_TERMINATED "orte-proc-num-terminated"
/*
* Convenience functions for accessing ORTE data
*/
typedef int (*orte_schema_get_proc_tokens_fn_t)(
char ***tokens,
size_t* num_tokens,
orte_process_name_t *proc);
typedef int (*orte_schema_get_node_tokens_fn_t)(
char ***tokens,
size_t* num_tokens,
orte_cellid_t cellid,
char *nodename);
typedef int (*orte_schema_get_cell_tokens_fn_t)(
char ***tokens,
size_t* num_tokens,
orte_cellid_t cellid);
typedef int (*orte_schema_get_job_segment_name_fn_t)(char **name, orte_jobid_t jobid);
typedef int (*orte_schema_extract_jobid_from_segment_name_fn_t)(orte_jobid_t *jobid, char *name);
/*
* Base structure for the convenience functions
*/
typedef struct {
orte_schema_get_proc_tokens_fn_t get_proc_tokens;
orte_schema_get_node_tokens_fn_t get_node_tokens;
orte_schema_get_cell_tokens_fn_t get_cell_tokens;
orte_schema_get_job_segment_name_fn_t get_job_segment_name;
orte_schema_extract_jobid_from_segment_name_fn_t extract_jobid_from_segment_name;
} orte_schema_t;
OMPI_DECLSPEC extern orte_schema_t orte_schema;
/*
* Open function to ensure orte_schema is loaded
*/
int orte_schema_open(void);
#endif

138
src/mca/schema/schema_types.h Обычный файл
Просмотреть файл

@ -0,0 +1,138 @@
/*
* 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$
*/
#ifndef ORTE_SCHEMA_H
#define ORTE_SCHEMA_H
#include "orte_config.h"
#include "include/orte_types.h"
#include "mca/ns/ns_types.h"
/*
* ORTE_DATA_NAME macro
* This macro is provided so that users can output an intelligible name for a data
* type during debugging. It is called by passing the data type into the macro and
* outputing the result via some print variant. For example, you can call it as:
* ompi_output(0, "data type: %s", ORTE_DATA_NAME(keyval.type));
*
* THE ACTUAL ARRAY IS INSTANTIATED IN runtime/ompi_init.c
*/
#define ORTE_DATA_NAME(n) orte_data_strings[n]
extern char *orte_data_strings[];
/*
* Similar to the above, this macro and array are used to output intelligible error
* messages. It is disturbing to think that we are still outputing error numbers and
* expecting users to look them up in the "big book" to find out what they represent.
* This macro allows the user to output an actual string representation of the error.
*
* * THE ACTUAL ARRAY IS INSTANTIATED IN runtime/ompi_init.c
*/
#define ORTE_ERROR_NAME(n) orte_error_strings[-1*n]
extern char *orte_error_strings[];
/*
* ORTE SEGMENT NAMES
* There are some predefined segments that are used across the entire ORTE system.
* These defines establish those names so everyone can access them, and so they
* can be easily changed if required.
*/
#define ORTE_JOB_SEGMENT "orte-job"
#define ORTE_NODE_SEGMENT "orte-node"
#define ORTE_RESOURCE_SEGMENT "orte-resources"
/*
* ORTE pre-defined tokens for special containers
*/
#define ORTE_JOB_GLOBALS "orte-job-globals"
/*
* ORTE-wide key names for storing/retrieving data from the registry.
* Subsystem-specific keys will be defined in each=/ subsystem's xxx_types.h file.
*/
#define ORTE_CELLID_KEY "orte-cellid"
#define ORTE_JOBID_KEY "orte-jobid"
#define ORTE_VPID_KEY "orte-vpid"
#define ORTE_NODE_NAME_KEY "orte-node-name"
#define ORTE_NODE_ARCH_KEY "orte-node-arch"
#define ORTE_NODE_STATE_KEY "orte-node-state"
#define ORTE_NODE_SLOTS_KEY "orte-node-slots"
#define ORTE_NODE_SLOTS_ALLOC_KEY "orte-node-slots-alloc"
#define ORTE_NODE_SLOTS_MAX_KEY "orte-node-slots-max"
#define ORTE_NODE_ALLOC_KEY "orte-node-alloc"
#define ORTE_NODE_BOOTPROXY_KEY "orte-node-bootproxy"
#define ORTE_JOB_APP_CONTEXT_KEY "orte-job-app-context"
#define ORTE_JOB_SLOTS_KEY "orte-job-slots" /**< number of procs in job */
#define ORTE_JOB_VPID_START_KEY "orte-job-vpid-start"
#define ORTE_JOB_VPID_RANGE_KEY "orte-job-vpid-range"
#define ORTE_JOB_IOF_KEY "orte-job-iof"
#define ORTE_PROC_NAME_KEY "orte-proc-name"
#define ORTE_PROC_RANK_KEY "orte-proc-rank"
#define ORTE_PROC_PID_KEY "orte-proc-pid"
#define ORTE_PROC_STATE_KEY "orte-proc-state"
#define ORTE_PROC_APP_CONTEXT_KEY "orte-proc-app-context"
#define ORTE_PROC_EXIT_CODE_KEY "orte-proc-exit-code"
#define ORTE_PROC_NUM_ALIVE "orte-proc-num-alive"
#define ORTE_PROC_NUM_ABORTED "orte-proc-num-aborted"
#define ORTE_PROC_NUM_AT_STG1 "orte-proc-num-stg1"
#define ORTE_PROC_NUM_AT_STG2 "orte-proc-num-stg2"
#define ORTE_PROC_NUM_AT_STG3 "orte-proc-num-stg3"
#define ORTE_PROC_NUM_FINALIZED "orte-proc-num-finalized"
#define ORTE_PROC_NUM_TERMINATED "orte-proc-num-terminated"
/*
* Convenience functions for accessing ORTE data
*/
typedef int (*orte_schema_get_proc_tokens_fn_t)(
char ***tokens,
size_t* num_tokens,
orte_process_name_t *proc);
typedef int (*orte_schema_get_node_tokens_fn_t)(
char ***tokens,
size_t* num_tokens,
orte_cellid_t cellid,
char *nodename);
typedef int (*orte_schema_get_cell_tokens_fn_t)(
char ***tokens,
size_t* num_tokens,
orte_cellid_t cellid);
typedef int (*orte_schema_get_job_segment_name_fn_t)(char **name, orte_jobid_t jobid);
typedef int (*orte_schema_extract_jobid_from_segment_name_fn_t)(orte_jobid_t *jobid, char *name);
/*
* Base structure for the convenience functions
*/
typedef struct {
orte_schema_get_proc_tokens_fn_t get_proc_tokens;
orte_schema_get_node_tokens_fn_t get_node_tokens;
orte_schema_get_cell_tokens_fn_t get_cell_tokens;
orte_schema_get_job_segment_name_fn_t get_job_segment_name;
orte_schema_extract_jobid_from_segment_name_fn_t extract_jobid_from_segment_name;
} orte_schema_t;
OMPI_DECLSPEC extern orte_schema_t orte_schema;
/*
* Open function to ensure orte_schema is loaded
*/
int orte_schema_open(void);
#endif

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

@ -37,7 +37,8 @@ int orte_soh_base_get_proc_soh(orte_proc_state_t *state,
{
orte_gpr_value_t **values;
orte_gpr_keyval_t **keyvals;
int rc, cnt, num_tokens, i, j;
int rc;
size_t cnt, num_tokens, i, j;
char *segment, **tokens, *keys[3];
orte_jobid_t jobid;

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

@ -39,7 +39,7 @@ int orte_soh_base_set_proc_soh(orte_process_name_t *proc,
int rc;
orte_jobid_t jobid;
orte_vpid_t vpid;
int i;
size_t i;
value = OBJ_NEW(orte_gpr_value_t);
if (NULL == value) {

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

@ -61,38 +61,4 @@ typedef int8_t orte_node_state_t;
orte_node_state_t) */
#define ORTE_NODE_STATE_REBOOT 0x03
/* composite (union) type used to reduce number of function calls to SOH routines */
/* only used on routines that do not store data in this format (coms) */
typedef enum {orte_soh_entity_type_not_set, orte_soh_entity_type_cellid, orte_soh_entity_type_jobid,
orte_soh_entity_type_proc, orte_soh_entity_type_node
} orte_soh_entity_type_t;
typedef union {
orte_cellid_t cellid;
orte_jobid_t jobid;
orte_process_name_t procname;
orte_process_name_t nodename;
} orte_soh_entity_value_t;
/* master SOH constants and types */
typedef int8_t orte_soh_master_update_policy_t;
/* these depend on soh master implementation so not all possible */
/* power2 so some can be combined */
/* update GPR on all changes */
#define ORTE_SOH_MASTER_UPDATE_IMMEDIATE 0x01
/* update GPR after time out (bundle/pack updates) */
#define ORTE_SOH_MASTER_UPDATE_PERIOD 0x02
/* update GPR on severity/level of change of status */
#define ORTE_SOH_MASTER_UPDATE_ON_LEVEL 0x04
/* update GPR on request/push only */
#define ORTE_SOH_MASTER_UPDATE_ON_REQUEST 0x08
/* key used by soh slaves to find master soh services in GPR */
#define ORTE_SOH_MASTER_LOC "orte-soh-master-location"
#endif

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

@ -296,7 +296,6 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
}
/* Let system know we are at STG1 Barrier */
if (ORTE_SUCCESS != (ret = orte_soh.set_proc_soh(orte_process_info.my_name,
ORTE_PROC_STATE_AT_STG1, 0))) {
ORTE_ERROR_LOG(ret);

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

@ -24,6 +24,7 @@
#include "mca/pml/pml.h"
#include "runtime/ompi_progress.h"
#include "include/constants.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/ns.h"
#include "mca/gpr/gpr.h"
#include "include/orte_schema.h"
@ -61,24 +62,25 @@ static int32_t event_num_mpi_users = 0;
static void
node_schedule_callback(orte_gpr_notify_data_t *notify_data, void *user_tag)
{
uint32_t proc_slots = 0;
uint32_t used_proc_slots = 0;
int param, i;
size_t proc_slots = 0;
size_t used_proc_slots = 0;
int param;
size_t i;
/* parse the response */
for(i = 0 ; i < notify_data->cnt ; i++) {
orte_gpr_value_t* value = notify_data->values[i];
int k;
size_t k;
for(k = 0 ; k < value->cnt ; k++) {
orte_gpr_keyval_t* keyval = value->keyvals[k];
if(strcmp(keyval->key, ORTE_NODE_SLOTS_KEY) == 0) {
proc_slots = keyval->value.ui32;
proc_slots = keyval->value.size;
continue;
}
if(strncmp(keyval->key, ORTE_NODE_SLOTS_ALLOC_KEY,
strlen(ORTE_NODE_SLOTS_ALLOC_KEY)) == 0) {
used_proc_slots += keyval->value.ui32;
used_proc_slots += keyval->value.size;
continue;
}
}
@ -98,22 +100,37 @@ register_node_schedule_callback(void)
orte_jobid_t jobid = orte_process_info.my_name->jobid;
int rc;
char **tokens;
int32_t num_tokens;
size_t num_tokens;
char *my_name_string;
orte_cellid_t cellid;
/* query our node... */
rc = orte_ns.get_proc_name_string(&my_name_string,
orte_process_info.my_name);
if (ORTE_SUCCESS != rc) return rc;
if (ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_ns.get_cellid(&cellid, orte_process_info.my_name);
if (ORTE_SUCCESS != rc) return rc;
if (ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_ns.get_jobid(&jobid, orte_process_info.my_name);
if (ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_schema.get_node_tokens(&tokens, &num_tokens,
cellid,
my_name_string);
if (ORTE_SUCCESS != rc) return rc;
if (ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* setup the subscription definition */
OBJ_CONSTRUCT(&sub, orte_gpr_subscription_t);
@ -173,12 +190,12 @@ register_node_schedule_callback(void)
subs = &sub;
trigs = &trig;
rc = orte_gpr.subscribe(
ORTE_GPR_NOTIFY_ADD_ENTRY | ORTE_GPR_NOTIFY_VALUE_CHG |
ORTE_GPR_TRIG_CMP_LEVELS | ORTE_GPR_TRIG_ONE_SHOT,
ORTE_GPR_TRIG_ALL_CMP,
1, &subs,
1, &trigs,
&rctag);
1, &trigs,
&rctag);
if(ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
OBJ_DESTRUCT(&sub);
OBJ_DESTRUCT(&trig);
return OMPI_ERROR;
@ -221,7 +238,10 @@ ompi_progress_mpi_init(void)
/* no default given. Register a callback so that we have a
value when we get to mpi_enable() */
rc = register_node_schedule_callback();
if (OMPI_SUCCESS != rc) return rc;
if (OMPI_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
event_num_mpi_users = 0;

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

@ -55,7 +55,7 @@ int orte_init(void)
* include/orte_names.h. For example, you can call it as:
* ompi_output(0, "data type: %s", ORTE_DATA_NAME(keyval.type));
*
* THE CORRESPONDING MACRO IS DEFINED IN include/orte_names.h
* THE CORRESPONDING MACRO IS DEFINED IN include/orte_schema.h
* AS IS THE EXTERN STATEMENT FOR ACCESSING THIS ARRAY
*/
@ -65,6 +65,7 @@ char *orte_data_strings[] = {
"ORTE_BOOL",
"ORTE_STRING",
"ORTE_SIZE",
"ORTE_PID",
/* all the integer flavors */
"ORTE_INT",
"ORTE_INT8",
@ -115,7 +116,7 @@ char *orte_data_strings[] = {
* expecting users to look them up in the "big book" to find out what they represent.
* This array allows the user to output an actual string representation of the error.
*
* THE CORRESPONDING MACRO IS DEFINED IN include/orte_names.h
* THE CORRESPONDING MACRO IS DEFINED IN include/orte_schema.h
* AS IS THE EXTERN STATEMENT FOR ACCESSING THIS ARRAY
*/
@ -165,6 +166,7 @@ char *orte_error_strings[] = {
"ORTE_UNPACK_READ_PAST_END_OF_BUFFER",
"ORTE_ERR_NOT_AVAILABLE",
"ORTE_ERR_GPR_DATA_CORRUPT",
"ORTE_ERR_PERM"
"ORTE_ERR_PERM",
"ORTE_ERR_TYPE_MISMATCH"
};

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

@ -34,9 +34,9 @@
#include "include/orte_schema.h"
int orte_schema_get_proc_tokens(char ***tokens, int32_t* num_tokens, orte_process_name_t *proc);
int orte_schema_get_node_tokens(char ***tokens, int32_t* num_tokens, orte_cellid_t cellid, char *nodename);
int orte_schema_get_cell_tokens(char ***tokens, int32_t* num_tokens, orte_cellid_t cellid);
int orte_schema_get_proc_tokens(char ***tokens, size_t* num_tokens, orte_process_name_t *proc);
int orte_schema_get_node_tokens(char ***tokens, size_t* num_tokens, orte_cellid_t cellid, char *nodename);
int orte_schema_get_cell_tokens(char ***tokens, size_t* num_tokens, orte_cellid_t cellid);
int orte_schema_get_job_segment_name(char **name, orte_jobid_t jobid);
int orte_schema_extract_jobid_from_segment_name(orte_jobid_t *jobid, char *name);
@ -57,7 +57,7 @@ int orte_schema_open(void)
return ORTE_SUCCESS;
}
int orte_schema_get_proc_tokens(char ***proc_tokens, int32_t* num_tokens, orte_process_name_t *proc)
int orte_schema_get_proc_tokens(char ***proc_tokens, size_t* num_tokens, orte_process_name_t *proc)
{
int rc;
char** tokens;
@ -96,7 +96,7 @@ CLEANUP:
return rc;
}
int orte_schema_get_node_tokens(char ***node_tokens, int32_t* num_tokens, orte_cellid_t cellid, char *nodename)
int orte_schema_get_node_tokens(char ***node_tokens, size_t* num_tokens, orte_cellid_t cellid, char *nodename)
{
int rc;
char** tokens;
@ -131,7 +131,7 @@ CLEANUP:
return rc;
}
int orte_schema_get_cell_tokens(char ***tokens, int32_t* num_tokens, orte_cellid_t cellid)
int orte_schema_get_cell_tokens(char ***tokens, size_t* num_tokens, orte_cellid_t cellid)
{
return ORTE_ERR_NOT_IMPLEMENTED;
}

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

@ -317,7 +317,7 @@ static void dump_aborted_procs(orte_jobid_t jobid)
{
char *segment;
orte_gpr_value_t** values = NULL;
int i, k, num_values = 0;
size_t i, k, num_values = 0;
int rc;
int32_t exit_status = 0;
bool exit_status_set;
@ -353,8 +353,9 @@ static void dump_aborted_procs(orte_jobid_t jobid)
for (i = 0; i < num_values; i++) {
orte_gpr_value_t* value = values[i];
orte_process_name_t name;
uint32_t pid = 0;
uint32_t rank = -1;
size_t pid = 0;
size_t rank = 0;
bool rank_found=false;
char* node_name = NULL;
exit_status = 0;
@ -366,11 +367,12 @@ static void dump_aborted_procs(orte_jobid_t jobid)
continue;
}
if(strcmp(keyval->key, ORTE_PROC_PID_KEY) == 0) {
pid = keyval->value.ui32;
pid = keyval->value.size;
continue;
}
if(strcmp(keyval->key, ORTE_PROC_RANK_KEY) == 0) {
rank = keyval->value.ui32;
rank_found = true;
rank = keyval->value.size;
continue;
}
if(strcmp(keyval->key, ORTE_PROC_EXIT_CODE_KEY) == 0) {
@ -383,11 +385,11 @@ static void dump_aborted_procs(orte_jobid_t jobid)
continue;
}
}
if (rank >= 0 && exit_status_set) {
if (rank_found && exit_status_set) {
proc_infos[rank].exit_status = exit_status;
}
if (WIFSIGNALED(exit_status) && rank >= 0 &&
if (WIFSIGNALED(exit_status) && rank_found &&
!proc_infos[rank].reported) {
proc_infos[rank].reported = true;
@ -785,7 +787,7 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
app->num_env = 0;
for (i = 0; NULL != environ[i]; ++i) {
if (0 == strncmp("OMPI_", environ[i], 5)) {
ompi_argv_append(&app->num_env, &app->env, environ[i]);
ompi_argv_append_nosize(&app->env, environ[i]);
}
}
@ -797,15 +799,15 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
param = ompi_cmd_line_get_param(&cmd_line, "x", i, 0);
if (NULL != strchr(param, '=')) {
ompi_argv_append(&app->num_env, &app->env, param);
ompi_argv_append_nosize(&app->env, param);
} else {
value = getenv(param);
if (NULL != value) {
if (NULL != strchr(value, '=')) {
ompi_argv_append(&app->num_env, &app->env, value);
ompi_argv_append_nosize(&app->env, value);
} else {
asprintf(&value2, "%s=%s", param, value);
ompi_argv_append(&app->num_env, &app->env, value2);
ompi_argv_append_nosize(&app->env, value2);
}
} else {
ompi_output(0, "Warning: could not find environment variable \"%s\"\n", param);
@ -819,7 +821,7 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
if (NULL != orterun_globals.path) {
asprintf(&value, "PATH=%s", orterun_globals.path);
ompi_argv_append(&app->num_env, &app->env, value);
ompi_argv_append_nosize(&app->env, value);
free(value);
}

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

@ -30,39 +30,56 @@
*/
int ompi_argv_append(int *argc, char ***argv, const char *arg)
{
int rc;
/* add the new element */
if (OMPI_SUCCESS != (rc = ompi_argv_append_nosize(argv, arg))) {
return rc;
}
*argc = ompi_argv_count(*argv);
return OMPI_SUCCESS;
}
int ompi_argv_append_nosize(char ***argv, const char *arg)
{
int argc;
/* Create new argv. */
if (NULL == *argv) {
*argv = (char**) malloc(2 * sizeof(char *));
*argv = (char**) malloc(2 * sizeof(char *));
if (NULL == *argv)
return OMPI_ERROR;
*argc = 0;
return OMPI_ERROR;
argc = 0;
(*argv)[0] = NULL;
(*argv)[1] = NULL;
}
/* Extend existing argv. */
else {
*argv = (char**) realloc(*argv, (*argc + 2) * sizeof(char *));
if (NULL == *argv)
return OMPI_ERROR;
}
/* count how many entries currently exist */
argc = ompi_argv_count(*argv);
*argv = (char**) realloc(*argv, (argc + 2) * sizeof(char *));
if (NULL == *argv)
return OMPI_ERROR;
}
/* Set the newest element to point to a copy of the arg string */
/* Set the newest element to point to a copy of the arg string */
(*argv)[*argc] = (char*) malloc(strlen(arg) + 1);
if (NULL == (*argv)[*argc])
return OMPI_ERROR;
(*argv)[argc] = (char*) malloc(strlen(arg) + 1);
if (NULL == (*argv)[argc])
return OMPI_ERROR;
strcpy((*argv)[*argc], arg);
*argc = *argc + 1;
(*argv)[*argc] = NULL;
strcpy((*argv)[argc], arg);
argc = argc + 1;
(*argv)[argc] = NULL;
return OMPI_SUCCESS;
return OMPI_SUCCESS;
}
/*
* Free a NULL-terminated argv array.
*/

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

@ -59,6 +59,7 @@ extern "C" {
* string (i.e., the arg parameter) after invoking this function.
*/
OMPI_DECLSPEC int ompi_argv_append(int *argc, char ***argv, const char *arg);
OMPI_DECLSPEC int ompi_argv_append_nosize(char ***argv, const char *arg);
/**
* Free a NULL-terminated argv array.

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

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

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

@ -62,8 +62,9 @@ static void find(const char *name, test_component_handle_t *handle,
int main(int argc, char **argv)
{
int rc, num_names, num_found;
int32_t i;
int rc;
size_t num_names, num_found;
size_t i;
char *tmp=NULL, *tmp2=NULL, *names[15], *keys[5];
orte_gpr_replica_segment_t *seg=NULL;
orte_gpr_replica_itag_t itag[10], itag2, *itaglist;
@ -208,6 +209,8 @@ int main(int argc, char **argv)
fprintf(test_out, "gpr_test: find_seg passed\n");
}
gpr_module->dump_all(0);
fprintf(stderr, "creating tags\n");
for (i=0; i<10; i++) {
asprintf(&tmp, "test-tag-%d", i);
@ -307,6 +310,8 @@ int main(int argc, char **argv)
} else {
fprintf(test_out, "gpr_test: create_container passed\n");
}
gpr_module->dump_all(0);
fprintf(test_out, "itags for container\n");
for (i=0; i < cptr->num_itags; i++) {

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

@ -582,7 +582,7 @@ int test2(void)
trig.keyvals = (orte_gpr_keyval_t**)malloc(sizeof(orte_gpr_keyval_t*));
trig.keyvals[0] = OBJ_NEW(orte_gpr_keyval_t);
trig.keyvals[0]->key = strdup("level-counter");
trig.keyvals[0]->type = ORTE_INT32;
trig.keyvals[0]->type = ORTE_UINT32;
trig.keyvals[0]->value.i32 = 2;
fprintf(test_out, "setting level trigger\n");