1
1

Merge pull request #1948 from rhc54/topic/pmixtool

Update to include extended tool support, new datatypes
Этот коммит содержится в:
rhc54 2016-08-09 16:17:28 -07:00 коммит произвёл GitHub
родитель 19be439998 527b5c692a
Коммит 60f789dca1
62 изменённых файлов: 5417 добавлений и 3337 удалений

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

@ -769,6 +769,10 @@ int opal_dss_pack_value(opal_buffer_t *buffer, const void *src,
}
break;
case OPAL_UINT8:
case OPAL_PERSIST:
case OPAL_SCOPE:
case OPAL_DATA_RANGE:
case OPAL_PROC_STATE:
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.uint8, 1, OPAL_UINT8))) {
return ret;
}
@ -779,6 +783,7 @@ int opal_dss_pack_value(opal_buffer_t *buffer, const void *src,
}
break;
case OPAL_UINT32:
case OPAL_INFO_DIRECTIVES:
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.uint32, 1, OPAL_UINT32))) {
return ret;
}
@ -823,291 +828,8 @@ int opal_dss_pack_value(opal_buffer_t *buffer, const void *src,
return ret;
}
break;
case OPAL_FLOAT_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.fval_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.fval_array.data,
ptr[i]->data.fval_array.size,
OPAL_FLOAT))) {
return ret;
}
break;
case OPAL_DOUBLE_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.dval_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.dval_array.data,
ptr[i]->data.dval_array.size,
OPAL_DOUBLE))) {
return ret;
}
break;
case OPAL_STRING_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.string_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.string_array.data,
ptr[i]->data.string_array.size,
OPAL_STRING))) {
return ret;
}
break;
case OPAL_BOOL_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.flag_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.flag_array.data,
ptr[i]->data.flag_array.size,
OPAL_BOOL))) {
return ret;
}
break;
case OPAL_SIZE_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.size_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.size_array.data,
ptr[i]->data.size_array.size,
OPAL_SIZE))) {
return ret;
}
break;
case OPAL_BYTE_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.byte_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.byte_array.data,
ptr[i]->data.byte_array.size,
OPAL_BYTE))) {
return ret;
}
break;
case OPAL_INT_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.integer_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.integer_array.data,
ptr[i]->data.integer_array.size,
OPAL_INT))) {
return ret;
}
break;
case OPAL_INT8_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.int8_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.int8_array.data,
ptr[i]->data.int8_array.size,
OPAL_INT8))) {
return ret;
}
break;
case OPAL_INT16_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.int16_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.int16_array.data,
ptr[i]->data.int16_array.size,
OPAL_INT16))) {
return ret;
}
break;
case OPAL_INT32_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.int32_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.int32_array.data,
ptr[i]->data.int32_array.size,
OPAL_INT32))) {
return ret;
}
break;
case OPAL_INT64_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.int64_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.int64_array.data,
ptr[i]->data.int64_array.size,
OPAL_INT64))) {
return ret;
}
break;
case OPAL_UINT_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.uint_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.uint_array.data,
ptr[i]->data.uint_array.size,
OPAL_UINT))) {
return ret;
}
break;
case OPAL_UINT8_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.uint8_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.uint8_array.data,
ptr[i]->data.uint8_array.size,
OPAL_UINT8))) {
return ret;
}
break;
case OPAL_UINT16_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.uint16_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.uint16_array.data,
ptr[i]->data.uint16_array.size,
OPAL_UINT16))) {
return ret;
}
break;
case OPAL_UINT32_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.uint32_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.uint32_array.data,
ptr[i]->data.uint32_array.size,
OPAL_UINT32))) {
return ret;
}
break;
case OPAL_UINT64_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.uint64_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.uint64_array.data,
ptr[i]->data.uint64_array.size,
OPAL_UINT64))) {
return ret;
}
break;
case OPAL_PID_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.pid_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.pid_array.data,
ptr[i]->data.pid_array.size,
OPAL_PID))) {
return ret;
}
break;
case OPAL_TIMEVAL_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
&ptr[i]->data.tv_array.size,
1,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_pack_buffer(buffer,
ptr[i]->data.tv_array.data,
ptr[i]->data.tv_array.size,
OPAL_TIMEVAL))) {
case OPAL_STATUS:
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.status, 1, OPAL_INT))) {
return ret;
}
break;

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

@ -703,8 +703,7 @@ int opal_dss_print_node_stat(char **output, char *prefix, opal_node_stats_t *src
*/
int opal_dss_print_value(char **output, char *prefix, opal_value_t *src, opal_data_type_t type)
{
char *prefx, *t2;
int i;
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
@ -796,184 +795,13 @@ int opal_dss_print_value(char **output, char *prefix, opal_value_t *src, opal_da
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIMEVAL\tKey: %s\tValue: %ld.%06ld", prefx,
src->key, (long)src->data.tv.tv_sec, (long)src->data.tv.tv_usec);
break;
case OPAL_TIME:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIME\tKey: %s\tValue: %s", prefx,
src->key, ctime(&src->data.time));
break;
case OPAL_PTR:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PTR\tKey: %s", prefx, src->key);
break;
case OPAL_FLOAT_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_FLOAT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.fval_array.size);
for (i = 0; i < src->data.fval_array.size; i++) {
asprintf(&t2, "%s\n%s\t%f", *output, prefx, src->data.fval_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_DOUBLE_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_DOUBLE_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.dval_array.size);
for (i = 0; i < src->data.dval_array.size; i++) {
asprintf(&t2, "%s\n%s\t%f", *output, prefx, src->data.dval_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_STRING_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_STRING_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.string_array.size);
for (i = 0; i < src->data.string_array.size; i++) {
asprintf(&t2, "%s\n%s\t%s", *output, prefx, src->data.string_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_BOOL_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BOOL_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.flag_array.size);
for (i = 0; i < src->data.flag_array.size; i++) {
asprintf(&t2, "%s\n%s\t%s", *output, prefx, src->data.flag_array.data[i] ? "true" : "false");
free(*output);
*output = t2;
}
break;
case OPAL_SIZE_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_SIZE_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.size_array.size);
for (i = 0; i < src->data.size_array.size; i++) {
asprintf(&t2, "%s\n%s\t%lu", *output, prefx, (unsigned long)src->data.size_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_BYTE_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.byte_array.size);
for (i = 0; i < src->data.byte_array.size; i++) {
asprintf(&t2, "%s\n%s\t%x", *output, prefx, (uint8_t)src->data.byte_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_INT_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.integer_array.size);
for (i = 0; i < src->data.integer_array.size; i++) {
asprintf(&t2, "%s\n%s\t%d", *output, prefx, src->data.integer_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_INT8_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT8_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.int8_array.size);
for (i = 0; i < src->data.int8_array.size; i++) {
asprintf(&t2, "%s\n%s\t%d", *output, prefx, (int)src->data.int8_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_INT16_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT16_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.int16_array.size);
for (i = 0; i < src->data.int16_array.size; i++) {
asprintf(&t2, "%s\n%s\t%d", *output, prefx, (int)src->data.int16_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_INT32_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT32_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.int32_array.size);
for (i = 0; i < src->data.int32_array.size; i++) {
asprintf(&t2, "%s\n%s\t%d", *output, prefx, src->data.int32_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_INT64_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT64_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.int64_array.size);
for (i = 0; i < src->data.int64_array.size; i++) {
asprintf(&t2, "%s\n%s\t%ld", *output, prefx, (long)src->data.int64_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_UINT_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.uint_array.size);
for (i = 0; i < src->data.uint_array.size; i++) {
asprintf(&t2, "%s\n%s\t%u", *output, prefx, src->data.uint_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_UINT8_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT8_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.uint8_array.size);
for (i = 0; i < src->data.uint8_array.size; i++) {
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.uint8_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_UINT16_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT16_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.uint16_array.size);
for (i = 0; i < src->data.uint16_array.size; i++) {
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.uint16_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_UINT32_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT32_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.uint32_array.size);
for (i = 0; i < src->data.uint32_array.size; i++) {
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.uint32_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_UINT64_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT64_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.uint64_array.size);
for (i = 0; i < src->data.uint64_array.size; i++) {
asprintf(&t2, "%s\n%s\t%lu", *output, prefx, (unsigned long)src->data.uint64_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_BYTE_OBJECT_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE_OBJECT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.bo_array.size);
for (i = 0; i < src->data.bo_array.size; i++) {
asprintf(&t2, "%s\n%s\tData: %s\tSize: %lu ", *output, prefx,
(NULL == src->data.bo_array.data[i].bytes) ? "NULL" : "NON-NULL",
(unsigned long)src->data.bo_array.data[i].size);
free(*output);
*output = t2;
}
break;
case OPAL_PID_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PID_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.pid_array.size);
for (i = 0; i < src->data.pid_array.size; i++) {
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.pid_array.data[i]);
free(*output);
*output = t2;
}
break;
case OPAL_TIMEVAL_ARRAY:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIMEVAL_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
prefx, src->key, src->data.tv_array.size);
for (i = 0; i < src->data.tv_array.size; i++) {
asprintf(&t2, "%s\n%s\t%ld.%06ld", *output, prefx,
(long)src->data.tv_array.data[i].tv_sec,
(long)src->data.tv_array.data[i].tv_usec);
free(*output);
*output = t2;
}
break;
default:
asprintf(output, "%sOPAL_VALUE: Data type: UNKNOWN\tKey: %s\tValue: UNPRINTABLE",
prefx, src->key);

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

@ -97,30 +97,16 @@ typedef struct {
#define OPAL_VALUE (opal_data_type_t) 26 /**< opal value structure */
#define OPAL_BUFFER (opal_data_type_t) 27 /**< pack the remaining contents of a buffer as an object */
#define OPAL_PTR (opal_data_type_t) 28 /**< pointer to void* */
/* OPAL Array types */
#define OPAL_FLOAT_ARRAY (opal_data_type_t) 31
#define OPAL_DOUBLE_ARRAY (opal_data_type_t) 32
#define OPAL_STRING_ARRAY (opal_data_type_t) 33
#define OPAL_BOOL_ARRAY (opal_data_type_t) 34
#define OPAL_SIZE_ARRAY (opal_data_type_t) 35
#define OPAL_BYTE_ARRAY (opal_data_type_t) 36
#define OPAL_INT_ARRAY (opal_data_type_t) 37
#define OPAL_INT8_ARRAY (opal_data_type_t) 38
#define OPAL_INT16_ARRAY (opal_data_type_t) 39
#define OPAL_INT32_ARRAY (opal_data_type_t) 40
#define OPAL_INT64_ARRAY (opal_data_type_t) 41
#define OPAL_UINT_ARRAY (opal_data_type_t) 42
#define OPAL_UINT8_ARRAY (opal_data_type_t) 43
#define OPAL_UINT16_ARRAY (opal_data_type_t) 44
#define OPAL_UINT32_ARRAY (opal_data_type_t) 45
#define OPAL_UINT64_ARRAY (opal_data_type_t) 46
#define OPAL_BYTE_OBJECT_ARRAY (opal_data_type_t) 47
#define OPAL_PID_ARRAY (opal_data_type_t) 48
#define OPAL_TIMEVAL_ARRAY (opal_data_type_t) 49
#define OPAL_NAME (opal_data_type_t) 50
#define OPAL_JOBID (opal_data_type_t) 51
#define OPAL_VPID (opal_data_type_t) 52
#define OPAL_STATUS (opal_data_type_t) 53
#define OPAL_NAME (opal_data_type_t) 29
#define OPAL_JOBID (opal_data_type_t) 30
#define OPAL_VPID (opal_data_type_t) 31
#define OPAL_STATUS (opal_data_type_t) 32
#define OPAL_PERSIST (opal_data_type_t) 33 /**< corresponds to PMIx persistence type (uint8_t) */
#define OPAL_SCOPE (opal_data_type_t) 34 /**< corresponds to PMIx scope type (uint8_t) */
#define OPAL_DATA_RANGE (opal_data_type_t) 35 /**< corresponds to PMIx data range type (uint8_t) */
#define OPAL_INFO_DIRECTIVES (opal_data_type_t) 36 /**< corresponds to PMIx info directives type (uint32_t) */
#define OPAL_PROC_STATE (opal_data_type_t) 37 /**< corresponds to PMIx proc state type (uint8_t) */
#define OPAL_PROC_INFO (opal_data_type_t) 38 /**< corresponds to PMIx proc_info type */
/* OPAL Dynamic */
#define OPAL_DSS_ID_DYNAMIC (opal_data_type_t) 100
@ -130,97 +116,22 @@ typedef struct {
#define OPAL_VALUE2_GREATER -1
#define OPAL_EQUAL 0
/* List types for opal_value_t, needs number of elements and a pointer */
/* float array object */
/* define some types so we can store the generic
* values and still *know* how to convert it for PMIx */
typedef int opal_status_t;
typedef uint32_t opal_proc_state_t;
/* define an opal_proc_info_t for transferring info to/from PMIx */
typedef struct {
int32_t size;
float *data;
} opal_float_array_t;
/* double array object */
typedef struct {
int32_t size;
double *data;
} opal_double_array_t;
/* string array object */
typedef struct {
int32_t size;
char **data;
} opal_string_array_t;
/* bool array object */
typedef struct {
int32_t size;
bool *data;
} opal_bool_array_t;
/* size array object */
typedef struct {
int32_t size;
size_t *data;
} opal_size_array_t;
/* opal byte object array object */
typedef struct {
int32_t size;
opal_byte_object_t *data;
} opal_byte_object_array_t;
/* int array object */
typedef struct {
int32_t size;
int *data;
} opal_int_array_t;
/* int8 array object */
typedef struct {
int32_t size;
int8_t *data;
} opal_int8_array_t;
/* int16 array object */
typedef struct {
int32_t size;
int16_t *data;
} opal_int16_array_t;
/* int32 array object */
typedef struct {
int32_t size;
int32_t *data;
} opal_int32_array_t;
/* int64 array object */
typedef struct {
int32_t size;
int64_t *data;
} opal_int64_array_t;
/* uint array object */
typedef struct {
int32_t size;
unsigned int *data;
} opal_uint_array_t;
/* uint8 array object */
typedef struct {
int32_t size;
uint8_t *data;
} opal_uint8_array_t;
/* uint16 array object */
typedef struct {
int32_t size;
uint16_t *data;
} opal_uint16_array_t;
/* uint32 array object */
typedef struct {
int32_t size;
uint32_t *data;
} opal_uint32_array_t;
/* uint64 array object */
typedef struct {
int32_t size;
uint64_t *data;
} opal_uint64_array_t;
/* pid array object */
typedef struct {
int32_t size;
pid_t *data;
} opal_pid_array_t;
/* timeval array object */
typedef struct {
int32_t size;
struct timeval *data;
} opal_timeval_array_t;
opal_list_item_t super;
opal_process_name_t name;
char *hostname;
char *executable_name;
pid_t pid;
opal_status_t exit_code;
opal_proc_state_t state;
} opal_proc_info_t;
OBJ_CLASS_DECLARATION(opal_proc_info_t);
/* Data value object */
typedef struct {
@ -247,27 +158,10 @@ typedef struct {
float fval;
double dval;
struct timeval tv;
int status;
time_t time;
opal_status_t status;
opal_process_name_t name;
opal_bool_array_t flag_array;
opal_uint8_array_t byte_array;
opal_string_array_t string_array;
opal_size_array_t size_array;
opal_int_array_t integer_array;
opal_int8_array_t int8_array;
opal_int16_array_t int16_array;
opal_int32_array_t int32_array;
opal_int64_array_t int64_array;
opal_uint_array_t uint_array;
opal_uint8_array_t uint8_array;
opal_uint16_array_t uint16_array;
opal_uint32_array_t uint32_array;
opal_uint64_array_t uint64_array;
opal_byte_object_array_t bo_array;
opal_float_array_t fval_array;
opal_double_array_t dval_array;
opal_pid_array_t pid_array;
opal_timeval_array_t tv_array;
opal_proc_info_t pinfo;
void *ptr; // never packed or passed anywhere
} data;
} opal_value_t;

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

@ -1086,294 +1086,6 @@ int opal_dss_unpack_value(opal_buffer_t *buffer, void *dest,
return ret;
}
break;
case OPAL_FLOAT_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.fval_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.fval_array.data,
&ptr[i]->data.fval_array.size,
OPAL_FLOAT))) {
return ret;
}
break;
case OPAL_DOUBLE_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.dval_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.dval_array.data,
&ptr[i]->data.dval_array.size,
OPAL_DOUBLE))) {
return ret;
}
break;
case OPAL_STRING_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.string_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.string_array.data,
&ptr[i]->data.string_array.size,
OPAL_STRING))) {
return ret;
}
break;
case OPAL_BOOL_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.flag_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.flag_array.data,
&ptr[i]->data.flag_array.size,
OPAL_BOOL))) {
return ret;
}
break;
case OPAL_SIZE_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.size_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.size_array.data,
&ptr[i]->data.size_array.size,
OPAL_SIZE))) {
return ret;
}
break;
case OPAL_BYTE_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.byte_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.byte_array.data,
&ptr[i]->data.byte_array.size,
OPAL_BYTE))) {
return ret;
}
break;
case OPAL_INT_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.integer_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.integer_array.data,
&ptr[i]->data.integer_array.size,
OPAL_INT))) {
return ret;
}
break;
case OPAL_INT8_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.int8_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.int8_array.data,
&ptr[i]->data.int8_array.size,
OPAL_INT8))) {
return ret;
}
break;
case OPAL_INT16_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.int16_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.int16_array.data,
&ptr[i]->data.int16_array.size,
OPAL_INT16))) {
return ret;
}
break;
case OPAL_INT32_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.int32_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.int32_array.data,
&ptr[i]->data.int32_array.size,
OPAL_INT32))) {
return ret;
}
break;
case OPAL_INT64_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.int64_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.int64_array.data,
&ptr[i]->data.int64_array.size,
OPAL_INT64))) {
return ret;
}
break;
case OPAL_UINT_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.uint_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.uint_array.data,
&ptr[i]->data.uint_array.size,
OPAL_UINT))) {
return ret;
}
break;
case OPAL_UINT8_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.uint8_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.uint8_array.data,
&ptr[i]->data.uint8_array.size,
OPAL_UINT8))) {
return ret;
}
break;
case OPAL_UINT16_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.uint16_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.uint16_array.data,
&ptr[i]->data.uint16_array.size,
OPAL_UINT16))) {
return ret;
}
break;
case OPAL_UINT32_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.uint32_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.uint32_array.data,
&ptr[i]->data.uint32_array.size,
OPAL_UINT32))) {
return ret;
}
break;
case OPAL_UINT64_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.uint64_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.uint64_array.data,
&ptr[i]->data.uint64_array.size,
OPAL_UINT64))) {
return ret;
}
break;
case OPAL_PID_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.pid_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.pid_array.data,
&ptr[i]->data.pid_array.size,
OPAL_PID))) {
return ret;
}
break;
case OPAL_TIMEVAL_ARRAY:
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
&ptr[i]->data.tv_array.size,
&m,
OPAL_INT32))) {
return ret;
}
if (OPAL_SUCCESS !=
(ret = opal_dss_unpack_buffer(buffer,
ptr[i]->data.tv_array.data,
&ptr[i]->data.tv_array.size,
OPAL_TIMEVAL))) {
return ret;
}
break;
default:
opal_output(0, "PACK-OPAL-VALUE: UNSUPPORTED TYPE");
return OPAL_ERROR;

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

@ -136,3 +136,19 @@ static void apdes(opal_pmix_app_t *p)
OBJ_CLASS_INSTANCE(opal_pmix_app_t,
opal_list_item_t,
apcon, apdes);
static void qcon(opal_pmix_query_t *p)
{
p->keys = NULL;
OBJ_CONSTRUCT(&p->qualifiers, opal_list_t);
}
static void qdes(opal_pmix_query_t *p)
{
if (NULL != p->keys) {
opal_argv_free(p->keys);
}
OPAL_LIST_DESTRUCT(&p->qualifiers);
}
OBJ_CLASS_INSTANCE(opal_pmix_query_t,
opal_list_item_t,
qcon, qdes);

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

@ -31,11 +31,11 @@ EXTRA_DIST =
# Only install the valgrind suppressions file if we're building in
# standalone mode
dist_pmixdata_DATA =
man_MANS =
if ! PMIX_EMBEDDED_MODE
dist_pmixdata_DATA += contrib/pmix-valgrind.supp
endif
man_MANS = \
man_MANS += \
man/man3/pmix_init.3 \
man/man3/pmix_finalize.3 \
man/man3/pmix_initialized.3 \
@ -46,6 +46,7 @@ man_MANS = \
man/man3/pmix_get.3 \
man/man7/pmix.7 \
man/man7/pmix_constants.7
endif
include config/Makefile.am
include include/Makefile.am

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

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

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

@ -95,6 +95,9 @@ AC_DEFUN([PMIX_SETUP_CORE],[
AC_DEFINE_UNQUOTED([PMIX_MAJOR_VERSION], ["$PMIX_MAJOR_VERSION"],
[The library major version is always available, contrary to VERSION])
AC_DEFINE_UNQUOTED([PMIX_VERSION_MAJOR], [${PMIX_MAJOR_VERSION}L],
[The library major version as integer])
AC_MSG_CHECKING([for pmix minor version])
PMIX_MINOR_VERSION="`$PMIX_top_srcdir/config/pmix_get_version.sh $PMIX_top_srcdir/VERSION --minor`"
if test "$?" != "0"; then
@ -104,6 +107,9 @@ AC_DEFUN([PMIX_SETUP_CORE],[
AC_DEFINE_UNQUOTED([PMIX_MINOR_VERSION], ["$PMIX_MINOR_VERSION"],
[The library minor version is always available, contrary to VERSION])
AC_DEFINE_UNQUOTED([PMIX_VERSION_MINOR], [${PMIX_MINOR_VERSION}L],
[The library minor version as integer])
AC_MSG_CHECKING([for pmix release version])
PMIX_RELEASE_VERSION="`$PMIX_top_srcdir/config/pmix_get_version.sh $PMIX_top_srcdir/VERSION --release`"
if test "$?" != "0"; then

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

@ -30,63 +30,57 @@
#include <pmix_tool.h>
static void cbfunc(pmix_status_t status,
pmix_info_t *info, size_t ninfo,
void *cbdata,
pmix_release_cbfunc_t release_fn,
void *release_cbdata)
{
volatile bool *active = (volatile bool*)cbdata;
/* do something with the returned info - it will be
* released in the release_fn */
if (NULL != release_fn) {
release_fn(release_cbdata);
}
*active = false;
}
int main(int argc, char **argv)
{
pmix_status_t rc;
pmix_proc_t myproc;
pmix_info_t *info;
size_t ninfo;
pmix_query_t *query;
size_t nq;
volatile bool active;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_tool_init(&myproc, NULL, 0))) {
fprintf(stderr, "PMIx_tool_init failed: %d\n", rc);
exit(rc);
}
fprintf(stderr, "Tool ns %s rank %d: Running\n", myproc.nspace, myproc.rank);
/* query something */
ninfo = 2;
PMIX_INFO_CREATE(info, ninfo);
(void)strncpy(info[0].key, "foobar", PMIX_MAX_KEYLEN);
(void)strncpy(info[1].key, "spastic", PMIX_MAX_KEYLEN);
if (PMIX_SUCCESS != (rc = PMIx_Query_info(info, ninfo))) {
nq = 2;
PMIX_QUERY_CREATE(query, nq);
query[0].keys = (char**)malloc(2 * sizeof(char*));
query[0].keys[0] = strdup("foobar");
query[0].keys[1] = NULL;
query[1].keys = (char**)malloc(2 * sizeof(char*));
query[1].keys[0] = strdup("spastic");
query[1].keys[1] = NULL;
active = true;
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&active))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
if (0 != strncmp(info[0].key, "foobar", PMIX_MAX_KEYLEN)) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info key[0] wrong: %s vs foobar\n",
myproc.nspace, myproc.rank, info[0].key);
while(active) {
usleep(10);
}
if (0 != strncmp(info[1].key, "spastic", PMIX_MAX_KEYLEN)) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info key[0] wrong: %s vs spastic\n",
myproc.nspace, myproc.rank, info[1].key);
}
if (PMIX_STRING != info[0].value.type) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info key[0] wrong type: %d vs %d\n",
myproc.nspace, myproc.rank, info[0].value.type, PMIX_STRING);
}
if (PMIX_STRING != info[1].value.type) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info key[1] wrong type: %d vs %d\n",
myproc.nspace, myproc.rank, info[1].value.type, PMIX_STRING);
}
if (0 != strcmp(info[0].value.data.string, "0")) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info key[0] wrong value: %s vs 0\n",
myproc.nspace, myproc.rank, info[1].value.data.string);
}
if (0 != strcmp(info[1].value.data.string, "1")) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info key[1] wrong value: %s vs 1\n",
myproc.nspace, myproc.rank, info[1].value.data.string);
}
PMIX_INFO_FREE(info, ninfo);
done:
/* finalize us */
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
} else {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);
}
fflush(stderr);
PMIx_Finalize(NULL, 0);
return(rc);
}

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

@ -407,22 +407,36 @@ BEGIN_C_DECLS
pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist);
/* Query information about the system in general - can include
* a list of active nspaces, network topology, etc. We assume that
* the host RM will exercise appropriate access control to the
* information. The blocking form of the call will fill the
* returned values into the info array structs. The following
* return status codes are provided:
* a list of active nspaces, network topology, etc. Also can be
* used to query node-specific info such as the list of peers
* executing on a given node. We assume that the host RM will
* exercise appropriate access control on the information.
*
* NOTE: there is no blocking form of this API as the structures
* passed to query info differ from those for receiving the results
*
* The following return status codes are provided in the callback:
*
* PMIX_SUCCESS - all data has been returned
* PMIX_ERR_NOT_FOUND - none of the requested data was available
* PMIX_ERR_PARTIAL_SUCCESS - some of the data has been returned
* PMIX_ERR_NOT_SUPPORTED - the host RM does not support this function
*/
pmix_status_t PMIx_Query_info(pmix_info_t info[], size_t ninfo);
pmix_status_t PMIx_Query_info_nb(pmix_info_t info[], size_t ninfo,
pmix_info_t *directives, size_t ndirectives,
pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nqueries,
pmix_info_cbfunc_t cbfunc, void *cbdata);
/* Log data to a central data service/store, subject to the
* services offered by the host resource manager. The data to
* be logged is provided in the data array. The (optional) directives
* can be used to request specific storage options and direct
* the choice of storage option.
*
* The callback function will be executed when the log operation
* has been completed. The data array must be maintained until
* the callback is provided
*/
pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata,
const pmix_info_t directives[], size_t ndirs,
pmix_op_cbfunc_t cbfunc, void *cbdata);
END_C_DECLS
#endif

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

@ -76,6 +76,9 @@ BEGIN_C_DECLS
#define PMIX_MAX_NSLEN 255
#define PMIX_MAX_KEYLEN 511
/* define a type for rank values */
typedef uint32_t pmix_rank_t;
/* define a value for requests for job-level data
* where the info itself isn't associated with any
* specific rank, or when a request involves
@ -83,11 +86,16 @@ BEGIN_C_DECLS
* info thru one of the legacy interfaces where the rank
* is typically encoded into the key itself since there is
* no rank parameter in the API itself */
#define PMIX_RANK_UNDEF INT32_MAX
#define PMIX_RANK_UNDEF UINT32_MAX
/* define a value to indicate that the user wants the
* data for the given key from every rank that posted
* that key */
#define PMIX_RANK_WILDCARD INT32_MAX-1
#define PMIX_RANK_WILDCARD UINT32_MAX-1
/* other special rank values will be used to define
* groups of ranks for use in collectives */
#define PMIX_RANK_LOCAL_NODE UINT32_MAX-2 // all ranks on local node
/* define a set of "standard" PMIx attributes that can
* be queried. Implementations (and users) are free to extend as
@ -105,11 +113,16 @@ BEGIN_C_DECLS
// of the internal progress thread
#define PMIX_SERVER_TOOL_SUPPORT "pmix.srvr.tool" // (bool) The host RM wants to declare itself as willing to
// accept tool connection requests
#define PMIX_SERVER_PIDINFO "pmix.srvr.pidinfo" // (uint32_t) pid of the target server
#define PMIX_SERVER_SYSTEM_SUPPORT "pmix.srvr.sys" // (bool) The host RM wants to declare itself as being the local
// system server for PMIx connection requests
#define PMIX_SERVER_PIDINFO "pmix.srvr.pidinfo" // (pid_t) pid of the target server
#define PMIX_SERVER_TMPDIR "pmix.srvr.tmpdir" // (char*) temp directory where PMIx server will place
// client rendezvous points
#define PMIX_SYSTEM_TMPDIR "pmix.sys.tmpdir" // (char*) temp directory for this system, where PMIx
// server will place tool rendezvous points
#define PMIX_CONNECT_TO_SYSTEM "pmix.cnct.sys" // (bool) The requestor requires that a connection be made only to
// a local system-level PMIx server
#define PMIX_CONNECT_SYSTEM_FIRST "pmix.cnct.sys.first" // (bool) Preferentially look for a system-level PMIx server first
/* identification attributes */
#define PMIX_USERID "pmix.euid" // (uint32_t) effective user id
@ -132,32 +145,23 @@ BEGIN_C_DECLS
/* information about relative ranks as assigned by the RM */
#define PMIX_JOBID "pmix.jobid" // (char*) jobid assigned by scheduler
#define PMIX_APPNUM "pmix.appnum" // (uint32_t) app number within the job
#define PMIX_RANK "pmix.rank" // (uint32_t) process rank within the job
#define PMIX_GLOBAL_RANK "pmix.grank" // (uint32_t) rank spanning across all jobs in this session
#define PMIX_APP_RANK "pmix.apprank" // (uint32_t) rank within this app
#define PMIX_NPROC_OFFSET "pmix.offset" // (uint32_t) starting global rank of this job
#define PMIX_RANK "pmix.rank" // (pmix_rank_t) process rank within the job
#define PMIX_GLOBAL_RANK "pmix.grank" // (pmix_rank_t) rank spanning across all jobs in this session
#define PMIX_APP_RANK "pmix.apprank" // (pmix_rank_t) rank within this app
#define PMIX_NPROC_OFFSET "pmix.offset" // (pmix_rank_t) starting global rank of this job
#define PMIX_LOCAL_RANK "pmix.lrank" // (uint16_t) rank on this node within this job
#define PMIX_NODE_RANK "pmix.nrank" // (uint16_t) rank on this node spanning all jobs
#define PMIX_LOCALLDR "pmix.lldr" // (uint64_t) opal_identifier of lowest rank on this node within this job
#define PMIX_APPLDR "pmix.aldr" // (uint32_t) lowest rank in this app within this job
#define PMIX_LOCALLDR "pmix.lldr" // (pmix_rank_t) lowest rank on this node within this job
#define PMIX_APPLDR "pmix.aldr" // (pmix_rank_t) lowest rank in this app within this job
#define PMIX_PROC_PID "pmix.ppid" // (pid_t) pid of specified proc
/* proc location-related info */
/* For PMIX_HOSTNAME, three use-cases exist for PMIx_Get:
*
* (a) Specifying a namespace with PMIX_RANK_WILDCARD will return
* a comma-delimited list of nodes that host procs in that namespace
*
* (b) Passing a NULL namespace will return a comma-delimited list of all
* nodes known to this session, regardless of whether or not they
* currently host procs. The rank argument in PMIx_Get is ignored
* for this use-case
*
* (c) Specifying a namespace and a rank will return the name of the
* host that proc is on
*/
#define PMIX_HOSTNAME "pmix.hname" // (char*) see above comment
#define PMIX_NODEID "pmix.nodeid" // (uint32_t) node identifier
#define PMIX_NODE_LIST "pmix.nlist" // (char*) comma-delimited list of nodes running procs for the specified nspace
#define PMIX_ALLOCATED_NODELIST "pmix.alist" // (char*) comma-delimited list of all nodes in this allocation regardless of
// whether or not they currently host procs.
#define PMIX_HOSTNAME "pmix.hname" // (char*) name of the host the specified proc is on
#define PMIX_NODEID "pmix.nodeid" // (uint32_t) node identifier where the specified proc is located
#define PMIX_LOCAL_PEERS "pmix.lpeers" // (char*) comma-delimited string of ranks on this node within the specified nspace
#define PMIX_LOCAL_PROCS "pmix.lprocs" // (pmix_proc_t array) array of pmix_proc_t of procs on the specified node
#define PMIX_LOCAL_CPUSETS "pmix.lcpus" // (char*) colon-delimited cpusets of local peers within the specified nspace
#define PMIX_PROC_URI "pmix.puri" // (char*) URI containing contact info for proc
@ -211,6 +215,10 @@ BEGIN_C_DECLS
#define PMIX_EVENT_AFFECTED_PROC "pmix.evproc" // (pmix_proc_t) single proc that was affected
#define PMIX_EVENT_AFFECTED_PROCS "pmix.evaffected" // (pmix_proc_t*) array of pmix_proc_t defining affected procs
#define PMIX_EVENT_NON_DEFAULT "pmix.evnondef" // (bool) event is not to be delivered to default event handlers
#define PMIX_EVENT_RETURN_OBJECT "pmix.evobject" // (void*) object to be returned whenever the registered cbfunc is invoked
// NOTE: the object will _only_ be returned to the process that
// registered it
/* fault tolerance-related events */
#define PMIX_EVENT_TERMINATE_SESSION "pmix.evterm.sess" // (bool) RM intends to terminate session
#define PMIX_EVENT_TERMINATE_JOB "pmix.evterm.job" // (bool) RM intends to terminate this job
@ -239,12 +247,61 @@ BEGIN_C_DECLS
#define PMIX_FWD_STDIN "pmix.fwd.stdin" // (bool) forward my stdin to the designated proc
#define PMIX_FWD_STDOUT "pmix.fwd.stdout" // (bool) forward stdout from spawned procs to me
#define PMIX_FWD_STDERR "pmix.fwd.stderr" // (bool) forward stderr from spawned procs to me
#define PMIX_DEBUGGER_DAEMONS "pmix.debugger" // (bool) spawned app consists of debugger daemons
/* query attributes */
#define PMIX_QUERY_NAMESPACES "pmix.qry.ns" // (char*) request a comma-delimited list of active nspaces
#define PMIX_QUERY_JOB_STATUS "pmix.qry.jst" // (pmix_status_t) status of a specified currently executing job
#define PMIX_QUERY_QUEUE_LIST "pmix.qry.qlst" // (char*) request a comma-delimited list of scheduler queues
#define PMIX_QUERY_QUEUE_STATUS "pmix.qry.qst" // (TBD) status of a specified scheduler queue
#define PMIX_QUERY_PROC_TABLE "pmix.qry.ptable" // (char*) input nspace of job whose info is being requested
// returns (pmix_data_array_t) an array of pmix_proc_info_t
#define PMIX_QUERY_LOCAL_PROC_TABLE "pmix.qry.lptable" // (char*) input nspace of job whose info is being requested
// returns (pmix_data_array_t) an array of pmix_proc_info_t for
// procs in job on same node
#define PMIX_QUERY_AUTHORIZATIONS "pmix.qry.auths" // return operations tool is authorized to perform"
/* log attributes */
#define PMIX_LOG_STDERR "pmix.log.stderr" // (bool) log data to stderr
#define PMIX_LOG_STDOUT "pmix.log.stdout" // (bool) log data to stdout
#define PMIX_LOG_SYSLOG "pmix.log.syslog" // (bool) log data to syslog - defaults to ERROR priority unless
// modified by directive
/**** PROCESS STATE DEFINITIONS ****/
typedef uint8_t pmix_proc_state_t;
#define PMIX_PROC_STATE_UNDEF 0 /* undefined process state */
#define PMIX_PROC_STATE_PREPPED 1 /* process is ready to be launched */
#define PMIX_PROC_STATE_LAUNCH_UNDERWAY 2 /* launch process underway */
#define PMIX_PROC_STATE_RESTART 3 /* the proc is ready for restart */
#define PMIX_PROC_STATE_TERMINATE 4 /* process is marked for termination */
#define PMIX_PROC_STATE_RUNNING 5 /* daemon has locally fork'd process */
#define PMIX_PROC_STATE_CONNECTED 6 /* proc connected to PMIx server */
/*
* Define a "boundary" so users can easily and quickly determine
* if a proc is still running or not - any value less than
* this one means that the proc has not terminated
*/
#define PMIX_PROC_STATE_UNTERMINATED 15
#define PMIX_PROC_STATE_TERMINATED 20 /* process has terminated and is no longer running */
/* Define a boundary so users can easily and quickly determine
* if a proc abnormally terminated - leave a little room
* for future expansion
*/
#define PMIX_PROC_STATE_ERROR 50
/* Define specific error code values */
#define PMIX_PROC_STATE_KILLED_BY_CMD (PMIX_PROC_STATE_ERROR + 1) /* process was killed by cmd */
#define PMIX_PROC_STATE_ABORTED (PMIX_PROC_STATE_ERROR + 2) /* process aborted */
#define PMIX_PROC_STATE_FAILED_TO_START (PMIX_PROC_STATE_ERROR + 3) /* process failed to start */
#define PMIX_PROC_STATE_ABORTED_BY_SIG (PMIX_PROC_STATE_ERROR + 4) /* process aborted by signal */
#define PMIX_PROC_STATE_TERM_WO_SYNC (PMIX_PROC_STATE_ERROR + 5) /* process exit'd w/o calling PMIx_Finalize */
#define PMIX_PROC_STATE_COMM_FAILED (PMIX_PROC_STATE_ERROR + 6) /* process communication has failed */
#define PMIX_PROC_STATE_CALLED_ABORT (PMIX_PROC_STATE_ERROR + 7) /* process called "PMIx_Abort" */
#define PMIX_PROC_STATE_MIGRATING (PMIX_PROC_STATE_ERROR + 8) /* process failed and is waiting for resources before restarting */
#define PMIX_PROC_STATE_CANNOT_RESTART (PMIX_PROC_STATE_ERROR + 9) /* process failed and cannot be restarted */
#define PMIX_PROC_STATE_TERM_NON_ZERO (PMIX_PROC_STATE_ERROR + 10) /* process exited with a non-zero status, indicating abnormal */
#define PMIX_PROC_STATE_FAILED_TO_LAUNCH (PMIX_PROC_STATE_ERROR + 11) /* unable to launch process */
/**** PMIX ERROR CONSTANTS ****/
/* PMIx errors are always negative, with 0 reserved for success */
@ -270,31 +327,50 @@ typedef int pmix_status_t;
#define PMIX_ERR_LOST_CONNECTION_TO_SERVER (PMIX_ERR_BASE - 11)
#define PMIX_ERR_LOST_PEER_CONNECTION (PMIX_ERR_BASE - 12)
#define PMIX_ERR_LOST_CONNECTION_TO_CLIENT (PMIX_ERR_BASE - 13)
/* operational */
#define PMIX_ERR_NO_PERMISSIONS (PMIX_ERR_BASE - 14)
#define PMIX_ERR_TIMEOUT (PMIX_ERR_BASE - 15)
#define PMIX_ERR_WOULD_BLOCK (PMIX_ERR_BASE - 16)
#define PMIX_EXISTS (PMIX_ERR_BASE - 17)
#define PMIX_ERR_SERVER_FAILED_REQUEST (PMIX_ERR_BASE - 18)
#define PMIX_ERR_NOT_SUPPORTED (PMIX_ERR_BASE - 19)
#define PMIX_ERR_NOT_FOUND (PMIX_ERR_BASE - 20)
#define PMIX_ERR_BAD_PARAM (PMIX_ERR_BASE - 21)
#define PMIX_ERR_DATA_VALUE_NOT_FOUND (PMIX_ERR_BASE - 22)
#define PMIX_ERR_OUT_OF_RESOURCE (PMIX_ERR_BASE - 23)
#define PMIX_ERR_INVALID_NAMESPACE (PMIX_ERR_BASE - 24)
#define PMIX_ERR_INVALID_SIZE (PMIX_ERR_BASE - 25)
#define PMIX_ERR_INIT (PMIX_ERR_BASE - 26)
#define PMIX_ERR_EVENT_REGISTRATION (PMIX_ERR_BASE - 27)
/* system failures */
#define PMIX_ERR_NODE_DOWN (PMIX_ERR_BASE - 28)
#define PMIX_ERR_NODE_OFFLINE (PMIX_ERR_BASE - 29)
/* used by event handlers */
#define PMIX_EVENT_NO_ACTION_TAKEN (PMIX_ERR_BASE - 30)
#define PMIX_EVENT_PARTIAL_ACTION_TAKEN (PMIX_ERR_BASE - 31)
#define PMIX_EVENT_ACTION_DEFERRED (PMIX_ERR_BASE - 32)
#define PMIX_EVENT_ACTION_COMPLETE (PMIX_ERR_BASE - 33)
/* used by the query system */
#define PMIX_QUERY_PARTIAL_SUCCESS (PMIX_ERR_BASE - 34)
#define PMIX_QUERY_PARTIAL_SUCCESS (PMIX_ERR_BASE - 14)
/* define a starting point for operational error constants so
* we avoid renumbering when making additions */
#define PMIX_ERR_OP_BASE -100
/* operational */
#define PMIX_ERR_NO_PERMISSIONS (PMIX_ERR_OP_BASE - 1)
#define PMIX_ERR_TIMEOUT (PMIX_ERR_OP_BASE - 2)
#define PMIX_ERR_WOULD_BLOCK (PMIX_ERR_OP_BASE - 3)
#define PMIX_EXISTS (PMIX_ERR_OP_BASE - 4)
#define PMIX_ERR_SERVER_FAILED_REQUEST (PMIX_ERR_OP_BASE - 5)
#define PMIX_ERR_NOT_SUPPORTED (PMIX_ERR_OP_BASE - 6)
#define PMIX_ERR_NOT_FOUND (PMIX_ERR_OP_BASE - 7)
#define PMIX_ERR_BAD_PARAM (PMIX_ERR_OP_BASE - 8)
#define PMIX_ERR_DATA_VALUE_NOT_FOUND (PMIX_ERR_OP_BASE - 9)
#define PMIX_ERR_OUT_OF_RESOURCE (PMIX_ERR_OP_BASE - 10)
#define PMIX_ERR_INVALID_NAMESPACE (PMIX_ERR_OP_BASE - 11)
#define PMIX_ERR_INVALID_SIZE (PMIX_ERR_OP_BASE - 12)
#define PMIX_ERR_INIT (PMIX_ERR_OP_BASE - 13)
#define PMIX_ERR_EVENT_REGISTRATION (PMIX_ERR_OP_BASE - 14)
#define PMIX_ERR_JOB_TERMINATED (PMIX_ERR_OP_BASE - 15)
/* define a starting point for system error constants so
* we avoid renumbering when making additions */
#define PMIX_ERR_SYS_BASE -200
/* system failures */
#define PMIX_ERR_NODE_DOWN (PMIX_ERR_SYS_BASE - 1)
#define PMIX_ERR_NODE_OFFLINE (PMIX_ERR_SYS_BASE - 2)
/* define a starting point for event handler error constants so
* we avoid renumbering when making additions */
#define PMIX_ERR_EVHDLR_BASE -300
/* used by event handlers */
#define PMIX_EVENT_NO_ACTION_TAKEN (PMIX_ERR_EVHDLR_BASE - 1)
#define PMIX_EVENT_PARTIAL_ACTION_TAKEN (PMIX_ERR_EVHDLR_BASE - 2)
#define PMIX_EVENT_ACTION_DEFERRED (PMIX_ERR_EVHDLR_BASE - 3)
#define PMIX_EVENT_ACTION_COMPLETE (PMIX_ERR_EVHDLR_BASE - 4)
/* define a starting point for PMIx internal error codes
@ -309,49 +385,56 @@ typedef int pmix_status_t;
#define PMIX_EXTERNAL_ERR_BASE -2000
/**** PMIX DATA TYPES ****/
typedef enum {
PMIX_UNDEF = 0,
PMIX_BOOL, // converted to/from native true/false to uint8 for pack/unpack
PMIX_BYTE, // a byte of data
PMIX_STRING, // NULL-terminated string
PMIX_SIZE, // size_t
PMIX_PID, // OS-pid
PMIX_INT,
PMIX_INT8,
PMIX_INT16,
PMIX_INT32,
PMIX_INT64,
PMIX_UINT,
PMIX_UINT8,
PMIX_UINT16,
PMIX_UINT32,
PMIX_UINT64,
PMIX_FLOAT,
PMIX_DOUBLE,
PMIX_TIMEVAL,
PMIX_TIME,
PMIX_STATUS, // needs to be tracked separately from integer for those times
typedef uint16_t pmix_data_type_t;
#define PMIX_UNDEF 0
#define PMIX_BOOL 1 // converted to/from native true/false to uint8 for pack/unpack
#define PMIX_BYTE 2 // a byte of data
#define PMIX_STRING 3 // NULL-terminated string
#define PMIX_SIZE 4 // size_t
#define PMIX_PID 5 // OS-pid
#define PMIX_INT 6
#define PMIX_INT8 7
#define PMIX_INT16 8
#define PMIX_INT32 9
#define PMIX_INT64 10
#define PMIX_UINT 11
#define PMIX_UINT8 12
#define PMIX_UINT16 13
#define PMIX_UINT32 14
#define PMIX_UINT64 15
#define PMIX_FLOAT 16
#define PMIX_DOUBLE 17
#define PMIX_TIMEVAL 18
#define PMIX_TIME 19
#define PMIX_STATUS 20 // needs to be tracked separately from integer for those times
// when we are embedded and it needs to be converted to the
// host error definitions
PMIX_HWLOC_TOPO,
PMIX_VALUE,
PMIX_INFO_ARRAY,
PMIX_PROC,
PMIX_APP,
PMIX_INFO,
PMIX_PDATA,
PMIX_BUFFER,
PMIX_BYTE_OBJECT,
PMIX_KVAL,
PMIX_MODEX,
PMIX_PERSIST,
PMIX_POINTER
} pmix_data_type_t;
#define PMIX_HWLOC_TOPO 21
#define PMIX_VALUE 22
#define PMIX_PROC 23
#define PMIX_APP 24
#define PMIX_INFO 25
#define PMIX_PDATA 26
#define PMIX_BUFFER 27
#define PMIX_BYTE_OBJECT 28
#define PMIX_KVAL 29
#define PMIX_MODEX 30
#define PMIX_PERSIST 31
#define PMIX_POINTER 32
#define PMIX_SCOPE 33
#define PMIX_DATA_RANGE 34
#define PMIX_COMMAND 35
#define PMIX_INFO_DIRECTIVES 36
#define PMIX_DATA_TYPE 37
#define PMIX_PROC_STATE 38
#define PMIX_PROC_INFO 39
#define PMIX_DATA_ARRAY 40
#define PMIX_PROC_RANK 41
#define PMIX_QUERY 42
/**** DEPRECATED ****/
#define PMIX_INFO_ARRAY 43
/********************/
/* define a scope for data "put" by PMI per the following:
*
@ -364,35 +447,36 @@ typedef enum {
* PMI_GLOBAL - the data is to be shared with all other requesting processes,
* regardless of location
*/
#define PMIX_SCOPE PMIX_UINT
typedef enum {
PMIX_SCOPE_UNDEF = 0,
PMIX_LOCAL, // share to procs also on this node
PMIX_REMOTE, // share with procs not on this node
PMIX_GLOBAL, // share with all procs (local + remote)
} pmix_scope_t;
typedef uint8_t pmix_scope_t;
#define PMIX_SCOPE_UNDEF 0
#define PMIX_LOCAL 1 // share to procs also on this node
#define PMIX_REMOTE 2 // share with procs not on this node
#define PMIX_GLOBAL 3 // share with all procs (local + remote)
/* define a range for data "published" by PMI
*/
#define PMIX_DATA_RANGE PMIX_UINT
typedef enum {
PMIX_RANGE_UNDEF = 0,
PMIX_RANGE_RM, // data is intended for the host resource manager
PMIX_RANGE_LOCAL, // available on local node only
PMIX_RANGE_NAMESPACE, // data is available to procs in the same nspace only
PMIX_RANGE_SESSION, // data available to all procs in session
PMIX_RANGE_GLOBAL, // data available to all procs
PMIX_RANGE_CUSTOM // range is specified in a pmix_info_t
} pmix_data_range_t;
typedef uint8_t pmix_data_range_t;
#define PMIX_RANGE_UNDEF 0
#define PMIX_RANGE_RM 1 // data is intended for the host resource manager
#define PMIX_RANGE_LOCAL 2 // available on local node only
#define PMIX_RANGE_NAMESPACE 3 // data is available to procs in the same nspace only
#define PMIX_RANGE_SESSION 4 // data available to all procs in session
#define PMIX_RANGE_GLOBAL 5 // data available to all procs
#define PMIX_RANGE_CUSTOM 6 // range is specified in a pmix_info_t
/* define a "persistence" policy for data published by clients */
typedef enum {
PMIX_PERSIST_INDEF = 0, // retain until specifically deleted
PMIX_PERSIST_FIRST_READ, // delete upon first access
PMIX_PERSIST_PROC, // retain until publishing process terminates
PMIX_PERSIST_APP, // retain until application terminates
PMIX_PERSIST_SESSION // retain until session/allocation terminates
} pmix_persistence_t;
typedef uint8_t pmix_persistence_t;
#define PMIX_PERSIST_INDEF 0 // retain until specifically deleted
#define PMIX_PERSIST_FIRST_READ 1 // delete upon first access
#define PMIX_PERSIST_PROC 2 // retain until publishing process terminates
#define PMIX_PERSIST_APP 3 // retain until application terminates
#define PMIX_PERSIST_SESSION 4 // retain until session/allocation terminates
/* define a set of bit-mask flags for specifying behavior of
* command directives via pmix_info_t arrays */
typedef uint32_t pmix_info_directives_t;
#define PMIX_INFO_REQD 0x0001
/**** PMIX BYTE OBJECT ****/
typedef struct pmix_byte_object {
@ -404,12 +488,11 @@ typedef struct pmix_byte_object {
/**** PMIX PROC OBJECT ****/
typedef struct pmix_proc {
char nspace[PMIX_MAX_NSLEN+1];
int rank;
pmix_rank_t rank;
} pmix_proc_t;
#define PMIX_PROC_CREATE(m, n) \
do { \
(m) = (pmix_proc_t*)malloc((n) * sizeof(pmix_proc_t)); \
memset((m), 0, (n) * sizeof(pmix_proc_t)); \
(m) = (pmix_proc_t*)calloc((n) , sizeof(pmix_proc_t)); \
} while (0)
#define PMIX_PROC_RELEASE(m) \
@ -432,14 +515,68 @@ typedef struct pmix_proc {
} while (0)
/**** PMIX PROC INFO STRUCT ****/
typedef struct pmix_proc_info {
pmix_proc_t proc;
char *hostname;
char *executable_name;
pid_t pid;
int exit_code;
pmix_proc_state_t state;
} pmix_proc_info_t;
#define PMIX_PROC_INFO_CREATE(m, n) \
do { \
(m) = (pmix_proc_info_t*)calloc((n) , sizeof(pmix_proc_info_t)); \
} while (0)
#define PMIX_PROC_INFO_RELEASE(m) \
do { \
PMIX_PROC_INFO_FREE((m)); \
} while (0)
#define PMIX_PROC_INFO_CONSTRUCT(m) \
do { \
memset((m), 0, sizeof(pmix_proc_info_t)); \
} while (0)
#define PMIX_PROC_INFO_DESTRUCT(m) \
do { \
if (NULL != (m)->hostname) { \
free((m)->hostname); \
} \
if (NULL != (m)->executable_name) { \
free((m)->executable_name); \
} \
} while(0)
#define PMIX_PROC_INFO_FREE(m, n) \
do { \
size_t _k; \
if (NULL != (m)) { \
for (_k=0; _k < (n); _k++) { \
PMIX_PROC_INFO_DESTRUCT(&(m)[_k]); \
} \
free((m)); \
} \
} while (0)
/**** PMIX VALUE STRUCT ****/
typedef struct pmix_info_t pmix_info_t;
typedef struct pmix_data_array {
pmix_data_type_t type;
size_t size;
void *array;
} pmix_data_array_t;
/**** DEPRECATED ****/
struct pmix_info;
typedef struct pmix_info_array {
size_t size;
pmix_info_t *array;
struct pmix_info *array;
} pmix_info_array_t;
/********************/
/* NOTE: operations can supply a collection of values under
* a single key by passing a pmix_value_t containing an
* array of type PMIX_INFO_ARRAY, with each array element
@ -466,21 +603,34 @@ typedef struct pmix_value {
float fval;
double dval;
struct timeval tv;
time_t time;
pmix_status_t status;
pmix_rank_t rank;
pmix_proc_t proc;
pmix_info_array_t array;
pmix_byte_object_t bo;
pmix_persistence_t persist;
pmix_scope_t scope;
pmix_data_range_t range;
pmix_proc_state_t state;
pmix_proc_info_t pinfo;
pmix_data_array_t darray;
void *ptr;
/**** DEPRECATED ****/
pmix_info_array_t array;
/********************/
} data;
} pmix_value_t;
/* allocate and initialize a specified number of value structs */
#define PMIX_VALUE_CREATE(m, n) \
do { \
int _ii; \
(m) = (pmix_value_t*)malloc((n) * sizeof(pmix_value_t)); \
memset((m), 0, (n) * sizeof(pmix_value_t)); \
pmix_value_t *_v; \
(m) = (pmix_value_t*)calloc((n), sizeof(pmix_value_t)); \
_v = (pmix_value_t*)(m); \
if (NULL != (m)) { \
for (_ii=0; _ii < (int)(n); _ii++) { \
(m)[_ii].type = PMIX_UNDEF; \
_v[_ii].type = PMIX_UNDEF; \
} \
} \
} while (0)
@ -501,6 +651,7 @@ typedef struct pmix_value {
/* release the memory in the value struct data field */
#define PMIX_VALUE_DESTRUCT(m) \
do { \
size_t _n; \
if (PMIX_STRING == (m)->type) { \
if (NULL != (m)->data.string) { \
free((m)->data.string); \
@ -509,8 +660,22 @@ typedef struct pmix_value {
if (NULL != (m)->data.bo.bytes) { \
free((m)->data.bo.bytes); \
} \
} else if (PMIX_DATA_ARRAY == (m)->type) { \
if (PMIX_STRING == (m)->data.darray.type) { \
char **_str = (char**)(m)->data.darray.array; \
for (_n=0; _n < (m)->data.darray.size; _n++) { \
if (NULL != _str[_n]) { \
free(_str[_n]); \
} \
} \
} else if (PMIX_PROC_INFO == (m)->data.darray.type) { \
pmix_proc_info_t *_info = \
(pmix_proc_info_t*)(m)->data.darray.array; \
for (_n=0; _n < (m)->data.darray.size; _n++) { \
PMIX_PROC_INFO_DESTRUCT(&_info[_n]); \
} \
/**** DEPRECATED ****/ \
} else if (PMIX_INFO_ARRAY == (m)->type) { \
size_t _n; \
pmix_info_t *_p = (pmix_info_t*)((m)->data.array.array); \
for (_n=0; _n < (m)->data.array.size; _n++) { \
if (PMIX_STRING == _p[_n].value.type) { \
@ -521,9 +686,41 @@ typedef struct pmix_value {
if (NULL != _p[_n].value.data.bo.bytes) { \
free(_p[_n].value.data.bo.bytes); \
} \
} else if (PMIX_PROC_INFO == _p[_n].value.type) { \
PMIX_PROC_INFO_DESTRUCT(&_p[_n].value.data.pinfo); \
} \
} \
free(_p); \
/********************/ \
} else if (PMIX_INFO == (m)->data.darray.type) { \
pmix_info_t *_info = \
(pmix_info_t*)(m)->data.darray.array; \
for (_n=0; _n < (m)->data.darray.size; _n++) { \
/* cannot use info destruct as that loops back */ \
if (PMIX_STRING == _info[_n].value.type) { \
if (NULL != _info[_n].value.data.string) { \
free(_info[_n].value.data.string); \
} \
} else if (PMIX_BYTE_OBJECT == _info[_n].value.type) { \
if (NULL != _info[_n].value.data.bo.bytes) { \
free(_info[_n].value.data.bo.bytes); \
} \
} else if (PMIX_PROC_INFO == _info[_n].value.type) { \
PMIX_PROC_INFO_DESTRUCT(&_info[_n].value.data.pinfo); \
} \
} \
} else if (PMIX_BYTE_OBJECT == (m)->data.darray.type) { \
pmix_byte_object_t *_obj = \
(pmix_byte_object_t*)(m)->data.darray.array; \
for (_n=0; _n < (m)->data.darray.size; _n++) { \
if (NULL != _obj[_n].bytes) { \
free(_obj[_n].bytes); \
} \
} \
} \
if (NULL != (m)->data.darray.array) { \
free((m)->data.darray.array); \
} \
} \
} while (0)
@ -550,17 +747,16 @@ pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src);
/**** PMIX INFO STRUCT ****/
struct pmix_info_t {
typedef struct pmix_info {
char key[PMIX_MAX_KEYLEN+1]; // ensure room for the NULL terminator
bool required; // defaults to optional (i.e., required=false)
pmix_info_directives_t flags; // bit-mask of flags
pmix_value_t value;
};
} pmix_info_t;
/* utility macros for working with pmix_info_t structs */
#define PMIX_INFO_CREATE(m, n) \
do { \
(m) = (pmix_info_t*)malloc((n) * sizeof(pmix_info_t)); \
memset((m), 0, (n) * sizeof(pmix_info_t)); \
(m) = (pmix_info_t*)calloc((n), sizeof(pmix_info_t)); \
} while (0)
#define PMIX_INFO_CONSTRUCT(m) \
@ -593,14 +789,15 @@ struct pmix_info_t {
#define PMIX_INFO_XFER(d, s) \
do { \
(void)strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \
(d)->required = (s)->required; \
(d)->flags = (s)->flags; \
pmix_value_xfer(&(d)->value, &(s)->value); \
} while(0)
#define PMIX_INFO_REQUIRED(m) \
(m)->required = true;
(m)->flags |= PMIX_INFO_REQD;
#define PMIX_INFO_OPTIONAL(m) \
(m)->required = false;
(m)->flags &= ~PMIX_INFO_REQD;
/**** PMIX LOOKUP RETURN STRUCT ****/
typedef struct pmix_pdata {
@ -612,8 +809,7 @@ typedef struct pmix_pdata {
/* utility macros for working with pmix_pdata_t structs */
#define PMIX_PDATA_CREATE(m, n) \
do { \
(m) = (pmix_pdata_t*)malloc((n) * sizeof(pmix_pdata_t)); \
memset((m), 0, (n) * sizeof(pmix_pdata_t)); \
(m) = (pmix_pdata_t*)calloc((n), sizeof(pmix_pdata_t)); \
} while (0)
#define PMIX_PDATA_RELEASE(m) \
@ -647,10 +843,12 @@ typedef struct pmix_pdata {
#define PMIX_PDATA_LOAD(m, p, k, v, t) \
do { \
if (NULL != (m)) { \
memset((m), 0, sizeof(pmix_pdata_t)); \
(void)strncpy((m)->proc.nspace, (p)->nspace, PMIX_MAX_NSLEN); \
(m)->proc.rank = (p)->rank; \
(void)strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \
pmix_value_load(&((m)->value), (v), (t)); \
} \
} while (0)
@ -667,8 +865,7 @@ typedef struct pmix_app {
/* utility macros for working with pmix_app_t structs */
#define PMIX_APP_CREATE(m, n) \
do { \
(m) = (pmix_app_t*)malloc((n) * sizeof(pmix_app_t)); \
memset((m), 0, (n) * sizeof(pmix_app_t)); \
(m) = (pmix_app_t*)calloc((n), sizeof(pmix_app_t)); \
} while (0)
#define PMIX_APP_RELEASE(m) \
@ -704,6 +901,7 @@ typedef struct pmix_app {
for (_ii=0; _ii < (m)->ninfo; _ii++) { \
PMIX_INFO_DESTRUCT(&(m)->info[_ii]); \
} \
free((m)->info); \
} \
} while (0)
@ -718,6 +916,61 @@ typedef struct pmix_app {
} \
} while (0)
/**** PMIX QUERY STRUCT ****/
typedef struct pmix_query {
char **keys;
pmix_info_t *qualifiers;
size_t nqual;
} pmix_query_t;
/* utility macros for working with pmix_query_t structs */
#define PMIX_QUERY_CREATE(m, n) \
do { \
(m) = (pmix_query_t*)calloc((n) , sizeof(pmix_query_t)); \
} while (0)
#define PMIX_QUERY_RELEASE(m) \
do { \
PMIX_QUERY_DESTRUCT((m)); \
free((m)); \
} while (0)
#define PMIX_QUERY_CONSTRUCT(m) \
do { \
memset((m), 0, sizeof(pmix_query_t)); \
} while (0)
#define PMIX_QUERY_DESTRUCT(m) \
do { \
size_t _ii; \
if (NULL != (m)->keys) { \
for (_ii=0; NULL != (m)->keys[_ii]; _ii++) { \
free((m)->keys[_ii]); \
} \
free((m)->keys); \
} \
if (NULL != (m)->qualifiers) { \
for (_ii=0; _ii < (m)->nqual; _ii++) { \
PMIX_INFO_DESTRUCT(&(m)->qualifiers[_ii]); \
} \
free((m)->qualifiers); \
} \
} while (0)
#define PMIX_QUERY_FREE(m, n) \
do { \
size_t _s; \
if (NULL != (m)) { \
for (_s=0; _s < (n); _s++) { \
PMIX_QUERY_DESTRUCT(&((m)[_s])); \
} \
free((m)); \
} \
} while (0)
/**** PMIX MODEX STRUCT ****/
typedef struct pmix_modex_data {
char nspace[PMIX_MAX_NSLEN+1];
@ -728,8 +981,7 @@ typedef struct pmix_modex_data {
/* utility macros for working with pmix_modex_t structs */
#define PMIX_MODEX_CREATE(m, n) \
do { \
(m) = (pmix_modex_data_t*)malloc((n) * sizeof(pmix_modex_data_t)); \
memset((m), 0, (n) * sizeof(pmix_modex_data_t)); \
(m) = (pmix_modex_data_t*)calloc((n) , sizeof(pmix_modex_data_t)); \
} while (0)
#define PMIX_MODEX_RELEASE(m) \
@ -993,10 +1245,25 @@ pmix_status_t PMIx_Notify_event(pmix_status_t status,
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Provide a string representation of a pmix_status_t value. Note
/* Provide a string representation for several types of value. Note
* that the provided string is statically defined and must NOT be
* free'd */
* free'd. Supported value types:
*
* - pmix_status_t (PMIX_STATUS)
* - pmix_scope_t (PMIX_SCOPE)
* - pmix_persistence_t (PMIX_PERSIST)
* - pmix_data_range_t (PMIX_DATA_RANGE)
* - pmix_info_directives_t (PMIX_INFO_DIRECTIVES)
* - pmix_data_type_t (PMIX_DATA_TYPE)
*/
const char* PMIx_Error_string(pmix_status_t status);
const char* PMIx_Proc_state_string(pmix_proc_state_t state);
const char* PMIx_Scope_string(pmix_scope_t scope);
const char* PMIx_Persistence_string(pmix_persistence_t persist);
const char* PMIx_Data_range_string(pmix_data_range_t range);
const char* PMIx_Info_directives_string(pmix_info_directives_t directives);
const char* PMIx_Data_type_string(pmix_data_type_t type);
/* Get the PMIx version string. Note that the provided string is
* statically defined and must NOT be free'd */

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

@ -289,11 +289,10 @@ typedef pmix_status_t (*pmix_server_listener_fn_t)(int listening_sd,
/* Query information from the resource manager. The query will include
* the nspace/rank of the proc that is requesting the info, an
* array of pmix_info_t describing the request, an optional array
* of pmix_info_t directives, and a callback function/data for the return. */
* array of pmix_query_t describing the request, and a callback
* function/data for the return. */
typedef pmix_status_t (*pmix_server_query_fn_t)(pmix_proc_t *proct,
pmix_info_t *info, size_t ninfo,
pmix_info_t *directives, size_t ndirs,
pmix_query_t *queries, size_t nqueries,
pmix_info_cbfunc_t cbfunc,
void *cbdata);
@ -321,6 +320,12 @@ typedef void (*pmix_server_tool_connection_fn_t)(pmix_info_t *info, size_t ninfo
pmix_tool_connection_cbfunc_t cbfunc,
void *cbdata);
/* Log data on behalf of a client */
typedef void (*pmix_server_log_fn_t)(const pmix_proc_t *client,
const pmix_info_t data[], size_t ndata,
const pmix_info_t directives[], size_t ndirs,
pmix_op_cbfunc_t cbfunc, void *cbdata);
typedef struct pmix_server_module_2_0_0_t {
pmix_server_client_connected_fn_t client_connected;
pmix_server_client_finalized_fn_t client_finalized;
@ -339,6 +344,7 @@ typedef struct pmix_server_module_2_0_0_t {
pmix_server_listener_fn_t listener;
pmix_server_query_fn_t query;
pmix_server_tool_connection_fn_t tool_connected;
pmix_server_log_fn_t log;
} pmix_server_module_t;
/**** SERVER SUPPORT INIT/FINALIZE FUNCTIONS ****/

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

@ -26,6 +26,7 @@
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/buffer_ops/internal.h"
pmix_status_t pmix_bfrop_copy(void **dest, void *src, pmix_data_type_t type)
@ -141,10 +142,38 @@ pmix_status_t pmix_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src)
datasize = sizeof(pmix_status_t);
break;
case PMIX_PROC_RANK:
datasize = sizeof(pmix_rank_t);
break;
case PMIX_PERSIST:
datasize = sizeof(pmix_persistence_t);
break;
case PMIX_POINTER:
datasize = sizeof(char*);
break;
case PMIX_SCOPE:
datasize = sizeof(pmix_scope_t);
break;
case PMIX_DATA_RANGE:
datasize = sizeof(pmix_data_range_t);
break;
case PMIX_COMMAND:
datasize = sizeof(pmix_cmd_t);
break;
case PMIX_INFO_DIRECTIVES:
datasize = sizeof(pmix_info_directives_t);
break;
case PMIX_PROC_STATE:
datasize = sizeof(pmix_proc_state_t);
break;
default:
return PMIX_ERR_UNKNOWN_DATA_TYPE;
}
@ -238,10 +267,24 @@ bool pmix_value_cmp(pmix_value_t *p, pmix_value_t *p1)
}
return rc;
}
/* COPY FUNCTIONS FOR GENERIC PMIX TYPES */
/* COPY FUNCTIONS FOR GENERIC PMIX TYPES - we
* are not allocating memory and so we cannot
* use the regular copy functions */
pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
{
size_t n, m;
pmix_status_t rc;
char **prarray, **strarray;
pmix_value_t *pv, *sv;
pmix_info_t *p1, *s1;
pmix_app_t *pa, *sa;
pmix_pdata_t *pd, *sd;
pmix_buffer_t *pb, *sb;
pmix_byte_object_t *pbo, *sbo;
pmix_kval_t *pk, *sk;
pmix_modex_data_t *pm, *sm;
pmix_proc_info_t *pi, *si;
pmix_query_t *pq, *sq;
/* copy the right field */
p->type = src->type;
@ -312,22 +355,22 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
p->data.dval = src->data.dval;
break;
case PMIX_TIMEVAL:
p->data.tv.tv_sec = src->data.tv.tv_sec;
p->data.tv.tv_usec = src->data.tv.tv_usec;
memcpy(&p->data.tv, &src->data.tv, sizeof(struct timeval));
break;
case PMIX_TIME:
memcpy(&p->data.time, &src->data.time, sizeof(time_t));
break;
case PMIX_STATUS:
memcpy(&p->data.status, &src->data.status, sizeof(pmix_status_t));
break;
case PMIX_INFO_ARRAY:
p->data.array.size = src->data.array.size;
if (0 < src->data.array.size) {
p->data.array.array = (pmix_info_t*)malloc(src->data.array.size * sizeof(pmix_info_t));
p1 = (pmix_info_t*)p->data.array.array;
s1 = (pmix_info_t*)src->data.array.array;
memcpy(p1, s1, src->data.array.size * sizeof(pmix_info_t));
}
case PMIX_PROC:
memcpy(&p->data.proc, &src->data.proc, sizeof(pmix_proc_t));
break;
case PMIX_PROC_RANK:
memcpy(&p->data.proc, &src->data.rank, sizeof(pmix_rank_t));
break;
case PMIX_BYTE_OBJECT:
memset(&p->data.bo, 0, sizeof(pmix_byte_object_t));
if (NULL != src->data.bo.bytes && 0 < src->data.bo.size) {
p->data.bo.bytes = malloc(src->data.bo.size);
memcpy(p->data.bo.bytes, src->data.bo.bytes, src->data.bo.size);
@ -337,9 +380,411 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
p->data.bo.size = 0;
}
break;
case PMIX_PERSIST:
memcpy(&p->data.persist, &src->data.persist, sizeof(pmix_persistence_t));
break;
case PMIX_SCOPE:
memcpy(&p->data.scope, &src->data.scope, sizeof(pmix_scope_t));
break;
case PMIX_DATA_RANGE:
memcpy(&p->data.range, &src->data.range, sizeof(pmix_data_range_t));
break;
case PMIX_PROC_STATE:
memcpy(&p->data.state, &src->data.state, sizeof(pmix_proc_state_t));
break;
case PMIX_PROC_INFO:
PMIX_PROC_INFO_CONSTRUCT(&p->data.pinfo);
if (NULL != src->data.pinfo.hostname) {
p->data.pinfo.hostname = strdup(src->data.pinfo.hostname);
}
if (NULL != src->data.pinfo.executable_name) {
p->data.pinfo.executable_name = strdup(src->data.pinfo.executable_name);
}
memcpy(&p->data.pinfo.pid, &src->data.pinfo.pid, sizeof(pid_t));
memcpy(&p->data.pinfo.exit_code, &src->data.pinfo.exit_code, sizeof(int));
memcpy(&p->data.pinfo.state, &src->data.pinfo.state, sizeof(pmix_proc_state_t));
break;
case PMIX_DATA_ARRAY:
p->data.darray.type = src->data.darray.type;
p->data.darray.size = src->data.darray.size;
if (0 == p->data.darray.size || NULL == src->data.darray.array) {
p->data.darray.array = NULL;
p->data.darray.size = 0;
break;
}
/* allocate space and do the copy */
switch (src->type) {
case PMIX_UINT8:
case PMIX_INT8:
case PMIX_BYTE:
p->data.darray.array = (char*)malloc(src->data.darray.size);
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size);
break;
case PMIX_UINT16:
case PMIX_INT16:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(uint16_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(uint16_t));
break;
case PMIX_UINT32:
case PMIX_INT32:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(uint32_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(uint32_t));
break;
case PMIX_UINT64:
case PMIX_INT64:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(uint64_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(uint64_t));
break;
case PMIX_BOOL:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(bool));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(bool));
break;
case PMIX_SIZE:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(size_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(size_t));
break;
case PMIX_PID:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(pid_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pid_t));
break;
case PMIX_STRING:
p->data.darray.array = (char**)malloc(src->data.darray.size * sizeof(char*));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
prarray = (char**)p->data.darray.array;
strarray = (char**)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
if (NULL != strarray[n]) {
prarray[n] = strdup(strarray[n]);
}
}
break;
case PMIX_INT:
case PMIX_UINT:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(int));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(int));
break;
case PMIX_FLOAT:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(float));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(float));
break;
case PMIX_DOUBLE:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(double));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(double));
break;
case PMIX_TIMEVAL:
p->data.darray.array = (struct timeval*)malloc(src->data.darray.size * sizeof(struct timeval));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(struct timeval));
break;
case PMIX_TIME:
p->data.darray.array = (time_t*)malloc(src->data.darray.size * sizeof(time_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(time_t));
break;
case PMIX_STATUS:
p->data.darray.array = (pmix_status_t*)malloc(src->data.darray.size * sizeof(pmix_status_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_status_t));
break;
case PMIX_VALUE:
PMIX_VALUE_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
pv = (pmix_value_t*)p->data.darray.array;
sv = (pmix_value_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
if (PMIX_SUCCESS != (rc = pmix_value_xfer(&pv[n], &sv[n]))) {
return rc;
}
}
break;
case PMIX_PROC:
PMIX_PROC_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_proc_t));
break;
case PMIX_APP:
PMIX_APP_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
pa = (pmix_app_t*)p->data.darray.array;
sa = (pmix_app_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
if (NULL != sa[n].cmd) {
pa[n].cmd = strdup(sa[n].cmd);
}
pa[n].argc = sa[n].argc;
if (NULL != sa[n].argv) {
pa[n].argv = pmix_argv_copy(sa[n].argv);
}
if (NULL != sa[n].env) {
pa[n].env = pmix_argv_copy(sa[n].env);
}
pa[n].maxprocs = sa[n].maxprocs;
if (0 < sa[n].ninfo && NULL != sa[n].info) {
PMIX_INFO_CREATE(pa[n].info, sa[n].ninfo);
if (NULL == pa[n].info) {
return PMIX_ERR_NOMEM;
}
pa[n].ninfo = sa[n].ninfo;
for (m=0; m < pa[n].ninfo; m++) {
PMIX_INFO_XFER(&pa[n].info[m], &sa[n].info[m]);
}
}
}
break;
case PMIX_INFO:
PMIX_INFO_CREATE(p->data.darray.array, src->data.darray.size);
p1 = (pmix_info_t*)p->data.darray.array;
s1 = (pmix_info_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type);
}
break;
case PMIX_PDATA:
PMIX_PDATA_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
pd = (pmix_pdata_t*)p->data.darray.array;
sd = (pmix_pdata_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value.data.flag, sd[n].value.type);
}
break;
case PMIX_BUFFER:
p->data.darray.array = (pmix_buffer_t*)malloc(src->data.darray.size * sizeof(pmix_buffer_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
pb = (pmix_buffer_t*)p->data.darray.array;
sb = (pmix_buffer_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
PMIX_CONSTRUCT(&pb[n], pmix_buffer_t);
pmix_bfrop.copy_payload(&pb[n], &sb[n]);
}
break;
case PMIX_BYTE_OBJECT:
p->data.darray.array = (pmix_byte_object_t*)malloc(src->data.darray.size * sizeof(pmix_byte_object_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
pbo = (pmix_byte_object_t*)p->data.darray.array;
sbo = (pmix_byte_object_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
if (NULL != sbo[n].bytes && 0 < sbo[n].size) {
pbo[n].size = sbo[n].size;
pbo[n].bytes = (char*)malloc(pbo[n].size);
memcpy(pbo[n].bytes, sbo[n].bytes, pbo[n].size);
} else {
pbo[n].bytes = NULL;
pbo[n].size = 0;
}
}
break;
case PMIX_KVAL:
p->data.darray.array = (pmix_kval_t*)calloc(src->data.darray.size , sizeof(pmix_kval_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
pk = (pmix_kval_t*)p->data.darray.array;
sk = (pmix_kval_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
if (NULL != sk[n].key) {
pk[n].key = strdup(sk[n].key);
}
if (NULL != sk[n].value) {
PMIX_VALUE_CREATE(pk[n].value, 1);
if (NULL == pk[n].value) {
return PMIX_ERR_NOMEM;
}
if (PMIX_SUCCESS != (rc = pmix_value_xfer(pk[n].value, sk[n].value))) {
return rc;
}
}
}
break;
case PMIX_MODEX:
PMIX_MODEX_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
pm = (pmix_modex_data_t*)p->data.darray.array;
sm = (pmix_modex_data_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
memcpy(&pm[n], &sm[n], sizeof(pmix_modex_data_t));
if (NULL != sm[n].blob && 0 < sm[n].size) {
pm[n].blob = (uint8_t*)malloc(sm[n].size);
if (NULL == pm[n].blob) {
return PMIX_ERR_NOMEM;
}
memcpy(pm[n].blob, sm[n].blob, sm[n].size);
pm[n].size = sm[n].size;
} else {
pm[n].blob = NULL;
pm[n].size = 0;
}
}
break;
case PMIX_PERSIST:
p->data.darray.array = (pmix_persistence_t*)malloc(src->data.darray.size * sizeof(pmix_persistence_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_persistence_t));
break;
case PMIX_POINTER:
p->data.darray.array = (void*)malloc(src->data.darray.size * sizeof(void*));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(void*));
break;
case PMIX_SCOPE:
p->data.darray.array = (pmix_scope_t*)malloc(src->data.darray.size * sizeof(pmix_scope_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_scope_t));
break;
case PMIX_DATA_RANGE:
p->data.darray.array = (pmix_data_range_t*)malloc(src->data.darray.size * sizeof(pmix_data_range_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_data_range_t));
break;
case PMIX_COMMAND:
p->data.darray.array = (pmix_cmd_t*)malloc(src->data.darray.size * sizeof(pmix_cmd_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_cmd_t));
break;
case PMIX_INFO_DIRECTIVES:
p->data.darray.array = (pmix_info_directives_t*)malloc(src->data.darray.size * sizeof(pmix_info_directives_t));
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_info_directives_t));
break;
case PMIX_PROC_INFO:
PMIX_PROC_INFO_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
pi = (pmix_proc_info_t*)p->data.darray.array;
si = (pmix_proc_info_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
memcpy(&pi[n].proc, &si[n].proc, sizeof(pmix_proc_t));
if (NULL != si[n].hostname) {
pi[n].hostname = strdup(si[n].hostname);
} else {
pi[n].hostname = NULL;
}
if (NULL != si[n].executable_name) {
pi[n].executable_name = strdup(si[n].executable_name);
} else {
pi[n].executable_name = NULL;
}
pi[n].pid = si[n].pid;
pi[n].exit_code = si[n].exit_code;
pi[n].state = si[n].state;
}
break;
case PMIX_DATA_ARRAY:
return PMIX_ERR_NOT_SUPPORTED; // don't support iterative arrays
case PMIX_QUERY:
PMIX_QUERY_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
return PMIX_ERR_NOMEM;
}
pq = (pmix_query_t*)p->data.darray.array;
sq = (pmix_query_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
if (NULL != sq[n].keys) {
pq[n].keys = pmix_argv_copy(sq[n].keys);
}
if (NULL != sq[n].qualifiers && 0 < sq[n].nqual) {
PMIX_INFO_CREATE(pq[n].qualifiers, sq[n].nqual);
if (NULL == pq[n].qualifiers) {
return PMIX_ERR_NOMEM;
}
for (m=0; m < sq[n].nqual; m++) {
PMIX_INFO_XFER(&pq[n].qualifiers[m], &sq[n].qualifiers[m]);
}
pq[n].nqual = sq[n].nqual;
} else {
pq[n].qualifiers = NULL;
pq[n].nqual = 0;
}
}
break;
default:
return PMIX_ERR_UNKNOWN_DATA_TYPE;
}
break;
case PMIX_POINTER:
memcpy(&p->data.ptr, &src->data.ptr, sizeof(void*));
break;
/**** DEPRECATED ****/
case PMIX_INFO_ARRAY:
p->data.array.size = src->data.array.size;
if (0 < src->data.array.size) {
p->data.array.array = (pmix_info_t*)malloc(src->data.array.size * sizeof(pmix_info_t));
if (NULL == p->data.array.array) {
return PMIX_ERR_NOMEM;
}
p1 = (pmix_info_t*)p->data.array.array;
s1 = (pmix_info_t*)src->data.array.array;
for (n=0; n < src->data.darray.size; n++) {
PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type);
}
}
break;
/********************/
default:
pmix_output(0, "COPY-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)src->type);
return PMIX_ERROR;
@ -371,7 +816,7 @@ pmix_status_t pmix_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src,
{
*dest = (pmix_info_t*)malloc(sizeof(pmix_info_t));
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
(*dest)->required = src->required;
(*dest)->flags = src->flags;
return pmix_value_xfer(&(*dest)->value, &src->value);
}
@ -421,21 +866,6 @@ pmix_status_t pmix_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src,
return pmix_value_xfer(p->value, src->value);
}
pmix_status_t pmix_bfrop_copy_array(pmix_info_array_t **dest,
pmix_info_array_t *src,
pmix_data_type_t type)
{
pmix_info_t *d1, *s1;
*dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
(*dest)->size = src->size;
(*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t));
d1 = (pmix_info_t*)(*dest)->array;
s1 = (pmix_info_t*)src->array;
memcpy(d1, s1, src->size * sizeof(pmix_info_t));
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
pmix_data_type_t type)
{
@ -512,3 +942,456 @@ pmix_status_t pmix_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src,
return pmix_value_xfer(&(*dest)->value, &src->value);
}
pmix_status_t pmix_bfrop_copy_pinfo(pmix_proc_info_t **dest, pmix_proc_info_t *src,
pmix_data_type_t type)
{
*dest = (pmix_proc_info_t*)malloc(sizeof(pmix_proc_info_t));
(void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN);
(*dest)->proc.rank = src->proc.rank;
if (NULL != src->hostname) {
(*dest)->hostname = strdup(src->hostname);
}
if (NULL != src->executable_name) {
(*dest)->executable_name = strdup(src->executable_name);
}
(*dest)->pid = src->pid;
(*dest)->exit_code = src->exit_code;
(*dest)->state = src->state;
return PMIX_SUCCESS;
}
/* the pmix_data_array_t is a little different in that it
* is an array of values, and so we cannot just copy one
* value at a time. So handle all value types here */
pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest,
pmix_data_array_t *src,
pmix_data_type_t type)
{
pmix_data_array_t *p;
size_t n, m;
pmix_status_t rc;
char **prarray, **strarray;
pmix_value_t *pv, *sv;
pmix_app_t *pa, *sa;
pmix_info_t *p1, *s1;
pmix_pdata_t *pd, *sd;
pmix_buffer_t *pb, *sb;
pmix_byte_object_t *pbo, *sbo;
pmix_kval_t *pk, *sk;
pmix_modex_data_t *pm, *sm;
pmix_proc_info_t *pi, *si;
pmix_query_t *pq, *sq;
p = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t));
if (NULL == p) {
return PMIX_ERR_NOMEM;
}
p->type = src->type;
p->size = src->size;
/* process based on type of array element */
switch (src->type) {
p->type = src->type;
p->size = src->size;
if (0 == p->size || NULL == src->array) {
p->array = NULL;
p->size = 0;
break;
}
case PMIX_UINT8:
case PMIX_INT8:
case PMIX_BYTE:
p->array = (char*)malloc(src->size);
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size);
break;
case PMIX_UINT16:
case PMIX_INT16:
p->array = (char*)malloc(src->size * sizeof(uint16_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(uint16_t));
break;
case PMIX_UINT32:
case PMIX_INT32:
p->array = (char*)malloc(src->size * sizeof(uint32_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(uint32_t));
break;
case PMIX_UINT64:
case PMIX_INT64:
p->array = (char*)malloc(src->size * sizeof(uint64_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(uint64_t));
break;
case PMIX_BOOL:
p->array = (char*)malloc(src->size * sizeof(bool));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(bool));
break;
case PMIX_SIZE:
p->array = (char*)malloc(src->size * sizeof(size_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(size_t));
break;
case PMIX_PID:
p->array = (char*)malloc(src->size * sizeof(pid_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pid_t));
break;
case PMIX_STRING:
p->array = (char**)malloc(src->size * sizeof(char*));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
prarray = (char**)p->array;
strarray = (char**)src->array;
for (n=0; n < src->size; n++) {
if (NULL != strarray[n]) {
prarray[n] = strdup(strarray[n]);
}
}
break;
case PMIX_INT:
case PMIX_UINT:
p->array = (char*)malloc(src->size * sizeof(int));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(int));
break;
case PMIX_FLOAT:
p->array = (char*)malloc(src->size * sizeof(float));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(float));
break;
case PMIX_DOUBLE:
p->array = (char*)malloc(src->size * sizeof(double));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(double));
break;
case PMIX_TIMEVAL:
p->array = (struct timeval*)malloc(src->size * sizeof(struct timeval));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(struct timeval));
break;
case PMIX_TIME:
p->array = (time_t*)malloc(src->size * sizeof(time_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(time_t));
break;
case PMIX_STATUS:
p->array = (pmix_status_t*)malloc(src->size * sizeof(pmix_status_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_status_t));
break;
case PMIX_VALUE:
PMIX_VALUE_CREATE(p->array, src->size);
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
pv = (pmix_value_t*)p->array;
sv = (pmix_value_t*)src->array;
for (n=0; n < src->size; n++) {
if (PMIX_SUCCESS != (rc = pmix_value_xfer(&pv[n], &sv[n]))) {
return rc;
}
}
break;
case PMIX_PROC:
PMIX_PROC_CREATE(p->array, src->size);
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_proc_t));
break;
case PMIX_PROC_RANK:
p->array = (char*)malloc(src->size * sizeof(pmix_rank_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_proc_t));
break;
case PMIX_APP:
PMIX_APP_CREATE(p->array, src->size);
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
pa = (pmix_app_t*)p->array;
sa = (pmix_app_t*)src->array;
for (n=0; n < src->size; n++) {
if (NULL != sa[n].cmd) {
pa[n].cmd = strdup(sa[n].cmd);
}
pa[n].argc = sa[n].argc;
if (NULL != sa[n].argv) {
pa[n].argv = pmix_argv_copy(sa[n].argv);
}
if (NULL != sa[n].env) {
pa[n].env = pmix_argv_copy(sa[n].env);
}
pa[n].maxprocs = sa[n].maxprocs;
if (0 < sa[n].ninfo && NULL != sa[n].info) {
PMIX_INFO_CREATE(pa[n].info, sa[n].ninfo);
if (NULL == pa[n].info) {
return PMIX_ERR_NOMEM;
}
pa[n].ninfo = sa[n].ninfo;
for (m=0; m < pa[n].ninfo; m++) {
PMIX_INFO_XFER(&pa[n].info[m], &sa[n].info[m]);
}
}
}
break;
case PMIX_INFO:
PMIX_INFO_CREATE(p->array, src->size);
p1 = (pmix_info_t*)p->array;
s1 = (pmix_info_t*)src->array;
for (n=0; n < src->size; n++) {
PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type);
}
break;
case PMIX_PDATA:
PMIX_PDATA_CREATE(p->array, src->size);
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
pd = (pmix_pdata_t*)p->array;
sd = (pmix_pdata_t*)src->array;
for (n=0; n < src->size; n++) {
PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value, sd[n].value.type);
}
break;
case PMIX_BUFFER:
p->array = (pmix_buffer_t*)malloc(src->size * sizeof(pmix_buffer_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
pb = (pmix_buffer_t*)p->array;
sb = (pmix_buffer_t*)src->array;
for (n=0; n < src->size; n++) {
PMIX_CONSTRUCT(&pb[n], pmix_buffer_t);
pmix_bfrop.copy_payload(&pb[n], &sb[n]);
}
break;
case PMIX_BYTE_OBJECT:
p->array = (pmix_byte_object_t*)malloc(src->size * sizeof(pmix_byte_object_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
pbo = (pmix_byte_object_t*)p->array;
sbo = (pmix_byte_object_t*)src->array;
for (n=0; n < src->size; n++) {
if (NULL != sbo[n].bytes && 0 < sbo[n].size) {
pbo[n].size = sbo[n].size;
pbo[n].bytes = (char*)malloc(pbo[n].size);
memcpy(pbo[n].bytes, sbo[n].bytes, pbo[n].size);
} else {
pbo[n].bytes = NULL;
pbo[n].size = 0;
}
}
break;
case PMIX_KVAL:
p->array = (pmix_kval_t*)calloc(src->size , sizeof(pmix_kval_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
pk = (pmix_kval_t*)p->array;
sk = (pmix_kval_t*)src->array;
for (n=0; n < src->size; n++) {
if (NULL != sk[n].key) {
pk[n].key = strdup(sk[n].key);
}
if (NULL != sk[n].value) {
PMIX_VALUE_CREATE(pk[n].value, 1);
if (NULL == pk[n].value) {
return PMIX_ERR_NOMEM;
}
if (PMIX_SUCCESS != (rc = pmix_value_xfer(pk[n].value, sk[n].value))) {
return rc;
}
}
}
break;
case PMIX_MODEX:
PMIX_MODEX_CREATE(p->array, src->size);
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
pm = (pmix_modex_data_t*)p->array;
sm = (pmix_modex_data_t*)src->array;
for (n=0; n < src->size; n++) {
memcpy(&pm[n], &sm[n], sizeof(pmix_modex_data_t));
if (NULL != sm[n].blob && 0 < sm[n].size) {
pm[n].blob = (uint8_t*)malloc(sm[n].size);
if (NULL == pm[n].blob) {
return PMIX_ERR_NOMEM;
}
memcpy(pm[n].blob, sm[n].blob, sm[n].size);
pm[n].size = sm[n].size;
} else {
pm[n].blob = NULL;
pm[n].size = 0;
}
}
break;
case PMIX_PERSIST:
p->array = (pmix_persistence_t*)malloc(src->size * sizeof(pmix_persistence_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_persistence_t));
break;
case PMIX_POINTER:
p->array = (void*)malloc(src->size * sizeof(void*));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(void*));
break;
case PMIX_SCOPE:
p->array = (pmix_scope_t*)malloc(src->size * sizeof(pmix_scope_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_scope_t));
break;
case PMIX_DATA_RANGE:
p->array = (pmix_data_range_t*)malloc(src->size * sizeof(pmix_data_range_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_data_range_t));
break;
case PMIX_COMMAND:
p->array = (pmix_cmd_t*)malloc(src->size * sizeof(pmix_cmd_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_cmd_t));
break;
case PMIX_INFO_DIRECTIVES:
p->array = (pmix_info_directives_t*)malloc(src->size * sizeof(pmix_info_directives_t));
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->array, src->array, src->size * sizeof(pmix_info_directives_t));
break;
case PMIX_PROC_INFO:
PMIX_PROC_INFO_CREATE(p->array, src->size);
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
pi = (pmix_proc_info_t*)p->array;
si = (pmix_proc_info_t*)src->array;
for (n=0; n < src->size; n++) {
memcpy(&pi[n].proc, &si[n].proc, sizeof(pmix_proc_t));
if (NULL != si[n].hostname) {
pi[n].hostname = strdup(si[n].hostname);
} else {
pi[n].hostname = NULL;
}
if (NULL != si[n].executable_name) {
pi[n].executable_name = strdup(si[n].executable_name);
} else {
pi[n].executable_name = NULL;
}
pi[n].pid = si[n].pid;
pi[n].exit_code = si[n].exit_code;
pi[n].state = si[n].state;
}
break;
case PMIX_DATA_ARRAY:
return PMIX_ERR_NOT_SUPPORTED; // don't support iterative arrays
case PMIX_QUERY:
PMIX_QUERY_CREATE(p->array, src->size);
if (NULL == p->array) {
return PMIX_ERR_NOMEM;
}
pq = (pmix_query_t*)p->array;
sq = (pmix_query_t*)src->array;
for (n=0; n < src->size; n++) {
if (NULL != sq[n].keys) {
pq[n].keys = pmix_argv_copy(sq[n].keys);
}
if (NULL != sq[n].qualifiers && 0 < sq[n].nqual) {
PMIX_INFO_CREATE(pq[n].qualifiers, sq[n].nqual);
if (NULL == pq[n].qualifiers) {
return PMIX_ERR_NOMEM;
}
for (m=0; m < sq[n].nqual; m++) {
PMIX_INFO_XFER(&pq[n].qualifiers[m], &sq[n].qualifiers[m]);
}
pq[n].nqual = sq[n].nqual;
} else {
pq[n].qualifiers = NULL;
pq[n].nqual = 0;
}
}
break;
default:
return PMIX_ERR_UNKNOWN_DATA_TYPE;
}
(*dest) = p;
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_copy_query(pmix_query_t **dest,
pmix_query_t *src,
pmix_data_type_t type)
{
pmix_status_t rc;
*dest = (pmix_query_t*)malloc(sizeof(pmix_query_t));
if (NULL != src->keys) {
(*dest)->keys = pmix_argv_copy(src->keys);
}
(*dest)->nqual = src->nqual;
if (NULL != src->qualifiers) {
if (PMIX_SUCCESS != (rc = pmix_bfrop_copy_info(&((*dest)->qualifiers), src->qualifiers, PMIX_INFO))) {
return rc;
}
}
return PMIX_SUCCESS;
}
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_copy_array(pmix_info_array_t **dest,
pmix_info_array_t *src,
pmix_data_type_t type)
{
pmix_info_t *d1, *s1;
*dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
(*dest)->size = src->size;
(*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t));
d1 = (pmix_info_t*)(*dest)->array;
s1 = (pmix_info_t*)src->array;
memcpy(d1, s1, src->size * sizeof(pmix_info_t));
return PMIX_SUCCESS;
}
/*******************/

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

@ -286,8 +286,6 @@ pmix_status_t pmix_bfrop_pack_status(pmix_buffer_t *buffer, const void *src,
#endif
pmix_status_t pmix_bfrop_pack_value(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
@ -302,12 +300,34 @@ pmix_status_t pmix_bfrop_pack_status(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_range(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_infodirs(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_ptr(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_pstate(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_pinfo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_query(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_rank(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
/********************/
/*
* Internal unpack functions
@ -351,8 +371,6 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
#endif
pmix_status_t pmix_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest,
@ -367,12 +385,34 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_scope(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_range(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_cmd(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_infodirs(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_ptr(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_pstate(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_pinfo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_rank(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
/********************/
/*
* Internal copy functions
@ -389,8 +429,6 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
#endif
pmix_status_t pmix_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_array(pmix_info_array_t **dest, pmix_info_array_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src,
@ -409,6 +447,19 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_pinfo(pmix_proc_info_t **dest, pmix_proc_info_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest, pmix_data_array_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_query(pmix_query_t **dest, pmix_query_t *src,
pmix_data_type_t type);
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_copy_array(pmix_info_array_t **dest,
pmix_info_array_t *src,
pmix_data_type_t type);
/********************/
/*
* Internal print functions
*/
@ -442,8 +493,6 @@ pmix_status_t pmix_bfrop_print_status(char **output, char *prefix, pmix_status_t
hwloc_topology_t src, pmix_data_type_t type);
#endif
pmix_status_t pmix_bfrop_print_value(char **output, char *prefix, pmix_value_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_array(char **output, char *prefix,
pmix_info_array_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_proc(char **output, char *prefix,
pmix_proc_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_app(char **output, char *prefix,
@ -458,12 +507,35 @@ pmix_status_t pmix_bfrop_print_status(char **output, char *prefix, pmix_status_t
pmix_modex_data_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_persist(char **output, char *prefix,
pmix_persistence_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_scope(char **output, char *prefix,
pmix_scope_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_range(char **output, char *prefix,
pmix_data_range_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_cmd(char **output, char *prefix,
pmix_cmd_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_infodirs(char **output, char *prefix,
pmix_info_directives_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_bo(char **output, char *prefix,
pmix_byte_object_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_pdata(char **output, char *prefix,
pmix_pdata_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_ptr(char **output, char *prefix,
void *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_pstate(char **output, char *prefix,
pmix_proc_state_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_pinfo(char **output, char *prefix,
pmix_proc_info_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_darray(char **output, char *prefix,
pmix_data_array_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_query(char **output, char *prefix,
pmix_query_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_rank(char **output, char *prefix,
pmix_rank_t *src, pmix_data_type_t type);
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_print_array(char **output, char *prefix,
pmix_info_array_t *src,
pmix_data_type_t type);
/********************/
/*
* Internal helper functions

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

@ -112,11 +112,11 @@ bool pmix_bfrop_too_small(pmix_buffer_t *buffer, size_t bytes_reqd)
pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type)
{
/* Lookup the pack function for the actual pmix_data_type type and call it */
return pmix_bfrop_pack_datatype(buffer, &type, 1, PMIX_INT);
return pmix_bfrop_pack_datatype(buffer, &type, 1, PMIX_DATA_TYPE);
}
pmix_status_t pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type)
{
int32_t n=1;
return pmix_bfrop_unpack_datatype(buffer, type, &n, PMIX_INT);
return pmix_bfrop_unpack_datatype(buffer, type, &n, PMIX_DATA_TYPE);
}

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

@ -311,12 +311,6 @@ pmix_status_t pmix_bfrop_open(void)
pmix_bfrop_copy_value,
pmix_bfrop_print_value);
PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY,
pmix_bfrop_pack_array,
pmix_bfrop_unpack_array,
pmix_bfrop_copy_array,
pmix_bfrop_print_array);
PMIX_REGISTER_TYPE("PMIX_PROC", PMIX_PROC,
pmix_bfrop_pack_proc,
pmix_bfrop_unpack_proc,
@ -368,7 +362,7 @@ pmix_status_t pmix_bfrop_open(void)
PMIX_REGISTER_TYPE("PMIX_PERSIST", PMIX_PERSIST,
pmix_bfrop_pack_persist,
pmix_bfrop_unpack_persist,
pmix_bfrop_copy_persist,
pmix_bfrop_std_copy,
pmix_bfrop_print_persist);
PMIX_REGISTER_TYPE("PMIX_POINTER", PMIX_POINTER,
@ -377,6 +371,68 @@ pmix_status_t pmix_bfrop_open(void)
pmix_bfrop_std_copy,
pmix_bfrop_print_ptr);
PMIX_REGISTER_TYPE("PMIX_SCOPE", PMIX_SCOPE,
pmix_bfrop_pack_scope,
pmix_bfrop_unpack_scope,
pmix_bfrop_std_copy,
pmix_bfrop_print_scope);
PMIX_REGISTER_TYPE("PMIX_DATA_RANGE", PMIX_DATA_RANGE,
pmix_bfrop_pack_range,
pmix_bfrop_unpack_range,
pmix_bfrop_std_copy,
pmix_bfrop_print_range);
PMIX_REGISTER_TYPE("PMIX_COMMAND", PMIX_COMMAND,
pmix_bfrop_pack_cmd,
pmix_bfrop_unpack_cmd,
pmix_bfrop_std_copy,
pmix_bfrop_print_cmd);
PMIX_REGISTER_TYPE("PMIX_INFO_DIRECTIVES", PMIX_INFO_DIRECTIVES,
pmix_bfrop_pack_infodirs,
pmix_bfrop_unpack_infodirs,
pmix_bfrop_std_copy,
pmix_bfrop_print_infodirs);
PMIX_REGISTER_TYPE("PMIX_PROC_STATE", PMIX_PROC_STATE,
pmix_bfrop_pack_pstate,
pmix_bfrop_unpack_pstate,
pmix_bfrop_std_copy,
pmix_bfrop_print_pstate);
PMIX_REGISTER_TYPE("PMIX_PROC_INFO", PMIX_PROC_INFO,
pmix_bfrop_pack_pinfo,
pmix_bfrop_unpack_pinfo,
pmix_bfrop_copy_pinfo,
pmix_bfrop_print_pinfo);
PMIX_REGISTER_TYPE("PMIX_DATA_ARRAY", PMIX_DATA_ARRAY,
pmix_bfrop_pack_darray,
pmix_bfrop_unpack_darray,
pmix_bfrop_copy_darray,
pmix_bfrop_print_darray);
PMIX_REGISTER_TYPE("PMIX_PROC_RANK", PMIX_PROC_RANK,
pmix_bfrop_pack_rank,
pmix_bfrop_unpack_rank,
pmix_bfrop_std_copy,
pmix_bfrop_print_rank);
PMIX_REGISTER_TYPE("PMIX_QUERY", PMIX_QUERY,
pmix_bfrop_pack_query,
pmix_bfrop_unpack_query,
pmix_bfrop_copy_query,
pmix_bfrop_print_query);
/**** DEPRECATED ****/
PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY,
pmix_bfrop_pack_array,
pmix_bfrop_unpack_array,
pmix_bfrop_copy_array,
pmix_bfrop_print_array);
/********************/
/* All done */
pmix_bfrop_initialized = true;
return PMIX_SUCCESS;
@ -484,18 +540,7 @@ PMIX_EXPORT void pmix_value_load(pmix_value_t *v, void *data,
case PMIX_POINTER:
memcpy(&(v->data.ptr), data, sizeof(void*));
break;
case PMIX_TIME:
case PMIX_HWLOC_TOPO:
case PMIX_VALUE:
case PMIX_INFO_ARRAY:
case PMIX_APP:
case PMIX_INFO:
case PMIX_PDATA:
case PMIX_BUFFER:
case PMIX_KVAL:
case PMIX_MODEX:
case PMIX_PERSIST:
case PMIX_PROC:
default:
/* silence warnings */
break;
}
@ -609,18 +654,7 @@ pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data,
memcpy(*data, &(kv->data.ptr), sizeof(void*));
*sz = sizeof(void*);
break;
case PMIX_TIME:
case PMIX_HWLOC_TOPO:
case PMIX_VALUE:
case PMIX_INFO_ARRAY:
case PMIX_APP:
case PMIX_INFO:
case PMIX_PDATA:
case PMIX_BUFFER:
case PMIX_KVAL:
case PMIX_MODEX:
case PMIX_PERSIST:
case PMIX_PROC:
default:
/* silence warnings */
rc = PMIX_ERROR;
break;

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

@ -259,7 +259,7 @@ pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer,
pmix_status_t pmix_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
return pmix_bfrop_pack_int32(buffer, src, num_vals, type);
return pmix_bfrop_pack_int16(buffer, src, num_vals, type);
}
/*
@ -529,26 +529,73 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer,
return ret;
}
break;
case PMIX_TIME:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.time, 1, PMIX_TIME))) {
return ret;
}
break;
case PMIX_STATUS:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.status, 1, PMIX_STATUS))) {
return ret;
}
break;
case PMIX_INFO_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.array, 1, PMIX_INFO_ARRAY))) {
return ret;
}
break;
case PMIX_BYTE_OBJECT:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) {
return ret;
}
break;
case PMIX_PROC:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.proc, 1, PMIX_PROC))) {
return ret;
}
break;
case PMIX_PROC_RANK:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.rank, 1, PMIX_PROC_RANK))) {
return ret;
}
break;
case PMIX_BYTE_OBJECT:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) {
return ret;
}
break;
case PMIX_PERSIST:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.persist, 1, PMIX_PERSIST))) {
return ret;
}
break;
case PMIX_SCOPE:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.scope, 1, PMIX_SCOPE))) {
return ret;
}
break;
case PMIX_DATA_RANGE:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.range, 1, PMIX_DATA_RANGE))) {
return ret;
}
break;
case PMIX_PROC_STATE:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.state, 1, PMIX_PROC_STATE))) {
return ret;
}
break;
case PMIX_PROC_INFO:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.pinfo, 1, PMIX_PROC_INFO))) {
return ret;
}
break;
case PMIX_DATA_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.darray, 1, PMIX_DATA_ARRAY))) {
return ret;
}
break;
case PMIX_QUERY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.darray, 1, PMIX_QUERY))) {
return ret;
}
break;
/**** DEPRECATED ****/
case PMIX_INFO_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.array, 1, PMIX_INFO_ARRAY))) {
return ret;
}
break;
/********************/
default:
pmix_output(0, "PACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)p->type);
return PMIX_ERROR;
@ -570,7 +617,7 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer,
for (i = 0; i < num_vals; ++i) {
/* pack the type */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &ptr[i].type, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, ptr[i].type))) {
return ret;
}
/* now pack the right field */
@ -599,8 +646,8 @@ pmix_status_t pmix_bfrop_pack_info(pmix_buffer_t *buffer, const void *src,
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &foo, 1, PMIX_STRING))) {
return ret;
}
/* pack required flag */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_bool(buffer, &info[i].required, 1, PMIX_BOOL))) {
/* pack info directives flag */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_infodirs(buffer, &info[i].flags, 1, PMIX_INFO_DIRECTIVES))) {
return ret;
}
/* pack the type */
@ -685,7 +732,7 @@ pmix_status_t pmix_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src,
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &ptr, 1, PMIX_STRING))) {
return ret;
}
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &proc[i].rank, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_rank(buffer, &proc[i].rank, 1, PMIX_PROC_RANK))) {
return ret;
}
}
@ -748,16 +795,18 @@ pmix_status_t pmix_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src,
pmix_kval_t *ptr;
int32_t i;
pmix_status_t ret;
char *st;
ptr = (pmix_kval_t *) src;
for (i = 0; i < num_vals; ++i) {
/* pack the key */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &ptr[i].key, 1, PMIX_STRING))) {
st = ptr[i].key;
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &st, 1, PMIX_STRING))) {
return ret;
}
/* pack the value */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_value(buffer, ptr[i].value, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_value(buffer, ptr[i].value, 1, PMIX_VALUE))) {
return ret;
}
}
@ -765,31 +814,6 @@ pmix_status_t pmix_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src,
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_info_array_t *ptr;
int32_t i;
pmix_status_t ret;
ptr = (pmix_info_array_t *) src;
for (i = 0; i < num_vals; ++i) {
/* pack the size */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) {
return ret;
}
if (0 < ptr[i].size) {
/* pack the values */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_pack_topo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
@ -874,7 +898,31 @@ pmix_status_t pmix_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src,
pmix_status_t pmix_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
return pmix_bfrop_pack_int(buffer, src, num_vals, PMIX_INT);
return pmix_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
return pmix_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_pack_range(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
return pmix_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
return pmix_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_pack_infodirs(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
return pmix_bfrop_pack_int32(buffer, src, num_vals, PMIX_UINT32);
}
pmix_status_t pmix_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src,
@ -907,3 +955,134 @@ pmix_status_t pmix_bfrop_pack_ptr(pmix_buffer_t *buffer, const void *src,
return pmix_bfrop_pack_byte(buffer, &foo, 1, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_pack_pstate(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
return pmix_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_pack_pinfo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_proc_info_t *pinfo = (pmix_proc_info_t*)src;
pmix_status_t ret;
int32_t i;
for (i=0; i < num_vals; i++) {
/* pack the proc identifier */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_proc(buffer, &pinfo[i].proc, 1, PMIX_PROC))) {
return ret;
}
/* pack the hostname and exec */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &pinfo[i].hostname, 1, PMIX_STRING))) {
return ret;
}
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &pinfo[i].executable_name, 1, PMIX_STRING))) {
return ret;
}
/* pack the pid and state */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_pid(buffer, &pinfo[i].pid, 1, PMIX_PID))) {
return ret;
}
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_pstate(buffer, &pinfo[i].state, 1, PMIX_PROC_STATE))) {
return ret;
}
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_data_array_t *p = (pmix_data_array_t*)src;
pmix_status_t ret;
int32_t i;
for (i=0; i < num_vals; i++) {
/* pack the actual type in the array */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_datatype(buffer, &p[i].type, 1, PMIX_DATA_TYPE))) {
return ret;
}
/* pack the number of array elements */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_sizet(buffer, &p[i].size, 1, PMIX_SIZE))) {
return ret;
}
if (0 == p[i].size || PMIX_UNDEF == p[i].type) {
/* nothing left to do */
continue;
}
/* pack the actual elements */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, p[i].array, p[i].size, p[i].type))) {
return ret;
}
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_pack_rank(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
return pmix_bfrop_pack_int32(buffer, src, num_vals, PMIX_UINT32);
}
pmix_status_t pmix_bfrop_pack_query(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_query_t *pq = (pmix_query_t*)src;
pmix_status_t ret;
int32_t i;
int32_t nkeys;
for (i=0; i < num_vals; i++) {
/* pack the number of keys */
nkeys = pmix_argv_count(pq[i].keys);
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int32(buffer, &nkeys, 1, PMIX_INT32))) {
return ret;
}
if (0 < nkeys) {
/* pack the keys */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, pq[i].keys, nkeys, PMIX_STRING))) {
return ret;
}
}
/* pack the number of qualifiers */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_sizet(buffer, &pq[i].nqual, 1, PMIX_SIZE))) {
return ret;
}
if (0 < pq[i].nqual) {
/* pack any provided qualifiers */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_info(buffer, pq[i].qualifiers, pq[i].nqual, PMIX_INFO))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_info_array_t *ptr;
int32_t i;
pmix_status_t ret;
ptr = (pmix_info_array_t *) src;
for (i = 0; i < num_vals; ++i) {
/* pack the size */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) {
return ret;
}
if (0 < ptr[i].size) {
/* pack the values */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
/********************/

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

@ -31,7 +31,7 @@
#endif
#include "src/util/error.h"
#include "src/include/pmix_globals.h"
#include "src/buffer_ops/internal.h"
pmix_status_t pmix_bfrop_print(char **output, char *prefix, void *src, pmix_data_type_t type)
@ -785,6 +785,9 @@ pmix_status_t pmix_bfrop_print_status(char **output, char *prefix,
}
switch (src->type) {
case PMIX_UNDEF:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_UNDEF", prefx);
break;
case PMIX_BYTE:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_BYTE\tValue: %x",
prefx, src->data.byte);
@ -853,10 +856,37 @@ pmix_status_t pmix_bfrop_print_status(char **output, char *prefix,
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_TIMEVAL\tValue: %ld.%06ld", prefx,
(long)src->data.tv.tv_sec, (long)src->data.tv.tv_usec);
break;
case PMIX_TIME:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_TIME\tValue: %s", prefx,
ctime(&src->data.time));
break;
case PMIX_STATUS:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_STATUS\tValue: %s", prefx,
PMIx_Error_string(src->data.status));
break;
case PMIX_PROC:
case PMIX_BYTE_OBJECT:
case PMIX_PERSIST:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_PERSIST\tValue: %d",
prefx, (int)src->data.persist);
break;
case PMIX_SCOPE:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_PERSIST\tValue: %d",
prefx, (int)src->data.persist);
break;
case PMIX_DATA_RANGE:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_PERSIST\tValue: %d",
prefx, (int)src->data.persist);
break;
case PMIX_PROC_STATE:
case PMIX_PROC_INFO:
case PMIX_DATA_ARRAY:
/**** DEPRECATED ****/
case PMIX_INFO_ARRAY:
rc = asprintf(output, "%sPMIX_VALUE: Data type: INFO_ARRAY\tARRAY SIZE: %ld",
prefx, (long)src->data.array.size);
break;
/********************/
default:
rc = asprintf(output, "%sPMIX_VALUE: Data type: UNKNOWN\tValue: UNPRINTABLE", prefx);
break;
@ -877,8 +907,8 @@ pmix_status_t pmix_bfrop_print_info(char **output, char *prefix,
int rc;
pmix_bfrop_print_value(&tmp, NULL, &src->value, PMIX_VALUE);
rc = asprintf(output, "%sKEY: %s REQD: %s %s", prefix, src->key,
src->required ? "Y" : "N", (NULL == tmp) ? "PMIX_VALUE: NULL" : tmp);
rc = asprintf(output, "%sKEY: %s DIRECTIVES: %0x %s", prefix, src->key,
src->flags, (NULL == tmp) ? "PMIX_VALUE: NULL" : tmp);
if (NULL != tmp) {
free(tmp);
}
@ -926,6 +956,7 @@ pmix_status_t pmix_bfrop_print_proc(char **output, char *prefix,
pmix_proc_t *src, pmix_data_type_t type)
{
char *prefx;
int rc;
/* deal with NULL prefix */
if (NULL == prefix) {
@ -936,7 +967,28 @@ pmix_status_t pmix_bfrop_print_proc(char **output, char *prefix,
prefx = prefix;
}
if (0 > asprintf(output, "%sPROC: %s:%d", prefx, src->nspace, src->rank)) {
switch(src->rank) {
case PMIX_RANK_UNDEF:
rc = asprintf(output,
"%sPROC: %s:PMIX_RANK_UNDEF", prefx, src->nspace);
break;
case PMIX_RANK_WILDCARD:
rc = asprintf(output,
"%sPROC: %s:PMIX_RANK_WILDCARD", prefx, src->nspace);
break;
case PMIX_RANK_LOCAL_NODE:
rc = asprintf(output,
"%sPROC: %s:PMIX_RANK_LOCAL_NODE", prefx, src->nspace);
break;
default:
rc = asprintf(output,
"%sPROC: %s:%lu", prefx, src->nspace,
(unsigned long)(src->rank));
}
if (prefx != prefix) {
free(prefx);
}
if (0 > rc) {
return PMIX_ERR_NOMEM;
}
return PMIX_SUCCESS;
@ -948,37 +1000,6 @@ pmix_status_t pmix_bfrop_print_kval(char **output, char *prefix,
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_print_array(char **output, char *prefix,
pmix_info_array_t *src, pmix_data_type_t type)
{
size_t j;
char *tmp, *tmp2, *tmp3, *pfx;
pmix_info_t *s1;
if (0 > asprintf(&tmp, "%sARRAY SIZE: %ld", prefix, (long)src->size)) {
return PMIX_ERR_NOMEM;
}
if (0 > asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix)) {
free(tmp);
return PMIX_ERR_NOMEM;
}
s1 = (pmix_info_t*)src->array;
for (j=0; j < src->size; j++) {
pmix_bfrop_print_info(&tmp2, pfx, &s1[j], PMIX_INFO);
if (0 > asprintf(&tmp3, "%s%s", tmp, tmp2)) {
free(tmp);
free(tmp2);
return PMIX_ERR_NOMEM;
}
free(tmp);
free(tmp2);
tmp = tmp3;
}
*output = tmp;
return PMIX_SUCCESS;
}
#if PMIX_HAVE_HWLOC
#define PMIX_HWLOC_MAX_STRING 2048
@ -1143,6 +1164,109 @@ pmix_status_t pmix_bfrop_print_persist(char **output, char *prefix, pmix_persist
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_print_scope(char **output, char *prefix,
pmix_scope_t *src,
pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) {
if (0 > asprintf(&prefx, " ")) {
return PMIX_ERR_NOMEM;
}
} else {
prefx = prefix;
}
if (0 > asprintf(output, "%sData type: PMIX_SCOPE\tValue: %s",
prefx, PMIx_Scope_string(*src))) {
return PMIX_ERR_NOMEM;
}
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_print_range(char **output, char *prefix,
pmix_data_range_t *src,
pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) {
if (0 > asprintf(&prefx, " ")) {
return PMIX_ERR_NOMEM;
}
} else {
prefx = prefix;
}
if (0 > asprintf(output, "%sData type: PMIX_DATA_RANGE\tValue: %s",
prefx, PMIx_Data_range_string(*src))) {
return PMIX_ERR_NOMEM;
}
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_print_cmd(char **output, char *prefix,
pmix_cmd_t *src,
pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) {
if (0 > asprintf(&prefx, " ")) {
return PMIX_ERR_NOMEM;
}
} else {
prefx = prefix;
}
if (0 > asprintf(output, "%sData type: PMIX_CMD\tValue: %s",
prefx, pmix_command_string(*src))) {
return PMIX_ERR_NOMEM;
}
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_print_infodirs(char **output, char *prefix,
pmix_info_directives_t *src,
pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) {
if (0 > asprintf(&prefx, " ")) {
return PMIX_ERR_NOMEM;
}
} else {
prefx = prefix;
}
if (0 > asprintf(output, "%sData type: PMIX_INFO_DIRECTIVES\tValue: %s",
prefx, PMIx_Info_directives_string(*src))) {
return PMIX_ERR_NOMEM;
}
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_print_bo(char **output, char *prefix,
pmix_byte_object_t *src, pmix_data_type_t type)
{
@ -1202,3 +1326,243 @@ pmix_status_t pmix_bfrop_print_ptr(char **output, char *prefix,
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_print_pstate(char **output, char *prefix,
pmix_proc_state_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) {
if (0 > asprintf(&prefx, " ")) {
return PMIX_ERR_NOMEM;
}
} else {
prefx = prefix;
}
if (0 > asprintf(output, "%sData type: PMIX_PROC_STATE\tValue: %s",
prefx, PMIx_Proc_state_string(*src))) {
return PMIX_ERR_NOMEM;
}
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_print_pinfo(char **output, char *prefix,
pmix_proc_info_t *src, pmix_data_type_t type)
{
char *prefx;
pmix_status_t rc = PMIX_SUCCESS;
char *p2, *tmp;
/* deal with NULL prefix */
if (NULL == prefix) {
if (0 > asprintf(&prefx, " ")) {
return PMIX_ERR_NOMEM;
}
} else {
prefx = prefix;
}
if (0 > asprintf(&p2, "%s\t", prefx)) {
rc = PMIX_ERR_NOMEM;
goto done;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop_print_proc(&tmp, p2, &src->proc, PMIX_PROC))) {
free(p2);
goto done;
}
if (0 > asprintf(output,
"%sData type: PMIX_PROC_INFO\tValue:\n%s\n%sHostname: %s\tExecutable: %s\n%sPid: %lu\tExit code: %d\tState: %s",
prefx, tmp, p2, src->hostname, src->executable_name,
p2, (unsigned long)src->pid, src->exit_code, PMIx_Proc_state_string(src->state))) {
free(p2);
rc = PMIX_ERR_NOMEM;
}
done:
if (prefx != prefix) {
free(prefx);
}
return rc;
}
pmix_status_t pmix_bfrop_print_darray(char **output, char *prefix,
pmix_data_array_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) {
if (0 > asprintf(&prefx, " ")) {
return PMIX_ERR_NOMEM;
}
} else {
prefx = prefix;
}
if (0 > asprintf(output, "%sData type: PMIX_DATA_ARRAY\tSize: %lu",
prefx, (unsigned long)src->size)) {
return PMIX_ERR_NOMEM;
}
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_print_query(char **output, char *prefix,
pmix_query_t *src, pmix_data_type_t type)
{
char *prefx, *p2;
pmix_status_t rc = PMIX_SUCCESS;
char *tmp, *t2, *t3;
size_t n;
/* deal with NULL prefix */
if (NULL == prefix) {
if (0 > asprintf(&prefx, " ")) {
return PMIX_ERR_NOMEM;
}
} else {
prefx = prefix;
}
if (0 > asprintf(&p2, "%s\t", prefx)) {
rc = PMIX_ERR_NOMEM;
goto done;
}
if (0 > asprintf(&tmp,
"%sData type: PMIX_QUERY\tValue:", prefx)) {
free(p2);
rc = PMIX_ERR_NOMEM;
goto done;
}
/* print out the keys */
if (NULL != src->keys) {
for (n=0; NULL != src->keys[n]; n++) {
if (0 > asprintf(&t2, "%s\n%sKey: %s", tmp, p2, src->keys[n])) {
free(p2);
free(tmp);
rc = PMIX_ERR_NOMEM;
goto done;
}
free(tmp);
tmp = t2;
}
}
/* now print the qualifiers */
if (0 < src->nqual) {
for (n=0; n < src->nqual; n++) {
if (PMIX_SUCCESS != (rc = pmix_bfrop_print_info(&t2, p2, &src->qualifiers[n], PMIX_PROC))) {
free(p2);
goto done;
}
if (0 > asprintf(&t3, "%s\n%s", tmp, t2)) {
free(p2);
free(tmp);
free(t2);
rc = PMIX_ERR_NOMEM;
goto done;
}
free(tmp);
free(t2);
tmp = t3;
}
}
*output = tmp;
done:
if (prefx != prefix) {
free(prefx);
}
return rc;
}
pmix_status_t pmix_bfrop_print_rank(char **output, char *prefix,
pmix_rank_t *src, pmix_data_type_t type)
{
char *prefx;
int rc;
/* deal with NULL prefix */
if (NULL == prefix) {
if (0 > asprintf(&prefx, " ")) {
return PMIX_ERR_NOMEM;
}
} else {
prefx = prefix;
}
switch(*src) {
case PMIX_RANK_UNDEF:
rc = asprintf(output,
"%sData type: PMIX_PROC_RANK\tValue: PMIX_RANK_UNDEF",
prefx);
break;
case PMIX_RANK_WILDCARD:
rc = asprintf(output,
"%sData type: PMIX_PROC_RANK\tValue: PMIX_RANK_WILDCARD",
prefx);
break;
case PMIX_RANK_LOCAL_NODE:
rc = asprintf(output,
"%sData type: PMIX_PROC_RANK\tValue: PMIX_RANK_LOCAL_NODE",
prefx);
break;
default:
rc = asprintf(output, "%sData type: PMIX_PROC_RANK\tValue: %lu",
prefx, (unsigned long)(*src));
}
if (prefx != prefix) {
free(prefx);
}
if (0 > rc) {
return PMIX_ERR_NOMEM;
}
return PMIX_SUCCESS;
}
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_print_array(char **output, char *prefix,
pmix_info_array_t *src, pmix_data_type_t type)
{
size_t j;
char *tmp, *tmp2, *tmp3, *pfx;
pmix_info_t *s1;
if (0 > asprintf(&tmp, "%sARRAY SIZE: %ld", prefix, (long)src->size)) {
return PMIX_ERR_NOMEM;
}
if (0 > asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix)) {
free(tmp);
return PMIX_ERR_NOMEM;
}
s1 = (pmix_info_t*)src->array;
for (j=0; j < src->size; j++) {
pmix_bfrop_print_info(&tmp2, pfx, &s1[j], PMIX_INFO);
if (0 > asprintf(&tmp3, "%s%s", tmp, tmp2)) {
free(tmp);
free(tmp2);
return PMIX_ERR_NOMEM;
}
free(tmp);
free(tmp2);
tmp = tmp3;
}
*output = tmp;
return PMIX_SUCCESS;
}
/********************/

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

@ -33,7 +33,8 @@
#include "src/buffer_ops/types.h"
#include "src/buffer_ops/internal.h"
pmix_status_t pmix_bfrop_unpack(pmix_buffer_t *buffer, void *dst, int32_t *num_vals,
pmix_status_t pmix_bfrop_unpack(pmix_buffer_t *buffer,
void *dst, int32_t *num_vals,
pmix_data_type_t type)
{
pmix_status_t rc, ret;
@ -330,7 +331,7 @@ pmix_status_t pmix_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest,
pmix_status_t pmix_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
return pmix_bfrop_unpack_int32(buffer, dest, num_vals, type);
return pmix_bfrop_unpack_int16(buffer, dest, num_vals, type);
}
pmix_status_t pmix_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest,
@ -619,26 +620,73 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
return ret;
}
break;
case PMIX_TIME:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.time, &m, PMIX_TIME))) {
return ret;
}
break;
case PMIX_STATUS:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.status, &m, PMIX_STATUS))) {
return ret;
}
break;
case PMIX_INFO_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.array, &m, PMIX_INFO_ARRAY))) {
return ret;
}
break;
case PMIX_BYTE_OBJECT:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.bo, &m, PMIX_BYTE_OBJECT))) {
return ret;
}
break;
case PMIX_PROC:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.proc, &m, PMIX_PROC))) {
return ret;
}
break;
case PMIX_PROC_RANK:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.rank, &m, PMIX_PROC_RANK))) {
return ret;
}
break;
case PMIX_BYTE_OBJECT:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.bo, &m, PMIX_BYTE_OBJECT))) {
return ret;
}
break;
case PMIX_PERSIST:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.proc, &m, PMIX_PROC))) {
return ret;
}
break;
case PMIX_SCOPE:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.scope, &m, PMIX_SCOPE))) {
return ret;
}
break;
case PMIX_DATA_RANGE:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.range, &m, PMIX_DATA_RANGE))) {
return ret;
}
break;
case PMIX_PROC_STATE:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.state, &m, PMIX_PROC_STATE))) {
return ret;
}
break;
case PMIX_PROC_INFO:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.pinfo, &m, PMIX_PROC_INFO))) {
return ret;
}
break;
case PMIX_DATA_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.darray, &m, PMIX_DATA_ARRAY))) {
return ret;
}
break;
case PMIX_QUERY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.darray, &m, PMIX_QUERY))) {
return ret;
}
break;
/**** DEPRECATED ****/
case PMIX_INFO_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.array, &m, PMIX_INFO_ARRAY))) {
return ret;
}
break;
/********************/
default:
pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type);
return PMIX_ERROR;
@ -651,7 +699,7 @@ pmix_status_t pmix_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_value_t *ptr;
int32_t i, m, n;
int32_t i, n;
pmix_status_t ret;
ptr = (pmix_value_t *) dest;
@ -659,8 +707,7 @@ pmix_status_t pmix_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest,
for (i = 0; i < n; ++i) {
/* unpack the type */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].type, &m, PMIX_INT))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &ptr[i].type))) {
return ret;
}
/* unpack value */
@ -699,9 +746,9 @@ pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
}
(void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);
free(tmp);
/* unpack the required flag */
/* unpack the flags */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_bool(buffer, &ptr[i].required, &m, PMIX_BOOL))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_infodirs(buffer, &ptr[i].flags, &m, PMIX_INFO_DIRECTIVES))) {
return ret;
}
/* unpack value - since the value structure is statically-defined
@ -840,7 +887,7 @@ pmix_status_t pmix_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest,
free(tmp);
/* unpack the rank */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].rank, &m, PMIX_INT))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_rank(buffer, &ptr[i].rank, &m, PMIX_PROC_RANK))) {
return ret;
}
}
@ -959,39 +1006,6 @@ pmix_status_t pmix_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest,
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_info_array_t *ptr;
int32_t i, n, m;
pmix_status_t ret;
pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: %d info arrays", *num_vals);
ptr = (pmix_info_array_t*) dest;
n = *num_vals;
for (i = 0; i < n; ++i) {
pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: init array[%d]", i);
memset(&ptr[i], 0, sizeof(pmix_info_array_t));
/* unpack the size of this array */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) {
return ret;
}
if (0 < ptr[i].size) {
ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t));
m=ptr[i].size;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_unpack_topo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals,
@ -1110,7 +1124,31 @@ pmix_status_t pmix_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest,
pmix_status_t pmix_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
return pmix_bfrop_unpack_int(buffer, dest, num_vals, PMIX_INT);
return pmix_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_unpack_scope(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
return pmix_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_unpack_range(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
return pmix_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_unpack_cmd(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
return pmix_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_unpack_infodirs(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
return pmix_bfrop_unpack_int32(buffer, dest, num_vals, PMIX_UINT32);
}
pmix_status_t pmix_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest,
@ -1155,3 +1193,260 @@ pmix_status_t pmix_bfrop_unpack_ptr(pmix_buffer_t *buffer, void *dest,
return pmix_bfrop_unpack_byte(buffer, &foo, &cnt, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_unpack_pstate(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
return pmix_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8);
}
pmix_status_t pmix_bfrop_unpack_pinfo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_proc_info_t *ptr;
int32_t i, n, m;
pmix_status_t ret;
pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: %d pinfo", *num_vals);
ptr = (pmix_proc_info_t *) dest;
n = *num_vals;
for (i = 0; i < n; ++i) {
PMIX_PROC_INFO_CONSTRUCT(&ptr[i]);
/* unpack the proc */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_proc(buffer, &ptr[i].proc, &m, PMIX_PROC))) {
return ret;
}
/* unpack the hostname */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &ptr[i].hostname, &m, PMIX_STRING))) {
return ret;
}
/* unpack the executable */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &ptr[i].executable_name, &m, PMIX_STRING))) {
return ret;
}
/* unpack pid */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_pid(buffer, &ptr[i].pid, &m, PMIX_PID))) {
return ret;
}
/* unpack state */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_pstate(buffer, &ptr[i].state, &m, PMIX_PROC_STATE))) {
return ret;
}
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_data_array_t *ptr;
int32_t i, n, m;
pmix_status_t ret;
size_t nbytes;
pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: %d data arrays", *num_vals);
ptr = (pmix_data_array_t *) dest;
n = *num_vals;
for (i = 0; i < n; ++i) {
memset(&ptr[i], 0, sizeof(pmix_data_array_t));
/* unpack the type */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_datatype(buffer, &ptr[i].type, &m, PMIX_DATA_TYPE))) {
return ret;
}
/* unpack the number of array elements */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) {
return ret;
}
if (0 == ptr[i].size || PMIX_UNDEF == ptr[i].type) {
/* nothing else to do */
continue;
}
/* allocate storage for the array and unpack the array elements */
m = ptr[i].size;
switch(ptr[i].type) {
case PMIX_BOOL:
nbytes = sizeof(bool);
break;
case PMIX_BYTE:
case PMIX_INT8:
case PMIX_UINT8:
nbytes = sizeof(int8_t);
break;
case PMIX_INT16:
case PMIX_UINT16:
nbytes = sizeof(int16_t);
break;
case PMIX_INT32:
case PMIX_UINT32:
nbytes = sizeof(int32_t);
break;
case PMIX_INT64:
case PMIX_UINT64:
nbytes = sizeof(int64_t);
break;
case PMIX_STRING:
nbytes = sizeof(char*);
break;
case PMIX_SIZE:
nbytes = sizeof(size_t);
break;
case PMIX_PID:
nbytes = sizeof(pid_t);
break;
case PMIX_INT:
case PMIX_UINT:
nbytes = sizeof(int);
break;
case PMIX_FLOAT:
nbytes = sizeof(float);
break;
case PMIX_DOUBLE:
nbytes = sizeof(double);
break;
case PMIX_TIMEVAL:
nbytes = sizeof(struct timeval);
break;
case PMIX_TIME:
nbytes = sizeof(time_t);
break;
case PMIX_STATUS:
nbytes = sizeof(pmix_status_t);
break;
case PMIX_PROC:
nbytes = sizeof(pmix_proc_t);
break;
case PMIX_BYTE_OBJECT:
nbytes = sizeof(pmix_byte_object_t);
break;
case PMIX_PERSIST:
nbytes = sizeof(pmix_persistence_t);
break;
case PMIX_SCOPE:
nbytes = sizeof(pmix_scope_t);
break;
case PMIX_DATA_RANGE:
nbytes = sizeof(pmix_data_range_t);
break;
case PMIX_PROC_STATE:
nbytes = sizeof(pmix_proc_state_t);
break;
case PMIX_PROC_INFO:
nbytes = sizeof(pmix_proc_info_t);
break;
case PMIX_QUERY:
nbytes = sizeof(pmix_query_t);
default:
return PMIX_ERR_NOT_SUPPORTED;
}
if (NULL == (ptr[i].array = malloc(m * nbytes))) {
return PMIX_ERR_NOMEM;
}
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, ptr[i].array, &m, ptr[i].type))) {
return ret;
}
}
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_unpack_rank(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
return pmix_bfrop_unpack_int32(buffer, dest, num_vals, PMIX_UINT32);
}
pmix_status_t pmix_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_query_t *ptr;
int32_t i, n, m;
pmix_status_t ret;
int32_t nkeys;
pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: %d queries", *num_vals);
ptr = (pmix_query_t *) dest;
n = *num_vals;
for (i = 0; i < n; ++i) {
PMIX_QUERY_CONSTRUCT(&ptr[i]);
/* unpack the number of keys */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int32(buffer, &nkeys, &m, PMIX_INT32))) {
return ret;
}
if (0 < nkeys) {
/* unpack the keys */
if (NULL == (ptr[i].keys = (char**)calloc(nkeys+1, sizeof(char*)))) {
return PMIX_ERR_NOMEM;
}
/* unpack keys */
m=nkeys;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, ptr[i].keys, &m, PMIX_STRING))) {
return ret;
}
}
/* unpack the number of qualifiers */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_sizet(buffer, &ptr[i].nqual, &m, PMIX_SIZE))) {
return ret;
}
if (0 < ptr[i].nqual) {
/* unpack the qualifiers */
PMIX_INFO_CREATE(ptr[i].qualifiers, ptr[i].nqual);
m = ptr[i].nqual;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_info(buffer, ptr[i].qualifiers, &m, PMIX_INFO))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
/**** DEPRECATED ****/
pmix_status_t pmix_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_info_array_t *ptr;
int32_t i, n, m;
pmix_status_t ret;
pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: %d info arrays", *num_vals);
ptr = (pmix_info_array_t*) dest;
n = *num_vals;
for (i = 0; i < n; ++i) {
pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: init array[%d]", i);
memset(&ptr[i], 0, sizeof(pmix_info_array_t));
/* unpack the size of this array */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) {
return ret;
}
if (0 < ptr[i].size) {
ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t));
m=ptr[i].size;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
/********************/

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

@ -88,6 +88,7 @@ static void pmix_client_notify_recv(struct pmix_peer_t *peer, pmix_usock_hdr_t *
int32_t cnt;
pmix_cmd_t cmd;
pmix_event_chain_t *chain;
size_t ninfo;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:client_notify_recv - processing event");
@ -104,7 +105,7 @@ static void pmix_client_notify_recv(struct pmix_peer_t *peer, pmix_usock_hdr_t *
}
/* unpack the status */
cnt=1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &chain->status, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &chain->status, &cnt, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
goto error;
}
@ -118,18 +119,25 @@ static void pmix_client_notify_recv(struct pmix_peer_t *peer, pmix_usock_hdr_t *
/* unpack the info that might have been provided */
cnt=1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &chain->ninfo, &cnt, PMIX_SIZE))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ninfo, &cnt, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
goto error;
}
if (0 < chain->ninfo) {
/* we always leave space for a callback object */
chain->ninfo = ninfo + 1;
PMIX_INFO_CREATE(chain->info, chain->ninfo);
cnt = chain->ninfo;
if (0 < ninfo) {
cnt = ninfo;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, chain->info, &cnt, PMIX_INFO))) {
PMIX_ERROR_LOG(rc);
goto error;
}
}
/* now put the callback object tag in the last element */
PMIX_INFO_LOAD(&chain->info[ninfo], PMIX_EVENT_RETURN_OBJECT, NULL, PMIX_POINTER);
pmix_output_verbose(2, pmix_globals.debug_output,
"[%s:%d] pmix:client_notify_recv - processing event %d, calling errhandler",
pmix_globals.myid.nspace, pmix_globals.myid.rank, chain->status);
@ -548,7 +556,7 @@ PMIX_EXPORT pmix_status_t PMIx_Abort(int flag, const char msg[],
return rc;
}
/* pack the status flag */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(bfr, &flag, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(bfr, &flag, 1, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bfr);
return rc;
@ -1106,7 +1114,7 @@ void pmix_client_process_nspace_blob(const char *nspace, pmix_buffer_t *bptr)
PMIX_RELEASE(kptr);
/* start by unpacking the rank */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(&buf2, &rank, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(&buf2, &rank, &cnt, PMIX_PROC_RANK))) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&buf2);
return;
@ -1114,8 +1122,8 @@ void pmix_client_process_nspace_blob(const char *nspace, pmix_buffer_t *bptr)
kp2 = PMIX_NEW(pmix_kval_t);
kp2->key = strdup(PMIX_RANK);
PMIX_VALUE_CREATE(kp2->value, 1);
kp2->value->type = PMIX_INT;
kp2->value->data.integer = rank;
kp2->value->type = PMIX_PROC_RANK;
kp2->value->data.rank = rank;
if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, rank, kp2))) {
PMIX_ERROR_LOG(rc);
}

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

@ -298,7 +298,7 @@ static void wait_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
/* unpack the returned status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
ret = rc;
}

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

@ -177,7 +177,7 @@ static pmix_status_t unpack_return(pmix_buffer_t *data)
/* unpack the status code */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(data, &ret, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(data, &ret, &cnt, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
return rc;
}

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

@ -60,7 +60,7 @@
#include "pmix_client_ops.h"
static pmix_buffer_t* _pack_get(char *nspace, int rank,
static pmix_buffer_t* _pack_get(char *nspace, pmix_rank_t rank,
const pmix_info_t info[], size_t ninfo,
pmix_cmd_t cmd);
@ -155,7 +155,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char *key,
}
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: get_nb value for proc %s:%d key %s",
"pmix: get_nb value for proc %s:%u key %s",
nm, rank, (NULL == key) ? "NULL" : key);
/* thread-shift so we can check global objects */
@ -187,7 +187,7 @@ static void _value_cbfunc(pmix_status_t status, pmix_value_t *kv, void *cbdata)
cb->active = false;
}
static pmix_buffer_t* _pack_get(char *nspace, int rank,
static pmix_buffer_t* _pack_get(char *nspace, pmix_rank_t rank,
const pmix_info_t info[], size_t ninfo,
pmix_cmd_t cmd)
{
@ -209,7 +209,7 @@ static pmix_buffer_t* _pack_get(char *nspace, int rank,
PMIX_RELEASE(msg);
return NULL;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &rank, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &rank, 1, PMIX_PROC_RANK))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
return NULL;
@ -242,8 +242,8 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
pmix_value_t *val = NULL;
int32_t cnt;
pmix_nspace_t *ns, *nptr;
int rank;
int cur_rank;
pmix_rank_t rank;
pmix_rank_t cur_rank;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: get_nb callback recvd");
@ -259,7 +259,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
/* unpack the status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
return;
}
@ -290,7 +290,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
* unpack and store it in the modex - this could consist
* of buffers from multiple scopes */
cnt = 1;
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(buf, &cur_rank, &cnt, PMIX_INT))) {
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(buf, &cur_rank, &cnt, PMIX_PROC_RANK))) {
pmix_kval_t *cur_kval;
pmix_buffer_t *bptr;
@ -387,6 +387,53 @@ done:
}
}
static pmix_status_t process_val(pmix_value_t *val,
size_t *num_vals,
pmix_pointer_array_t *results)
{
pmix_info_t *info;
size_t n, nsize, nvals;
if (NULL == val) {
/* this is an error */
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return PMIX_ERR_BAD_PARAM;
}
/* since we didn't provide them with a key, the hash function
* must return the results in the pmix_data_array field of the
* value */
/* must account for the deprecated pmix_info_array_t */
if (PMIX_DATA_ARRAY != val->type &&
PMIX_INFO_ARRAY != val->type) {
/* this is an error */
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return PMIX_ERR_BAD_PARAM;
}
/* save the results */
if (PMIX_DATA_ARRAY == val->type) {
info = (pmix_info_t*)val->data.darray.array;
nsize = val->data.darray.size;
} else {
info = (pmix_info_t*)val->data.array.array;
nsize = val->data.array.size;
}
nvals = 0;
for (n=0; n < nsize; n++) {
pmix_pointer_array_add(results, &info[n]);
++nvals;
}
if (PMIX_DATA_ARRAY == val->type) {
val->data.darray.array = NULL; // protect the data
val->data.darray.size = 0;
} else {
val->data.array.array = NULL;
val->data.array.size = 0;
}
/* increment the number of values */
(*num_vals) += nvals;
return PMIX_SUCCESS;
}
static void _getnbfn(int fd, short flags, void *cbdata)
{
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
@ -444,28 +491,17 @@ static void _getnbfn(int fd, short flags, void *cbdata)
#endif /* PMIX_ENABLE_DSTORE */
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_get[%d]: value retrieved from dstore", __LINE__);
/* since we didn't provide them with a key, the hash function
* must return the results in the pmix_info_array field of the
* value */
if (NULL == val || PMIX_INFO_ARRAY != val->type) {
/* this is an error */
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
cb->value_cbfunc(PMIX_ERR_BAD_PARAM, NULL, cb->cbdata);
PMIX_RELEASE(cb);
return;
}
/* save the results */
info = (pmix_info_t*)val->data.array.array;
for (n=0; n < val->data.array.size; n++) {
pmix_pointer_array_add(&results, &info[n]);
++nvals;
}
val->data.array.array = NULL; // protect the data
val->data.array.size = 0;
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
cb->value_cbfunc(rc, NULL, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
}
PMIX_RELEASE(cb);
return;
}
/* cleanup */
PMIX_VALUE_RELEASE(val);
} else {
/* if we didn't find a modex for this rank, then we need
* to go get it. Thus, the caller wants -all- information for
@ -475,35 +511,25 @@ static void _getnbfn(int fd, short flags, void *cbdata)
}
/* now get any data from the job-level info */
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, PMIX_RANK_WILDCARD, NULL, &val))) {
/* since we didn't provide them with a key, the hash function
* must return the results in the pmix_info_array field of the
* value */
if (NULL == val || PMIX_INFO_ARRAY != val->type) {
/* this is an error */
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
cb->value_cbfunc(PMIX_ERR_BAD_PARAM, NULL, cb->cbdata);
PMIX_RELEASE(cb);
return;
}
/* save the results */
info = (pmix_info_t*)val->data.array.array;
for (n=0; n < val->data.array.size; n++) {
pmix_pointer_array_add(&results, &info[n]);
++nvals;
}
val->data.array.array = NULL; // protect the data
val->data.array.size = 0;
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
cb->value_cbfunc(rc, NULL, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
}
PMIX_RELEASE(cb);
return;
}
/* cleanup */
PMIX_VALUE_RELEASE(val);
}
/* now let's package up the results */
PMIX_VALUE_CREATE(val, 1);
val->type = PMIX_INFO_ARRAY;
val->data.array.size = nvals;
val->type = PMIX_DATA_ARRAY;
val->data.darray.type = PMIX_INFO;
val->data.darray.size = nvals;
PMIX_INFO_CREATE(iptr, nvals);
val->data.array.array = (pmix_info_t*)iptr;
val->data.darray.array = (void*)iptr;
for (n=0; n < (size_t)results.size && n < nvals; n++) {
if (NULL != (info = (pmix_info_t*)pmix_pointer_array_get_item(&results, n))) {
(void)strncpy(iptr[n].key, info->key, PMIX_MAX_KEYLEN);

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

@ -412,7 +412,7 @@ static void wait_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
/* unpack the returned status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
}
if (NULL != cb->op_cbfunc) {
@ -454,7 +454,7 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
/* unpack the returned status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
ret = rc;
}

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

@ -193,7 +193,7 @@ static void wait_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
/* unpack the returned status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
ret = rc;
}

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

@ -8,4 +8,6 @@
#
sources += \
src/common/pmix_query.c
src/common/pmix_query.c \
src/common/pmix_strings.c \
src/common/pmix_log.c

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

@ -0,0 +1,130 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <src/include/types.h>
#include <pmix/autogen/pmix_stdint.h>
#include <src/include/pmix_socket_errno.h>
#include <pmix.h>
#include <pmix/pmix_common.h>
#include <pmix_server.h>
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/usock/usock.h"
#include "src/client/pmix_client_ops.h"
#include "src/server/pmix_server_ops.h"
#include "src/include/pmix_globals.h"
static void log_cbfunc(struct pmix_peer_t *peer,
pmix_usock_hdr_t *hdr,
pmix_buffer_t *buf, void *cbdata)
{
pmix_shift_caddy_t *cd = (pmix_shift_caddy_t*)cbdata;
int32_t m;
pmix_status_t rc, status;
/* unpack the return status */
m=1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &status, &m, PMIX_STATUS))) {
status = rc;
}
if (NULL != cd->cbfunc.opcbfn) {
cd->cbfunc.opcbfn(status, cd->cbdata);
}
PMIX_RELEASE(cd);
}
PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata,
const pmix_info_t directives[], size_t ndirs,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_shift_caddy_t *cd;
pmix_cmd_t cmd = PMIX_LOG_CMD;
pmix_buffer_t *msg;
pmix_status_t rc;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:log non-blocking");
if (pmix_globals.init_cntr <= 0) {
return PMIX_ERR_INIT;
}
if (0 == ndata || NULL == data) {
return PMIX_ERR_BAD_PARAM;
}
/* if we are the server, then we just log and
* return the response */
if (pmix_globals.server) {
if (NULL == pmix_host_server.log) {
/* nothing we can do */
return PMIX_ERR_NOT_SUPPORTED;
}
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query handed to RM");
pmix_host_server.log(&pmix_globals.myid,
data, ndata, directives, ndirs,
cbfunc, cbdata);
} else {
/* if we are a client, then relay this request to the server */
cd = PMIX_NEW(pmix_shift_caddy_t);
cd->cbfunc.opcbfn = cbfunc;
cd->cbdata = cbdata;
msg = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ndata, 1, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, data, ndata, PMIX_INFO))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ndirs, 1, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (0 < ndirs) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, data, ndata, PMIX_INFO))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
}
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query sending to server");
PMIX_ACTIVATE_SEND_RECV(&pmix_client_globals.myserver, msg, log_cbfunc, cd);
}
return PMIX_SUCCESS;
}

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

@ -30,54 +30,9 @@
#include "src/server/pmix_server_ops.h"
#include "src/include/pmix_globals.h"
static void wait_cbfunc(pmix_status_t status,
pmix_info_t *info, size_t ninfo,
void *cbdata,
pmix_release_cbfunc_t release_fn,
void *release_cbdata);
PMIX_EXPORT pmix_status_t PMIx_Query_info(pmix_info_t *info, size_t ninfo)
{
pmix_query_caddy_t *cd;
pmix_status_t rc, ret;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query blocking version");
if (pmix_globals.init_cntr <= 0) {
return PMIX_ERR_INIT;
}
/* prep the caddy */
cd = PMIX_NEW(pmix_query_caddy_t);
cd->cbfunc = wait_cbfunc;
cd->cbdata = cd;
/* Use the non-blocking form as our engine */
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query requesting %d values",
(int)ninfo);
cd->info = info;
cd->ninfo = ninfo;
cd->active = true;
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(cd->info, cd->ninfo, NULL, 0, wait_cbfunc, cd))) {
PMIX_RELEASE(cd);
return rc;
}
PMIX_WAIT_FOR_COMPLETION(cd->active);
if (PMIX_ERR_NOT_FOUND == cd->status) {
PMIX_RELEASE(cd);
return PMIX_ERR_NOT_FOUND;
}
/* the RM always returns the data in the info array*/
ret = cd->status;
PMIX_RELEASE(cd);
return ret;
}
static void relcbfunc(void *cbdata)
{
pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata;
pmix_shift_caddy_t *cd = (pmix_shift_caddy_t*)cbdata;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query release callback");
@ -93,13 +48,13 @@ static void query_cbfunc(struct pmix_peer_t *peer,
{
pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata;
pmix_status_t rc;
pmix_query_caddy_t *results;
pmix_shift_caddy_t *results;
int cnt;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query cback from server");
results = PMIX_NEW(pmix_query_caddy_t);
results = PMIX_NEW(pmix_shift_caddy_t);
/* unpack the status */
cnt = 1;
@ -136,8 +91,7 @@ static void query_cbfunc(struct pmix_peer_t *peer,
PMIX_RELEASE(cd);
}
PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_info_t info[], size_t ninfo,
pmix_info_t *directives, size_t ndirectives,
PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nqueries,
pmix_info_cbfunc_t cbfunc, void *cbdata)
{
@ -153,7 +107,7 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_info_t info[], size_t ninfo,
return PMIX_ERR_INIT;
}
if (0 == ninfo || NULL == info) {
if (0 == nqueries || NULL == queries) {
return PMIX_ERR_BAD_PARAM;
}
@ -167,8 +121,7 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_info_t info[], size_t ninfo,
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query handed to RM");
pmix_host_server.query(&pmix_globals.myid,
info, ninfo,
directives, ndirectives,
queries, nqueries,
cbfunc, cbdata);
} else {
/* if we are a client, then relay this request to the server */
@ -182,70 +135,21 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_info_t info[], size_t ninfo,
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &nqueries, 1, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, info, ninfo, PMIX_INFO))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, queries, nqueries, PMIX_QUERY))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ndirectives, 1, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
if (0 < ndirectives) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, directives, ndirectives, PMIX_INFO))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(msg);
PMIX_RELEASE(cd);
return rc;
}
}
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query sending to server");
PMIX_ACTIVATE_SEND_RECV(&pmix_client_globals.myserver, msg, query_cbfunc, cd);
}
return PMIX_SUCCESS;
}
static void wait_cbfunc(pmix_status_t status,
pmix_info_t *results, size_t nresults,
void *cbdata,
pmix_release_cbfunc_t release_fn,
void *release_cbdata)
{
pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata;
size_t n, m;
pmix_status_t rc;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query wait callback");
cd->status = status;
/* transfer the results across to our query - while these _should_
* be in the same order as our query, there is no _guarantee_ that
* this is true, so we have to do a search */
for (n=0; n < nresults; n++) {
for (m=0; m < cd->ninfo; m++) {
if (0 == strncmp(results[n].key, cd->info[m].key, PMIX_MAX_KEYLEN)) {
if (PMIX_SUCCESS != (rc = pmix_value_xfer(&cd->info[m].value, &results[n].value))) {
cd->status = rc;
goto complete;
}
break;
}
}
}
complete:
cd->relcbfunc = release_fn;
cd->cbdata = release_cbdata;
cd->active = false;
}

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

@ -0,0 +1,205 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <errno.h>
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <pmix/pmix_common.h>
#include "src/buffer_ops/internal.h"
#include "src/include/pmix_globals.h"
const char* PMIx_Proc_state_string(pmix_proc_state_t state)
{
switch(state) {
case PMIX_PROC_STATE_UNDEF:
return "UNDEFINED";
case PMIX_PROC_STATE_PREPPED:
return "PREPPED FOR LAUNCH";
case PMIX_PROC_STATE_LAUNCH_UNDERWAY:
return "LAUNCH UNDERWAY";
case PMIX_PROC_STATE_RESTART:
return "PROC READY FOR RESTART";
case PMIX_PROC_STATE_TERMINATE:
return "PROC MARKED FOR TERMINATION";
case PMIX_PROC_STATE_RUNNING:
return "PROC EXECUTING";
case PMIX_PROC_STATE_CONNECTED:
return "PROC HAS CONNECTED TO LOCAL PMIX SERVER";
case PMIX_PROC_STATE_UNTERMINATED:
return "PROC HAS NOT TERMINATED";
case PMIX_PROC_STATE_TERMINATED:
return "PROC HAS TERMINATED";
case PMIX_PROC_STATE_ERROR:
return "PROC ERROR";
case PMIX_PROC_STATE_KILLED_BY_CMD:
return "PROC KILLED BY CMD";
case PMIX_PROC_STATE_ABORTED:
return "PROC ABNORMALLY ABORTED";
case PMIX_PROC_STATE_FAILED_TO_START:
return "PROC FAILED TO START";
case PMIX_PROC_STATE_ABORTED_BY_SIG:
return "PROC ABORTED BY SIGNAL";
case PMIX_PROC_STATE_TERM_WO_SYNC:
return "PROC TERMINATED WITHOUT CALLING PMIx_Finalize";
case PMIX_PROC_STATE_COMM_FAILED:
return "PROC LOST COMMUNICATION";
case PMIX_PROC_STATE_CALLED_ABORT:
return "PROC CALLED PMIx_Abort";
case PMIX_PROC_STATE_MIGRATING:
return "PROC WAITING TO MIGRATE";
case PMIX_PROC_STATE_CANNOT_RESTART:
return "PROC CANNOT BE RESTARTED";
case PMIX_PROC_STATE_TERM_NON_ZERO:
return "PROC TERMINATED WITH NON-ZERO STATUS";
case PMIX_PROC_STATE_FAILED_TO_LAUNCH:
return "PROC FAILED TO LAUNCH";
default:
return "UNKNOWN STATE";
}
}
const char* PMIx_Scope_string(pmix_scope_t scope)
{
switch(scope) {
case PMIX_SCOPE_UNDEF:
return "UNDEFINED";
case PMIX_LOCAL:
return "SHARE ON LOCAL NODE ONLY";
case PMIX_REMOTE:
return "SHARE ON REMOTE NODES ONLY";
case PMIX_GLOBAL:
return "SHARE ACROSS ALL NODES";
default:
return "UNKNOWN SCOPE";
}
}
const char* PMIx_Persistence_string(pmix_persistence_t persist)
{
switch(persist) {
case PMIX_PERSIST_INDEF:
return "INDEFINITE";
case PMIX_PERSIST_FIRST_READ:
return "DELETE ON FIRST ACCESS";
case PMIX_PERSIST_PROC:
return "RETAIN UNTIL PUBLISHING PROCESS TERMINATES";
case PMIX_PERSIST_APP:
return "RETAIN UNTIL APPLICATION OF PUBLISHING PROCESS TERMINATES";
case PMIX_PERSIST_SESSION:
return "RETAIN UNTIL ALLOCATION OF PUBLISHING PROCESS TERMINATES";
default:
return "UNKNOWN PERSISTENCE";
}
}
const char* PMIx_Data_range_string(pmix_data_range_t range)
{
switch(range) {
case PMIX_RANGE_UNDEF:
return "UNDEFINED";
case PMIX_RANGE_RM:
return "INTENDED FOR HOST RESOURCE MANAGER ONLY";
case PMIX_RANGE_LOCAL:
return "AVAIL ON LOCAL NODE ONLY";
case PMIX_RANGE_NAMESPACE:
return "AVAIL TO PROCESSES IN SAME JOB ONLY";
case PMIX_RANGE_SESSION:
return "AVAIL TO PROCESSES IN SAME ALLOCATION ONLY";
case PMIX_RANGE_GLOBAL:
return "AVAIL TO ANYONE WITH AUTHORIZATION";
case PMIX_RANGE_CUSTOM:
return "AVAIL AS SPECIFIED IN DIRECTIVES";
default:
return "UNKNOWN";
}
}
const char* PMIx_Info_directives_string(pmix_info_directives_t directives)
{
switch(directives) {
case PMIX_INFO_REQD:
return "REQUIRED";
default:
return "UNSPECIFIED";
}
}
const char* pmix_command_string(pmix_cmd_t cmd)
{
switch(cmd) {
case PMIX_REQ_CMD:
return "REQUEST INIT INFO";
case PMIX_ABORT_CMD:
return "ABORT";
case PMIX_COMMIT_CMD:
return "COMMIT";
case PMIX_FENCENB_CMD:
return "FENCE";
case PMIX_GETNB_CMD:
return "GET";
case PMIX_FINALIZE_CMD:
return "FINALIZE";
case PMIX_PUBLISHNB_CMD:
return "PUBLISH";
case PMIX_LOOKUPNB_CMD:
return "LOOKUP";
case PMIX_UNPUBLISHNB_CMD:
return "UNPUBLISH";
case PMIX_SPAWNNB_CMD:
return "SPAWN";
case PMIX_CONNECTNB_CMD:
return "CONNECT";
case PMIX_DISCONNECTNB_CMD:
return "DISCONNECT";
case PMIX_NOTIFY_CMD:
return "NOTIFY";
case PMIX_REGEVENTS_CMD:
return "REGISTER EVENT HANDLER";
case PMIX_DEREGEVENTS_CMD:
return "DEREGISTER EVENT HANDLER";
case PMIX_QUERY_CMD:
return "QUERY";
default:
return "UNKNOWN";
}
}
const char* PMIx_Data_type_string(pmix_data_type_t type)
{
pmix_bfrop_type_info_t *info;
if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&pmix_bfrop_types, type))) {
return "UNKNOWN";
}
if (NULL == info->odti_name) {
return "UNKNOWN";
}
return info->odti_name;
}

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

@ -1,6 +1,7 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -23,8 +24,10 @@ BEGIN_C_DECLS
int pmix_dstore_init(void);
void pmix_dstore_finalize(void);
int pmix_dstore_store(const char *nspace, int rank, pmix_kval_t *kv);
int pmix_dstore_fetch(const char *nspace, int rank, const char *key, pmix_value_t **kvs);
int pmix_dstore_store(const char *nspace,
int rank, pmix_kval_t *kv);
int pmix_dstore_fetch(const char *nspace, int rank,
const char *key, pmix_value_t **kvs);
/**
* Initialize the module. Returns an error if the module cannot
@ -49,7 +52,9 @@ typedef int (*pmix_dstore_base_module_fini_fn_t)(void);
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstore_base_module_store_fn_t)(const char *nspace, int rank, pmix_kval_t *kv);
typedef int (*pmix_dstore_base_module_store_fn_t)(const char *nspace,
pmix_rank_t rank,
pmix_kval_t *kv);
/**
* fetch value in datastore.
@ -62,7 +67,10 @@ typedef int (*pmix_dstore_base_module_store_fn_t)(const char *nspace, int rank,
*
* @return kvs(key/value pair) and PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstrore_base_module_fetch_fn_t)(const char *nspace, int rank, const char *key, pmix_value_t **kvs);
typedef int (*pmix_dstrore_base_module_fetch_fn_t)(const char *nspace,
pmix_rank_t rank,
const char *key,
pmix_value_t **kvs);
/**

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

@ -38,6 +38,7 @@ typedef struct {
size_t index;
pmix_status_t code;
pmix_notification_fn_t evhdlr;
void *cbobject;
} pmix_single_event_t;
PMIX_CLASS_DECLARATION(pmix_single_event_t);
@ -51,6 +52,7 @@ typedef struct {
pmix_status_t *codes;
size_t ncodes;
pmix_notification_fn_t evhdlr;
void *cbobject;
} pmix_multi_event_t;
PMIX_CLASS_DECLARATION(pmix_multi_event_t);
@ -60,6 +62,7 @@ typedef struct {
char *name;
size_t index;
pmix_notification_fn_t evhdlr;
void *cbobject;
} pmix_default_event_t;
PMIX_CLASS_DECLARATION(pmix_default_event_t);

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

@ -226,6 +226,8 @@ static void progress_local_event_hdlr(pmix_status_t status,
if (sing->code == chain->status) {
PMIX_RETAIN(chain);
chain->sing = sing;
/* add any cbobject - the info struct for it is at the end */
chain->info[chain->ninfo-1].value.data.ptr = sing->cbobject;
sing->evhdlr(sing->index,
chain->status, &chain->source,
chain->info, chain->ninfo,
@ -251,6 +253,8 @@ static void progress_local_event_hdlr(pmix_status_t status,
* callback function to our progression function */
PMIX_RETAIN(chain);
chain->multi = multi;
/* add any cbobject - the info struct for it is at the end */
chain->info[chain->ninfo-1].value.data.ptr = multi->cbobject;
multi->evhdlr(multi->index,
chain->status, &chain->source,
chain->info, chain->ninfo,
@ -277,6 +281,8 @@ static void progress_local_event_hdlr(pmix_status_t status,
def = (pmix_default_event_t*)nxt;
PMIX_RETAIN(chain);
chain->def = def;
/* add any cbobject - the info struct for it is at the end */
chain->info[chain->ninfo-1].value.data.ptr = def->cbobject;
def->evhdlr(def->index,
chain->status, &chain->source,
chain->info, chain->ninfo,
@ -332,6 +338,8 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain)
* callback function to our progression function */
PMIX_RETAIN(chain);
chain->sing = sing;
/* add any cbobject - the info struct for it is at the end */
chain->info[chain->ninfo-1].value.data.ptr = sing->cbobject;
pmix_output_verbose(2, pmix_globals.debug_output,
"[%s:%d] CALLING SINGLE EVHDLR",
pmix_globals.myid.nspace, pmix_globals.myid.rank);
@ -353,6 +361,8 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain)
* callback function to our progression function */
PMIX_RETAIN(chain);
chain->multi = multi;
/* add any cbobject - the info struct for it is at the end */
chain->info[chain->ninfo-1].value.data.ptr = multi->cbobject;
pmix_output_verbose(2, pmix_globals.debug_output,
"[%s:%d] CALLING MULTI EVHDLR",
pmix_globals.myid.nspace, pmix_globals.myid.rank);
@ -375,6 +385,8 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain)
PMIX_LIST_FOREACH(def, &pmix_globals.events.default_events, pmix_default_event_t) {
PMIX_RETAIN(chain);
chain->def = def;
/* add any cbobject - the info struct for it is at the end */
chain->info[chain->ninfo-1].value.data.ptr = def->cbobject;
pmix_output_verbose(2, pmix_globals.debug_output,
"[%s:%d] CALLING DEFAULT EVHDLR",
pmix_globals.myid.nspace, pmix_globals.myid.rank);
@ -493,7 +505,7 @@ static pmix_status_t notify_client_of_event(pmix_status_t status,
}
/* pack the status */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(cd->buf, &status, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(cd->buf, &status, 1, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cd);
return rc;
@ -539,6 +551,7 @@ static void sevcon(pmix_single_event_t *p)
{
p->name = NULL;
p->evhdlr = NULL;
p->cbobject = NULL;
}
static void sevdes(pmix_single_event_t *p)
{
@ -556,6 +569,7 @@ static void mevcon(pmix_multi_event_t *p)
p->codes = NULL;
p->ncodes = 0;
p->evhdlr = NULL;
p->cbobject = NULL;
}
static void mevdes(pmix_multi_event_t *p)
{
@ -574,6 +588,7 @@ static void devcon(pmix_default_event_t *p)
{
p->name = NULL;
p->evhdlr = NULL;
p->cbobject = NULL;
}
static void devdes(pmix_default_event_t *p)
{

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

@ -284,6 +284,7 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
char *name = NULL;
pmix_list_t xfer;
pmix_info_caddy_t *ixfer;
void *cbobject = NULL;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: register event_hdlr with %d infos", (int)cd->ninfo);
@ -301,6 +302,8 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
name = cd->info[n].value.data.string;
} else if (0 == strcmp(cd->info[n].key, PMIX_EVENT_ENVIRO_LEVEL)) {
cd->enviro = cd->info[n].value.data.flag;
} else if (0 == strcmp(cd->info[n].key, PMIX_EVENT_RETURN_OBJECT)) {
cbobject = cd->info[n].value.data.ptr;
} else {
ixfer = PMIX_NEW(pmix_info_caddy_t);
ixfer->info = &cd->info[n];
@ -320,6 +323,7 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
++pmix_globals.events.nhdlrs;
def->index = index;
def->evhdlr = cd->evhdlr;
def->cbobject = cbobject;
rc = _add_hdlr(&pmix_globals.events.default_events, &def->super,
index, prepend, &xfer, cd);
PMIX_LIST_DESTRUCT(&xfer);
@ -348,6 +352,7 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
index = pmix_globals.events.nhdlrs;
sing->index = index;
++pmix_globals.events.nhdlrs;
sing->cbobject = cbobject;
rc = _add_hdlr(&pmix_globals.events.single_events, &sing->super,
index, prepend, &xfer, cd);
PMIX_LIST_DESTRUCT(&xfer);
@ -377,6 +382,7 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
index = pmix_globals.events.nhdlrs;
multi->index = index;
++pmix_globals.events.nhdlrs;
multi->cbobject = cbobject;
rc = _add_hdlr(&pmix_globals.events.multi_events, &multi->super,
index, prepend, &xfer, cd);
PMIX_LIST_DESTRUCT(&xfer);

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

@ -168,6 +168,8 @@ static void scon(pmix_shift_caddy_t *p)
p->ndata = 0;
p->info = NULL;
p->ninfo = 0;
p->directives = NULL;
p->ndirs = 0;
p->evhdlr = NULL;
p->kv = NULL;
p->vptr = NULL;
@ -194,10 +196,8 @@ PMIX_CLASS_INSTANCE(pmix_info_caddy_t,
static void qcon(pmix_query_caddy_t *p)
{
p->info = NULL;
p->ninfo = 0;
p->directives = NULL;
p->ndirs = 0;
p->queries = NULL;
p->nqueries = 0;
p->cbfunc = NULL;
p->cbdata = NULL;
p->relcbfunc = NULL;

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

@ -66,9 +66,13 @@ typedef enum {
PMIX_NOTIFY_CMD,
PMIX_REGEVENTS_CMD,
PMIX_DEREGEVENTS_CMD,
PMIX_QUERY_CMD
PMIX_QUERY_CMD,
PMIX_LOG_CMD
} pmix_cmd_t;
/* provide a "pretty-print" function for cmds */
const char* pmix_command_string(pmix_cmd_t cmd);
/* define a set of flags to direct collection
* of data during operations */
typedef enum {
@ -158,7 +162,7 @@ PMIX_CLASS_DECLARATION(pmix_nspace_t);
typedef struct pmix_rank_info_t {
pmix_list_item_t super;
pmix_nspace_t *nptr;
int rank;
pmix_rank_t rank;
uid_t uid;
gid_t gid;
bool modex_recvd;
@ -221,10 +225,8 @@ typedef struct {
pmix_event_t ev;
volatile bool active;
pmix_status_t status;
pmix_info_t *info;
size_t ninfo;
pmix_info_t *directives;
size_t ndirs;
pmix_query_t *queries;
size_t nqueries;
pmix_info_cbfunc_t cbfunc;
pmix_release_cbfunc_t relcbfunc;
void *cbdata;
@ -262,12 +264,14 @@ PMIX_CLASS_DECLARATION(pmix_server_trkr_t);
pmix_status_t *codes;
size_t ncodes;
const char *nspace;
int rank;
pmix_rank_t rank;
const char *data;
size_t ndata;
const char *key;
pmix_info_t *info;
size_t ninfo;
pmix_info_t *directives;
size_t ndirs;
pmix_notification_fn_t evhdlr;
pmix_kval_t *kv;
pmix_value_t *vptr;

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

@ -73,7 +73,7 @@ static char *systmpdir = NULL;
// local functions for connection support
static void server_message_handler(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
pmix_buffer_t *buf, void *cbdata);
static inline int _my_client(const char *nspace, int rank);
static inline int _my_client(const char *nspace, pmix_rank_t rank);
/* queue a message to be sent to one of our procs - must
* provide the following params:
@ -185,15 +185,13 @@ static pmix_status_t initialize_server_base(pmix_server_module_t *module)
/* find the temp dir */
if (NULL != mytmpdir) {
tdir = mytmpdir;
} else if (NULL == (tdir = getenv("PMIX_SERVER_TMPDIR"))) {
if (NULL == (tdir = getenv("TMPDIR"))) {
} else if (NULL == (tdir = getenv("TMPDIR"))) {
if (NULL == (tdir = getenv("TEMP"))) {
if (NULL == (tdir = getenv("TMP"))) {
tdir = "/tmp";
}
}
}
}
/* for now, just setup the v1.1 series rendezvous point
* we use the pid to reduce collisions */
@ -238,6 +236,9 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
char **protected = NULL;
bool protect;
bool tool_support = false;
bool system_tool = false;
bool session_tool = false;
pmix_listener_t *tl;
++pmix_globals.init_cntr;
if (1 < pmix_globals.init_cntr) {
@ -296,24 +297,40 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
} else if (0 == strcmp(info[n].key, PMIX_SERVER_TOOL_SUPPORT)) {
/* defer processing to ensure we pickup any tmpdir
* directives before setting location */
session_tool = true;
tool_support = true;
/* push this onto our protected list of keys not
* to be passed to the clients */
pmix_argv_append_nosize(&protected, PMIX_SERVER_TOOL_SUPPORT);
} else if (0 == strcmp(info[n].key, PMIX_SERVER_SYSTEM_SUPPORT)) {
/* we are also the system tool server */
system_tool = true;
tool_support = true;
/* push this onto our protected list of keys not
* to be passed to the clients */
pmix_argv_append_nosize(&protected, PMIX_SERVER_TOOL_SUPPORT);
} else if (0 == strcmp(info[n].key, PMIX_SERVER_TMPDIR)) {
mytmpdir = strdup(info[n].value.data.string);
/* push this onto our protected list of keys not
* to be passed to the clients */
pmix_argv_append_nosize(&protected, PMIX_SERVER_TMPDIR);
} else if (0 == strcmp(info[n].key, PMIX_SYSTEM_TMPDIR)) {
systmpdir = strdup(info[n].value.data.string);
/* push this onto our protected list of keys not
* to be passed to the clients */
pmix_argv_append_nosize(&protected, PMIX_SYSTEM_TMPDIR);
}
}
}
if (tool_support) {
pmix_listener_t *tl = PMIX_NEW(pmix_listener_t);
tl -> address.sun_family = AF_UNIX;
tl->protocol = PMIX_PROTOCOL_TOOL;
/* Get up to 30 chars of hostname.*/
gethostname(myhostname, myhostnamelen);
/* ensure it is NULL terminated */
myhostname[myhostnamelen-1] = '\0';
/* need to put this in the global tmpdir as opposed to
* where the server tmpdir might be */
/* if we are to be the system tool, then we look for
* the system tmpdir and do not include a pid in
* the rendezvous point */
if (system_tool) {
if (NULL != systmpdir) {
tdir = systmpdir;
} else if (NULL == (tdir = getenv("TMPDIR"))) {
@ -323,6 +340,34 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
}
}
}
if (0 > asprintf(&pmix_pid, "%s/pmix.sys.%s", tdir, myhostname)) {
return PMIX_ERR_NOMEM;
}
if ((strlen(pmix_pid) + 1) > sizeof(tl->address.sun_path)-1) {
free(pmix_pid);
return PMIX_ERR_INVALID_LENGTH;
}
/* create the listener for this point */
pmix_listener_t *tl = PMIX_NEW(pmix_listener_t);
tl -> address.sun_family = AF_UNIX;
tl->protocol = PMIX_PROTOCOL_TOOL;
snprintf(tl->address.sun_path, sizeof(tl->address.sun_path) - 1, "%s", pmix_pid);
free(pmix_pid);
pmix_list_append(&pmix_server_globals.listeners, &tl->super);
}
/* if we are a session tool, then we use the session tmpdir
* and append our pid */
if (session_tool) {
if (NULL != mytmpdir) {
tdir = mytmpdir;
} else if (NULL == (tdir = getenv("TMPDIR"))) {
if (NULL == (tdir = getenv("TEMP"))) {
if (NULL == (tdir = getenv("TMP"))) {
tdir = "/tmp";
}
}
}
/* mark this with my pid */
if (0 > asprintf(&pmix_pid, "%s/pmix.%s.tool.%d", tdir, myhostname, mypid)) {
return PMIX_ERR_NOMEM;
}
@ -330,15 +375,17 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
free(pmix_pid);
return PMIX_ERR_INVALID_LENGTH;
}
/* create the listener for this point */
tl = PMIX_NEW(pmix_listener_t);
tl -> address.sun_family = AF_UNIX;
tl->protocol = PMIX_PROTOCOL_TOOL;
snprintf(tl->address.sun_path, sizeof(tl->address.sun_path) - 1, "%s", pmix_pid);
free(pmix_pid);
pmix_list_append(&pmix_server_globals.listeners, &tl->super);
}
/* we don't provide a URI for this listener as we don't pass
* the TOOL connection URI to a child process */
pmix_server_globals.tool_connections_allowed = true;
pmix_list_append(&pmix_server_globals.listeners, &tl->super);
/* push this onto our protected list of keys not
* to be passed to the clients */
pmix_argv_append_nosize(&protected, PMIX_SERVER_TOOL_SUPPORT);
}
/* setup the wildcard recv for inbound messages from clients */
@ -566,12 +613,13 @@ static void _register_nspace(int sd, short args, void *cbdata)
}
} else if (0 == strcmp(cd->info[i].key, PMIX_PROC_DATA)) {
/* an array of data pertaining to a specific proc */
if (PMIX_INFO_ARRAY != cd->info[i].value.type) {
if (PMIX_DATA_ARRAY != cd->info[i].value.type ||
PMIX_INFO != cd->info[i].value.data.darray.type) {
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
goto release;
}
size = cd->info[i].value.data.array.size;
iptr = (pmix_info_t*)cd->info[i].value.data.array.array;
size = cd->info[i].value.data.darray.size;
iptr = (pmix_info_t*)cd->info[i].value.data.darray.array;
PMIX_CONSTRUCT(&buf2, pmix_buffer_t);
/* first element of the array must be the rank */
if (0 != strcmp(iptr[0].key, PMIX_RANK)) {
@ -580,8 +628,8 @@ static void _register_nspace(int sd, short args, void *cbdata)
goto release;
}
/* pack it separately */
rank = iptr[0].value.data.integer;
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&buf2, &rank, 1, PMIX_INT))) {
rank = iptr[0].value.data.rank;
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&buf2, &rank, 1, PMIX_PROC_RANK))) {
PMIX_ERROR_LOG(rc);
pmix_list_remove_item(&pmix_globals.nspaces, &nptr->super);
PMIX_RELEASE(nptr);
@ -750,7 +798,7 @@ void pmix_server_execute_collective(int sd, short args, void *cbdata)
/* pack the proc so we know the source */
char *foobar = info->nptr->nspace;
pmix_bfrop.pack(&rankbuf, &foobar, 1, PMIX_STRING);
pmix_bfrop.pack(&rankbuf, &info->rank, 1, PMIX_INT);
pmix_bfrop.pack(&rankbuf, &info->rank, 1, PMIX_PROC_RANK);
PMIX_CONSTRUCT(&xfer, pmix_buffer_t);
PMIX_LOAD_BUFFER(&xfer, val->data.bo.bytes, val->data.bo.size);
PMIX_VALUE_RELEASE(val);
@ -1562,7 +1610,7 @@ static void op_cbfunc(pmix_status_t status, void *cbdata)
/* setup the reply with the returned status */
reply = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &status, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &status, 1, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(reply);
return;
@ -1584,7 +1632,7 @@ static void _spcb(int sd, short args, void *cbdata)
/* setup the reply with the returned status */
reply = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &cd->status, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &cd->status, 1, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cd->cd);
cd->active = false;
@ -1643,7 +1691,7 @@ static void lookup_cbfunc(pmix_status_t status, pmix_pdata_t pdata[], size_t nda
/* setup the reply with the returned status */
reply = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &status, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &status, 1, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(reply);
return;
@ -1758,7 +1806,7 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata)
/* unpack the rank */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(bptr, &rank, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(bptr, &rank, &cnt, PMIX_PROC_RANK))) {
PMIX_ERROR_LOG(rc);
goto finish_collective;
}
@ -1815,7 +1863,7 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata)
finish_collective:
/* setup the reply, starting with the returned status */
reply = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &rc, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &rc, 1, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
@ -1901,7 +1949,7 @@ static void get_cbfunc(pmix_status_t status, const char *data, size_t ndata, voi
/* setup the reply, starting with the returned status */
reply = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &status, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &status, 1, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
@ -1943,7 +1991,7 @@ static void _cnct(int sd, short args, void *cbdata)
/* setup the reply, starting with the returned status */
reply = PMIX_NEW(pmix_buffer_t);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &scd->status, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(reply, &scd->status, 1, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
@ -2079,7 +2127,7 @@ static void query_cbfunc(pmix_status_t status,
// send reply
PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply);
// cleanup
PMIX_INFO_FREE(qcd->info, qcd->ninfo);
PMIX_QUERY_FREE(qcd->queries, qcd->nqueries);
PMIX_RELEASE(qcd);
PMIX_RELEASE(cd);
}
@ -2272,6 +2320,12 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag,
return rc;
}
if (PMIX_LOG_CMD == cmd) {
PMIX_PEER_CADDY(cd, peer, tag);
rc = pmix_server_log(peer, buf, op_cbfunc, cd);
return rc;
}
return PMIX_ERR_NOT_SUPPORTED;
}
@ -2296,7 +2350,7 @@ static void server_message_handler(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr
}
}
static inline int _my_client(const char *nspace, int rank)
static inline int _my_client(const char *nspace, pmix_rank_t rank)
{
pmix_peer_t *peer;
int i;

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

@ -87,10 +87,10 @@ PMIX_CLASS_INSTANCE(pmix_dmdx_reply_caddy_t,
static void dmdx_cbfunc(pmix_status_t status, const char *data,
size_t ndata, void *cbdata,
pmix_release_cbfunc_t relfn, void *relcbdata);
static pmix_status_t _satisfy_request(pmix_nspace_t *ns, int rank,
static pmix_status_t _satisfy_request(pmix_nspace_t *ns, pmix_rank_t rank,
pmix_server_caddy_t *cd,
pmix_modex_cbfunc_t cbfunc, void *cbdata, bool *scope);
static pmix_status_t create_local_tracker(char nspace[], int rank,
static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank,
pmix_info_t info[], size_t ninfo,
pmix_modex_cbfunc_t cbfunc,
void *cbdata,
@ -116,7 +116,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
pmix_server_caddy_t *cd = (pmix_server_caddy_t*)cbdata;
int32_t cnt;
pmix_status_t rc;
int rank;
pmix_rank_t rank;
char *cptr;
char nspace[PMIX_MAX_NSLEN+1];
pmix_nspace_t *ns, *nptr;
@ -143,7 +143,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
(void)strncpy(nspace, cptr, PMIX_MAX_NSLEN);
free(cptr);
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &rank, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &rank, &cnt, PMIX_PROC_RANK))) {
PMIX_ERROR_LOG(rc);
return rc;
}
@ -192,7 +192,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
* info for this nspace - provide it */
if (PMIX_RANK_WILDCARD == rank) {
PMIX_CONSTRUCT(&pbkt, pmix_buffer_t);
pmix_bfrop.pack(&pbkt, &rank, 1, PMIX_INT);
pmix_bfrop.pack(&pbkt, &rank, 1, PMIX_PROC_RANK);
/* the client is expecting this to arrive as a byte object
* containing a buffer, so package it accordingly */
pmix_bfrop.pack(&pbkt, &nptr->server->job_info, 1, PMIX_BUFFER);
@ -267,7 +267,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
return rc;
}
static pmix_status_t create_local_tracker(char nspace[], int rank,
static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank,
pmix_info_t info[], size_t ninfo,
pmix_modex_cbfunc_t cbfunc,
void *cbdata,
@ -364,14 +364,16 @@ void pmix_pending_nspace_requests(pmix_nspace_t *nptr)
}
}
static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank, pmix_server_caddy_t *cd,
pmix_modex_cbfunc_t cbfunc, void *cbdata, bool *scope)
static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, pmix_rank_t rank,
pmix_server_caddy_t *cd,
pmix_modex_cbfunc_t cbfunc,
void *cbdata, bool *scope)
{
pmix_status_t rc;
pmix_value_t *val;
char *data;
size_t sz;
int cur_rank;
pmix_rank_t cur_rank;
int found = 0;
pmix_buffer_t pbkt, *pbptr;
void *last;
@ -419,7 +421,7 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank, pmix_serve
if (NULL != cd &&
0 != strncmp(nptr->nspace, cd->peer->info->nptr->nspace, PMIX_MAX_NSLEN)) {
cur_rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&pbkt, &cur_rank, 1, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&pbkt, &cur_rank, 1, PMIX_PROC_RANK))) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&pbkt);
cbfunc(rc, NULL, 0, cbdata, NULL, NULL);
@ -459,7 +461,7 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank, pmix_serve
PMIX_RELEASE(kv);
#else
pmix_buffer_t xfer, *xptr;
pmix_bfrop.pack(&pbkt, &cur_rank, 1, PMIX_INT);
pmix_bfrop.pack(&pbkt, &cur_rank, 1, PMIX_PROC_RANK);
/* the client is expecting this to arrive as a byte object
* containing a buffer, so package it accordingly */
PMIX_CONSTRUCT(&xfer, pmix_buffer_t);
@ -494,7 +496,7 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank, pmix_serve
}
/* Resolve pending requests to this namespace/rank */
pmix_status_t pmix_pending_resolve(pmix_nspace_t *nptr, int rank,
pmix_status_t pmix_pending_resolve(pmix_nspace_t *nptr, pmix_rank_t rank,
pmix_status_t status, pmix_dmdx_local_t *lcd)
{
pmix_dmdx_local_t *cd;
@ -549,7 +551,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata)
pmix_status_t rc;
pmix_output_verbose(2, pmix_globals.debug_output,
"[%s:%d] process dmdx reply from %s:%d",
"[%s:%d] process dmdx reply from %s:%u",
__FILE__, __LINE__,
caddy->lcd->proc.nspace, caddy->lcd->proc.rank);
@ -630,7 +632,7 @@ static void dmdx_cbfunc(pmix_status_t status,
caddy->ndata = ndata;
caddy->lcd = (pmix_dmdx_local_t *)cbdata;
pmix_output_verbose(2, pmix_globals.debug_output,
"[%s:%d] queue dmdx reply for %s:%d",
"[%s:%d] queue dmdx reply for %s:%u",
__FILE__, __LINE__,
caddy->lcd->proc.nspace, caddy->lcd->proc.rank);
event_assign(&caddy->ev, pmix_globals.evbase, -1, EV_WRITE,

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

@ -480,7 +480,7 @@ static void cnct_cbfunc(pmix_status_t status,
static pmix_status_t parse_connect_ack (char *msg,
pmix_listener_protocol_t protocol,
int len,
char **nspace, int *rank,
char **nspace, pmix_rank_t *rank,
char **version, char **cred)
{
int msglen;
@ -497,9 +497,9 @@ static pmix_status_t parse_connect_ack (char *msg,
PMIX_STRNLEN(msglen, msg, len);
if (msglen <= len) {
memcpy(rank, msg, sizeof(int));
msg += sizeof(int);
len -= sizeof(int);
memcpy(rank, msg, sizeof(pmix_rank_t));
msg += sizeof(pmix_rank_t);
len -= sizeof(pmix_rank_t);
} else {
return PMIX_ERR_BAD_PARAM;
}
@ -528,12 +528,12 @@ static pmix_status_t parse_connect_ack (char *msg,
* connected socket and verify the expected response.
*/
static pmix_status_t pmix_server_authenticate(pmix_pending_connection_t *pnd,
int *out_rank,
pmix_rank_t *out_rank,
pmix_peer_t **peer)
{
char *msg, *nspace, *version, *cred;
pmix_status_t rc;
int rank;
pmix_rank_t rank;
pmix_usock_hdr_t hdr;
pmix_nspace_t *nptr, *tmp;
pmix_rank_info_t *info;
@ -586,15 +586,6 @@ static pmix_status_t pmix_server_authenticate(pmix_pending_connection_t *pnd,
/* if the attaching process is not a tool, then set it up as
* a known peer */
if (PMIX_PROTOCOL_TOOL != pnd->protocol) {
pmix_globals.myid.rank = rank;
/* get the nspace */
nspace = msg; // a NULL terminator is in the data
/* get the rank */
memcpy(&rank, msg+strlen(nspace)+1, sizeof(int));
pmix_output_verbose(2, pmix_globals.debug_output,
"connect-ack recvd from peer %s:%d:%s",
nspace, rank, version);
@ -766,7 +757,7 @@ static void connection_handler(int sd, short flags, void* cbdata)
{
pmix_pending_connection_t *pnd = (pmix_pending_connection_t*)cbdata;
pmix_peer_t *peer;
int rank;
pmix_rank_t rank;
pmix_status_t status;
pmix_output_verbose(8, pmix_globals.debug_output,
"connection_handler: new connection: %d",
@ -796,7 +787,7 @@ static void connection_handler(int sd, short flags, void* cbdata)
event_assign(&peer->send_event, pmix_globals.evbase, pnd->sd,
EV_WRITE|EV_PERSIST, pmix_usock_send_handler, peer);
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:server client %s:%d has connected on socket %d",
"pmix:server client %s:%u has connected on socket %d",
peer->info->nptr->nspace, peer->info->rank, peer->sd);
PMIX_RELEASE(pnd);
}

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

@ -74,7 +74,7 @@ pmix_status_t pmix_server_abort(pmix_peer_t *peer, pmix_buffer_t *buf,
/* unpack the status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &status, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &status, &cnt, PMIX_STATUS))) {
return rc;
}
/* unpack the message */
@ -576,7 +576,7 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd,
/* pack the proc so we know the source */
char *foobar = rkinfo->nptr->nspace;
pmix_bfrop.pack(&rankbuf, &foobar, 1, PMIX_STRING);
pmix_bfrop.pack(&rankbuf, &rkinfo->rank, 1, PMIX_INT);
pmix_bfrop.pack(&rankbuf, &rkinfo->rank, 1, PMIX_PROC_RANK);
PMIX_CONSTRUCT(&xfer, pmix_buffer_t);
PMIX_LOAD_BUFFER(&xfer, val->data.bo.bytes, val->data.bo.size);
PMIX_VALUE_RELEASE(val);
@ -1277,7 +1277,7 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer,
/* unpack status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &cd->status, &cnt, PMIX_INT))) {
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &cd->status, &cnt, PMIX_STATUS))) {
PMIX_ERROR_LOG(rc);
goto exit;
}
@ -1336,13 +1336,73 @@ pmix_status_t pmix_server_query(pmix_peer_t *peer,
cd = PMIX_NEW(pmix_query_caddy_t);
cd->cbdata = cbdata;
/* unpack the number of info */
/* unpack the number of queries */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &cd->nqueries, &cnt, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
goto exit;
}
/* unpack the queries */
if (0 < cd->nqueries) {
PMIX_QUERY_CREATE(cd->queries, cd->nqueries);
cnt = cd->nqueries;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, cd->queries, &cnt, PMIX_QUERY))) {
PMIX_ERROR_LOG(rc);
goto exit;
}
}
/* setup the requesting peer name */
(void)strncpy(proc.nspace, peer->info->nptr->nspace, PMIX_MAX_NSLEN);
proc.rank = peer->info->rank;
/* ask the host for the info */
if (PMIX_SUCCESS != (rc = pmix_host_server.query(&proc, cd->queries, cd->nqueries,
cbfunc, cd))) {
goto exit;
}
return PMIX_SUCCESS;
exit:
PMIX_RELEASE(cd);
return rc;
}
static void logcbfn(pmix_status_t status, void *cbdata)
{
pmix_shift_caddy_t *cd = (pmix_shift_caddy_t*)cbdata;
if (NULL != cd->cbfunc.opcbfn) {
cd->cbfunc.opcbfn(status, cd->cbdata);
}
PMIX_RELEASE(cd);
}
pmix_status_t pmix_server_log(pmix_peer_t *peer,
pmix_buffer_t *buf,
pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
int32_t cnt;
pmix_status_t rc;
pmix_shift_caddy_t *cd;
pmix_proc_t proc;
pmix_output_verbose(2, pmix_globals.debug_output,
"recvd log from client");
if (NULL == pmix_host_server.log) {
return PMIX_ERR_NOT_SUPPORTED;
}
cd = PMIX_NEW(pmix_shift_caddy_t);
cd->cbfunc.opcbfn = cbfunc;
cd->cbdata = cbdata;
/* unpack the number of data */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &cd->ninfo, &cnt, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
goto exit;
}
/* unpack the info */
/* unpack the data */
if (0 < cd->ninfo) {
PMIX_INFO_CREATE(cd->info, cd->ninfo);
cnt = cd->ninfo;
@ -1351,13 +1411,13 @@ pmix_status_t pmix_server_query(pmix_peer_t *peer,
goto exit;
}
}
/* unpack any directives */
/* unpack the number of directives */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &cd->ndirs, &cnt, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
goto exit;
}
/* unpack the directives */
if (0 < cd->ndirs) {
PMIX_INFO_CREATE(cd->directives, cd->ndirs);
cnt = cd->ndirs;
@ -1371,13 +1431,10 @@ pmix_status_t pmix_server_query(pmix_peer_t *peer,
(void)strncpy(proc.nspace, peer->info->nptr->nspace, PMIX_MAX_NSLEN);
proc.rank = peer->info->rank;
/* ask the host for the info */
if (PMIX_SUCCESS != (rc = pmix_host_server.query(&proc, cd->info, cd->ninfo,
/* ask the host to log the info */
pmix_host_server.log(&proc, cd->info, cd->ninfo,
cd->directives, cd->ndirs,
cbfunc, cd))) {
PMIX_RELEASE(cd);
return rc;
}
logcbfn, cd);
return PMIX_SUCCESS;
exit:
@ -1386,7 +1443,6 @@ pmix_status_t pmix_server_query(pmix_peer_t *peer,
}
/***** INSTANCE SERVER LIBRARY CLASSES *****/
static void tcon(pmix_server_trkr_t *t)
{

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

@ -222,7 +222,7 @@ void pmix_stop_listening(void);
bool pmix_server_trk_update(pmix_server_trkr_t *trk);
void pmix_pending_nspace_requests(pmix_nspace_t *nptr);
pmix_status_t pmix_pending_resolve(pmix_nspace_t *nptr, int rank,
pmix_status_t pmix_pending_resolve(pmix_nspace_t *nptr, pmix_rank_t rank,
pmix_status_t status, pmix_dmdx_local_t *lcd);
@ -288,6 +288,11 @@ pmix_status_t pmix_server_query(pmix_peer_t *peer,
pmix_info_cbfunc_t cbfunc,
void *cbdata);
pmix_status_t pmix_server_log(pmix_peer_t *peer,
pmix_buffer_t *buf,
pmix_op_cbfunc_t cbfunc,
void *cbdata);
pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer,
pmix_buffer_t *buf,
pmix_op_cbfunc_t cbfunc,

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

@ -189,11 +189,17 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc,
pmix_kval_t *kptr;
pmix_status_t rc;
pmix_nspace_t *nptr, *nsptr;
int server_pid = -1;
pid_t server_pid;
bool server_pid_given = false;
int hostnamelen = 30;
char hostname[hostnamelen];
DIR *cur_dirp = NULL;
struct dirent * dir_entry;
bool connect_to_system_server = false;
bool connect_to_system_first = false;
bool connection_defined = false;
char *mytmpdir = NULL;
char *systmpdir = NULL;
if (NULL == proc) {
return PMIX_ERR_BAD_PARAM;
@ -218,7 +224,18 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc,
pmix_globals.evbase = (pmix_event_base_t*)info[n].value.data.ptr;
pmix_globals.external_evbase = true;
} else if (strcmp(info[n].key, PMIX_SERVER_PIDINFO) == 0) {
server_pid = info[n].value.data.integer;
server_pid = info[n].value.data.pid;
server_pid_given = true;
} else if (strcmp(info[n].key, PMIX_CONNECT_TO_SYSTEM) == 0) {
connect_to_system_server = info[n].value.data.flag;
connection_defined = true;
} else if (strcmp(info[n].key, PMIX_CONNECT_SYSTEM_FIRST) == 0) {
connect_to_system_first = info[n].value.data.flag;
connection_defined = true;
} else if (strcmp(info[n].key, PMIX_SERVER_TMPDIR) == 0) {
mytmpdir = strdup(info[n].value.data.string);
} else if (strcmp(info[n].key, PMIX_SYSTEM_TMPDIR) == 0) {
systmpdir = strdup(info[n].value.data.string);
}
}
}
@ -247,15 +264,6 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc,
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: init called");
/* find the temp dir */
if (NULL == (tdir = getenv("TMPDIR"))) {
if (NULL == (tdir = getenv("TEMP"))) {
if (NULL == (tdir = getenv("TMP"))) {
tdir = "/tmp";
}
}
}
/* setup the path to the daemon rendezvous point */
memset(&address, 0, sizeof(struct sockaddr_un));
address.sun_family = AF_UNIX;
@ -264,10 +272,58 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc,
/* ensure it is NULL terminated */
hostname[hostnamelen-1] = '\0';
/* if we are to connect solely to the system-level daemon,
* or to preferentially connect to the system-level daemon,
* or nothing was specified at all, then look to see if a
* rendezvous point in that location exists */
if (connect_to_system_server || connect_to_system_first || !connection_defined) {
/* find the temp dir */
if (NULL != systmpdir) {
tdir = systmpdir;
} else if (NULL == (tdir = getenv("TMPDIR"))) {
if (NULL == (tdir = getenv("TEMP"))) {
if (NULL == (tdir = getenv("TMP"))) {
tdir = "/tmp";
}
}
}
snprintf(address.sun_path, sizeof(address.sun_path)-1, "%s/pmix.sys.%s", tdir, hostname);
/* see if the rendezvous file exists */
if (0 != access(address.sun_path, R_OK)) {
/* if it was a requirement, then error out */
if (connect_to_system_server) {
return PMIX_ERR_UNREACH;
}
/* otherwise, this isn't a fatal error - reset the addr */
memset(&address, 0, sizeof(struct sockaddr_un));
connection_defined = false;
} else {
/* connect to this server */
connection_defined = true;
}
}
if (!connection_defined) {
/* if we get here, then either we are to connect to
* a non-system daemon, or a system-level daemon was
* not found - so now look for the session daemon */
/* find the temp dir */
if (NULL != mytmpdir) {
tdir = mytmpdir;
} else if (NULL == (tdir = getenv("TMPDIR"))) {
if (NULL == (tdir = getenv("TEMP"))) {
if (NULL == (tdir = getenv("TMP"))) {
tdir = "/tmp";
}
}
}
/* if they gave us a specific pid, then look for that
* particular server - otherwise, see if there is only
* one on this node and default to it */
if (server_pid != -1) {
if (server_pid_given) {
snprintf(address.sun_path, sizeof(address.sun_path)-1, "%s/pmix.%s.%d", tdir, hostname, server_pid);
/* if the rendezvous file doesn't exist, that's an error */
if (0 != access(address.sun_path, R_OK)) {
@ -318,6 +374,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc,
snprintf(address.sun_path, sizeof(address.sun_path)-1, "%s/%s", tdir, evar);
free(evar);
}
}
pmix_bfrop_open();
pmix_usock_init(pmix_tool_notify_recv);

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

@ -104,7 +104,7 @@ typedef struct {
size_t errhandler_ref;
void *cbdata;
char nspace[PMIX_MAX_NSLEN+1];
int rank;
pmix_rank_t rank;
char *key;
pmix_value_t *value;
pmix_proc_t *procs;

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

@ -327,7 +327,7 @@ void pmix_usock_recv_handler(int sd, short flags, void *cbdata)
pmix_output_verbose(2, pmix_globals.debug_output,
"usock:recv:handler called with peer %s:%d",
(NULL == peer) ? "NULL" : peer->info->nptr->nspace,
(NULL == peer) ? -1 : peer->info->rank);
(NULL == peer) ? PMIX_RANK_UNDEF : peer->info->rank);
if (NULL == peer) {
return;

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

@ -66,7 +66,7 @@ static pmix_proc_data_t* lookup_proc(pmix_hash_table_t *jtable,
uint64_t id, bool create);
pmix_status_t pmix_hash_store(pmix_hash_table_t *table,
int rank, pmix_kval_t *kin)
pmix_rank_t rank, pmix_kval_t *kin)
{
pmix_proc_data_t *proc_data;
uint64_t id;
@ -98,7 +98,7 @@ pmix_status_t pmix_hash_store(pmix_hash_table_t *table,
return PMIX_SUCCESS;
}
pmix_status_t pmix_hash_fetch(pmix_hash_table_t *table, int rank,
pmix_status_t pmix_hash_fetch(pmix_hash_table_t *table, pmix_rank_t rank,
const char *key, pmix_value_t **kvs)
{
pmix_status_t rc = PMIX_SUCCESS;
@ -174,7 +174,7 @@ pmix_status_t pmix_hash_fetch(pmix_hash_table_t *table, int rank,
}
pmix_status_t pmix_hash_fetch_by_key(pmix_hash_table_t *table, const char *key,
int *rank, pmix_value_t **kvs, void **last)
pmix_rank_t *rank, pmix_value_t **kvs, void **last)
{
pmix_status_t rc = PMIX_SUCCESS;
pmix_proc_data_t *proc_data;
@ -230,7 +230,7 @@ pmix_status_t pmix_hash_fetch_by_key(pmix_hash_table_t *table, const char *key,
}
pmix_status_t pmix_hash_remove_data(pmix_hash_table_t *table,
int rank, const char *key)
pmix_rank_t rank, const char *key)
{
pmix_status_t rc = PMIX_SUCCESS;
pmix_proc_data_t *proc_data;

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

@ -25,11 +25,11 @@ BEGIN_C_DECLS
/* store a value in the given hash table for the specified
* rank index.*/
pmix_status_t pmix_hash_store(pmix_hash_table_t *table,
int rank, pmix_kval_t *kv);
pmix_rank_t rank, pmix_kval_t *kv);
/* Fetch the value for a specified key and rank from within
* the given hash_table */
pmix_status_t pmix_hash_fetch(pmix_hash_table_t *table, int rank,
pmix_status_t pmix_hash_fetch(pmix_hash_table_t *table, pmix_rank_t rank,
const char *key, pmix_value_t **kvs);
/* Fetch the value for a specified key from within
@ -38,7 +38,7 @@ pmix_status_t pmix_hash_fetch(pmix_hash_table_t *table, int rank,
* To get the first data from table, function is called with key parameter as string.
* Remaining data from table are obtained by calling function with a null pointer for the key parameter.*/
pmix_status_t pmix_hash_fetch_by_key(pmix_hash_table_t *table, const char *key,
int *rank, pmix_value_t **kvs, void **last);
pmix_rank_t *rank, pmix_value_t **kvs, void **last);
/* remove the specified key-value from the given hash_table.
* A NULL key will result in removal of all data for the
@ -48,7 +48,7 @@ pmix_status_t pmix_hash_fetch_by_key(pmix_hash_table_t *table, const char *key,
* will therefore result in removal of all data from the
* table */
pmix_status_t pmix_hash_remove_data(pmix_hash_table_t *table,
int rank, const char *key);
pmix_rank_t rank, const char *key);
END_C_DECLS

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

@ -67,6 +67,12 @@ static void errhandler_reg_callbk(pmix_status_t status,
*active = false;
}
static void opcbfunc(pmix_status_t status, void *cbdata)
{
volatile bool *active = (volatile bool*)cbdata;
*active = false;
}
int main(int argc, char **argv)
{
int rc;
@ -78,6 +84,7 @@ int main(int argc, char **argv)
int cnt, j;
bool doabort = false;
volatile bool active;
pmix_info_t info;
if (1 < argc) {
if (0 == strcmp("-abort", argv[1])) {
@ -201,6 +208,18 @@ int main(int argc, char **argv)
}
}
/* log something */
PMIX_INFO_CONSTRUCT(&info);
(void)strncpy(info.key, "foobar", PMIX_MAX_KEYLEN);
info.value.type = PMIX_BOOL;
info.value.data.flag = true;
active = true;
PMIx_Log_nb(&info, 1, NULL, 0, opcbfunc, (void*)&active);
while (active) {
usleep(10);
}
PMIX_INFO_DESTRUCT(&info);
/* if requested and our rank is 0, call abort */
if (doabort) {
if (0 == myproc.rank) {

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

@ -91,13 +91,16 @@ static pmix_status_t notify_event(pmix_status_t code,
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t query_fn(pmix_proc_t *proct,
pmix_info_t *info, size_t ninfo,
pmix_info_t *directives, size_t ndir,
pmix_query_t *queries, size_t nqueries,
pmix_info_cbfunc_t cbfunc,
void *cbdata);
static void tool_connect_fn(pmix_info_t *info, size_t ninfo,
pmix_tool_connection_cbfunc_t cbfunc,
void *cbdata);
static void log_fn(const pmix_proc_t *client,
const pmix_info_t data[], size_t ndata,
const pmix_info_t directives[], size_t ndirs,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_server_module_t mymodule = {
.client_connected = connected,
@ -115,7 +118,8 @@ static pmix_server_module_t mymodule = {
.deregister_events = deregister_events,
.notify_event = notify_event,
.query = query_fn,
.tool_connected = tool_connect_fn
.tool_connected = tool_connect_fn,
.log = log_fn
};
typedef struct {
@ -708,12 +712,12 @@ typedef struct query_data_t {
} query_data_t;
static pmix_status_t query_fn(pmix_proc_t *proct,
pmix_info_t *info, size_t ninfo,
pmix_info_t *directives, size_t ndirs,
pmix_query_t *queries, size_t nqueries,
pmix_info_cbfunc_t cbfunc,
void *cbdata)
{
size_t n;
pmix_info_t *info;
pmix_output(0, "SERVER: QUERY");
@ -721,13 +725,15 @@ static pmix_status_t query_fn(pmix_proc_t *proct,
return PMIX_ERROR;
}
/* keep this simple */
for (n=0; n < ninfo; n++) {
PMIX_INFO_CREATE(info, nqueries);
for (n=0; n < nqueries; n++) {
(void)strncpy(info[n].key, queries[n].keys[0], PMIX_MAX_KEYLEN);
info[n].value.type = PMIX_STRING;
if (0 > asprintf(&info[n].value.data.string, "%d", (int)n)) {
return PMIX_ERROR;
}
}
cbfunc(PMIX_SUCCESS, info, ninfo, cbdata, NULL, NULL);
cbfunc(PMIX_SUCCESS, info, nqueries, cbdata, NULL, NULL);
return PMIX_SUCCESS;
}
@ -748,6 +754,18 @@ static void tool_connect_fn(pmix_info_t *info, size_t ninfo,
}
}
static void log_fn(const pmix_proc_t *client,
const pmix_info_t data[], size_t ndata,
const pmix_info_t directives[], size_t ndirs,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_output(0, "SERVER: LOG");
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, cbdata);
}
}
static void wait_signal_callback(int fd, short event, void *arg)
{
pmix_event_t *sig = (pmix_event_t*) arg;

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

@ -33,38 +33,26 @@
#include "src/class/pmix_object.h"
#include "src/buffer_ops/types.h"
#include "src/util/argv.h"
#include "src/util/output.h"
#include "src/util/printf.h"
int main(int argc, char **argv)
static pmix_proc_t myproc;
static void cbfunc(pmix_status_t status,
pmix_info_t *info, size_t ninfo,
void *cbdata,
pmix_release_cbfunc_t release_fn,
void *release_cbdata)
{
pmix_status_t rc;
pmix_proc_t myproc;
pmix_info_t *info;
size_t ninfo;
volatile bool *active = (volatile bool*)cbdata;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_tool_init(&myproc, NULL, 0))) {
fprintf(stderr, "PMIx_tool_init failed: %d\n", rc);
exit(rc);
}
pmix_output(0, "Tool ns %s rank %d: Running", myproc.nspace, myproc.rank);
/* query something */
ninfo = 2;
PMIX_INFO_CREATE(info, ninfo);
(void)strncpy(info[0].key, "foobar", PMIX_MAX_KEYLEN);
(void)strncpy(info[1].key, "spastic", PMIX_MAX_KEYLEN);
if (PMIX_SUCCESS != (rc = PMIx_Query_info(info, ninfo))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Query_info failed: %d", myproc.nspace, myproc.rank, rc);
goto done;
}
if (0 != strncmp(info[0].key, "foobar", PMIX_MAX_KEYLEN)) {
pmix_output(0, "Client ns %s rank %d: PMIx_Query_info key[0] wrong: %s vs foobar",
pmix_output(0, "Client ns %s rank %d: PMIx_Query_info[0] key wrong: %s vs foobar",
myproc.nspace, myproc.rank, info[0].key);
}
if (0 != strncmp(info[1].key, "spastic", PMIX_MAX_KEYLEN)) {
pmix_output(0, "Client ns %s rank %d: PMIx_Query_info key[0] wrong: %s vs spastic",
pmix_output(0, "Client ns %s rank %d: PMIx_Query_info[1] key wrong: %s vs spastic",
myproc.nspace, myproc.rank, info[1].key);
}
if (PMIX_STRING != info[0].value.type) {
@ -83,8 +71,39 @@ int main(int argc, char **argv)
pmix_output(0, "Client ns %s rank %d: PMIx_Query_info key[1] wrong value: %s vs 1",
myproc.nspace, myproc.rank, info[1].value.data.string);
}
PMIX_INFO_FREE(info, ninfo);
if (NULL != release_fn) {
release_fn(release_cbdata);
}
*active = false;
}
int main(int argc, char **argv)
{
pmix_status_t rc;
pmix_query_t *query;
size_t nq;
volatile bool active;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_tool_init(&myproc, NULL, 0))) {
fprintf(stderr, "PMIx_tool_init failed: %d\n", rc);
exit(rc);
}
pmix_output(0, "Tool ns %s rank %d: Running", myproc.nspace, myproc.rank);
/* query something */
nq = 2;
PMIX_QUERY_CREATE(query, nq);
pmix_argv_append_nosize(&query[0].keys, "foobar");
pmix_argv_append_nosize(&query[1].keys, "spastic");
active = true;
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&active))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Query_info failed: %d", myproc.nspace, myproc.rank, rc);
goto done;
}
while(active) {
usleep(10);
}
done:
/* finalize us */
pmix_output(0, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank);

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

@ -99,7 +99,7 @@ typedef struct {
uint32_t nprocs;
int timeout;
int verbose;
int rank;
pmix_rank_t rank;
int early_fail;
int test_job_fence;
int collect_bad;
@ -111,7 +111,7 @@ typedef struct {
char *ns_dist;
int ns_size;
int ns_id;
int base_rank;
pmix_rank_t base_rank;
int test_publish;
int test_spawn;
int test_connect;
@ -122,7 +122,7 @@ typedef struct {
#define INIT_TEST_PARAMS(params) do { \
params.nprocs = 1; \
params.verbose = 0; \
params.rank = -1; \
params.rank = PMIX_RANK_UNDEF; \
params.base_rank = 0; \
params.early_fail = 0; \
params.ns_size = -1; \

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
@ -35,7 +35,7 @@ static void get_cb(pmix_status_t status, pmix_value_t *kv, void *cbdata)
cb->status = status;
}
static void add_noise(char *noise_param, char *my_nspace, int my_rank)
static void add_noise(char *noise_param, char *my_nspace, pmix_rank_t my_rank)
{
bool participate = false;
participant_t *p;
@ -127,7 +127,7 @@ static void add_noise(char *noise_param, char *my_nspace, int my_rank)
rc = PMIX_ERROR; \
} \
else if (val->type != PMIX_VAL_TYPE_ ## dtype || PMIX_VAL_CMP(dtype, PMIX_VAL_FIELD_ ## dtype((val)), data)) { \
TEST_VERBOSE(("%s:%d: from %s:%d Key %s value or type mismatch," \
TEST_VERBOSE(("%s:%u: from %s:%d Key %s value or type mismatch," \
" want type %d get type %d", \
my_nspace, my_rank, ns, r, key, PMIX_VAL_TYPE_ ## dtype, val->type)); \
rc = PMIX_ERROR; \
@ -174,7 +174,7 @@ static void add_noise(char *noise_param, char *my_nspace, int my_rank)
} \
} while (0)
int test_fence(test_params params, char *my_nspace, int my_rank)
int test_fence(test_params params, char *my_nspace, pmix_rank_t my_rank)
{
int len;
int rc;
@ -313,7 +313,7 @@ int test_fence(test_params params, char *my_nspace, int my_rank)
PMIX_LIST_DESTRUCT(&test_fences);
return rc;
}
GET(int, fence_num+p->proc.rank, p->proc.nspace, p->proc.rank, fence_num, put_ind++, params.use_same_keys, 0, 0);
GET(uint32_t, fence_num+p->proc.rank, p->proc.nspace, p->proc.rank, fence_num, put_ind++, params.use_same_keys, 0, 0);
if (PMIX_SUCCESS != rc) {
TEST_ERROR(("%s:%d: PMIx_Get failed (%d) from %s:%d", my_nspace, my_rank, rc, p->proc.nspace, p->proc.rank));
PMIX_PROC_FREE(pcs, npcs);
@ -354,12 +354,12 @@ int test_fence(test_params params, char *my_nspace, int my_rank)
return PMIX_SUCCESS;
}
static int get_local_peers(char *my_nspace, int my_rank, int **_peers, int *count)
static int get_local_peers(char *my_nspace, int my_rank, pmix_rank_t **_peers, pmix_rank_t *count)
{
pmix_value_t *val;
int *peers = NULL;
pmix_rank_t *peers = NULL;
char *sptr, *token, *eptr, *str;
int npeers;
pmix_rank_t npeers;
int rc;
pmix_proc_t proc;
@ -382,7 +382,7 @@ static int get_local_peers(char *my_nspace, int my_rank, int **_peers, int *coun
return PMIX_ERROR;
}
npeers = val->data.uint32;
peers = malloc(sizeof(int) * npeers);
peers = malloc(sizeof(pmix_rank_t) * npeers);
/* get ranks of neighbours on this node */
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) {
@ -437,12 +437,12 @@ static int get_local_peers(char *my_nspace, int my_rank, int **_peers, int *coun
return PMIX_SUCCESS;
}
int test_job_fence(test_params params, char *my_nspace, int my_rank)
int test_job_fence(test_params params, char *my_nspace, pmix_rank_t my_rank)
{
int rc;
int i, j;
char sval[50];
int *peers, npeers;
pmix_rank_t *peers, npeers;
pmix_value_t value;
pmix_value_t *val = &value;
pmix_proc_t proc;
@ -493,7 +493,8 @@ int test_job_fence(test_params params, char *my_nspace, int my_rank)
for (j=0; j < 3; j++) {
int local = 0, k;
int local = 0;
pmix_rank_t k;
for(k=0; k<npeers; k++){
if( peers[k] == i+params.base_rank){
local = 1;

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
@ -16,5 +16,5 @@
#include <time.h>
#include "test_common.h"
int test_fence(test_params params, char *my_nspace, int my_rank);
int test_job_fence(test_params params, char *my_nspace, int my_rank);
int test_fence(test_params params, char *my_nspace, pmix_rank_t my_rank);
int test_job_fence(test_params params, char *my_nspace, pmix_rank_t my_rank);

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

@ -429,7 +429,7 @@ opal_vpid_t pmix2x_convert_rank(int rank)
}
}
int pmix2x_convert_opalrank(opal_vpid_t vpid)
pmix_rank_t pmix2x_convert_opalrank(opal_vpid_t vpid)
{
switch(vpid) {
case OPAL_VPID_WILDCARD:
@ -437,7 +437,7 @@ int pmix2x_convert_opalrank(opal_vpid_t vpid)
case OPAL_VPID_INVALID:
return PMIX_RANK_UNDEF;
default:
return (int)vpid;
return (pmix_rank_t)vpid;
}
}
@ -576,6 +576,22 @@ int pmix2x_convert_rc(pmix_status_t rc)
}
}
opal_pmix_scope_t pmix2x_convert_scope(pmix_scope_t scope)
{
switch(scope) {
case PMIX_SCOPE_UNDEF:
return OPAL_PMIX_SCOPE_UNDEF;
case PMIX_LOCAL:
return OPAL_PMIX_LOCAL;
case PMIX_REMOTE:
return OPAL_PMIX_REMOTE;
case PMIX_GLOBAL:
return OPAL_PMIX_GLOBAL;
default:
return OPAL_PMIX_SCOPE_UNDEF;
}
}
pmix_scope_t pmix2x_convert_opalscope(opal_pmix_scope_t scope) {
switch(scope) {
case OPAL_PMIX_LOCAL:
@ -627,13 +643,48 @@ opal_pmix_data_range_t pmix2x_convert_range(pmix_data_range_t range) {
}
}
opal_pmix_persistence_t pmix2x_convert_persist(pmix_persistence_t persist)
{
switch(persist) {
case PMIX_PERSIST_INDEF:
return OPAL_PMIX_PERSIST_INDEF;
case PMIX_PERSIST_FIRST_READ:
return OPAL_PMIX_PERSIST_FIRST_READ;
case PMIX_PERSIST_PROC:
return OPAL_PMIX_PERSIST_PROC;
case PMIX_PERSIST_APP:
return OPAL_PMIX_PERSIST_APP;
case PMIX_PERSIST_SESSION:
return OPAL_PMIX_PERSIST_SESSION;
default:
return OPAL_PMIX_PERSIST_INDEF;
}
}
pmix_persistence_t pmix2x_convert_opalpersist(opal_pmix_persistence_t persist)
{
switch(persist) {
case OPAL_PMIX_PERSIST_INDEF:
return PMIX_PERSIST_INDEF;
case OPAL_PMIX_PERSIST_FIRST_READ:
return PMIX_PERSIST_FIRST_READ;
case OPAL_PMIX_PERSIST_PROC:
return PMIX_PERSIST_PROC;
case OPAL_PMIX_PERSIST_APP:
return PMIX_PERSIST_APP;
case OPAL_PMIX_PERSIST_SESSION:
return PMIX_PERSIST_SESSION;
default:
return PMIX_PERSIST_INDEF;
}
}
/**** RHC: NEED TO ADD SUPPORT FOR NEW PMIX DATA TYPES, INCLUDING
**** CONVERSION OF PROC STATES ****/
void pmix2x_value_load(pmix_value_t *v,
opal_value_t *kv)
{
char nspace[PMIX_MAX_NSLEN + 1];
size_t n;
switch(kv->type) {
case OPAL_UNDEF:
v->type = PMIX_UNDEF;
@ -714,6 +765,24 @@ void pmix2x_value_load(pmix_value_t *v,
v->type = PMIX_TIMEVAL;
memcpy(&(v->data.tv), &kv->data.tv, sizeof(struct timeval));
break;
case OPAL_TIME:
v->type = PMIX_TIME;
memcpy(&(v->data.time), &kv->data.time, sizeof(time_t));
break;
case OPAL_STATUS:
v->type = PMIX_STATUS;
memcpy(&(v->data.status), &kv->data.status, sizeof(pmix_status_t));
break;
case OPAL_VPID:
v->type = PMIX_PROC_RANK;
v->data.rank = pmix2x_convert_opalrank(kv->data.name.vpid);
break;
case OPAL_NAME:
v->type = PMIX_PROC;
/* have to stringify the jobid */
(void)opal_snprintf_jobid(v->data.proc.nspace, PMIX_MAX_NSLEN, kv->data.name.vpid);
v->data.proc.rank = pmix2x_convert_opalrank(kv->data.name.vpid);
break;
case OPAL_BYTE_OBJECT:
v->type = PMIX_BYTE_OBJECT;
if (NULL != kv->data.bo.bytes) {
@ -725,23 +794,23 @@ void pmix2x_value_load(pmix_value_t *v,
v->data.bo.size = 0;
}
break;
case OPAL_UINT32_ARRAY:
/* an array of 32-bit jobids */
v->type = PMIX_INFO_ARRAY;
v->data.array.size = kv->data.uint32_array.size;
if (0 < v->data.array.size) {
PMIX_INFO_CREATE(v->data.array.array, v->data.array.size);
for (n=0; n < v->data.array.size; n++) {
v->data.array.array[n].value.type = PMIX_STRING;
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, kv->data.uint32_array.data[n]);
v->data.array.array[n].value.data.string = strdup(nspace);
}
}
case OPAL_PERSIST:
v->type = PMIX_PERSIST;
v->data.persist = pmix2x_convert_opalpersist(kv->data.uint8);
break;
case OPAL_NAME:
v->type = PMIX_PROC;
(void)opal_snprintf_jobid(v->data.proc.nspace, PMIX_MAX_NSLEN, kv->data.name.jobid);
v->data.proc.rank = pmix2x_convert_opalrank(kv->data.name.vpid);
case OPAL_SCOPE:
v->type = PMIX_SCOPE;
v->data.scope = pmix2x_convert_opalscope(kv->data.uint8);
break;
case OPAL_DATA_RANGE:
v->type = PMIX_DATA_RANGE;
v->data.range = pmix2x_convert_opalrange(kv->data.uint8);
break;
case OPAL_PROC_STATE:
v->type = PMIX_PROC_STATE;
/* the OPAL layer doesn't have any concept of proc state,
* so the ORTE layer is responsible for converting it */
memcpy(&v->data.state, &kv->data.uint8, sizeof(uint8_t));
break;
default:
/* silence warnings */
@ -799,39 +868,58 @@ int pmix2x_value_unload(opal_value_t *kv,
break;
case PMIX_INT64:
kv->type = OPAL_INT64;
memcpy(&kv->data, &(v->data.int64), 8);
memcpy(&kv->data.int64, &(v->data.int64), 8);
break;
case PMIX_UINT:
kv->type = OPAL_UINT;
memcpy(&kv->data, &(v->data.uint), sizeof(int));
memcpy(&kv->data.uint, &(v->data.uint), sizeof(int));
break;
case PMIX_UINT8:
kv->type = OPAL_UINT8;
memcpy(&kv->data, &(v->data.uint8), 1);
memcpy(&kv->data.uint8, &(v->data.uint8), 1);
break;
case PMIX_UINT16:
kv->type = OPAL_UINT16;
memcpy(&kv->data, &(v->data.uint16), 2);
memcpy(&kv->data.uint16, &(v->data.uint16), 2);
break;
case PMIX_UINT32:
kv->type = OPAL_UINT32;
memcpy(&kv->data, &(v->data.uint32), 4);
memcpy(&kv->data.uint32, &(v->data.uint32), 4);
break;
case PMIX_UINT64:
kv->type = OPAL_UINT64;
memcpy(&kv->data, &(v->data.uint64), 8);
memcpy(&kv->data.uint64, &(v->data.uint64), 8);
break;
case PMIX_FLOAT:
kv->type = OPAL_FLOAT;
memcpy(&kv->data, &(v->data.fval), sizeof(float));
memcpy(&kv->data.fval, &(v->data.fval), sizeof(float));
break;
case PMIX_DOUBLE:
kv->type = OPAL_DOUBLE;
memcpy(&kv->data, &(v->data.dval), sizeof(double));
memcpy(&kv->data.dval, &(v->data.dval), sizeof(double));
break;
case PMIX_TIMEVAL:
kv->type = OPAL_TIMEVAL;
memcpy(&kv->data, &(v->data.tv), sizeof(struct timeval));
memcpy(&kv->data.tv, &(v->data.tv), sizeof(struct timeval));
break;
case PMIX_TIME:
kv->type = OPAL_TIME;
memcpy(&kv->data.time, &(v->data.tv), sizeof(struct timeval));
break;
case PMIX_STATUS:
kv->type = OPAL_STATUS;
memcpy(&kv->data.status, &(v->data.status), sizeof(opal_status_t));
break;
case PMIX_PROC_RANK:
kv->type = OPAL_VPID;
kv->data.name.vpid = pmix2x_convert_rank(v->data.rank);
break;
case PMIX_PROC:
kv->type = OPAL_NAME;
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&kv->data.name.jobid, v->data.proc.nspace))) {
return pmix2x_convert_opalrc(rc);
}
kv->data.name.vpid = pmix2x_convert_rank(v->data.proc.rank);
break;
case PMIX_BYTE_OBJECT:
kv->type = OPAL_BYTE_OBJECT;
@ -844,13 +932,22 @@ int pmix2x_value_unload(opal_value_t *kv,
kv->data.bo.size = 0;
}
break;
case PMIX_PROC:
kv->type = OPAL_NAME;
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&kv->data.name.jobid, v->data.proc.nspace))) {
return pmix2x_convert_opalrc(rc);
}
kv->data.name.vpid = pmix2x_convert_rank(v->data.proc.rank);
case PMIX_PERSIST:
kv->type = OPAL_PERSIST;
kv->data.uint8 = pmix2x_convert_persist(v->data.persist);
break;
case PMIX_SCOPE:
kv->type = OPAL_SCOPE;
kv->data.uint8 = pmix2x_convert_scope(v->data.persist);
break;
case PMIX_DATA_RANGE:
kv->type = OPAL_DATA_RANGE;
kv->data.uint8 = pmix2x_convert_range(v->data.persist);
case PMIX_PROC_STATE:
kv->type = OPAL_PROC_STATE;
/* the OPAL layer doesn't have any concept of proc state,
* so the ORTE layer is responsible for converting it */
memcpy(&kv->data.uint8, &v->data.state, sizeof(uint8_t));
default:
/* silence warnings */
rc = OPAL_ERROR;

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

@ -300,11 +300,19 @@ OPAL_MODULE_DECLSPEC void pmix2x_event_hdlr(size_t evhdlr_registration_id,
void *cbdata);
OPAL_MODULE_DECLSPEC pmix_status_t pmix2x_convert_opalrc(int rc);
OPAL_MODULE_DECLSPEC int pmix2x_convert_rc(pmix_status_t rc);
OPAL_MODULE_DECLSPEC opal_vpid_t pmix2x_convert_rank(int rank);
OPAL_MODULE_DECLSPEC int pmix2x_convert_opalrank(opal_vpid_t vpid);
OPAL_MODULE_DECLSPEC pmix_rank_t pmix2x_convert_opalrank(opal_vpid_t vpid);
OPAL_MODULE_DECLSPEC opal_pmix_scope_t pmix2x_convert_scope(pmix_scope_t scope);
OPAL_MODULE_DECLSPEC pmix_scope_t pmix2x_convert_opalscope(opal_pmix_scope_t scope);
OPAL_MODULE_DECLSPEC pmix_data_range_t pmix2x_convert_opalrange(opal_pmix_data_range_t range);
OPAL_MODULE_DECLSPEC opal_pmix_data_range_t pmix2x_convert_range(pmix_data_range_t range);
OPAL_MODULE_DECLSPEC opal_pmix_persistence_t pmix2x_convert_persist(pmix_persistence_t scope);
OPAL_MODULE_DECLSPEC pmix_persistence_t pmix2x_convert_opalpersist(opal_pmix_persistence_t scope);
OPAL_MODULE_DECLSPEC void pmix2x_value_load(pmix_value_t *v,
opal_value_t *kv);
OPAL_MODULE_DECLSPEC int pmix2x_value_unload(opal_value_t *kv,

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

@ -90,13 +90,16 @@
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t server_query(pmix_proc_t *proct,
pmix_info_t *info, size_t ninfo,
pmix_info_t *directives, size_t ndirs,
pmix_query_t *queryies, size_t nqueries,
pmix_info_cbfunc_t cbfunc,
void *cbdata);
static void server_tool_connection(pmix_info_t *info, size_t ninfo,
pmix_tool_connection_cbfunc_t cbfunc,
void *cbdata);
static void server_log(const pmix_proc_t *client,
const pmix_info_t data[], size_t ndata,
const pmix_info_t directives[], size_t ndirs,
pmix_op_cbfunc_t cbfunc, void *cbdata);
pmix_server_module_t mymodule = {
.client_connected = server_client_connected_fn,
@ -114,7 +117,8 @@
.deregister_events = server_deregister_events,
.notify_event = server_notify_event,
.query = server_query,
.tool_connected = server_tool_connection
.tool_connected = server_tool_connection,
.log = server_log
};
opal_pmix_server_module_t *host_module = NULL;
@ -812,15 +816,15 @@ static void info_cbfunc(int status,
}
static pmix_status_t server_query(pmix_proc_t *proct,
pmix_info_t *info, size_t ninfo,
pmix_info_t *directives, size_t ndirs,
pmix_query_t *queries, size_t nqueries,
pmix_info_cbfunc_t cbfunc,
void *cbdata)
{
pmix2x_opalcaddy_t *opalcaddy;
opal_process_name_t requestor;
int rc;
size_t n;
size_t n, m;
opal_pmix_query_t *q;
opal_value_t *oinfo;
if (NULL == host_module || NULL == host_module->query) {
@ -840,22 +844,27 @@ static pmix_status_t server_query(pmix_proc_t *proct,
}
requestor.vpid = pmix2x_convert_rank(proct->rank);
/* convert the info */
for (n=0; n < ninfo; n++) {
/* convert the queries */
for (n=0; n < nqueries; n++) {
q = OBJ_NEW(opal_pmix_query_t);
/* we "borrow" the info field of the caddy as we and the
* server function both agree on what will be there */
opal_list_append(&opalcaddy->info, &q->super);
q->keys = opal_argv_copy(queries[n].keys);
for (m=0; m < queries[n].nqual; m++) {
oinfo = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &oinfo->super);
oinfo->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix2x_value_unload(oinfo, &info[n].value))) {
opal_list_append(&q->qualifiers, &oinfo->super);
oinfo->key = strdup(queries[n].qualifiers[m].key);
if (OPAL_SUCCESS != (rc = pmix2x_value_unload(oinfo, &queries[n].qualifiers[m].value))) {
OBJ_RELEASE(opalcaddy);
return pmix2x_convert_opalrc(rc);
}
}
/* we ignore directives for now */
}
/* pass the call upwards */
if (OPAL_SUCCESS != (rc = host_module->query(&requestor,
&opalcaddy->info, NULL,
&opalcaddy->info,
info_cbfunc, opalcaddy))) {
OBJ_RELEASE(opalcaddy);
}
@ -917,3 +926,78 @@ static void server_tool_connection(pmix_info_t *info, size_t ninfo,
/* pass it up */
host_module->tool_connected(&opalcaddy->info, toolcbfunc, opalcaddy);
}
static void server_log(const pmix_proc_t *proct,
const pmix_info_t data[], size_t ndata,
const pmix_info_t directives[], size_t ndirs,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix2x_opalcaddy_t *opalcaddy;
opal_process_name_t requestor;
int rc;
size_t n;
opal_value_t *oinfo;
pmix_status_t ret;
if (NULL == host_module || NULL == host_module->log) {
if (NULL != cbfunc) {
cbfunc(PMIX_ERR_NOT_SUPPORTED, cbdata);
}
return;
}
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix2x_opalcaddy_t);
opalcaddy->opcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
/* convert the requestor */
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&requestor.jobid, proct->nspace))) {
opal_output(0, "FILE: %s LINE %d", __FILE__, __LINE__);
OBJ_RELEASE(opalcaddy);
ret = pmix2x_convert_opalrc(rc);
if (NULL != cbfunc) {
cbfunc(ret, cbdata);
}
return;
}
requestor.vpid = pmix2x_convert_rank(proct->rank);
/* convert the data */
for (n=0; n < ndata; n++) {
oinfo = OBJ_NEW(opal_value_t);
/* we "borrow" the info field of the caddy as we and the
* server function both agree on what will be there */
opal_list_append(&opalcaddy->info, &oinfo->super);
if (OPAL_SUCCESS != (rc = pmix2x_value_unload(oinfo, &data[n].value))) {
OBJ_RELEASE(opalcaddy);
ret = pmix2x_convert_opalrc(rc);
if (NULL != cbfunc) {
cbfunc(ret, cbdata);
}
return;
}
}
/* convert the directives */
for (n=0; n < ndirs; n++) {
oinfo = OBJ_NEW(opal_value_t);
/* we "borrow" the apps field of the caddy as we and the
* server function both agree on what will be there */
opal_list_append(&opalcaddy->apps, &oinfo->super);
if (OPAL_SUCCESS != (rc = pmix2x_value_unload(oinfo, &directives[n].value))) {
OBJ_RELEASE(opalcaddy);
ret = pmix2x_convert_opalrc(rc);
if (NULL != cbfunc) {
cbfunc(ret, cbdata);
}
return;
}
}
/* pass the call upwards */
host_module->log(&requestor,
&opalcaddy->info,
&opalcaddy->apps,
opal_opcbfunc, opalcaddy);
}

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

@ -202,14 +202,15 @@ static void _reg_nspace(int sd, short args, void *cbdata)
OPAL_LIST_FOREACH(kv, cd->info, opal_value_t) {
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
if (0 == strcmp(kv->key, OPAL_PMIX_PROC_DATA)) {
pinfo[n].value.type = PMIX_INFO_ARRAY;
pinfo[n].value.type = PMIX_DATA_ARRAY;
/* the value contains a list of values - convert
* that list to another array */
pmapinfo = (opal_list_t*)kv->data.ptr;
szmap = opal_list_get_size(pmapinfo);
PMIX_INFO_CREATE(pmap, szmap);
pinfo[n].value.data.array.array = (struct pmix_info_t*)pmap;
pinfo[n].value.data.array.size = szmap;
pinfo[n].value.data.darray.type = PMIX_INFO;
pinfo[n].value.data.darray.array = (struct pmix_info_t*)pmap;
pinfo[n].value.data.darray.size = szmap;
m = 0;
OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) {
(void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN);

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

@ -183,9 +183,9 @@ typedef int (*opal_pmix_server_disconnect_fn_t)(opal_list_t *procs, opal_list_t
typedef int (*opal_pmix_server_notify_fn_t)(int code, opal_list_t *procs, opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Query the RTE for information */
/* Query the RTE for information - the list is composed of opal_pmix_query_t items */
typedef int (*opal_pmix_server_query_fn_t)(opal_process_name_t *requestor,
opal_list_t *info, opal_list_t *directives,
opal_list_t *queries,
opal_pmix_info_cbfunc_t cbfunc, void *cbdata);
/* Register that a tool has connected to the server, and request
@ -204,6 +204,14 @@ typedef void (*opal_pmix_server_tool_connection_fn_t)(opal_list_t *info,
opal_pmix_tool_connection_cbfunc_t cbfunc,
void *cbdata);
/* Log data on behalf of the client */
typedef void (*opal_pmix_server_log_fn_t)(opal_process_name_t *requestor,
opal_list_t *info,
opal_list_t *directives,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
/* Callback function for incoming connection requests from
* local clients */
typedef void (*opal_pmix_connection_cbfunc_t)(int incoming_sd);
@ -238,6 +246,7 @@ typedef struct opal_pmix_server_module_1_0_0_t {
opal_pmix_server_notify_fn_t notify_event;
opal_pmix_server_query_fn_t query;
opal_pmix_server_tool_connection_fn_t tool_connected;
opal_pmix_server_log_fn_t log;
opal_pmix_server_listener_fn_t listener;
} opal_pmix_server_module_t;

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

@ -26,11 +26,11 @@ BEGIN_C_DECLS
* info thru one of the legacy interfaces where the rank
* is typically encoded into the key itself since there is
* no rank parameter in the API itself */
#define OPAL_PMIX_RANK_UNDEF INT32_MAX
#define OPAL_PMIX_RANK_UNDEF UINT32_MAX
/* define a value to indicate that the user wants the
* data for the given key from every rank that posted
* that key */
#define OPAL_PMIX_RANK_WILDCARD INT32_MAX-1
#define OPAL_PMIX_RANK_WILDCARD UINT32_MAX-1
/* define a set of "standard" attributes that can
* be queried. Implementations (and users) are free to extend as
@ -45,11 +45,16 @@ BEGIN_C_DECLS
#define OPAL_PMIX_SERVER_TOOL_SUPPORT "pmix.srvr.tool" // (bool) The host RM wants to declare itself as willing to
// accept tool connection requests
#define OPAL_PMIX_SERVER_PIDINFO "pmix.srvr.pidinfo" // (uint32_t) pid of the target server
#define OPAL_PMIX_SERVER_SYSTEM_SUPPORT "pmix.srvr.sys" // (bool) The host RM wants to declare itself as being the local
// system server for PMIx connection requests
#define OPAL_PMIX_SERVER_PIDINFO "pmix.srvr.pidinfo" // (pid_t) pid of the target server
#define OPAL_PMIX_SERVER_TMPDIR "pmix.srvr.tmpdir" // (char*) temp directory where PMIx server will place
// client rendezvous points
#define OPAL_PMIX_SYSTEM_TMPDIR "pmix.sys.tmpdir" // (char*) temp directory where PMIx server will place
// tool rendezvous points
#define OPAL_PMIX_CONNECT_TO_SYSTEM "pmix.cnct.sys" // (bool) The requestor requires that a connection be made only to
// a local system-level PMIx server
#define OPAL_PMIX_CONNECT_SYSTEM_FIRST "pmix.cnct.sys.first" // (bool) Preferentially look for a system-level PMIx server first
/* identification attributes */
@ -83,22 +88,15 @@ BEGIN_C_DECLS
#define OPAL_PMIX_NODE_RANK "pmix.nrank" // (uint16_t) rank on this node spanning all jobs
#define OPAL_PMIX_LOCALLDR "pmix.lldr" // (uint64_t) opal_identifier of lowest rank on this node within this job
#define OPAL_PMIX_APPLDR "pmix.aldr" // (uint32_t) lowest rank in this app within this job
#define OPAL_PMIX_PROC_PID "pmix.ppid" // (pid_t) pid of specified proc
/**** no PMIx equivalent ****/
#define OPAL_PMIX_LOCALITY "pmix.loc" // (uint16_t) relative locality of two procs
/* proc location-related info */
/* For PMIX_HOSTNAME, three use-cases exist for PMIx_Get:
*
* (a) Specifying a namespace with PMIX_RANK_WILDCARD will return
* a comma-delimited list of nodes that host procs in that namespace
*
* (b) Passing a NULL namespace will return a comma-delimited list of all
* nodes known to this session, regardless of whether or not they
* currently host procs. The rank argument in PMIx_Get is ignored
* for this use-case
*
* (c) Specifying a namespace and a rank will return the name of the
* host this proc is on
*/
#define OPAL_PMIX_HOSTNAME "pmix.hname" // (char*) see above comment
#define OPAL_PMIX_NODE_LIST "pmix.nlist" // (char*) comma-delimited list of nodes running procs for the specified nspace
#define OPAL_PMIX_ALLOCATED_NODELIST "pmix.alist" // (char*) comma-delimited list of all nodes in this allocation regardless of
// whether or not they currently host procs.
#define OPAL_PMIX_HOSTNAME "pmix.hname" // (char*) name of the host the specified proc is on
#define OPAL_PMIX_NODEID "pmix.nodeid" // (uint32_t) node identifier
#define OPAL_PMIX_LOCAL_PEERS "pmix.lpeers" // (char*) comma-delimited string of ranks on this node within the specified nspace
#define OPAL_PMIX_LOCAL_CPUSETS "pmix.lcpus" // (char*) colon-delimited cpusets of local peers within the specified nspace
@ -154,6 +152,10 @@ BEGIN_C_DECLS
#define OPAL_PMIX_EVENT_AFFECTED_PROC "pmix.evproc" // (pmix_proc_t) single proc that was affected
#define OPAL_PMIX_EVENT_AFFECTED_PROCS "pmix.evaffected" // (pmix_proc_t*) array of pmix_proc_t defining affected procs
#define OPAL_PMIX_EVENT_NON_DEFAULT "pmix.evnondef" // (bool) event is not to be delivered to default event handlers
#define OPAL_PMIX_EVENT_RETURN_OBJECT "pmix.evobject" // (void*) object to be returned whenever the registered cbfunc is invoked
// NOTE: the object will _only_ be returned to the process that
// registered it
/* fault tolerance-related events */
#define OPAL_PMIX_EVENT_TERMINATE_SESSION "pmix.evterm.sess" // (bool) RM intends to terminate session
#define OPAL_PMIX_EVENT_TERMINATE_JOB "pmix.evterm.job" // (bool) RM intends to terminate this job
@ -183,9 +185,19 @@ BEGIN_C_DECLS
#define OPAL_PMIX_FWD_STDIN "pmix.fwd.stdin" // (bool) forward my stdin to the designated proc
#define OPAL_PMIX_FWD_STDOUT "pmix.fwd.stdout" // (bool) forward stdout from spawned procs to me
#define OPAL_PMIX_FWD_STDERR "pmix.fwd.stderr" // (bool) forward stderr from spawned procs to me
#define OPAL_PMIX_DEBUGGER_DAEMONS "pmix.debugger" // (bool) spawned app consists of debugger daemons
/* query attributes */
#define OPAL_PMIX_QUERY_NAMESPACES "pmix.qry.ns" // (char*) request a comma-delimited list of active nspaces
#define OPAL_PMIX_QUERY_JOB_STATUS "pmix.qry.jst" // (pmix_status_t) status of a specified currently executing job
#define OPAL_PMIX_QUERY_QUEUE_LIST "pmix.qry.qlst" // (char*) request a comma-delimited list of scheduler queues
#define OPAL_PMIX_QUERY_QUEUE_STATUS "pmix.qry.qst" // (TBD) status of a specified scheduler queue
#define OPAL_PMIX_QUERY_PROC_TABLE "pmix.qry.ptable" // (char*) input nspace of job whose info is being requested
// returns (pmix_data_array_t) an array of pmix_proc_info_t
#define OPAL_PMIX_QUERY_LOCAL_PROC_TABLE "pmix.qry.lptable" // (char*) input nspace of job whose info is being requested
// returns (pmix_data_array_t) an array of pmix_proc_info_t for
// procs in job on same node
#define OPAL_PMIX_QUERY_AUTHORIZATIONS "pmix.qry.auths" // return operations tool is authorized to perform"
/* define a scope for data "put" by PMI per the following:
@ -267,6 +279,13 @@ typedef struct {
} opal_pmix_modex_data_t;
OBJ_CLASS_DECLARATION(opal_pmix_modex_data_t);
/**** PMIX QUERY STRUCT ****/
typedef struct {
opal_list_item_t super;
char **keys;
opal_list_t qualifiers;
} opal_pmix_query_t;
OBJ_CLASS_DECLARATION(opal_pmix_query_t);
/**** CALLBACK FUNCTIONS FOR NON-BLOCKING OPERATIONS ****/

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

@ -99,7 +99,8 @@ static opal_pmix_server_module_t pmix_server = {
.register_events = pmix_server_register_events_fn,
.deregister_events = pmix_server_deregister_events_fn,
.query = pmix_server_query_fn,
.tool_connected = pmix_tool_connected_fn
.tool_connected = pmix_tool_connected_fn,
.log = pmix_server_log_fn
};
void pmix_server_register_params(void)

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

@ -342,20 +342,30 @@ void pmix_server_notify(int status, orte_process_name_t* sender,
}
}
static void qrel(void *cbdata)
{
opal_list_t *l = (opal_list_t*)cbdata;
OPAL_LIST_RELEASE(l);
}
static void _query(int sd, short args, void *cbdata)
{
orte_pmix_server_op_caddy_t *cd = (orte_pmix_server_op_caddy_t*)cbdata;
opal_pmix_query_t *q;
opal_value_t *kv;
orte_job_t *jdata;
int rc;
size_t nresults=0;
opal_list_t *results;
size_t n;
uint32_t key;
void *nptr;
char **nspaces=NULL, nspace[512];
results = OBJ_NEW(opal_list_t);
/* see what they wanted */
OPAL_LIST_FOREACH(kv, cd->info, opal_value_t) {
if (0 == strcmp(kv->key, OPAL_PMIX_QUERY_NAMESPACES)) {
OPAL_LIST_FOREACH(q, cd->info, opal_pmix_query_t) {
for (n=0; NULL != q->keys[n]; n++) {
if (0 == strcmp(q->keys[n], OPAL_PMIX_QUERY_NAMESPACES)) {
/* get the current jobids */
rc = opal_hash_table_get_first_key_uint32(orte_job_data, &key, (void **)&jdata, &nptr);
while (OPAL_SUCCESS == rc) {
@ -367,39 +377,41 @@ static void _query(int sd, short args, void *cbdata)
rc = opal_hash_table_get_next_key_uint32(orte_job_data, &key, (void **)&jdata, nptr, &nptr);
}
/* join the results into a single comma-delimited string */
kv = OBJ_NEW(opal_value_t);
kv->type = OPAL_STRING;
if (NULL != nspaces) {
kv->data.string = opal_argv_join(nspaces, ',');
} else {
kv->data.string = NULL;
}
++nresults;
opal_list_append(results, &kv->super);
}
}
if (0 == nresults) {
}
if (0 == opal_list_get_size(results)) {
rc = ORTE_ERR_NOT_FOUND;
} else if (nresults < opal_list_get_size(cd->info)) {
} else if (opal_list_get_size(results) < opal_list_get_size(cd->info)) {
rc = ORTE_ERR_PARTIAL_SUCCESS;
} else {
rc = ORTE_SUCCESS;
}
cd->infocbfunc(rc, cd->info, cd->cbdata, NULL, NULL);
cd->infocbfunc(rc, results, cd->cbdata, qrel, results);
}
int pmix_server_query_fn(opal_process_name_t *requestor,
opal_list_t *info, opal_list_t *directives,
opal_list_t *queries,
opal_pmix_info_cbfunc_t cbfunc, void *cbdata)
{
orte_pmix_server_op_caddy_t *cd;
if (NULL == info || NULL == cbfunc) {
if (NULL == queries || NULL == cbfunc) {
return OPAL_ERR_BAD_PARAM;
}
/* need to threadshift this request */
cd = OBJ_NEW(orte_pmix_server_op_caddy_t);
cd->proc = requestor;
cd->info = info;
cd->info = queries;
cd->infocbfunc = cbfunc;
cd->cbdata = cbdata;
@ -461,3 +473,26 @@ void pmix_tool_connected_fn(opal_list_t *info,
opal_event_active(&(cd->ev), OPAL_EV_WRITE, 1);
}
void pmix_server_log_fn(opal_process_name_t *requestor,
opal_list_t *info,
opal_list_t *directives,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
opal_value_t *val;
/* for now, we only support logging show_help messages */
OPAL_LIST_FOREACH(val, info, opal_value_t) {
/* we ignore the key as irrelevant - we only want to
* pull out the string value */
if (OPAL_STRING != val->type) {
continue;
}
opal_output(0, "SHOWHELP: %s", val->data.string);
}
if (NULL != cbfunc) {
cbfunc(OPAL_SUCCESS, cbdata);
}
}

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

@ -190,12 +190,18 @@ extern int pmix_server_deregister_events_fn(opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
extern int pmix_server_query_fn(opal_process_name_t *requestor,
opal_list_t *info, opal_list_t *directives,
opal_list_t *queries,
opal_pmix_info_cbfunc_t cbfunc, void *cbdata);
extern void pmix_tool_connected_fn(opal_list_t *info,
opal_pmix_tool_connection_cbfunc_t cbfunc,
void *cbdata);
extern void pmix_server_log_fn(opal_process_name_t *requestor,
opal_list_t *info,
opal_list_t *directives,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
/* declare the RML recv functions for responses */
extern void pmix_server_launch_resp(int status, orte_process_name_t* sender,
opal_buffer_t *buffer,

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

@ -260,8 +260,8 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
/* pass the local ldr */
kv = OBJ_NEW(opal_value_t);
kv->key = strdup(OPAL_PMIX_LOCALLDR);
kv->type = OPAL_UINT32;
kv->data.uint32 = vpid;
kv->type = OPAL_VPID;
kv->data.name.vpid = vpid;
opal_list_append(info, &kv->super);
}
@ -320,8 +320,8 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
/* rank */
kv = OBJ_NEW(opal_value_t);
kv->key = strdup(OPAL_PMIX_RANK);
kv->type = OPAL_INT;
kv->data.integer = pptr->name.vpid;
kv->type = OPAL_VPID;
kv->data.name.vpid = pptr->name.vpid;
opal_list_append(pmap, &kv->super);
/* appnum */
@ -335,22 +335,22 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, pptr->app_idx);
kv = OBJ_NEW(opal_value_t);
kv->key = strdup(OPAL_PMIX_APPLDR);
kv->type = OPAL_UINT32;
kv->data.uint32 = app->first_rank;
kv->type = OPAL_VPID;
kv->data.name.vpid = app->first_rank;
opal_list_append(pmap, &kv->super);
/* global/univ rank */
kv = OBJ_NEW(opal_value_t);
kv->key = strdup(OPAL_PMIX_GLOBAL_RANK);
kv->type = OPAL_UINT32;
kv->data.uint32 = pptr->name.vpid + jdata->offset;
kv->type = OPAL_VPID;
kv->data.name.vpid = pptr->name.vpid + jdata->offset;
opal_list_append(pmap, &kv->super);
/* app rank */
kv = OBJ_NEW(opal_value_t);
kv->key = strdup(OPAL_PMIX_APP_RANK);
kv->type = OPAL_UINT32;
kv->data.uint32 = pptr->app_rank;
kv->type = OPAL_VPID;
kv->data.name.vpid = pptr->app_rank;
opal_list_append(pmap, &kv->super);
/* app size */