From 527b5c692a08681eb2d0ee588cb08193d2e20ab0 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Sun, 7 Aug 2016 20:41:54 -0700 Subject: [PATCH] Update to include extended tool support, new datatypes --- opal/dss/dss_pack.c | 292 +--- opal/dss/dss_print.c | 182 +-- opal/dss/dss_types.h | 162 +- opal/dss/dss_unpack.c | 288 ---- opal/mca/pmix/base/pmix_base_frame.c | 16 + opal/mca/pmix/pmix2x/pmix/Makefile.am | 7 +- opal/mca/pmix/pmix2x/pmix/VERSION | 4 +- opal/mca/pmix/pmix2x/pmix/config/pmix.m4 | 6 + opal/mca/pmix/pmix2x/pmix/examples/tool.c | 72 +- opal/mca/pmix/pmix2x/pmix/include/pmix.h | 32 +- .../pmix2x/pmix/include/pmix/pmix_common.h | 641 +++++--- .../pmix/pmix2x/pmix/include/pmix_server.h | 14 +- .../pmix/pmix2x/pmix/src/buffer_ops/copy.c | 961 +++++++++++- .../pmix2x/pmix/src/buffer_ops/internal.h | 392 +++-- .../pmix/src/buffer_ops/internal_functions.c | 4 +- .../pmix2x/pmix/src/buffer_ops/open_close.c | 96 +- .../pmix/pmix2x/pmix/src/buffer_ops/pack.c | 521 ++++--- .../pmix/pmix2x/pmix/src/buffer_ops/print.c | 592 ++++++-- .../pmix/pmix2x/pmix/src/buffer_ops/unpack.c | 645 +++++--- .../pmix/pmix2x/pmix/src/client/pmix_client.c | 28 +- .../pmix/src/client/pmix_client_connect.c | 2 +- .../pmix/src/client/pmix_client_fence.c | 6 +- .../pmix2x/pmix/src/client/pmix_client_get.c | 124 +- .../pmix2x/pmix/src/client/pmix_client_pub.c | 4 +- .../pmix/src/client/pmix_client_spawn.c | 2 +- .../pmix/pmix2x/pmix/src/common/Makefile.am | 4 +- .../pmix/pmix2x/pmix/src/common/pmix_log.c | 130 ++ .../pmix/pmix2x/pmix/src/common/pmix_query.c | 112 +- .../pmix2x/pmix/src/common/pmix_strings.c | 205 +++ .../pmix/pmix2x/pmix/src/dstore/pmix_dstore.h | 16 +- .../pmix/pmix2x/pmix/src/event/pmix_event.h | 3 + .../pmix/src/event/pmix_event_notification.c | 17 +- .../pmix/src/event/pmix_event_registration.c | 6 + .../pmix2x/pmix/src/include/pmix_globals.c | 8 +- .../pmix2x/pmix/src/include/pmix_globals.h | 18 +- .../pmix/pmix2x/pmix/src/server/pmix_server.c | 146 +- .../pmix2x/pmix/src/server/pmix_server_get.c | 30 +- .../pmix/src/server/pmix_server_listener.c | 25 +- .../pmix2x/pmix/src/server/pmix_server_ops.c | 86 +- .../pmix2x/pmix/src/server/pmix_server_ops.h | 7 +- .../mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c | 177 ++- opal/mca/pmix/pmix2x/pmix/src/usock/usock.h | 2 +- .../pmix2x/pmix/src/usock/usock_sendrecv.c | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/hash.c | 8 +- opal/mca/pmix/pmix2x/pmix/src/util/hash.h | 8 +- .../pmix/pmix2x/pmix/test/simple/simpclient.c | 19 + .../pmix/pmix2x/pmix/test/simple/simptest.c | 32 +- .../pmix/pmix2x/pmix/test/simple/simptool.c | 67 +- opal/mca/pmix/pmix2x/pmix/test/test_common.h | 6 +- opal/mca/pmix/pmix2x/pmix/test/test_fence.c | 25 +- opal/mca/pmix/pmix2x/pmix/test/test_fence.h | 6 +- opal/mca/pmix/pmix2x/pmix2x.c | 1315 +++++++++-------- opal/mca/pmix/pmix2x/pmix2x.h | 10 +- opal/mca/pmix/pmix2x/pmix2x_component.c | 56 +- opal/mca/pmix/pmix2x/pmix2x_server_north.c | 672 +++++---- opal/mca/pmix/pmix2x/pmix2x_server_south.c | 259 ++-- opal/mca/pmix/pmix_server.h | 13 +- opal/mca/pmix/pmix_types.h | 55 +- orte/orted/pmix/pmix_server.c | 3 +- orte/orted/pmix/pmix_server_gen.c | 85 +- orte/orted/pmix/pmix_server_internal.h | 8 +- orte/orted/pmix/pmix_server_register_fns.c | 20 +- 62 files changed, 5417 insertions(+), 3337 deletions(-) create mode 100644 opal/mca/pmix/pmix2x/pmix/src/common/pmix_log.c create mode 100644 opal/mca/pmix/pmix2x/pmix/src/common/pmix_strings.c diff --git a/opal/dss/dss_pack.c b/opal/dss/dss_pack.c index 396c351d25..cd7b035bb1 100644 --- a/opal/dss/dss_pack.c +++ b/opal/dss/dss_pack.c @@ -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; diff --git a/opal/dss/dss_print.c b/opal/dss/dss_print.c index f8e413efea..e95a40f814 100644 --- a/opal/dss/dss_print.c +++ b/opal/dss/dss_print.c @@ -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); diff --git a/opal/dss/dss_types.h b/opal/dss/dss_types.h index 8424d2b908..d3096964e2 100644 --- a/opal/dss/dss_types.h +++ b/opal/dss/dss_types.h @@ -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; diff --git a/opal/dss/dss_unpack.c b/opal/dss/dss_unpack.c index 4f66e5aacb..9e86ec98b8 100644 --- a/opal/dss/dss_unpack.c +++ b/opal/dss/dss_unpack.c @@ -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; diff --git a/opal/mca/pmix/base/pmix_base_frame.c b/opal/mca/pmix/base/pmix_base_frame.c index 253a5aab63..04cf76c01e 100644 --- a/opal/mca/pmix/base/pmix_base_frame.c +++ b/opal/mca/pmix/base/pmix_base_frame.c @@ -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); diff --git a/opal/mca/pmix/pmix2x/pmix/Makefile.am b/opal/mca/pmix/pmix2x/pmix/Makefile.am index 537862e790..0cdb201523 100644 --- a/opal/mca/pmix/pmix2x/pmix/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/Makefile.am @@ -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 diff --git a/opal/mca/pmix/pmix2x/pmix/VERSION b/opal/mca/pmix/pmix2x/pmix/VERSION index 37ceb8af33..87d4ad54cc 100644 --- a/opal/mca/pmix/pmix2x/pmix/VERSION +++ b/opal/mca/pmix/pmix2x/pmix/VERSION @@ -30,7 +30,7 @@ greek= # command, or with the date (if "git describe" fails) in the form of # "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 diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 index bd60247aff..f2d4f16a8a 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 @@ -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 diff --git a/opal/mca/pmix/pmix2x/pmix/examples/tool.c b/opal/mca/pmix/pmix2x/pmix/examples/tool.c index de54d58909..6818e49c5a 100644 --- a/opal/mca/pmix/pmix2x/pmix/examples/tool.c +++ b/opal/mca/pmix/pmix2x/pmix/examples/tool.c @@ -30,63 +30,57 @@ #include +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); } diff --git a/opal/mca/pmix/pmix2x/pmix/include/pmix.h b/opal/mca/pmix/pmix2x/pmix/include/pmix.h index 0e45cd88b9..b5e7a89837 100644 --- a/opal/mca/pmix/pmix2x/pmix/include/pmix.h +++ b/opal/mca/pmix/pmix2x/pmix/include/pmix.h @@ -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 diff --git a/opal/mca/pmix/pmix2x/pmix/include/pmix/pmix_common.h b/opal/mca/pmix/pmix2x/pmix/include/pmix/pmix_common.h index e58333215f..96a9019776 100644 --- a/opal/mca/pmix/pmix2x/pmix/include/pmix/pmix_common.h +++ b/opal/mca/pmix/pmix2x/pmix/include/pmix/pmix_common.h @@ -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 +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 +#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 +/********************/ - 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 - // 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 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,29 +603,42 @@ 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)); \ - for (_ii=0; _ii < (int)(n); _ii++) { \ - (m)[_ii].type = PMIX_UNDEF; \ - } \ +#define PMIX_VALUE_CREATE(m, n) \ + do { \ + int _ii; \ + 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++) { \ + _v[_ii].type = PMIX_UNDEF; \ + } \ + } \ } while (0) /* release a single pmix_value_t struct, including its data */ -#define PMIX_VALUE_RELEASE(m) \ - do { \ - PMIX_VALUE_DESTRUCT((m)); \ - free((m)); \ +#define PMIX_VALUE_RELEASE(m) \ + do { \ + PMIX_VALUE_DESTRUCT((m)); \ + free((m)); \ } while (0) /* initialize a single value struct */ @@ -499,32 +649,79 @@ typedef struct pmix_value { } while (0) /* release the memory in the value struct data field */ -#define PMIX_VALUE_DESTRUCT(m) \ - do { \ - if (PMIX_STRING == (m)->type) { \ - if (NULL != (m)->data.string) { \ - free((m)->data.string); \ - } \ - } else if (PMIX_BYTE_OBJECT == (m)->type) { \ - if (NULL != (m)->data.bo.bytes) { \ - free((m)->data.bo.bytes); \ - } \ - } 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) { \ - if (NULL != _p[_n].value.data.string) { \ - free(_p[_n].value.data.string); \ - } \ - } else if (PMIX_BYTE_OBJECT == _p[_n].value.type) { \ - if (NULL != _p[_n].value.data.bo.bytes) { \ - free(_p[_n].value.data.bo.bytes); \ - } \ - } \ - } \ - free(_p); \ - } \ +#define PMIX_VALUE_DESTRUCT(m) \ + do { \ + size_t _n; \ + if (PMIX_STRING == (m)->type) { \ + if (NULL != (m)->data.string) { \ + free((m)->data.string); \ + } \ + } else if (PMIX_BYTE_OBJECT == (m)->type) { \ + 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) { \ + 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) { \ + if (NULL != _p[_n].value.data.string) { \ + free(_p[_n].value.data.string); \ + } \ + } else if (PMIX_BYTE_OBJECT == _p[_n].value.type) { \ + 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) #define PMIX_VALUE_FREE(m, n) \ @@ -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 { - char key[PMIX_MAX_KEYLEN+1]; // ensure room for the NULL terminator - bool required; // defaults to optional (i.e., required=false) +typedef struct pmix_info { + char key[PMIX_MAX_KEYLEN+1]; // ensure room for the NULL terminator + 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 { @@ -610,10 +807,9 @@ typedef struct pmix_pdata { } pmix_pdata_t; /* 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)); \ +#define PMIX_PDATA_CREATE(m, n) \ + do { \ + (m) = (pmix_pdata_t*)calloc((n), sizeof(pmix_pdata_t)); \ } while (0) #define PMIX_PDATA_RELEASE(m) \ @@ -644,13 +840,15 @@ typedef struct pmix_pdata { } \ } while (0) -#define PMIX_PDATA_LOAD(m, p, k, v, t) \ - do { \ - if (NULL != (m)) { \ - (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)); \ +#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]; @@ -726,10 +979,9 @@ typedef struct pmix_modex_data { size_t size; } pmix_modex_data_t; /* 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)); \ +#define PMIX_MODEX_CREATE(m, n) \ + do { \ + (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 */ diff --git a/opal/mca/pmix/pmix2x/pmix/include/pmix_server.h b/opal/mca/pmix/pmix2x/pmix/include/pmix_server.h index 6fb371d6bd..d7b55d7725 100644 --- a/opal/mca/pmix/pmix2x/pmix/include/pmix_server.h +++ b/opal/mca/pmix/pmix2x/pmix/include/pmix_server.h @@ -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 ****/ diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c index bf1ea46732..229a475329 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c @@ -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; @@ -349,7 +794,7 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src) /* PMIX_VALUE */ pmix_status_t pmix_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src, - pmix_data_type_t type) + pmix_data_type_t type) { pmix_value_t *p; @@ -367,16 +812,16 @@ pmix_status_t pmix_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src, } pmix_status_t pmix_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src, - pmix_data_type_t type) + pmix_data_type_t type) { *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); } pmix_status_t pmix_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src, - pmix_data_type_t type) + pmix_data_type_t type) { *dest = PMIX_NEW(pmix_buffer_t); pmix_bfrop.copy_payload(*dest, src); @@ -384,7 +829,7 @@ pmix_status_t pmix_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src, } pmix_status_t pmix_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src, - pmix_data_type_t type) + pmix_data_type_t type) { size_t j; @@ -404,7 +849,7 @@ pmix_status_t pmix_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src, } pmix_status_t pmix_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src, - pmix_data_type_t type) + pmix_data_type_t type) { pmix_kval_t *p; @@ -421,23 +866,8 @@ 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) + pmix_data_type_t type) { *dest = (pmix_proc_t*)malloc(sizeof(pmix_proc_t)); if (NULL == *dest) { @@ -450,8 +880,8 @@ pmix_status_t pmix_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src, #if PMIX_HAVE_HWLOC pmix_status_t pmix_bfrop_copy_topo(hwloc_topology_t *dest, - hwloc_topology_t src, - pmix_data_type_t type) + hwloc_topology_t src, + pmix_data_type_t type) { /* use the hwloc dup function */ return hwloc_topology_dup(dest, src); @@ -459,7 +889,7 @@ pmix_status_t pmix_bfrop_copy_topo(hwloc_topology_t *dest, #endif pmix_status_t pmix_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src, - pmix_data_type_t type) + pmix_data_type_t type) { *dest = (pmix_modex_data_t*)malloc(sizeof(pmix_modex_data_t)); if (NULL == *dest) { @@ -479,7 +909,7 @@ pmix_status_t pmix_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t } pmix_status_t pmix_bfrop_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src, - pmix_data_type_t type) + pmix_data_type_t type) { *dest = (pmix_persistence_t*)malloc(sizeof(pmix_persistence_t)); if (NULL == *dest) { @@ -490,7 +920,7 @@ pmix_status_t pmix_bfrop_copy_persist(pmix_persistence_t **dest, pmix_persistenc } pmix_status_t pmix_bfrop_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t *src, - pmix_data_type_t type) + pmix_data_type_t type) { *dest = (pmix_byte_object_t*)malloc(sizeof(pmix_byte_object_t)); if (NULL == *dest) { @@ -503,7 +933,7 @@ pmix_status_t pmix_bfrop_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t * } pmix_status_t pmix_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src, - pmix_data_type_t type) + pmix_data_type_t type) { *dest = (pmix_pdata_t*)malloc(sizeof(pmix_pdata_t)); (void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN); @@ -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; +} +/*******************/ diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal.h b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal.h index 5d3fd3ea33..e207bc0be3 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal.h +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal.h @@ -219,160 +219,200 @@ PMIX_CLASS_DECLARATION(pmix_bfrop_type_info_t); * Implementations of API functions */ - pmix_status_t pmix_bfrop_pack(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, - pmix_data_type_t type); - pmix_status_t pmix_bfrop_unpack(pmix_buffer_t *buffer, void *dest, - int32_t *max_num_vals, - pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, + pmix_data_type_t type); +pmix_status_t pmix_bfrop_unpack(pmix_buffer_t *buffer, void *dest, + int32_t *max_num_vals, + pmix_data_type_t type); - pmix_status_t pmix_bfrop_copy(void **dest, void *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_copy(void **dest, void *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print(char **output, char *prefix, void *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print(char **output, char *prefix, void *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src); +pmix_status_t pmix_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src); /* * Specialized functions */ - pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, - int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, + int32_t *num_vals, pmix_data_type_t type); /* * Internal pack functions */ - pmix_status_t pmix_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_int(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_int(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_pack_status(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); + int32_t num_vals, pmix_data_type_t type); #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); +pmix_status_t pmix_bfrop_pack_topo(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); #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, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_info(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - pmix_status_t pmix_bfrop_pack_modex(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_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_value(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, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_info(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix_bfrop_pack_modex(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 */ pmix_status_t pmix_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); #if PMIX_HAVE_HWLOC pmix_status_t pmix_bfrop_unpack_topo(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); #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); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + int32_t *num_vals, pmix_data_type_t type); pmix_status_t pmix_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); + 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); + 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); + 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); + 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); + 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 @@ -387,83 +427,115 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, hwloc_topology_t src, pmix_data_type_t type); #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, - pmix_data_type_t type); - pmix_status_t pmix_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src, - pmix_data_type_t type); - pmix_status_t pmix_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src, - pmix_data_type_t type); - pmix_status_t pmix_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src, - pmix_data_type_t type); - pmix_status_t pmix_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src, - pmix_data_type_t type); - pmix_status_t pmix_bfrop_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src, - pmix_data_type_t type); - pmix_status_t pmix_bfrop_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t *src, - 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_value(pmix_value_t **dest, pmix_value_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, + pmix_data_type_t type); +pmix_status_t pmix_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src, + pmix_data_type_t type); +pmix_status_t pmix_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src, + pmix_data_type_t type); +pmix_status_t pmix_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src, + pmix_data_type_t type); +pmix_status_t pmix_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src, + pmix_data_type_t type); +pmix_status_t pmix_bfrop_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src, + pmix_data_type_t type); +pmix_status_t pmix_bfrop_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t *src, + 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 */ - pmix_status_t pmix_bfrop_print_bool(char **output, char *prefix, bool *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_byte(char **output, char *prefix, uint8_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_string(char **output, char *prefix, char *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_size(char **output, char *prefix, size_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_pid(char **output, char *prefix, pid_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_bool(char **output, char *prefix, bool *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_byte(char **output, char *prefix, uint8_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_string(char **output, char *prefix, char *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_size(char **output, char *prefix, size_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_pid(char **output, char *prefix, pid_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_int(char **output, char *prefix, int *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_int8(char **output, char *prefix, int8_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_int16(char **output, char *prefix, int16_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_int32(char **output, char *prefix, int32_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_int64(char **output, char *prefix, int64_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_int(char **output, char *prefix, int *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_int8(char **output, char *prefix, int8_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_int16(char **output, char *prefix, int16_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_int32(char **output, char *prefix, int32_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_int64(char **output, char *prefix, int64_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_uint(char **output, char *prefix, uint *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_uint8(char **output, char *prefix, uint8_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_uint16(char **output, char *prefix, uint16_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_uint32(char **output, char *prefix, uint32_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_uint64(char **output, char *prefix, uint64_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_uint(char **output, char *prefix, uint *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_uint8(char **output, char *prefix, uint8_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_uint16(char **output, char *prefix, uint16_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_uint32(char **output, char *prefix, uint32_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_uint64(char **output, char *prefix, uint64_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_float(char **output, char *prefix, float *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_double(char **output, char *prefix, double *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_float(char **output, char *prefix, float *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_double(char **output, char *prefix, double *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_timeval(char **output, char *prefix, struct timeval *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_time(char **output, char *prefix, time_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_timeval(char **output, char *prefix, struct timeval *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_time(char **output, char *prefix, time_t *src, pmix_data_type_t type); pmix_status_t pmix_bfrop_print_status(char **output, char *prefix, pmix_status_t *src, pmix_data_type_t type); #if PMIX_HAVE_HWLOC - pmix_status_t pmix_bfrop_print_topo(char **output, char *prefix, - hwloc_topology_t src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_topo(char **output, char *prefix, + 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, - pmix_app_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_info(char **output, char *prefix, - pmix_info_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_buf(char **output, char *prefix, - pmix_buffer_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_kval(char **output, char *prefix, - pmix_kval_t *src, pmix_data_type_t type); - pmix_status_t pmix_bfrop_print_modex(char **output, char *prefix, - 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_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_value(char **output, char *prefix, pmix_value_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, + pmix_app_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_info(char **output, char *prefix, + pmix_info_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_buf(char **output, char *prefix, + pmix_buffer_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_kval(char **output, char *prefix, + pmix_kval_t *src, pmix_data_type_t type); +pmix_status_t pmix_bfrop_print_modex(char **output, char *prefix, + 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 diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal_functions.c b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal_functions.c index 13d5b620d3..55b126b07f 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal_functions.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal_functions.c @@ -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); } diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/open_close.c b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/open_close.c index 52a487acf8..ee7728e23a 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/open_close.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/open_close.c @@ -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; diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/pack.c b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/pack.c index 6e02cc593d..f62d9d8ae1 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/pack.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/pack.c @@ -36,9 +36,9 @@ #include "src/util/output.h" #include "src/buffer_ops/internal.h" - pmix_status_t pmix_bfrop_pack(pmix_buffer_t *buffer, - const void *src, int32_t num_vals, - pmix_data_type_t type) +pmix_status_t pmix_bfrop_pack(pmix_buffer_t *buffer, + const void *src, int32_t num_vals, + pmix_data_type_t type) { pmix_status_t rc; @@ -62,8 +62,8 @@ } pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, - const void *src, int32_t num_vals, - pmix_data_type_t type) + const void *src, int32_t num_vals, + pmix_data_type_t type) { pmix_status_t rc; pmix_bfrop_type_info_t *info; @@ -93,8 +93,8 @@ pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, /* * BOOL */ - pmix_status_t pmix_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { uint8_t *dst; int32_t i; @@ -125,8 +125,8 @@ pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, /* * INT */ - pmix_status_t pmix_bfrop_pack_int(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_pack_int(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; @@ -143,8 +143,8 @@ pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, /* * SIZE_T */ - pmix_status_t pmix_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; @@ -160,8 +160,8 @@ pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, /* * PID_T */ - pmix_status_t pmix_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; @@ -181,8 +181,8 @@ pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, /* * BYTE, CHAR, INT8 */ - pmix_status_t pmix_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { char *dst; @@ -205,8 +205,8 @@ pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, /* * INT16 */ - pmix_status_t pmix_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int32_t i; uint16_t tmp, *srctmp = (uint16_t*) src; @@ -232,8 +232,8 @@ pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, /* * INT32 */ - pmix_status_t pmix_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int32_t i; uint32_t tmp, *srctmp = (uint32_t*) src; @@ -257,16 +257,16 @@ 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) + 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); } /* * INT64 */ - pmix_status_t pmix_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int32_t i; uint64_t tmp, tmp2; @@ -294,8 +294,8 @@ pmix_status_t pmix_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src, /* * STRING */ - pmix_status_t pmix_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i, len; @@ -324,7 +324,7 @@ return PMIX_SUCCESS; /* FLOAT */ pmix_status_t pmix_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -347,7 +347,7 @@ pmix_status_t pmix_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, /* DOUBLE */ pmix_status_t pmix_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -370,7 +370,7 @@ pmix_status_t pmix_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, /* TIMEVAL */ pmix_status_t pmix_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { int64_t tmp[2]; pmix_status_t ret = PMIX_SUCCESS; @@ -390,7 +390,7 @@ pmix_status_t pmix_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, /* TIME */ pmix_status_t pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -412,7 +412,7 @@ pmix_status_t pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, /* STATUS */ pmix_status_t pmix_bfrop_pack_status(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -432,123 +432,170 @@ pmix_status_t pmix_bfrop_pack_status(pmix_buffer_t *buffer, const void *src, /* PACK FUNCTIONS FOR GENERIC PMIX TYPES */ static pmix_status_t pack_val(pmix_buffer_t *buffer, - pmix_value_t *p) + pmix_value_t *p) { pmix_status_t ret; switch (p->type) { case PMIX_UNDEF: - break; + break; case PMIX_BOOL: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.flag, 1, PMIX_BOOL))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.flag, 1, PMIX_BOOL))) { + return ret; + } + break; case PMIX_BYTE: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.byte, 1, PMIX_BYTE))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.byte, 1, PMIX_BYTE))) { + return ret; + } + break; case PMIX_STRING: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.string, 1, PMIX_STRING))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.string, 1, PMIX_STRING))) { + return ret; + } + break; case PMIX_SIZE: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.size, 1, PMIX_SIZE))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.size, 1, PMIX_SIZE))) { + return ret; + } + break; case PMIX_PID: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.pid, 1, PMIX_PID))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.pid, 1, PMIX_PID))) { + return ret; + } + break; case PMIX_INT: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.integer, 1, PMIX_INT))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.integer, 1, PMIX_INT))) { + return ret; + } + break; case PMIX_INT8: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int8, 1, PMIX_INT8))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int8, 1, PMIX_INT8))) { + return ret; + } + break; case PMIX_INT16: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int16, 1, PMIX_INT16))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int16, 1, PMIX_INT16))) { + return ret; + } + break; case PMIX_INT32: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int32, 1, PMIX_INT32))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int32, 1, PMIX_INT32))) { + return ret; + } + break; case PMIX_INT64: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int64, 1, PMIX_INT64))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int64, 1, PMIX_INT64))) { + return ret; + } + break; case PMIX_UINT: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint, 1, PMIX_UINT))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint, 1, PMIX_UINT))) { + return ret; + } + break; case PMIX_UINT8: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint8, 1, PMIX_UINT8))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint8, 1, PMIX_UINT8))) { + return ret; + } + break; case PMIX_UINT16: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint16, 1, PMIX_UINT16))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint16, 1, PMIX_UINT16))) { + return ret; + } + break; case PMIX_UINT32: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint32, 1, PMIX_UINT32))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint32, 1, PMIX_UINT32))) { + return ret; + } + break; case PMIX_UINT64: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint64, 1, PMIX_UINT64))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint64, 1, PMIX_UINT64))) { + return ret; + } + break; case PMIX_FLOAT: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.fval, 1, PMIX_FLOAT))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.fval, 1, PMIX_FLOAT))) { + return ret; + } + break; case PMIX_DOUBLE: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.dval, 1, PMIX_DOUBLE))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.dval, 1, PMIX_DOUBLE))) { + return ret; + } + break; case PMIX_TIMEVAL: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.tv, 1, PMIX_TIMEVAL))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.tv, 1, PMIX_TIMEVAL))) { + 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; + if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.status, 1, PMIX_STATUS))) { + return ret; + } + break; case PMIX_PROC: - if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.proc, 1, PMIX_PROC))) { - return ret; - } - break; + 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; @@ -560,7 +607,7 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, * PMIX_VALUE */ pmix_status_t pmix_bfrop_pack_value(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_value_t *ptr; int32_t i; @@ -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 */ @@ -584,7 +631,7 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, pmix_status_t pmix_bfrop_pack_info(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_info_t *info; int32_t i; @@ -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 */ @@ -616,7 +663,7 @@ pmix_status_t pmix_bfrop_pack_info(pmix_buffer_t *buffer, const void *src, } pmix_status_t pmix_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_pdata_t *pdata; int32_t i; @@ -648,7 +695,7 @@ pmix_status_t pmix_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src, } pmix_status_t pmix_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_buffer_t **ptr; int32_t i; @@ -672,7 +719,7 @@ pmix_status_t pmix_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, } pmix_status_t pmix_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_proc_t *proc; int32_t i; @@ -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; } } @@ -693,7 +740,7 @@ pmix_status_t pmix_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src, } pmix_status_t pmix_bfrop_pack_app(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_app_t *app; int32_t i, j, nvals; @@ -743,21 +790,23 @@ pmix_status_t pmix_bfrop_pack_app(pmix_buffer_t *buffer, const void *src, pmix_status_t pmix_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { 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) @@ -836,13 +860,13 @@ pmix_status_t pmix_bfrop_pack_topo(pmix_buffer_t *buffer, const void *src, sizeof(struct hwloc_topology_cpubind_support), PMIX_BYTE))) { return rc; -} - /* pack the membind support */ -if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_byte(buffer, support->membind, - sizeof(struct hwloc_topology_membind_support), - PMIX_BYTE))) { - return rc; -} + } + /* pack the membind support */ + if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_byte(buffer, support->membind, + sizeof(struct hwloc_topology_membind_support), + PMIX_BYTE))) { + return rc; + } } return PMIX_SUCCESS; @@ -850,7 +874,7 @@ return PMIX_SUCCESS; #endif pmix_status_t pmix_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_modex_data_t *ptr; int32_t i; @@ -872,13 +896,37 @@ 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) + 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, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; int i; @@ -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; +} +/********************/ diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/print.c b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/print.c index c4730dd19c..c6b8044929 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/print.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/print.c @@ -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) @@ -81,14 +81,14 @@ } if (0 > asprintf(output, "%sData type: PMIX_BOOL\tValue: %s", prefix, - (*src) ? "TRUE" : "FALSE")) { + (*src) ? "TRUE" : "FALSE")) { return PMIX_ERR_NOMEM; - } - if (prefx != prefix) { - free(prefx); - } +} +if (prefx != prefix) { + free(prefx); +} - return PMIX_SUCCESS; +return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_print_byte(char **output, char *prefix, uint8_t *src, pmix_data_type_t type) @@ -363,7 +363,7 @@ pmix_status_t pmix_bfrop_print_uint16(char **output, char *prefix, uint16_t *src } pmix_status_t pmix_bfrop_print_uint32(char **output, char *prefix, - uint32_t *src, pmix_data_type_t type) + uint32_t *src, pmix_data_type_t type) { char *prefx; @@ -398,7 +398,7 @@ pmix_status_t pmix_bfrop_print_uint32(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_int8(char **output, char *prefix, - int8_t *src, pmix_data_type_t type) + int8_t *src, pmix_data_type_t type) { char *prefx; @@ -433,7 +433,7 @@ pmix_status_t pmix_bfrop_print_int8(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_int16(char **output, char *prefix, - int16_t *src, pmix_data_type_t type) + int16_t *src, pmix_data_type_t type) { char *prefx; @@ -501,8 +501,8 @@ pmix_status_t pmix_bfrop_print_int32(char **output, char *prefix, int32_t *src, return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_print_uint64(char **output, char *prefix, - uint64_t *src, - pmix_data_type_t type) + uint64_t *src, + pmix_data_type_t type) { char *prefx; @@ -537,8 +537,8 @@ pmix_status_t pmix_bfrop_print_uint64(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_int64(char **output, char *prefix, - int64_t *src, - pmix_data_type_t type) + int64_t *src, + pmix_data_type_t type) { char *prefx; @@ -573,7 +573,7 @@ pmix_status_t pmix_bfrop_print_int64(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_float(char **output, char *prefix, - float *src, pmix_data_type_t type) + float *src, pmix_data_type_t type) { char *prefx; @@ -608,7 +608,7 @@ pmix_status_t pmix_bfrop_print_float(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_double(char **output, char *prefix, - double *src, pmix_data_type_t type) + double *src, pmix_data_type_t type) { char *prefx; @@ -643,7 +643,7 @@ pmix_status_t pmix_bfrop_print_double(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_time(char **output, char *prefix, - time_t *src, pmix_data_type_t type) + time_t *src, pmix_data_type_t type) { char *prefx; char *t; @@ -682,7 +682,7 @@ pmix_status_t pmix_bfrop_print_time(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_timeval(char **output, char *prefix, - struct timeval *src, pmix_data_type_t type) + struct timeval *src, pmix_data_type_t type) { char *prefx; @@ -707,18 +707,18 @@ pmix_status_t pmix_bfrop_print_timeval(char **output, char *prefix, } if (0 > asprintf(output, "%sData type: PMIX_TIMEVAL\tValue: %ld.%06ld", prefx, - (long)src->tv_sec, (long)src->tv_usec)) { + (long)src->tv_sec, (long)src->tv_usec)) { return PMIX_ERR_NOMEM; - } - if (prefx != prefix) { - free(prefx); - } +} +if (prefx != prefix) { + free(prefx); +} - return PMIX_SUCCESS; +return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_print_status(char **output, char *prefix, - pmix_status_t *src, pmix_data_type_t type) + pmix_status_t *src, pmix_data_type_t type) { char *prefx; @@ -759,7 +759,7 @@ pmix_status_t pmix_bfrop_print_status(char **output, char *prefix, * PMIX_VALUE */ pmix_status_t pmix_bfrop_print_value(char **output, char *prefix, - pmix_value_t *src, pmix_data_type_t type) + pmix_value_t *src, pmix_data_type_t type) { char *prefx; int rc; @@ -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); @@ -851,12 +854,39 @@ pmix_status_t pmix_bfrop_print_status(char **output, char *prefix, break; case PMIX_TIMEVAL: 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); + (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; @@ -871,14 +901,14 @@ pmix_status_t pmix_bfrop_print_status(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_info(char **output, char *prefix, - pmix_info_t *src, pmix_data_type_t type) + pmix_info_t *src, pmix_data_type_t type) { char *tmp; 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); } @@ -889,7 +919,7 @@ pmix_status_t pmix_bfrop_print_info(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_pdata(char **output, char *prefix, - pmix_pdata_t *src, pmix_data_type_t type) + pmix_pdata_t *src, pmix_data_type_t type) { char *tmp1, *tmp2; int rc; @@ -897,7 +927,7 @@ pmix_status_t pmix_bfrop_print_pdata(char **output, char *prefix, pmix_bfrop_print_proc(&tmp1, NULL, &src->proc, PMIX_PROC); pmix_bfrop_print_value(&tmp2, NULL, &src->value, PMIX_VALUE); rc = asprintf(output, "%s %s KEY: %s %s", prefix, tmp1, src->key, - (NULL == tmp2) ? "NULL" : tmp2); + (NULL == tmp2) ? "NULL" : tmp2); if (NULL != tmp1) { free(tmp1); } @@ -911,21 +941,22 @@ pmix_status_t pmix_bfrop_print_pdata(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_buf(char **output, char *prefix, - pmix_buffer_t *src, pmix_data_type_t type) + pmix_buffer_t *src, pmix_data_type_t type) { return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_print_app(char **output, char *prefix, - pmix_app_t *src, pmix_data_type_t type) + pmix_app_t *src, pmix_data_type_t type) { return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_print_proc(char **output, char *prefix, - pmix_proc_t *src, pmix_data_type_t type) + pmix_proc_t *src, pmix_data_type_t type) { char *prefx; + int rc; /* deal with NULL prefix */ if (NULL == prefix) { @@ -936,49 +967,39 @@ 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; } pmix_status_t pmix_bfrop_print_kval(char **output, char *prefix, - pmix_kval_t *src, pmix_data_type_t type) + pmix_kval_t *src, pmix_data_type_t type) { 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 @@ -996,21 +1017,21 @@ static void print_hwloc_obj(char **output, char *prefix, return; } if (0 > asprintf(&tmp, "%sType: %s Number of child objects: %u%sName=%s", - (NULL == prefix) ? "" : prefix, string, obj->arity, - pfx, (NULL == obj->name) ? "NULL" : obj->name)) { + (NULL == prefix) ? "" : prefix, string, obj->arity, + pfx, (NULL == obj->name) ? "NULL" : obj->name)) { + free(pfx); + return; +} +if (0 < hwloc_obj_attr_snprintf(string, 1024, obj, pfx, 1)) { + /* print the attributes */ + if (0 > asprintf(&tmp2, "%s%s%s", tmp, pfx, string)) { + free(tmp); free(pfx); return; } - if (0 < hwloc_obj_attr_snprintf(string, 1024, obj, pfx, 1)) { - /* print the attributes */ - if (0 > asprintf(&tmp2, "%s%s%s", tmp, pfx, string)) { - free(tmp); - free(pfx); - return; - } - free(tmp); - tmp = tmp2; - } + free(tmp); + tmp = tmp2; +} /* print the cpusets - apparently, some new HWLOC types don't * have cpusets, so protect ourselves here */ @@ -1048,47 +1069,47 @@ static void print_hwloc_obj(char **output, char *prefix, /* root level object - add support values */ support = (struct hwloc_topology_support*)hwloc_topology_get_support(topo); if (0 > asprintf(&tmp2, "%s%sBind CPU proc: %s%sBind CPU thread: %s", tmp, pfx, - (support->cpubind->set_thisproc_cpubind) ? "TRUE" : "FALSE", pfx, - (support->cpubind->set_thisthread_cpubind) ? "TRUE" : "FALSE")) { + (support->cpubind->set_thisproc_cpubind) ? "TRUE" : "FALSE", pfx, + (support->cpubind->set_thisthread_cpubind) ? "TRUE" : "FALSE")) { free(tmp); - free(pfx); - return; - } - free(tmp); - tmp = tmp2; - if (0 > asprintf(&tmp2, "%s%sBind MEM proc: %s%sBind MEM thread: %s", tmp, pfx, - (support->membind->set_thisproc_membind) ? "TRUE" : "FALSE", pfx, - (support->membind->set_thisthread_membind) ? "TRUE" : "FALSE")) { - free(tmp); - free(pfx); - return; - } - free(tmp); - tmp = tmp2; - } - if (0 > asprintf(&tmp2, "%s%s\n", (NULL == *output) ? "" : *output, tmp)) { - free(tmp); + free(pfx); return; } free(tmp); + tmp = tmp2; + if (0 > asprintf(&tmp2, "%s%sBind MEM proc: %s%sBind MEM thread: %s", tmp, pfx, + (support->membind->set_thisproc_membind) ? "TRUE" : "FALSE", pfx, + (support->membind->set_thisthread_membind) ? "TRUE" : "FALSE")) { + free(tmp); free(pfx); - if (0 > asprintf(&pfx, "%s\t", (NULL == prefix) ? "" : prefix)) { - return; - } - for (i=0; i < obj->arity; i++) { - obj2 = obj->children[i]; + return; +} +free(tmp); +tmp = tmp2; +} +if (0 > asprintf(&tmp2, "%s%s\n", (NULL == *output) ? "" : *output, tmp)) { + free(tmp); + return; +} +free(tmp); +free(pfx); +if (0 > asprintf(&pfx, "%s\t", (NULL == prefix) ? "" : prefix)) { + return; +} +for (i=0; i < obj->arity; i++) { + obj2 = obj->children[i]; /* print the object */ - print_hwloc_obj(&tmp2, pfx, topo, obj2); - } - free(pfx); - if (NULL != *output) { - free(*output); - } - *output = tmp2; + print_hwloc_obj(&tmp2, pfx, topo, obj2); +} +free(pfx); +if (NULL != *output) { + free(*output); +} +*output = tmp2; } pmix_status_t pmix_bfrop_print_topo(char **output, char *prefix, - hwloc_topology_t src, pmix_data_type_t type) + hwloc_topology_t src, pmix_data_type_t type) { hwloc_obj_t obj; char *tmp=NULL; @@ -1104,7 +1125,7 @@ pmix_status_t pmix_bfrop_print_topo(char **output, char *prefix, #endif pmix_status_t pmix_bfrop_print_modex(char **output, char *prefix, - pmix_modex_data_t *src, pmix_data_type_t type) + pmix_modex_data_t *src, pmix_data_type_t type) { return PMIX_SUCCESS; } @@ -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) { @@ -1179,7 +1303,7 @@ pmix_status_t pmix_bfrop_print_bo(char **output, char *prefix, } pmix_status_t pmix_bfrop_print_ptr(char **output, char *prefix, - void *src, pmix_data_type_t type) + void *src, pmix_data_type_t type) { char *prefx; @@ -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; +} +/********************/ diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c index 4772ab502f..19cea29395 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c @@ -33,8 +33,9 @@ #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_data_type_t type) +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; int32_t local_num, n=1; @@ -71,21 +72,21 @@ return rc; } if (PMIX_INT32 != local_type) { /* if the length wasn't first, then error */ - *num_vals = 0; - return PMIX_ERR_UNPACK_FAILURE; + *num_vals = 0; + return PMIX_ERR_UNPACK_FAILURE; + } } -} -n=1; -if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_int32(buffer, &local_num, &n, PMIX_INT32))) { - *num_vals = 0; - /* don't error log here as the user may be unpacking past - * the end of the buffer, which isn't necessarily an error */ - return rc; -} + n=1; + if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_int32(buffer, &local_num, &n, PMIX_INT32))) { + *num_vals = 0; + /* don't error log here as the user may be unpacking past + * the end of the buffer, which isn't necessarily an error */ + return rc; + } -pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: found %d values for %d provided storage", - local_num, *num_vals); + pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: found %d values for %d provided storage", + local_num, *num_vals); /** if the storage provided is inadequate, set things up * to unpack as much as we can and to return an error code @@ -148,8 +149,8 @@ pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32_t /* * BOOL */ - pmix_status_t pmix_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint8_t *src; @@ -182,8 +183,8 @@ pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32_t /* * INT */ - pmix_status_t pmix_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; @@ -208,8 +209,8 @@ pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32_t /* * SIZE_T */ - pmix_status_t pmix_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; @@ -234,8 +235,8 @@ pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32_t /* * PID_T */ - pmix_status_t pmix_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; @@ -263,8 +264,8 @@ pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32_t /* * BYTE, CHAR, INT8 */ - pmix_status_t pmix_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_byte * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ @@ -282,7 +283,7 @@ pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32_t } pmix_status_t pmix_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint16_t tmp, *desttmp = (uint16_t*) dest; @@ -328,13 +329,13 @@ 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) + 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, - int32_t *num_vals, pmix_data_type_t type) + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint64_t tmp, *desttmp = (uint64_t*) dest; @@ -368,23 +369,23 @@ pmix_status_t pmix_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, return ret; } if (0 == len) { /* zero-length string - unpack the NULL */ - sdest[i] = NULL; - } else { - sdest[i] = (char*)malloc(len); - if (NULL == sdest[i]) { - return PMIX_ERR_OUT_OF_RESOURCE; - } - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_byte(buffer, sdest[i], &len, PMIX_BYTE))) { - return ret; + sdest[i] = NULL; + } else { + sdest[i] = (char*)malloc(len); + if (NULL == sdest[i]) { + return PMIX_ERR_OUT_OF_RESOURCE; + } + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_byte(buffer, sdest[i], &len, PMIX_BYTE))) { + return ret; + } } } -} -return PMIX_SUCCESS; + return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; float *desttmp = (float*) dest, tmp; @@ -414,7 +415,7 @@ pmix_status_t pmix_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, } pmix_status_t pmix_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; double *desttmp = (double*) dest, tmp; @@ -444,7 +445,7 @@ pmix_status_t pmix_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, } pmix_status_t pmix_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; int64_t tmp[2]; @@ -471,7 +472,7 @@ pmix_status_t pmix_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, } pmix_status_t pmix_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; time_t *desttmp = (time_t *) dest, tmp; @@ -502,7 +503,7 @@ pmix_status_t pmix_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) + int32_t *num_vals, pmix_data_type_t type) { pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_status * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ @@ -528,117 +529,164 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, m = 1; switch (val->type) { case PMIX_UNDEF: - break; + break; case PMIX_BOOL: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.flag, &m, PMIX_BOOL))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.flag, &m, PMIX_BOOL))) { + return ret; + } + break; case PMIX_BYTE: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.byte, &m, PMIX_BYTE))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.byte, &m, PMIX_BYTE))) { + return ret; + } + break; case PMIX_STRING: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.string, &m, PMIX_STRING))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.string, &m, PMIX_STRING))) { + return ret; + } + break; case PMIX_SIZE: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.size, &m, PMIX_SIZE))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.size, &m, PMIX_SIZE))) { + return ret; + } + break; case PMIX_PID: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.pid, &m, PMIX_PID))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.pid, &m, PMIX_PID))) { + return ret; + } + break; case PMIX_INT: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.integer, &m, PMIX_INT))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.integer, &m, PMIX_INT))) { + return ret; + } + break; case PMIX_INT8: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int8, &m, PMIX_INT8))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int8, &m, PMIX_INT8))) { + return ret; + } + break; case PMIX_INT16: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int16, &m, PMIX_INT16))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int16, &m, PMIX_INT16))) { + return ret; + } + break; case PMIX_INT32: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int32, &m, PMIX_INT32))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int32, &m, PMIX_INT32))) { + return ret; + } + break; case PMIX_INT64: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int64, &m, PMIX_INT64))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int64, &m, PMIX_INT64))) { + return ret; + } + break; case PMIX_UINT: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint, &m, PMIX_UINT))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint, &m, PMIX_UINT))) { + return ret; + } + break; case PMIX_UINT8: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint8, &m, PMIX_UINT8))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint8, &m, PMIX_UINT8))) { + return ret; + } + break; case PMIX_UINT16: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint16, &m, PMIX_UINT16))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint16, &m, PMIX_UINT16))) { + return ret; + } + break; case PMIX_UINT32: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint32, &m, PMIX_UINT32))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint32, &m, PMIX_UINT32))) { + return ret; + } + break; case PMIX_UINT64: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint64, &m, PMIX_UINT64))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint64, &m, PMIX_UINT64))) { + return ret; + } + break; case PMIX_FLOAT: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.fval, &m, PMIX_FLOAT))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.fval, &m, PMIX_FLOAT))) { + return ret; + } + break; case PMIX_DOUBLE: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.dval, &m, PMIX_DOUBLE))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.dval, &m, PMIX_DOUBLE))) { + return ret; + } + break; case PMIX_TIMEVAL: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.tv, &m, PMIX_TIMEVAL))) { - return ret; - } - break; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.tv, &m, PMIX_TIMEVAL))) { + 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; + if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.status, &m, PMIX_STATUS))) { + return ret; + } + break; case PMIX_PROC: - if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.proc, &m, PMIX_PROC))) { - return ret; - } - break; + 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, @@ -1108,9 +1122,33 @@ 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) + 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; +} +/********************/ diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c index eedf550194..b20d473b2f 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c @@ -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) { - PMIX_INFO_CREATE(chain->info, chain->ninfo); - cnt = chain->ninfo; + + /* we always leave space for a callback object */ + chain->ninfo = ninfo + 1; + PMIX_INFO_CREATE(chain->info, 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); @@ -520,7 +528,7 @@ PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo) } PMIX_EXPORT pmix_status_t PMIx_Abort(int flag, const char msg[], - pmix_proc_t procs[], size_t nprocs) + pmix_proc_t procs[], size_t nprocs) { pmix_buffer_t *bfr; pmix_cmd_t cmd = PMIX_ABORT_CMD; @@ -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); } diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_connect.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_connect.c index df9f528767..5c63a0631b 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_connect.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_connect.c @@ -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; } diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_fence.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_fence.c index ac1b1b093b..e24fbe013c 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_fence.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_fence.c @@ -59,8 +59,8 @@ static pmix_status_t unpack_return(pmix_buffer_t *data); static pmix_status_t pack_fence(pmix_buffer_t *msg, pmix_cmd_t cmd, - const pmix_proc_t *procs, size_t nprocs, - const pmix_info_t *info, size_t ninfo); + const pmix_proc_t *procs, size_t nprocs, + const pmix_info_t *info, size_t ninfo); static void wait_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr, pmix_buffer_t *buf, void *cbdata); @@ -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; } diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c index 714d0e5646..33145b089e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c @@ -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); @@ -72,8 +72,8 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr, static void _value_cbfunc(pmix_status_t status, pmix_value_t *kv, void *cbdata); PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[], - const pmix_info_t info[], size_t ninfo, - pmix_value_t **val) + const pmix_info_t info[], size_t ninfo, + pmix_value_t **val) { pmix_cb_t *cb; pmix_status_t rc; @@ -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); + 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; } - /* 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; /* cleanup */ - if (NULL != val) { - PMIX_VALUE_RELEASE(val); - } + 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); + 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; } - /* 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; /* cleanup */ - if (NULL != val) { - PMIX_VALUE_RELEASE(val); - } + 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); diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c index 2de2b3f20d..135546b8d9 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c @@ -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; } diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_spawn.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_spawn.c index 73b0e85096..a1e6e74901 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_spawn.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_spawn.c @@ -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; } diff --git a/opal/mca/pmix/pmix2x/pmix/src/common/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/common/Makefile.am index cdd1b80c6d..3b4d0807b5 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/common/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/src/common/Makefile.am @@ -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 diff --git a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_log.c b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_log.c new file mode 100644 index 0000000000..87295d0463 --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/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 + +#include +#include +#include + +#include +#include +#include + +#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; +} diff --git a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_query.c b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_query.c index 4523554ba2..23f7ac3312 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_query.c +++ b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_query.c @@ -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; -} diff --git a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_strings.c b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_strings.c new file mode 100644 index 0000000000..bbd6ea8dee --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_strings.c @@ -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 + + +#ifdef HAVE_STRING_H +#include +#endif +#include +#include +#ifdef HAVE_STDLIB_H +#include +#endif + +#include +#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; +} diff --git a/opal/mca/pmix/pmix2x/pmix/src/dstore/pmix_dstore.h b/opal/mca/pmix/pmix2x/pmix/src/dstore/pmix_dstore.h index ee813729ce..a306a9abdf 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/dstore/pmix_dstore.h +++ b/opal/mca/pmix/pmix2x/pmix/src/dstore/pmix_dstore.h @@ -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); /** diff --git a/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event.h b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event.h index 95d2a3f94b..f184035153 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event.h +++ b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event.h @@ -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); diff --git a/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_notification.c b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_notification.c index 3869465841..b9db00567e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_notification.c +++ b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_notification.c @@ -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) { diff --git a/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_registration.c b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_registration.c index 17bdc2d898..b18c7afd85 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_registration.c +++ b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_registration.c @@ -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); diff --git a/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.c b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.c index 54440fd1a0..69a1e75f62 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.c +++ b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.c @@ -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; diff --git a/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.h b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.h index 43fe13f000..7992c3533b 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.h +++ b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.h @@ -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; diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c index cc7f309e26..80733ba54f 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c @@ -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,12 +185,10 @@ 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"))) { - if (NULL == (tdir = getenv("TEMP"))) { - if (NULL == (tdir = getenv("TMP"))) { - tdir = "/tmp"; - } + } else if (NULL == (tdir = getenv("TMPDIR"))) { + if (NULL == (tdir = getenv("TEMP"))) { + if (NULL == (tdir = getenv("TMP"))) { + tdir = "/tmp"; } } } @@ -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,49 +297,95 @@ 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 (NULL != systmpdir) { - tdir = systmpdir; - } else if (NULL == (tdir = getenv("TMPDIR"))) { - if (NULL == (tdir = getenv("TEMP"))) { - if (NULL == (tdir = getenv("TMP"))) { - tdir = "/tmp"; + /* 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"))) { + if (NULL == (tdir = getenv("TEMP"))) { + if (NULL == (tdir = getenv("TMP"))) { + tdir = "/tmp"; + } } } - } - if (0 > asprintf(&pmix_pid, "%s/pmix.%s.tool.%d", tdir, myhostname, mypid)) { - return PMIX_ERR_NOMEM; - } - if ((strlen(pmix_pid) + 1) > sizeof(tl->address.sun_path)-1) { + 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); - return PMIX_ERR_INVALID_LENGTH; + 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; + } + 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 */ + 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); } - snprintf(tl->address.sun_path, sizeof(tl->address.sun_path) - 1, "%s", pmix_pid); - free(pmix_pid); /* 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; } @@ -1812,10 +1860,10 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) rc = PMIX_SUCCESS; } -finish_collective: + 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; diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c index 85de896e9e..fca6dafed7 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c @@ -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, diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_listener.c b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_listener.c index b4749b75ef..da608c986b 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_listener.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_listener.c @@ -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); } diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c index 56944e9902..5c8a4710ac 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c @@ -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, - cd->directives, cd->ndirs, - cbfunc, cd))) { - PMIX_RELEASE(cd); - return rc; - } + /* ask the host to log the info */ + pmix_host_server.log(&proc, cd->info, cd->ninfo, + cd->directives, cd->ndirs, + 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) { diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.h b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.h index 963f353497..06b7bd8dfb 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.h +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.h @@ -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, diff --git a/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c index 6739266e61..7d18b7b7a2 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c @@ -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,59 +272,108 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* ensure it is NULL terminated */ hostname[hostnamelen-1] = '\0'; - /* 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) { - 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)) { - pmix_output_close(pmix_globals.debug_output); - pmix_output_finalize(); - pmix_class_finalize(); - return PMIX_ERR_NOT_FOUND; - } - } else { - /* open up the temp directory */ - if (NULL == (cur_dirp = opendir(tdir))) { - pmix_output_close(pmix_globals.debug_output); - pmix_output_finalize(); - pmix_class_finalize(); - return PMIX_ERR_NOT_FOUND; - } - /* search the entries for something that starts with pmix.hostname */ - if (0 > asprintf(&tmp, "pmix.%s", hostname)) { - closedir(cur_dirp); - return PMIX_ERR_NOMEM; - } - evar = NULL; - while (NULL != (dir_entry = readdir(cur_dirp))) { - if (0 == strncmp(dir_entry->d_name, tmp, strlen(tmp))) { - /* found one - if more than one, then that's an error */ - if (NULL != evar) { - closedir(cur_dirp); - free(evar); - free(tmp); - pmix_output_close(pmix_globals.debug_output); - pmix_output_finalize(); - pmix_class_finalize(); - return PMIX_ERR_INIT; + /* 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"; } - evar = strdup(dir_entry->d_name); } } - free(tmp); - closedir(cur_dirp); - if (NULL == evar) { - /* none found */ - pmix_output_close(pmix_globals.debug_output); - pmix_output_finalize(); - pmix_class_finalize(); - return PMIX_ERR_INIT; + 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_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)) { + pmix_output_close(pmix_globals.debug_output); + pmix_output_finalize(); + pmix_class_finalize(); + return PMIX_ERR_NOT_FOUND; + } + } else { + /* open up the temp directory */ + if (NULL == (cur_dirp = opendir(tdir))) { + pmix_output_close(pmix_globals.debug_output); + pmix_output_finalize(); + pmix_class_finalize(); + return PMIX_ERR_NOT_FOUND; + } + /* search the entries for something that starts with pmix.hostname */ + if (0 > asprintf(&tmp, "pmix.%s", hostname)) { + closedir(cur_dirp); + return PMIX_ERR_NOMEM; + } + evar = NULL; + while (NULL != (dir_entry = readdir(cur_dirp))) { + if (0 == strncmp(dir_entry->d_name, tmp, strlen(tmp))) { + /* found one - if more than one, then that's an error */ + if (NULL != evar) { + closedir(cur_dirp); + free(evar); + free(tmp); + pmix_output_close(pmix_globals.debug_output); + pmix_output_finalize(); + pmix_class_finalize(); + return PMIX_ERR_INIT; + } + evar = strdup(dir_entry->d_name); + } + } + free(tmp); + closedir(cur_dirp); + if (NULL == evar) { + /* none found */ + pmix_output_close(pmix_globals.debug_output); + pmix_output_finalize(); + pmix_class_finalize(); + return PMIX_ERR_INIT; + } + /* use the found one as our contact point */ + snprintf(address.sun_path, sizeof(address.sun_path)-1, "%s/%s", tdir, evar); + free(evar); } - /* use the found one as our contact point */ - snprintf(address.sun_path, sizeof(address.sun_path)-1, "%s/%s", tdir, evar); - free(evar); } pmix_bfrop_open(); diff --git a/opal/mca/pmix/pmix2x/pmix/src/usock/usock.h b/opal/mca/pmix/pmix2x/pmix/src/usock/usock.h index c0eb139164..b9c15ac62a 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/usock/usock.h +++ b/opal/mca/pmix/pmix2x/pmix/src/usock/usock.h @@ -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; diff --git a/opal/mca/pmix/pmix2x/pmix/src/usock/usock_sendrecv.c b/opal/mca/pmix/pmix2x/pmix/src/usock/usock_sendrecv.c index 5fb952c3a4..05658ef987 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/usock/usock_sendrecv.c +++ b/opal/mca/pmix/pmix2x/pmix/src/usock/usock_sendrecv.c @@ -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; diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/hash.c b/opal/mca/pmix/pmix2x/pmix/src/util/hash.c index 1acdd13fdb..125e13479e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/hash.c +++ b/opal/mca/pmix/pmix2x/pmix/src/util/hash.c @@ -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; diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/hash.h b/opal/mca/pmix/pmix2x/pmix/src/util/hash.h index e6a6bbd753..6b385b2710 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/hash.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/hash.h @@ -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 diff --git a/opal/mca/pmix/pmix2x/pmix/test/simple/simpclient.c b/opal/mca/pmix/pmix2x/pmix/test/simple/simpclient.c index 0e57621406..ea363dc8ef 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/simple/simpclient.c +++ b/opal/mca/pmix/pmix2x/pmix/test/simple/simpclient.c @@ -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) { diff --git a/opal/mca/pmix/pmix2x/pmix/test/simple/simptest.c b/opal/mca/pmix/pmix2x/pmix/test/simple/simptest.c index 59951ca86b..755971fc4c 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/simple/simptest.c +++ b/opal/mca/pmix/pmix2x/pmix/test/simple/simptest.c @@ -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; diff --git a/opal/mca/pmix/pmix2x/pmix/test/simple/simptool.c b/opal/mca/pmix/pmix2x/pmix/test/simple/simptool.c index 3926939548..ea31cedaa1 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/simple/simptool.c +++ b/opal/mca/pmix/pmix2x/pmix/test/simple/simptool.c @@ -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); diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_common.h b/opal/mca/pmix/pmix2x/pmix/test/test_common.h index f98f3acbfa..29ff8a0c46 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_common.h +++ b/opal/mca/pmix/pmix2x/pmix/test/test_common.h @@ -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; \ diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_fence.c b/opal/mca/pmix/pmix2x/pmix/test/test_fence.c index 57473451eb..f5cf4d2677 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_fence.c +++ b/opal/mca/pmix/pmix2x/pmix/test/test_fence.c @@ -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 #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); diff --git a/opal/mca/pmix/pmix2x/pmix2x.c b/opal/mca/pmix/pmix2x/pmix2x.c index dc1b6a5ad5..bdc5d33b33 100644 --- a/opal/mca/pmix/pmix2x/pmix2x.c +++ b/opal/mca/pmix/pmix2x/pmix2x.c @@ -49,18 +49,18 @@ static const char *pmix2x_get_nspace(opal_jobid_t jobid); static void pmix2x_register_jobid(opal_jobid_t jobid, const char *nspace); static void register_handler(opal_list_t *event_codes, - opal_list_t *info, - opal_pmix_notification_fn_t evhandler, - opal_pmix_evhandler_reg_cbfunc_t cbfunc, - void *cbdata); + opal_list_t *info, + opal_pmix_notification_fn_t evhandler, + opal_pmix_evhandler_reg_cbfunc_t cbfunc, + void *cbdata); static void deregister_handler(size_t evhandler, - opal_pmix_op_cbfunc_t cbfunc, - void *cbdata); + opal_pmix_op_cbfunc_t cbfunc, + void *cbdata); static int notify_event(int status, - const opal_process_name_t *source, - opal_pmix_data_range_t range, - opal_list_t *info, - opal_pmix_op_cbfunc_t cbfunc, void *cbdata); + const opal_process_name_t *source, + opal_pmix_data_range_t range, + opal_list_t *info, + opal_pmix_op_cbfunc_t cbfunc, void *cbdata); const opal_pmix_base_module_t opal_pmix_pmix2x_module = { /* client APIs */ @@ -115,9 +115,9 @@ static const char *pmix2x_get_nspace(opal_jobid_t jobid) opal_pmix2x_jobid_trkr_t *jptr; OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { - if (jptr->jobid == jobid) { - return jptr->nspace; - } + if (jptr->jobid == jobid) { + return jptr->nspace; + } } return NULL; } @@ -128,9 +128,9 @@ static void pmix2x_register_jobid(opal_jobid_t jobid, const char *nspace) /* if we don't already have it, add this to our jobid tracker */ OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { - if (jptr->jobid == jobid) { - return; - } + if (jptr->jobid == jobid) { + return; + } } jptr = OBJ_NEW(opal_pmix2x_jobid_trkr_t); (void)strncpy(jptr->nspace, nspace, PMIX_MAX_NSLEN); @@ -142,14 +142,14 @@ static void completion_handler(int status, void *cbdata) { opal_pmix2x_event_chain_t *chain = (opal_pmix2x_event_chain_t*)cbdata; if (NULL != chain->info) { - OPAL_LIST_RELEASE(chain->info); + OPAL_LIST_RELEASE(chain->info); } } static void progress_local_event_hdlr(int status, - opal_list_t *results, - opal_pmix_op_cbfunc_t cbfunc, void *thiscbdata, - void *notification_cbdata) + opal_list_t *results, + opal_pmix_op_cbfunc_t cbfunc, void *thiscbdata, + void *notification_cbdata) { opal_pmix2x_event_chain_t *chain = (opal_pmix2x_event_chain_t*)notification_cbdata; size_t n; @@ -160,92 +160,92 @@ static void progress_local_event_hdlr(int status, /* if the caller indicates that the chain is completed, then stop here */ if (OPAL_ERR_HANDLERS_COMPLETE == status) { - goto complete; + goto complete; } /* if any results were provided, then add them here */ if (NULL != results) { - while (NULL != (nxt = opal_list_remove_first(results))) { - opal_list_append(results, nxt); - } + while (NULL != (nxt = opal_list_remove_first(results))) { + opal_list_append(results, nxt); + } } /* see if we need to continue, starting with the single code events */ if (NULL != chain->sing) { - /* the last handler was for a single code - see if there are - * any others that match this event */ - while (opal_list_get_end(&mca_pmix_pmix2x_component.single_events) != (nxt = opal_list_get_next(&chain->sing->super))) { - sing = (opal_pmix2x_single_event_t*)nxt; - if (sing->code == chain->status) { - OBJ_RETAIN(chain); - chain->sing = sing; - sing->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - goto complete; - } - } - /* if we get here, then there are no more single code - * events that match */ - chain->sing = NULL; - /* pickup the beginning of the multi-code event list */ - if (0 < opal_list_get_size(&mca_pmix_pmix2x_component.multi_events)) { - chain->multi = (opal_pmix2x_multi_event_t*)opal_list_get_begin(&mca_pmix_pmix2x_component.multi_events); - } + /* the last handler was for a single code - see if there are + * any others that match this event */ + while (opal_list_get_end(&mca_pmix_pmix2x_component.single_events) != (nxt = opal_list_get_next(&chain->sing->super))) { + sing = (opal_pmix2x_single_event_t*)nxt; + if (sing->code == chain->status) { + OBJ_RETAIN(chain); + chain->sing = sing; + sing->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + goto complete; + } + } + /* if we get here, then there are no more single code + * events that match */ + chain->sing = NULL; + /* pickup the beginning of the multi-code event list */ + if (0 < opal_list_get_size(&mca_pmix_pmix2x_component.multi_events)) { + chain->multi = (opal_pmix2x_multi_event_t*)opal_list_get_begin(&mca_pmix_pmix2x_component.multi_events); + } } /* see if we need to continue with the multi code events */ if (NULL != chain->multi) { - while (opal_list_get_end(&mca_pmix_pmix2x_component.multi_events) != (nxt = opal_list_get_next(&chain->multi->super))) { - multi = (opal_pmix2x_multi_event_t*)nxt; - for (n=0; n < multi->ncodes; n++) { - if (multi->codes[n] == chain->status) { - /* found it - invoke the handler, pointing its - * callback function to our progression function */ - OBJ_RETAIN(chain); - chain->multi = multi; - multi->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - goto complete; - } - } - } - /* if we get here, then there are no more multi-mode - * events that match */ - chain->multi = NULL; - /* pickup the beginning of the default event list */ - if (0 < opal_list_get_size(&mca_pmix_pmix2x_component.default_events)) { - chain->def = (opal_pmix2x_default_event_t*)opal_list_get_begin(&mca_pmix_pmix2x_component.default_events); - } + while (opal_list_get_end(&mca_pmix_pmix2x_component.multi_events) != (nxt = opal_list_get_next(&chain->multi->super))) { + multi = (opal_pmix2x_multi_event_t*)nxt; + for (n=0; n < multi->ncodes; n++) { + if (multi->codes[n] == chain->status) { + /* found it - invoke the handler, pointing its + * callback function to our progression function */ + OBJ_RETAIN(chain); + chain->multi = multi; + multi->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + goto complete; + } + } + } + /* if we get here, then there are no more multi-mode + * events that match */ + chain->multi = NULL; + /* pickup the beginning of the default event list */ + if (0 < opal_list_get_size(&mca_pmix_pmix2x_component.default_events)) { + chain->def = (opal_pmix2x_default_event_t*)opal_list_get_begin(&mca_pmix_pmix2x_component.default_events); + } } /* if they didn't want it to go to a default handler, then we are done */ if (chain->nondefault) { - goto complete; + goto complete; } if (NULL != chain->def) { - if (opal_list_get_end(&mca_pmix_pmix2x_component.default_events) != (nxt = opal_list_get_next(&chain->def->super))) { - def = (opal_pmix2x_default_event_t*)nxt; - OBJ_RETAIN(chain); - chain->def = def; - def->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - } + if (opal_list_get_end(&mca_pmix_pmix2x_component.default_events) != (nxt = opal_list_get_next(&chain->def->super))) { + def = (opal_pmix2x_default_event_t*)nxt; + OBJ_RETAIN(chain); + chain->def = def; + def->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + } } complete: /* we still have to call their final callback */ if (NULL != chain->final_cbfunc) { - chain->final_cbfunc(OPAL_SUCCESS, chain->final_cbdata); + chain->final_cbfunc(OPAL_SUCCESS, chain->final_cbdata); } /* maintain acctng */ OBJ_RELEASE(chain); /* let the caller know that we are done with their callback */ if (NULL != cbfunc) { - cbfunc(OPAL_SUCCESS, thiscbdata); + cbfunc(OPAL_SUCCESS, thiscbdata); } } @@ -259,8 +259,8 @@ static void _event_hdlr(int sd, short args, void *cbdata) opal_pmix2x_default_event_t *def; opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s RECEIVED NOTIFICATION OF STATUS %d", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), cd->status); + "%s RECEIVED NOTIFICATION OF STATUS %d", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), cd->status); chain = OBJ_NEW(opal_pmix2x_event_chain_t); /* point it at our final callback */ @@ -275,47 +275,47 @@ static void _event_hdlr(int sd, short args, void *cbdata) /* cycle thru the single-event registrations first */ OPAL_LIST_FOREACH(sing, &mca_pmix_pmix2x_component.single_events, opal_pmix2x_single_event_t) { - if (sing->code == chain->status) { - /* found it - invoke the handler, pointing its - * callback function to our progression function */ - OBJ_RETAIN(chain); - chain->sing = sing; - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s CALLING SINGLE EVHDLR", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); - sing->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - return; - } + if (sing->code == chain->status) { + /* found it - invoke the handler, pointing its + * callback function to our progression function */ + OBJ_RETAIN(chain); + chain->sing = sing; + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "%s CALLING SINGLE EVHDLR", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); + sing->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + return; + } } /* if we didn't find any match in the single-event registrations, * then cycle thru the multi-event registrations next */ OPAL_LIST_FOREACH(multi, &mca_pmix_pmix2x_component.multi_events, opal_pmix2x_multi_event_t) { - for (n=0; n < multi->ncodes; n++) { - if (multi->codes[n] == chain->status) { - /* found it - invoke the handler, pointing its - * callback function to our progression function */ - OBJ_RETAIN(chain); - chain->multi = multi; - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s CALLING MULTI EVHDLR", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); - multi->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - return; - } - } + for (n=0; n < multi->ncodes; n++) { + if (multi->codes[n] == chain->status) { + /* found it - invoke the handler, pointing its + * callback function to our progression function */ + OBJ_RETAIN(chain); + chain->multi = multi; + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "%s CALLING MULTI EVHDLR", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); + multi->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + return; + } + } } /* if they didn't want it to go to a default handler, then we are done */ if (chain->nondefault) { - /* if we get here, then we need to cache this event in case they - * register for it later - we cannot lose individual events */ - opal_list_append(&mca_pmix_pmix2x_component.cache, &chain->super); - return; + /* if we get here, then we need to cache this event in case they + * register for it later - we cannot lose individual events */ + opal_list_append(&mca_pmix_pmix2x_component.cache, &chain->super); + return; } /* we are done with the threadshift caddy */ @@ -323,21 +323,21 @@ static void _event_hdlr(int sd, short args, void *cbdata) /* finally, pass it to any default handlers */ if (0 < opal_list_get_size(&mca_pmix_pmix2x_component.default_events)) { - def = (opal_pmix2x_default_event_t*)opal_list_get_first(&mca_pmix_pmix2x_component.default_events); - OBJ_RETAIN(chain); - chain->def = def; - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s CALLING DEFAULT EVHDLR", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); - def->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - return; + def = (opal_pmix2x_default_event_t*)opal_list_get_first(&mca_pmix_pmix2x_component.default_events); + OBJ_RETAIN(chain); + chain->def = def; + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "%s CALLING DEFAULT EVHDLR", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); + def->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + return; } /* we still have to call their final callback */ if (NULL != chain->final_cbfunc) { - chain->final_cbfunc(PMIX_SUCCESS, chain->final_cbdata); + chain->final_cbfunc(PMIX_SUCCESS, chain->final_cbdata); } return; } @@ -349,11 +349,11 @@ static void _event_hdlr(int sd, short args, void *cbdata) * from another process (via the local daemon). * The call will occur in the PMIx event base */ void pmix2x_event_hdlr(size_t evhdlr_registration_id, - pmix_status_t status, const pmix_proc_t *source, - pmix_info_t info[], size_t ninfo, - pmix_info_t results[], size_t nresults, - pmix_event_notification_cbfunc_fn_t cbfunc, - void *cbdata) + pmix_status_t status, const pmix_proc_t *source, + pmix_info_t info[], size_t ninfo, + pmix_info_t results[], size_t nresults, + pmix_event_notification_cbfunc_fn_t cbfunc, + void *cbdata) { pmix2x_threadshift_t *cd; int rc; @@ -365,55 +365,55 @@ void pmix2x_event_hdlr(size_t evhdlr_registration_id, * lists and objects */ opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s RECEIVED NOTIFICATION OF STATUS %d", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), status); + "%s RECEIVED NOTIFICATION OF STATUS %d", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), status); cd = OBJ_NEW(pmix2x_threadshift_t); /* convert the incoming status */ cd->status = pmix2x_convert_rc(status); opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s CONVERTED STATUS %d TO STATUS %d", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), status, cd->status); + "%s CONVERTED STATUS %d TO STATUS %d", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), status, cd->status); /* convert the nspace/rank to an opal_process_name_t */ if (NULL == source) { - cd->pname.jobid = OPAL_NAME_INVALID->jobid; - cd->pname.vpid = OPAL_NAME_INVALID->vpid; + cd->pname.jobid = OPAL_NAME_INVALID->jobid; + cd->pname.vpid = OPAL_NAME_INVALID->vpid; } else { - if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&cd->pname.jobid, source->nspace))) { - OPAL_ERROR_LOG(rc); - OBJ_RELEASE(cd); - return; - } - cd->pname.vpid = pmix2x_convert_rank(source->rank); + if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&cd->pname.jobid, source->nspace))) { + OPAL_ERROR_LOG(rc); + OBJ_RELEASE(cd); + return; + } + cd->pname.vpid = pmix2x_convert_rank(source->rank); } /* convert the array of info */ if (NULL != info) { - cd->info = OBJ_NEW(opal_list_t); - for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_EVENT_NON_DEFAULT, PMIX_MAX_KEYLEN)) { - cd->nondefault = true; - } - iptr = OBJ_NEW(opal_value_t); - iptr->key = strdup(info[n].key); - if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { - OPAL_ERROR_LOG(rc); - OBJ_RELEASE(iptr); - continue; - } - opal_list_append(cd->info, &iptr->super); - } + cd->info = OBJ_NEW(opal_list_t); + for (n=0; n < ninfo; n++) { + if (0 == strncmp(info[n].key, PMIX_EVENT_NON_DEFAULT, PMIX_MAX_KEYLEN)) { + cd->nondefault = true; + } + iptr = OBJ_NEW(opal_value_t); + iptr->key = strdup(info[n].key); + if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { + OPAL_ERROR_LOG(rc); + OBJ_RELEASE(iptr); + continue; + } + opal_list_append(cd->info, &iptr->super); + } } /* now push it into the local thread */ event_assign(&cd->ev, opal_pmix_base.evbase, - -1, EV_WRITE, _event_hdlr, cd); + -1, EV_WRITE, _event_hdlr, cd); event_active(&cd->ev, EV_WRITE, 1); /* we don't need any of the data they provided, * so let them go */ if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata); + cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata); } } @@ -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; } } @@ -445,65 +445,65 @@ pmix_status_t pmix2x_convert_opalrc(int rc) { switch (rc) { case OPAL_ERR_DEBUGGER_RELEASE: - return PMIX_ERR_DEBUGGER_RELEASE; + return PMIX_ERR_DEBUGGER_RELEASE; case OPAL_ERR_HANDLERS_COMPLETE: - return PMIX_EVENT_ACTION_COMPLETE; + return PMIX_EVENT_ACTION_COMPLETE; case OPAL_ERR_PROC_ABORTED: - return PMIX_ERR_PROC_ABORTED; + return PMIX_ERR_PROC_ABORTED; case OPAL_ERR_PROC_REQUESTED_ABORT: - return PMIX_ERR_PROC_REQUESTED_ABORT; + return PMIX_ERR_PROC_REQUESTED_ABORT; case OPAL_ERR_PROC_ABORTING: - return PMIX_ERR_PROC_ABORTING; + return PMIX_ERR_PROC_ABORTING; case OPAL_ERR_NODE_DOWN: - return PMIX_ERR_NODE_DOWN; + return PMIX_ERR_NODE_DOWN; case OPAL_ERR_NODE_OFFLINE: - return PMIX_ERR_NODE_OFFLINE; + return PMIX_ERR_NODE_OFFLINE; case OPAL_ERR_NOT_IMPLEMENTED: case OPAL_ERR_NOT_SUPPORTED: - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_SUPPORTED; case OPAL_ERR_NOT_FOUND: - return PMIX_ERR_NOT_FOUND; + return PMIX_ERR_NOT_FOUND; case OPAL_ERR_PERM: case OPAL_ERR_UNREACH: case OPAL_ERR_SERVER_NOT_AVAIL: - return PMIX_ERR_UNREACH; + return PMIX_ERR_UNREACH; case OPAL_ERR_BAD_PARAM: - return PMIX_ERR_BAD_PARAM; + return PMIX_ERR_BAD_PARAM; case OPAL_ERR_OUT_OF_RESOURCE: - return PMIX_ERR_OUT_OF_RESOURCE; + return PMIX_ERR_OUT_OF_RESOURCE; case OPAL_ERR_DATA_VALUE_NOT_FOUND: - return PMIX_ERR_DATA_VALUE_NOT_FOUND; + return PMIX_ERR_DATA_VALUE_NOT_FOUND; case OPAL_ERR_TIMEOUT: - return PMIX_ERR_TIMEOUT; + return PMIX_ERR_TIMEOUT; case OPAL_ERR_WOULD_BLOCK: - return PMIX_ERR_WOULD_BLOCK; + return PMIX_ERR_WOULD_BLOCK; case OPAL_EXISTS: - return PMIX_EXISTS; + return PMIX_EXISTS; case OPAL_ERR_PARTIAL_SUCCESS: - return PMIX_QUERY_PARTIAL_SUCCESS; + return PMIX_QUERY_PARTIAL_SUCCESS; case OPAL_ERROR: - return PMIX_ERROR; + return PMIX_ERROR; case OPAL_SUCCESS: - return PMIX_SUCCESS; + return PMIX_SUCCESS; default: - return PMIX_ERROR; + return PMIX_ERROR; } } @@ -511,350 +511,447 @@ int pmix2x_convert_rc(pmix_status_t rc) { switch (rc) { case PMIX_ERR_DEBUGGER_RELEASE: - return OPAL_ERR_DEBUGGER_RELEASE; + return OPAL_ERR_DEBUGGER_RELEASE; case PMIX_EVENT_ACTION_COMPLETE: - return OPAL_ERR_HANDLERS_COMPLETE; + return OPAL_ERR_HANDLERS_COMPLETE; case PMIX_ERR_PROC_ABORTED: - return OPAL_ERR_PROC_ABORTED; + return OPAL_ERR_PROC_ABORTED; case PMIX_ERR_PROC_REQUESTED_ABORT: - return OPAL_ERR_PROC_REQUESTED_ABORT; + return OPAL_ERR_PROC_REQUESTED_ABORT; case PMIX_ERR_PROC_ABORTING: - return OPAL_ERR_PROC_ABORTING; + return OPAL_ERR_PROC_ABORTING; case PMIX_ERR_NODE_DOWN: - return OPAL_ERR_NODE_DOWN; + return OPAL_ERR_NODE_DOWN; case PMIX_ERR_NODE_OFFLINE: - return OPAL_ERR_NODE_OFFLINE; + return OPAL_ERR_NODE_OFFLINE; case PMIX_ERR_NOT_SUPPORTED: - return OPAL_ERR_NOT_SUPPORTED; + return OPAL_ERR_NOT_SUPPORTED; case PMIX_ERR_NOT_FOUND: - return OPAL_ERR_NOT_FOUND; + return OPAL_ERR_NOT_FOUND; case PMIX_ERR_OUT_OF_RESOURCE: - return OPAL_ERR_OUT_OF_RESOURCE; + return OPAL_ERR_OUT_OF_RESOURCE; case PMIX_ERR_INIT: - return OPAL_ERROR; + return OPAL_ERROR; case PMIX_ERR_BAD_PARAM: - return OPAL_ERR_BAD_PARAM; + return OPAL_ERR_BAD_PARAM; case PMIX_ERR_UNREACH: case PMIX_ERR_NO_PERMISSIONS: - return OPAL_ERR_UNREACH; + return OPAL_ERR_UNREACH; case PMIX_ERR_TIMEOUT: - return OPAL_ERR_TIMEOUT; + return OPAL_ERR_TIMEOUT; case PMIX_ERR_WOULD_BLOCK: - return OPAL_ERR_WOULD_BLOCK; + return OPAL_ERR_WOULD_BLOCK; case PMIX_ERR_LOST_CONNECTION_TO_SERVER: case PMIX_ERR_LOST_PEER_CONNECTION: case PMIX_ERR_LOST_CONNECTION_TO_CLIENT: - return OPAL_ERR_COMM_FAILURE; + return OPAL_ERR_COMM_FAILURE; case PMIX_EXISTS: - return OPAL_EXISTS; + return OPAL_EXISTS; case PMIX_QUERY_PARTIAL_SUCCESS: - return OPAL_ERR_PARTIAL_SUCCESS; + return OPAL_ERR_PARTIAL_SUCCESS; case PMIX_ERROR: - return OPAL_ERROR; + return OPAL_ERROR; case PMIX_SUCCESS: - return OPAL_SUCCESS; + return OPAL_SUCCESS; default: - return OPAL_ERROR; + return OPAL_ERROR; + } +} + +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: - return PMIX_LOCAL; + return PMIX_LOCAL; case OPAL_PMIX_REMOTE: - return PMIX_REMOTE; + return PMIX_REMOTE; case OPAL_PMIX_GLOBAL: - return PMIX_GLOBAL; + return PMIX_GLOBAL; default: - return PMIX_SCOPE_UNDEF; + return PMIX_SCOPE_UNDEF; } } pmix_data_range_t pmix2x_convert_opalrange(opal_pmix_data_range_t range) { switch(range) { case OPAL_PMIX_RANGE_UNDEF: - return PMIX_RANGE_UNDEF; + return PMIX_RANGE_UNDEF; case OPAL_PMIX_RANGE_LOCAL: - return PMIX_RANGE_LOCAL; + return PMIX_RANGE_LOCAL; case OPAL_PMIX_RANGE_NAMESPACE: - return PMIX_RANGE_NAMESPACE; + return PMIX_RANGE_NAMESPACE; case OPAL_PMIX_RANGE_SESSION: - return PMIX_RANGE_SESSION; + return PMIX_RANGE_SESSION; case OPAL_PMIX_RANGE_GLOBAL: - return PMIX_RANGE_GLOBAL; + return PMIX_RANGE_GLOBAL; case OPAL_PMIX_RANGE_CUSTOM: - return PMIX_RANGE_CUSTOM; + return PMIX_RANGE_CUSTOM; default: - return PMIX_SCOPE_UNDEF; + return PMIX_SCOPE_UNDEF; } } opal_pmix_data_range_t pmix2x_convert_range(pmix_data_range_t range) { switch(range) { case PMIX_RANGE_UNDEF: - return OPAL_PMIX_RANGE_UNDEF; + return OPAL_PMIX_RANGE_UNDEF; case PMIX_RANGE_LOCAL: - return OPAL_PMIX_RANGE_LOCAL; + return OPAL_PMIX_RANGE_LOCAL; case PMIX_RANGE_NAMESPACE: - return OPAL_PMIX_RANGE_NAMESPACE; + return OPAL_PMIX_RANGE_NAMESPACE; case PMIX_RANGE_SESSION: - return OPAL_PMIX_RANGE_SESSION; + return OPAL_PMIX_RANGE_SESSION; case PMIX_RANGE_GLOBAL: - return OPAL_PMIX_RANGE_GLOBAL; + return OPAL_PMIX_RANGE_GLOBAL; case PMIX_RANGE_CUSTOM: - return OPAL_PMIX_RANGE_CUSTOM; + return OPAL_PMIX_RANGE_CUSTOM; default: - return OPAL_PMIX_SCOPE_UNDEF; + return OPAL_PMIX_SCOPE_UNDEF; } } +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) + opal_value_t *kv) { - char nspace[PMIX_MAX_NSLEN + 1]; - size_t n; - switch(kv->type) { - case OPAL_UNDEF: - v->type = PMIX_UNDEF; - break; - case OPAL_BOOL: - v->type = PMIX_BOOL; - memcpy(&(v->data.flag), &kv->data.flag, 1); - break; - case OPAL_BYTE: - v->type = PMIX_BYTE; - memcpy(&(v->data.byte), &kv->data.byte, 1); - break; - case OPAL_STRING: - v->type = PMIX_STRING; - if (NULL != kv->data.string) { - v->data.string = strdup(kv->data.string); - } else { - v->data.string = NULL; - } - break; - case OPAL_SIZE: - v->type = PMIX_SIZE; - v->data.size = (size_t)kv->data.size; - break; - case OPAL_PID: - v->type = PMIX_PID; - memcpy(&(v->data.pid), &kv->data.pid, sizeof(pid_t)); - break; - case OPAL_INT: - v->type = PMIX_INT; - memcpy(&(v->data.integer), &kv->data.integer, sizeof(int)); - break; - case OPAL_INT8: - v->type = PMIX_INT8; - memcpy(&(v->data.int8), &kv->data.int8, 1); - break; - case OPAL_INT16: - v->type = PMIX_INT16; - memcpy(&(v->data.int16), &kv->data.int16, 2); - break; - case OPAL_INT32: - v->type = PMIX_INT32; - memcpy(&(v->data.int32), &kv->data.int32, 4); - break; - case OPAL_INT64: - v->type = PMIX_INT64; - memcpy(&(v->data.int64), &kv->data.int64, 8); - break; - case OPAL_UINT: - v->type = PMIX_UINT; - memcpy(&(v->data.uint), &kv->data.uint, sizeof(int)); - break; - case OPAL_UINT8: - v->type = PMIX_UINT8; - memcpy(&(v->data.uint8), &kv->data.uint8, 1); - break; - case OPAL_UINT16: - v->type = PMIX_UINT16; - memcpy(&(v->data.uint16), &kv->data.uint16, 2); - break; - case OPAL_UINT32: - v->type = PMIX_UINT32; - memcpy(&(v->data.uint32), &kv->data.uint32, 4); - break; - case OPAL_UINT64: - v->type = PMIX_UINT64; - memcpy(&(v->data.uint64), &kv->data.uint64, 8); - break; - case OPAL_FLOAT: - v->type = PMIX_FLOAT; - memcpy(&(v->data.fval), &kv->data.fval, sizeof(float)); - break; - case OPAL_DOUBLE: - v->type = PMIX_DOUBLE; - memcpy(&(v->data.dval), &kv->data.dval, sizeof(double)); - break; - case OPAL_TIMEVAL: - v->type = PMIX_TIMEVAL; - memcpy(&(v->data.tv), &kv->data.tv, sizeof(struct timeval)); - break; - case OPAL_BYTE_OBJECT: - v->type = PMIX_BYTE_OBJECT; - if (NULL != kv->data.bo.bytes) { - v->data.bo.bytes = (char*)malloc(kv->data.bo.size); - memcpy(v->data.bo.bytes, kv->data.bo.bytes, kv->data.bo.size); - v->data.bo.size = (size_t)kv->data.bo.size; - } else { - v->data.bo.bytes = NULL; - 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); - } - } - 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); - break; - default: - /* silence warnings */ - break; + case OPAL_UNDEF: + v->type = PMIX_UNDEF; + break; + case OPAL_BOOL: + v->type = PMIX_BOOL; + memcpy(&(v->data.flag), &kv->data.flag, 1); + break; + case OPAL_BYTE: + v->type = PMIX_BYTE; + memcpy(&(v->data.byte), &kv->data.byte, 1); + break; + case OPAL_STRING: + v->type = PMIX_STRING; + if (NULL != kv->data.string) { + v->data.string = strdup(kv->data.string); + } else { + v->data.string = NULL; + } + break; + case OPAL_SIZE: + v->type = PMIX_SIZE; + v->data.size = (size_t)kv->data.size; + break; + case OPAL_PID: + v->type = PMIX_PID; + memcpy(&(v->data.pid), &kv->data.pid, sizeof(pid_t)); + break; + case OPAL_INT: + v->type = PMIX_INT; + memcpy(&(v->data.integer), &kv->data.integer, sizeof(int)); + break; + case OPAL_INT8: + v->type = PMIX_INT8; + memcpy(&(v->data.int8), &kv->data.int8, 1); + break; + case OPAL_INT16: + v->type = PMIX_INT16; + memcpy(&(v->data.int16), &kv->data.int16, 2); + break; + case OPAL_INT32: + v->type = PMIX_INT32; + memcpy(&(v->data.int32), &kv->data.int32, 4); + break; + case OPAL_INT64: + v->type = PMIX_INT64; + memcpy(&(v->data.int64), &kv->data.int64, 8); + break; + case OPAL_UINT: + v->type = PMIX_UINT; + memcpy(&(v->data.uint), &kv->data.uint, sizeof(int)); + break; + case OPAL_UINT8: + v->type = PMIX_UINT8; + memcpy(&(v->data.uint8), &kv->data.uint8, 1); + break; + case OPAL_UINT16: + v->type = PMIX_UINT16; + memcpy(&(v->data.uint16), &kv->data.uint16, 2); + break; + case OPAL_UINT32: + v->type = PMIX_UINT32; + memcpy(&(v->data.uint32), &kv->data.uint32, 4); + break; + case OPAL_UINT64: + v->type = PMIX_UINT64; + memcpy(&(v->data.uint64), &kv->data.uint64, 8); + break; + case OPAL_FLOAT: + v->type = PMIX_FLOAT; + memcpy(&(v->data.fval), &kv->data.fval, sizeof(float)); + break; + case OPAL_DOUBLE: + v->type = PMIX_DOUBLE; + memcpy(&(v->data.dval), &kv->data.dval, sizeof(double)); + break; + case OPAL_TIMEVAL: + 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) { + v->data.bo.bytes = (char*)malloc(kv->data.bo.size); + memcpy(v->data.bo.bytes, kv->data.bo.bytes, kv->data.bo.size); + v->data.bo.size = (size_t)kv->data.bo.size; + } else { + v->data.bo.bytes = NULL; + v->data.bo.size = 0; + } + break; + case OPAL_PERSIST: + v->type = PMIX_PERSIST; + v->data.persist = pmix2x_convert_opalpersist(kv->data.uint8); + break; + 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 */ + break; } } int pmix2x_value_unload(opal_value_t *kv, - const pmix_value_t *v) + const pmix_value_t *v) { int rc=OPAL_SUCCESS; switch(v->type) { case PMIX_UNDEF: - kv->type = OPAL_UNDEF; - break; + kv->type = OPAL_UNDEF; + break; case PMIX_BOOL: - kv->type = OPAL_BOOL; - memcpy(&kv->data.flag, &(v->data.flag), 1); - break; + kv->type = OPAL_BOOL; + memcpy(&kv->data.flag, &(v->data.flag), 1); + break; case PMIX_BYTE: - kv->type = OPAL_BYTE; - memcpy(&kv->data.byte, &(v->data.byte), 1); - break; + kv->type = OPAL_BYTE; + memcpy(&kv->data.byte, &(v->data.byte), 1); + break; case PMIX_STRING: - kv->type = OPAL_STRING; - if (NULL != v->data.string) { - kv->data.string = strdup(v->data.string); - } - break; + kv->type = OPAL_STRING; + if (NULL != v->data.string) { + kv->data.string = strdup(v->data.string); + } + break; case PMIX_SIZE: - kv->type = OPAL_SIZE; - kv->data.size = (int)v->data.size; - break; + kv->type = OPAL_SIZE; + kv->data.size = (int)v->data.size; + break; case PMIX_PID: - kv->type = OPAL_PID; - memcpy(&kv->data.pid, &(v->data.pid), sizeof(pid_t)); - break; + kv->type = OPAL_PID; + memcpy(&kv->data.pid, &(v->data.pid), sizeof(pid_t)); + break; case PMIX_INT: - kv->type = OPAL_INT; - memcpy(&kv->data.integer, &(v->data.integer), sizeof(int)); - break; + kv->type = OPAL_INT; + memcpy(&kv->data.integer, &(v->data.integer), sizeof(int)); + break; case PMIX_INT8: - kv->type = OPAL_INT8; - memcpy(&kv->data.int8, &(v->data.int8), 1); - break; + kv->type = OPAL_INT8; + memcpy(&kv->data.int8, &(v->data.int8), 1); + break; case PMIX_INT16: - kv->type = OPAL_INT16; - memcpy(&kv->data.int16, &(v->data.int16), 2); - break; + kv->type = OPAL_INT16; + memcpy(&kv->data.int16, &(v->data.int16), 2); + break; case PMIX_INT32: - kv->type = OPAL_INT32; - memcpy(&kv->data.int32, &(v->data.int32), 4); - break; + kv->type = OPAL_INT32; + memcpy(&kv->data.int32, &(v->data.int32), 4); + break; case PMIX_INT64: - kv->type = OPAL_INT64; - memcpy(&kv->data, &(v->data.int64), 8); - break; + kv->type = OPAL_INT64; + memcpy(&kv->data.int64, &(v->data.int64), 8); + break; case PMIX_UINT: - kv->type = OPAL_UINT; - memcpy(&kv->data, &(v->data.uint), sizeof(int)); - break; + kv->type = OPAL_UINT; + memcpy(&kv->data.uint, &(v->data.uint), sizeof(int)); + break; case PMIX_UINT8: - kv->type = OPAL_UINT8; - memcpy(&kv->data, &(v->data.uint8), 1); - break; + kv->type = OPAL_UINT8; + memcpy(&kv->data.uint8, &(v->data.uint8), 1); + break; case PMIX_UINT16: - kv->type = OPAL_UINT16; - memcpy(&kv->data, &(v->data.uint16), 2); - break; + kv->type = OPAL_UINT16; + memcpy(&kv->data.uint16, &(v->data.uint16), 2); + break; case PMIX_UINT32: - kv->type = OPAL_UINT32; - memcpy(&kv->data, &(v->data.uint32), 4); - break; + kv->type = OPAL_UINT32; + memcpy(&kv->data.uint32, &(v->data.uint32), 4); + break; case PMIX_UINT64: - kv->type = OPAL_UINT64; - memcpy(&kv->data, &(v->data.uint64), 8); - break; + kv->type = OPAL_UINT64; + memcpy(&kv->data.uint64, &(v->data.uint64), 8); + break; case PMIX_FLOAT: - kv->type = OPAL_FLOAT; - memcpy(&kv->data, &(v->data.fval), sizeof(float)); - break; + kv->type = OPAL_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)); - break; + kv->type = OPAL_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)); - break; - case PMIX_BYTE_OBJECT: - kv->type = OPAL_BYTE_OBJECT; - if (NULL != v->data.bo.bytes && 0 < v->data.bo.size) { - kv->data.bo.bytes = (uint8_t*)malloc(v->data.bo.size); - memcpy(kv->data.bo.bytes, v->data.bo.bytes, v->data.bo.size); - kv->data.bo.size = (int)v->data.bo.size; - } else { - kv->data.bo.bytes = NULL; - kv->data.bo.size = 0; - } - break; + kv->type = OPAL_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; + 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; + if (NULL != v->data.bo.bytes && 0 < v->data.bo.size) { + kv->data.bo.bytes = (uint8_t*)malloc(v->data.bo.size); + memcpy(kv->data.bo.bytes, v->data.bo.bytes, v->data.bo.size); + kv->data.bo.size = (int)v->data.bo.size; + } else { + kv->data.bo.bytes = NULL; + kv->data.bo.size = 0; + } + break; + 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; - break; + /* silence warnings */ + rc = OPAL_ERROR; + break; } return rc; } @@ -872,125 +969,125 @@ static void _reg_hdlr(int sd, short args, void *cbdata) size_t n; opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s REGISTER HANDLER CODES %s", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), - (NULL == cd->event_codes) ? "NULL" : "NON-NULL"); + "%s REGISTER HANDLER CODES %s", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), + (NULL == cd->event_codes) ? "NULL" : "NON-NULL"); if (NULL != cd->info) { - OPAL_LIST_FOREACH(kv, cd->info, opal_value_t) { - if (0 == strcmp(kv->key, OPAL_PMIX_EVENT_ORDER_PREPEND)) { - prepend = true; - break; - } - } + OPAL_LIST_FOREACH(kv, cd->info, opal_value_t) { + if (0 == strcmp(kv->key, OPAL_PMIX_EVENT_ORDER_PREPEND)) { + prepend = true; + break; + } + } } if (NULL == cd->event_codes) { - /* this is a default handler */ - def = OBJ_NEW(opal_pmix2x_default_event_t); - def->handler = cd->evhandler; - def->index = mca_pmix_pmix2x_component.evindex; - if (prepend) { - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s PREPENDING TO DEFAULT EVENTS", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); - opal_list_prepend(&mca_pmix_pmix2x_component.default_events, &def->super); - } else { - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s APPENDING TO DEFAULT EVENTS", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); - opal_list_append(&mca_pmix_pmix2x_component.default_events, &def->super); - } + /* this is a default handler */ + def = OBJ_NEW(opal_pmix2x_default_event_t); + def->handler = cd->evhandler; + def->index = mca_pmix_pmix2x_component.evindex; + if (prepend) { + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "%s PREPENDING TO DEFAULT EVENTS", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); + opal_list_prepend(&mca_pmix_pmix2x_component.default_events, &def->super); + } else { + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "%s APPENDING TO DEFAULT EVENTS", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); + opal_list_append(&mca_pmix_pmix2x_component.default_events, &def->super); + } } else if (1 == opal_list_get_size(cd->event_codes)) { - /* single handler */ - sing = OBJ_NEW(opal_pmix2x_single_event_t); - kv = (opal_value_t*)opal_list_get_first(cd->event_codes); - sing->code = kv->data.integer; - sing->index = mca_pmix_pmix2x_component.evindex; - sing->handler = cd->evhandler; - if (prepend) { - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s PREPENDING TO SINGLE EVENTS WITH CODE %d", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), sing->code); - opal_list_prepend(&mca_pmix_pmix2x_component.single_events, &sing->super); - } else { - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s APPENDING TO SINGLE EVENTS WITH CODE %d", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), sing->code); - opal_list_append(&mca_pmix_pmix2x_component.single_events, &sing->super); - } + /* single handler */ + sing = OBJ_NEW(opal_pmix2x_single_event_t); + kv = (opal_value_t*)opal_list_get_first(cd->event_codes); + sing->code = kv->data.integer; + sing->index = mca_pmix_pmix2x_component.evindex; + sing->handler = cd->evhandler; + if (prepend) { + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "%s PREPENDING TO SINGLE EVENTS WITH CODE %d", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), sing->code); + opal_list_prepend(&mca_pmix_pmix2x_component.single_events, &sing->super); + } else { + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "%s APPENDING TO SINGLE EVENTS WITH CODE %d", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), sing->code); + opal_list_append(&mca_pmix_pmix2x_component.single_events, &sing->super); + } } else { - multi = OBJ_NEW(opal_pmix2x_multi_event_t); - multi->ncodes = opal_list_get_size(cd->event_codes); - multi->codes = (int*)malloc(multi->ncodes * sizeof(int)); - i=0; - OPAL_LIST_FOREACH(kv, cd->event_codes, opal_value_t) { - multi->codes[i] = kv->data.integer; - ++i; - } - multi->index = mca_pmix_pmix2x_component.evindex; - multi->handler = cd->evhandler; - if (prepend) { - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s PREPENDING TO MULTI EVENTS", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); - opal_list_prepend(&mca_pmix_pmix2x_component.multi_events, &multi->super); - } else { - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "%s APPENDING TO MULTI EVENTS", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); - opal_list_append(&mca_pmix_pmix2x_component.multi_events, &multi->super); - } + multi = OBJ_NEW(opal_pmix2x_multi_event_t); + multi->ncodes = opal_list_get_size(cd->event_codes); + multi->codes = (int*)malloc(multi->ncodes * sizeof(int)); + i=0; + OPAL_LIST_FOREACH(kv, cd->event_codes, opal_value_t) { + multi->codes[i] = kv->data.integer; + ++i; + } + multi->index = mca_pmix_pmix2x_component.evindex; + multi->handler = cd->evhandler; + if (prepend) { + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "%s PREPENDING TO MULTI EVENTS", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); + opal_list_prepend(&mca_pmix_pmix2x_component.multi_events, &multi->super); + } else { + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "%s APPENDING TO MULTI EVENTS", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); + opal_list_append(&mca_pmix_pmix2x_component.multi_events, &multi->super); + } } /* release the caller */ if (NULL != cd->cbfunc) { - cd->cbfunc(OPAL_SUCCESS, mca_pmix_pmix2x_component.evindex, cd->cbdata); + cd->cbfunc(OPAL_SUCCESS, mca_pmix_pmix2x_component.evindex, cd->cbdata); } mca_pmix_pmix2x_component.evindex++; /* check if any matching notifications have been cached - only nondefault * events will have been cached*/ if (NULL == def) { - /* check single code registrations */ - if (NULL != sing) { - OPAL_LIST_FOREACH(chain, &mca_pmix_pmix2x_component.cache, opal_pmix2x_event_chain_t) { - if (sing->code == chain->status) { - opal_list_remove_item(&mca_pmix_pmix2x_component.cache, &chain->super); - chain->sing = sing; - sing->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - OBJ_RELEASE(cd); - return; - } - } - } else if (NULL != multi) { - /* check for multi code registrations */ - OPAL_LIST_FOREACH(chain, &mca_pmix_pmix2x_component.cache, opal_pmix2x_event_chain_t) { - for (n=0; n < multi->ncodes; n++) { - if (multi->codes[n] == chain->status) { - opal_list_remove_item(&mca_pmix_pmix2x_component.cache, &chain->super); - chain->multi = multi; - multi->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - OBJ_RELEASE(cd); - return; - } - } - } - } + /* check single code registrations */ + if (NULL != sing) { + OPAL_LIST_FOREACH(chain, &mca_pmix_pmix2x_component.cache, opal_pmix2x_event_chain_t) { + if (sing->code == chain->status) { + opal_list_remove_item(&mca_pmix_pmix2x_component.cache, &chain->super); + chain->sing = sing; + sing->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + OBJ_RELEASE(cd); + return; + } + } + } else if (NULL != multi) { + /* check for multi code registrations */ + OPAL_LIST_FOREACH(chain, &mca_pmix_pmix2x_component.cache, opal_pmix2x_event_chain_t) { + for (n=0; n < multi->ncodes; n++) { + if (multi->codes[n] == chain->status) { + opal_list_remove_item(&mca_pmix_pmix2x_component.cache, &chain->super); + chain->multi = multi; + multi->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + OBJ_RELEASE(cd); + return; + } + } + } + } } OBJ_RELEASE(cd); return; } static void register_handler(opal_list_t *event_codes, - opal_list_t *info, - opal_pmix_notification_fn_t evhandler, - opal_pmix_evhandler_reg_cbfunc_t cbfunc, - void *cbdata) + opal_list_t *info, + opal_pmix_notification_fn_t evhandler, + opal_pmix_evhandler_reg_cbfunc_t cbfunc, + void *cbdata) { /* we must threadshift this request as we might not be in an event * and we are going to access framework-global lists/objects */ @@ -1008,39 +1105,39 @@ static void _dereg_hdlr(int sd, short args, void *cbdata) /* check the single events first */ OPAL_LIST_FOREACH(sing, &mca_pmix_pmix2x_component.single_events, opal_pmix2x_single_event_t) { - if (cd->handler == sing->index) { - opal_list_remove_item(&mca_pmix_pmix2x_component.single_events, &sing->super); - OBJ_RELEASE(sing); - goto release; - } + if (cd->handler == sing->index) { + opal_list_remove_item(&mca_pmix_pmix2x_component.single_events, &sing->super); + OBJ_RELEASE(sing); + goto release; + } } /* check multi events */ OPAL_LIST_FOREACH(multi, &mca_pmix_pmix2x_component.multi_events, opal_pmix2x_multi_event_t) { - if (cd->handler == multi->index) { - opal_list_remove_item(&mca_pmix_pmix2x_component.multi_events, &multi->super); - OBJ_RELEASE(multi); - goto release; - } + if (cd->handler == multi->index) { + opal_list_remove_item(&mca_pmix_pmix2x_component.multi_events, &multi->super); + OBJ_RELEASE(multi); + goto release; + } } /* check default events */ OPAL_LIST_FOREACH(def, &mca_pmix_pmix2x_component.default_events, opal_pmix2x_default_event_t) { - if (cd->handler == def->index) { - opal_list_remove_item(&mca_pmix_pmix2x_component.default_events, &def->super); - OBJ_RELEASE(def); - break; - } + if (cd->handler == def->index) { + opal_list_remove_item(&mca_pmix_pmix2x_component.default_events, &def->super); + OBJ_RELEASE(def); + break; + } } release: if (NULL != cd->opcbfunc) { - cd->opcbfunc(OPAL_SUCCESS, cd->cbdata); + cd->opcbfunc(OPAL_SUCCESS, cd->cbdata); } OBJ_RELEASE(cd); } static void deregister_handler(size_t evhandler, - opal_pmix_op_cbfunc_t cbfunc, - void *cbdata) + opal_pmix_op_cbfunc_t cbfunc, + void *cbdata) { /* we must threadshift this request as we might not be in an event * and we are going to access framework-global lists/objects */ @@ -1059,86 +1156,86 @@ static void _notify_event(int sd, short args, void *cbdata) /* check the single events first */ OPAL_LIST_FOREACH(sing, &mca_pmix_pmix2x_component.single_events, opal_pmix2x_single_event_t) { - if (cd->status == sing->code) { - /* found it - invoke the handler, pointing its - * callback function to our progression function */ - chain = OBJ_NEW(opal_pmix2x_event_chain_t); - chain->status = cd->status; - chain->range = pmix2x_convert_opalrange(cd->range); - chain->source = *(cd->source); - chain->info = cd->info; - chain->final_cbfunc = cd->opcbfunc; - chain->final_cbdata = cd->cbdata; - chain->sing = sing; - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "[%s] CALLING SINGLE EVHDLR FOR STATUS %d", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), chain->status); - sing->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - OBJ_RELEASE(cd); - return; - } + if (cd->status == sing->code) { + /* found it - invoke the handler, pointing its + * callback function to our progression function */ + chain = OBJ_NEW(opal_pmix2x_event_chain_t); + chain->status = cd->status; + chain->range = pmix2x_convert_opalrange(cd->range); + chain->source = *(cd->source); + chain->info = cd->info; + chain->final_cbfunc = cd->opcbfunc; + chain->final_cbdata = cd->cbdata; + chain->sing = sing; + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "[%s] CALLING SINGLE EVHDLR FOR STATUS %d", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), chain->status); + sing->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + OBJ_RELEASE(cd); + return; + } } /* check multi events */ OPAL_LIST_FOREACH(multi, &mca_pmix_pmix2x_component.multi_events, opal_pmix2x_multi_event_t) { - for (i=0; i < multi->ncodes; i++) { - if (cd->status == multi->codes[i]) { - /* found it - invoke the handler, pointing its - * callback function to our progression function */ - chain = OBJ_NEW(opal_pmix2x_event_chain_t); - chain->status = cd->status; - chain->range = pmix2x_convert_opalrange(cd->range); - chain->source = *(cd->source); - chain->info = cd->info; - chain->final_cbfunc = cd->opcbfunc; - chain->final_cbdata = cd->cbdata; - chain->multi = multi; - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "[%s] CALLING MULTI EVHDLR FOR STATUS %d", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), chain->status); - multi->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - OBJ_RELEASE(cd); - return; - } - } + for (i=0; i < multi->ncodes; i++) { + if (cd->status == multi->codes[i]) { + /* found it - invoke the handler, pointing its + * callback function to our progression function */ + chain = OBJ_NEW(opal_pmix2x_event_chain_t); + chain->status = cd->status; + chain->range = pmix2x_convert_opalrange(cd->range); + chain->source = *(cd->source); + chain->info = cd->info; + chain->final_cbfunc = cd->opcbfunc; + chain->final_cbdata = cd->cbdata; + chain->multi = multi; + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "[%s] CALLING MULTI EVHDLR FOR STATUS %d", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), chain->status); + multi->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + OBJ_RELEASE(cd); + return; + } + } } /* check default events */ if (0 < opal_list_get_size(&mca_pmix_pmix2x_component.default_events)) { - def = (opal_pmix2x_default_event_t*)opal_list_get_first(&mca_pmix_pmix2x_component.default_events); - chain = OBJ_NEW(opal_pmix2x_event_chain_t); - chain->status = cd->status; - chain->range = pmix2x_convert_opalrange(cd->range); - chain->source = *(cd->source); - chain->info = cd->info; - chain->final_cbfunc = cd->opcbfunc; - chain->final_cbdata = cd->cbdata; - chain->def = def; - opal_output_verbose(2, opal_pmix_base_framework.framework_output, - "[%s] CALLING DEFAULT EVHDLR FOR STATUS %d", - OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), chain->status); - def->handler(chain->status, &chain->source, - chain->info, &chain->results, - progress_local_event_hdlr, (void*)chain); - OBJ_RELEASE(cd); - return; + def = (opal_pmix2x_default_event_t*)opal_list_get_first(&mca_pmix_pmix2x_component.default_events); + chain = OBJ_NEW(opal_pmix2x_event_chain_t); + chain->status = cd->status; + chain->range = pmix2x_convert_opalrange(cd->range); + chain->source = *(cd->source); + chain->info = cd->info; + chain->final_cbfunc = cd->opcbfunc; + chain->final_cbdata = cd->cbdata; + chain->def = def; + opal_output_verbose(2, opal_pmix_base_framework.framework_output, + "[%s] CALLING DEFAULT EVHDLR FOR STATUS %d", + OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), chain->status); + def->handler(chain->status, &chain->source, + chain->info, &chain->results, + progress_local_event_hdlr, (void*)chain); + OBJ_RELEASE(cd); + return; } /* if we get here, then there are no registered event handlers */ if (NULL != cd->opcbfunc) { - cd->opcbfunc(OPAL_ERR_NOT_FOUND, cd->cbdata); + cd->opcbfunc(OPAL_ERR_NOT_FOUND, cd->cbdata); } OBJ_RELEASE(cd); return; } static int notify_event(int status, - const opal_process_name_t *source, - opal_pmix_data_range_t range, - opal_list_t *info, - opal_pmix_op_cbfunc_t cbfunc, void *cbdata) + const opal_process_name_t *source, + opal_pmix_data_range_t range, + opal_list_t *info, + opal_pmix_op_cbfunc_t cbfunc, void *cbdata) { /* we must threadshift this request as we might not be in an event * and we are going to access framework-global lists/objects */ @@ -1148,12 +1245,12 @@ static int notify_event(int status, /**** INSTANTIATE INTERNAL CLASSES ****/ OBJ_CLASS_INSTANCE(opal_pmix2x_jobid_trkr_t, - opal_list_item_t, - NULL, NULL); + opal_list_item_t, + NULL, NULL); OBJ_CLASS_INSTANCE(opal_pmix2x_single_event_t, - opal_list_item_t, - NULL, NULL); + opal_list_item_t, + NULL, NULL); static void mtevcon(opal_pmix2x_multi_event_t *p) { @@ -1163,16 +1260,16 @@ static void mtevcon(opal_pmix2x_multi_event_t *p) static void mtevdes(opal_pmix2x_multi_event_t *p) { if (NULL != p->codes) { - free(p->codes); + free(p->codes); } } OBJ_CLASS_INSTANCE(opal_pmix2x_multi_event_t, - opal_list_item_t, - mtevcon, mtevdes); + opal_list_item_t, + mtevcon, mtevdes); OBJ_CLASS_INSTANCE(opal_pmix2x_default_event_t, - opal_list_item_t, - NULL, NULL); + opal_list_item_t, + NULL, NULL); static void chcon(opal_pmix2x_event_chain_t *p) { @@ -1190,8 +1287,8 @@ static void chdes(opal_pmix2x_event_chain_t *p) OPAL_LIST_DESTRUCT(&p->results); } OBJ_CLASS_INSTANCE(opal_pmix2x_event_chain_t, - opal_list_item_t, - chcon, chdes); + opal_list_item_t, + chcon, chdes); static void opcon(pmix2x_opcaddy_t *p) { @@ -1215,21 +1312,21 @@ static void opcon(pmix2x_opcaddy_t *p) static void opdes(pmix2x_opcaddy_t *p) { if (NULL != p->procs) { - PMIX_PROC_FREE(p->procs, p->nprocs); + PMIX_PROC_FREE(p->procs, p->nprocs); } if (NULL != p->error_procs) { - PMIX_PROC_FREE(p->error_procs, p->nerror_procs); + PMIX_PROC_FREE(p->error_procs, p->nerror_procs); } if (NULL != p->info) { - PMIX_INFO_FREE(p->info, p->sz); + PMIX_INFO_FREE(p->info, p->sz); } if (NULL != p->apps) { - PMIX_APP_FREE(p->apps, p->sz); + PMIX_APP_FREE(p->apps, p->sz); } } OBJ_CLASS_INSTANCE(pmix2x_opcaddy_t, - opal_object_t, - opcon, opdes); + opal_object_t, + opcon, opdes); static void ocadcon(pmix2x_opalcaddy_t *p) { @@ -1254,8 +1351,8 @@ static void ocaddes(pmix2x_opalcaddy_t *p) OPAL_LIST_DESTRUCT(&p->apps); } OBJ_CLASS_INSTANCE(pmix2x_opalcaddy_t, - opal_object_t, - ocadcon, ocaddes); + opal_object_t, + ocadcon, ocaddes); static void tscon(pmix2x_threadshift_t *p) { @@ -1270,5 +1367,5 @@ static void tscon(pmix2x_threadshift_t *p) p->cbdata = NULL; } OBJ_CLASS_INSTANCE(pmix2x_threadshift_t, - opal_object_t, - tscon, NULL); + opal_object_t, + tscon, NULL); diff --git a/opal/mca/pmix/pmix2x/pmix2x.h b/opal/mca/pmix/pmix2x/pmix2x.h index 3c824534dd..51519cba7d 100644 --- a/opal/mca/pmix/pmix2x/pmix2x.h +++ b/opal/mca/pmix/pmix2x/pmix2x.h @@ -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, diff --git a/opal/mca/pmix/pmix2x/pmix2x_component.c b/opal/mca/pmix/pmix2x/pmix2x_component.c index 193750f17d..3079cbc3b7 100644 --- a/opal/mca/pmix/pmix2x/pmix2x_component.c +++ b/opal/mca/pmix/pmix2x/pmix2x_component.c @@ -49,30 +49,30 @@ mca_pmix_pmix2x_component_t mca_pmix_pmix2x_component = { /* First, the mca_component_t struct containing meta information about the component itself */ - .base_version = { - /* Indicate that we are a pmix v1.1.0 component (which also - implies a specific MCA version) */ + .base_version = { + /* Indicate that we are a pmix v1.1.0 component (which also + implies a specific MCA version) */ - OPAL_PMIX_BASE_VERSION_2_0_0, + OPAL_PMIX_BASE_VERSION_2_0_0, - /* Component name and version */ + /* Component name and version */ - .mca_component_name = "pmix2x", - MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, - OPAL_RELEASE_VERSION), + .mca_component_name = "pmix2x", + MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, + OPAL_RELEASE_VERSION), - /* Component open and close functions */ + /* Component open and close functions */ - .mca_open_component = external_open, - .mca_close_component = external_close, - .mca_query_component = external_component_query, - .mca_register_component_params = external_register, - }, - /* Next the MCA v1.0.0 component meta data */ - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - } + .mca_open_component = external_open, + .mca_close_component = external_close, + .mca_query_component = external_component_query, + .mca_register_component_params = external_register, + }, + /* Next the MCA v1.0.0 component meta data */ + .base_data = { + /* The component is checkpoint ready */ + MCA_BASE_METADATA_PARAM_CHECKPOINT + } }, .native_launch = false }; @@ -81,10 +81,10 @@ static int external_register(void) { mca_pmix_pmix2x_component.cache_size = 256; mca_base_component_var_register(&mca_pmix_pmix2x_component.super.base_version, - "cache_size", "Size of the ring buffer cache for events", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_5, - MCA_BASE_VAR_SCOPE_CONSTANT, - &mca_pmix_pmix2x_component.cache_size); + "cache_size", "Size of the ring buffer cache for events", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_CONSTANT, + &mca_pmix_pmix2x_component.cache_size); return OPAL_SUCCESS; } @@ -119,12 +119,12 @@ static int external_component_query(mca_base_module_t **module, int *priority) /* see if a PMIx server is present */ if (NULL != (t = getenv("PMIX_SERVER_URI")) || - NULL != (id = getenv("PMIX_ID"))) { - /* if PMIx is present, then we are a client and need to use it */ - *priority = 100; + NULL != (id = getenv("PMIX_ID"))) { + /* if PMIx is present, then we are a client and need to use it */ + *priority = 100; } else { - /* we could be a server, so we still need to be considered */ - *priority = 5; + /* we could be a server, so we still need to be considered */ + *priority = 5; } *module = (mca_base_module_t *)&opal_pmix_pmix2x_module; return OPAL_SUCCESS; diff --git a/opal/mca/pmix/pmix2x/pmix2x_server_north.c b/opal/mca/pmix/pmix2x/pmix2x_server_north.c index 2719ac290f..4676949d41 100644 --- a/opal/mca/pmix/pmix2x/pmix2x_server_north.c +++ b/opal/mca/pmix/pmix2x/pmix2x_server_north.c @@ -46,57 +46,60 @@ * to call up into ORTE for service requests */ static pmix_status_t server_client_connected_fn(const pmix_proc_t *proc, void* server_object, - pmix_op_cbfunc_t cbfunc, void *cbdata); + pmix_op_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_client_finalized_fn(const pmix_proc_t *proc, void* server_object, - pmix_op_cbfunc_t cbfunc, void *cbdata); + pmix_op_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_abort_fn(const pmix_proc_t *proc, void *server_object, - int status, const char msg[], - pmix_proc_t procs[], size_t nprocs, - pmix_op_cbfunc_t cbfunc, void *cbdata); + int status, const char msg[], + pmix_proc_t procs[], size_t nprocs, + pmix_op_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs, - const pmix_info_t info[], size_t ninfo, - char *data, size_t ndata, - pmix_modex_cbfunc_t cbfunc, void *cbdata); + const pmix_info_t info[], size_t ninfo, + char *data, size_t ndata, + pmix_modex_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *proc, - const pmix_info_t info[], size_t ninfo, - pmix_modex_cbfunc_t cbfunc, void *cbdata); + const pmix_info_t info[], size_t ninfo, + pmix_modex_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_publish_fn(const pmix_proc_t *proc, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata); + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_lookup_fn(const pmix_proc_t *proc, char **keys, - const pmix_info_t info[], size_t ninfo, - pmix_lookup_cbfunc_t cbfunc, void *cbdata); + const pmix_info_t info[], size_t ninfo, + pmix_lookup_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_unpublish_fn(const pmix_proc_t *proc, char **keys, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata); + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_spawn_fn(const pmix_proc_t *proc, - const pmix_info_t job_info[], size_t ninfo, - const pmix_app_t apps[], size_t napps, - pmix_spawn_cbfunc_t cbfunc, void *cbdata); + const pmix_info_t job_info[], size_t ninfo, + const pmix_app_t apps[], size_t napps, + pmix_spawn_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata); + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t nprocs, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata); + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_register_events(pmix_status_t *codes, size_t ncodes, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata); + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_deregister_events(pmix_status_t *codes, size_t ncodes, - pmix_op_cbfunc_t cbfunc, void *cbdata); + pmix_op_cbfunc_t cbfunc, void *cbdata); static pmix_status_t server_notify_event(pmix_status_t code, - const pmix_proc_t *source, - pmix_data_range_t range, - pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata); + const pmix_proc_t *source, + pmix_data_range_t range, + 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_info_cbfunc_t cbfunc, - void *cbdata); + 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); + 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; @@ -125,20 +129,20 @@ static void opal_opcbfunc(int status, void *cbdata) pmix2x_opalcaddy_t *opalcaddy = (pmix2x_opalcaddy_t*)cbdata; if (NULL != opalcaddy->opcbfunc) { - opalcaddy->opcbfunc(pmix2x_convert_opalrc(status), opalcaddy->cbdata); + opalcaddy->opcbfunc(pmix2x_convert_opalrc(status), opalcaddy->cbdata); } OBJ_RELEASE(opalcaddy); } static pmix_status_t server_client_connected_fn(const pmix_proc_t *p, void *server_object, - pmix_op_cbfunc_t cbfunc, void *cbdata) + pmix_op_cbfunc_t cbfunc, void *cbdata) { int rc; opal_process_name_t proc; pmix2x_opalcaddy_t *opalcaddy; if (NULL == host_module || NULL == host_module->client_connected) { - return PMIX_SUCCESS; + return PMIX_SUCCESS; } opalcaddy = OBJ_NEW(pmix2x_opalcaddy_t); @@ -147,30 +151,30 @@ static pmix_status_t server_client_connected_fn(const pmix_proc_t *p, void *serv /* convert the nspace/rank to an opal_process_name_t */ if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) { - return pmix2x_convert_opalrc(rc); + return pmix2x_convert_opalrc(rc); } proc.vpid = pmix2x_convert_rank(p->rank); /* pass it up */ rc = host_module->client_connected(&proc, server_object, - opal_opcbfunc, opalcaddy); + opal_opcbfunc, opalcaddy); return pmix2x_convert_opalrc(rc); } static pmix_status_t server_client_finalized_fn(const pmix_proc_t *p, void* server_object, - pmix_op_cbfunc_t cbfunc, void *cbdata) + pmix_op_cbfunc_t cbfunc, void *cbdata) { int rc; pmix2x_opalcaddy_t *opalcaddy; opal_process_name_t proc; if (NULL == host_module || NULL == host_module->client_finalized) { - return PMIX_SUCCESS; + return PMIX_SUCCESS; } /* convert the nspace/rank to an opal_process_name_t */ if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) { - return pmix2x_convert_opalrc(rc); + return pmix2x_convert_opalrc(rc); } proc.vpid = pmix2x_convert_rank(p->rank); @@ -182,15 +186,15 @@ static pmix_status_t server_client_finalized_fn(const pmix_proc_t *p, void* serv /* pass it up */ rc = host_module->client_finalized(&proc, server_object, opal_opcbfunc, opalcaddy); if (OPAL_SUCCESS != rc) { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); } static pmix_status_t server_abort_fn(const pmix_proc_t *p, void *server_object, - int status, const char msg[], - pmix_proc_t procs[], size_t nprocs, - pmix_op_cbfunc_t cbfunc, void *cbdata) + int status, const char msg[], + pmix_proc_t procs[], size_t nprocs, + pmix_op_cbfunc_t cbfunc, void *cbdata) { size_t n; opal_namelist_t *nm; @@ -199,12 +203,12 @@ static pmix_status_t server_abort_fn(const pmix_proc_t *p, void *server_object, pmix2x_opalcaddy_t *opalcaddy; if (NULL == host_module || NULL == host_module->abort) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_SUPPORTED; } /* convert the nspace/rank to an opal_process_name_t */ if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) { - return pmix2x_convert_opalrc(rc); + return pmix2x_convert_opalrc(rc); } proc.vpid = pmix2x_convert_rank(p->rank); @@ -215,20 +219,20 @@ static pmix_status_t server_abort_fn(const pmix_proc_t *p, void *server_object, /* convert the array of pmix_proc_t to the list of procs */ for (n=0; n < nprocs; n++) { - nm = OBJ_NEW(opal_namelist_t); - opal_list_append(&opalcaddy->procs, &nm->super); - if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + nm = OBJ_NEW(opal_namelist_t); + opal_list_append(&opalcaddy->procs, &nm->super); + if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } nm->name.vpid = pmix2x_convert_rank(procs[n].rank); } /* pass it up */ rc = host_module->abort(&proc, server_object, status, msg, - &opalcaddy->procs, opal_opcbfunc, opalcaddy); + &opalcaddy->procs, opal_opcbfunc, opalcaddy); if (OPAL_SUCCESS != rc) { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); } @@ -238,32 +242,32 @@ static void _data_release(void *cbdata) pmix2x_opalcaddy_t *opalcaddy = (pmix2x_opalcaddy_t*)cbdata; if (NULL != opalcaddy->odmdxfunc) { - opalcaddy->odmdxfunc(opalcaddy->ocbdata); + opalcaddy->odmdxfunc(opalcaddy->ocbdata); } OBJ_RELEASE(opalcaddy); } static void opmdx_response(int status, const char *data, size_t sz, void *cbdata, - opal_pmix_release_cbfunc_t relcbfunc, void *relcbdata) + opal_pmix_release_cbfunc_t relcbfunc, void *relcbdata) { pmix_status_t rc; pmix2x_opalcaddy_t *opalcaddy = (pmix2x_opalcaddy_t*)cbdata; rc = pmix2x_convert_rc(status); if (NULL != opalcaddy->mdxcbfunc) { - opalcaddy->odmdxfunc = relcbfunc; - opalcaddy->ocbdata = relcbdata; - opalcaddy->mdxcbfunc(rc, data, sz, opalcaddy->cbdata, - _data_release, opalcaddy); + opalcaddy->odmdxfunc = relcbfunc; + opalcaddy->ocbdata = relcbdata; + opalcaddy->mdxcbfunc(rc, data, sz, opalcaddy->cbdata, + _data_release, opalcaddy); } else { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } } static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs, - const pmix_info_t info[], size_t ninfo, - char *data, size_t ndata, - pmix_modex_cbfunc_t cbfunc, void *cbdata) + const pmix_info_t info[], size_t ninfo, + char *data, size_t ndata, + pmix_modex_cbfunc_t cbfunc, void *cbdata) { pmix2x_opalcaddy_t *opalcaddy; size_t n; @@ -272,7 +276,7 @@ static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs, int rc; if (NULL == host_module || NULL == host_module->fence_nb) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_SUPPORTED; } /* setup the caddy */ @@ -282,38 +286,38 @@ static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs, /* convert the array of pmix_proc_t to the list of procs */ for (n=0; n < nprocs; n++) { - nm = OBJ_NEW(opal_namelist_t); - opal_list_append(&opalcaddy->procs, &nm->super); - if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + nm = OBJ_NEW(opal_namelist_t); + opal_list_append(&opalcaddy->procs, &nm->super); + if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } nm->name.vpid = pmix2x_convert_rank(procs[n].rank); } /* convert the array of pmix_info_t to the list of info */ for (n=0; n < ninfo; n++) { - iptr = OBJ_NEW(opal_value_t); - opal_list_append(&opalcaddy->info, &iptr->super); - iptr->key = strdup(info[n].key); - if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + iptr = OBJ_NEW(opal_value_t); + opal_list_append(&opalcaddy->info, &iptr->super); + iptr->key = strdup(info[n].key); + if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } } /* pass it up */ rc = host_module->fence_nb(&opalcaddy->procs, &opalcaddy->info, - data, ndata, opmdx_response, opalcaddy); + data, ndata, opmdx_response, opalcaddy); if (OPAL_SUCCESS != rc) { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); } static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p, - const pmix_info_t info[], size_t ninfo, - pmix_modex_cbfunc_t cbfunc, void *cbdata) + const pmix_info_t info[], size_t ninfo, + pmix_modex_cbfunc_t cbfunc, void *cbdata) { int rc; pmix2x_opalcaddy_t *opalcaddy; @@ -322,12 +326,12 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p, size_t n; if (NULL == host_module || NULL == host_module->direct_modex) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_SUPPORTED; } /* convert the nspace/rank to an opal_process_name_t */ if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) { - return pmix2x_convert_opalrc(rc); + return pmix2x_convert_opalrc(rc); } proc.vpid = pmix2x_convert_rank(p->rank); @@ -338,29 +342,29 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p, /* convert the array of pmix_info_t to the list of info */ for (n=0; n < ninfo; n++) { - iptr = OBJ_NEW(opal_value_t); - opal_list_append(&opalcaddy->info, &iptr->super); - iptr->key = strdup(info[n].key); - if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + iptr = OBJ_NEW(opal_value_t); + opal_list_append(&opalcaddy->info, &iptr->super); + iptr->key = strdup(info[n].key); + if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } } /* pass it up */ rc = host_module->direct_modex(&proc, &opalcaddy->info, opmdx_response, opalcaddy); if (OPAL_SUCCESS != rc && OPAL_ERR_IN_PROCESS != rc) { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } if (OPAL_ERR_IN_PROCESS == rc) { - rc = OPAL_SUCCESS; + rc = OPAL_SUCCESS; } return pmix2x_convert_opalrc(rc); } static pmix_status_t server_publish_fn(const pmix_proc_t *p, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata) + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) { int rc; size_t n; @@ -369,12 +373,12 @@ static pmix_status_t server_publish_fn(const pmix_proc_t *p, opal_value_t *oinfo; if (NULL == host_module || NULL == host_module->publish) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_SUPPORTED; } /* convert the nspace/rank to an opal_process_name_t */ if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) { - return pmix2x_convert_opalrc(rc); + return pmix2x_convert_opalrc(rc); } proc.vpid = pmix2x_convert_rank(p->rank); @@ -385,27 +389,27 @@ static pmix_status_t server_publish_fn(const pmix_proc_t *p, /* convert the info array */ for (n=0; n < ninfo; n++) { - 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))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + 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))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } } /* pass it up */ rc = host_module->publish(&proc, &opalcaddy->info, opal_opcbfunc, opalcaddy); if (OPAL_SUCCESS != rc) { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); } static void opal_lkupcbfunc(int status, - opal_list_t *data, - void *cbdata) + opal_list_t *data, + void *cbdata) { pmix2x_opalcaddy_t *opalcaddy = (pmix2x_opalcaddy_t*)cbdata; pmix_status_t rc; @@ -414,28 +418,28 @@ static void opal_lkupcbfunc(int status, opal_pmix_pdata_t *p; if (NULL != opalcaddy->lkupcbfunc) { - rc = pmix2x_convert_opalrc(status); - /* convert any returned data */ - if (NULL != data) { - nd = opal_list_get_size(data); - PMIX_PDATA_CREATE(d, nd); - n=0; - OPAL_LIST_FOREACH(p, data, opal_pmix_pdata_t) { - /* convert the jobid */ - (void)opal_snprintf_jobid(d[n].proc.nspace, PMIX_MAX_NSLEN, p->proc.jobid); - d[n].proc.rank = pmix2x_convert_opalrank(p->proc.vpid); - (void)strncpy(d[n].key, p->value.key, PMIX_MAX_KEYLEN); - pmix2x_value_load(&d[n].value, &p->value); - } - } - opalcaddy->lkupcbfunc(rc, d, nd, opalcaddy->cbdata); + rc = pmix2x_convert_opalrc(status); + /* convert any returned data */ + if (NULL != data) { + nd = opal_list_get_size(data); + PMIX_PDATA_CREATE(d, nd); + n=0; + OPAL_LIST_FOREACH(p, data, opal_pmix_pdata_t) { + /* convert the jobid */ + (void)opal_snprintf_jobid(d[n].proc.nspace, PMIX_MAX_NSLEN, p->proc.jobid); + d[n].proc.rank = pmix2x_convert_opalrank(p->proc.vpid); + (void)strncpy(d[n].key, p->value.key, PMIX_MAX_KEYLEN); + pmix2x_value_load(&d[n].value, &p->value); + } + } + opalcaddy->lkupcbfunc(rc, d, nd, opalcaddy->cbdata); } OBJ_RELEASE(opalcaddy); } static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys, - const pmix_info_t info[], size_t ninfo, - pmix_lookup_cbfunc_t cbfunc, void *cbdata) + const pmix_info_t info[], size_t ninfo, + pmix_lookup_cbfunc_t cbfunc, void *cbdata) { int rc; pmix2x_opalcaddy_t *opalcaddy; @@ -444,12 +448,12 @@ static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys, size_t n; if (NULL == host_module || NULL == host_module->lookup) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_SUPPORTED; } /* convert the nspace/rank to an opal_process_name_t */ if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) { - return pmix2x_convert_opalrc(rc); + return pmix2x_convert_opalrc(rc); } proc.vpid = pmix2x_convert_rank(p->rank); @@ -460,19 +464,19 @@ static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys, /* convert the array of pmix_info_t to the list of info */ for (n=0; n < ninfo; n++) { - iptr = OBJ_NEW(opal_value_t); - opal_list_append(&opalcaddy->info, &iptr->super); - iptr->key = strdup(info[n].key); - if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + iptr = OBJ_NEW(opal_value_t); + opal_list_append(&opalcaddy->info, &iptr->super); + iptr->key = strdup(info[n].key); + if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } } /* pass it up */ rc = host_module->lookup(&proc, keys, &opalcaddy->info, opal_lkupcbfunc, opalcaddy); if (OPAL_SUCCESS != rc) { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); @@ -480,8 +484,8 @@ static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys, static pmix_status_t server_unpublish_fn(const pmix_proc_t *p, char **keys, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata) + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) { int rc; pmix2x_opalcaddy_t *opalcaddy; @@ -490,12 +494,12 @@ static pmix_status_t server_unpublish_fn(const pmix_proc_t *p, char **keys, size_t n; if (NULL == host_module || NULL == host_module->unpublish) { - return PMIX_SUCCESS; + return PMIX_SUCCESS; } /* convert the nspace/rank to an opal_process_name_t */ if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) { - return pmix2x_convert_opalrc(rc); + return pmix2x_convert_opalrc(rc); } proc.vpid = pmix2x_convert_rank(p->rank); @@ -506,19 +510,19 @@ static pmix_status_t server_unpublish_fn(const pmix_proc_t *p, char **keys, /* convert the array of pmix_info_t to the list of info */ for (n=0; n < ninfo; n++) { - iptr = OBJ_NEW(opal_value_t); - opal_list_append(&opalcaddy->info, &iptr->super); - iptr->key = strdup(info[n].key); - if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + iptr = OBJ_NEW(opal_value_t); + opal_list_append(&opalcaddy->info, &iptr->super); + iptr->key = strdup(info[n].key); + if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } } /* pass it up */ rc = host_module->unpublish(&proc, keys, &opalcaddy->info, opal_opcbfunc, opalcaddy); if (OPAL_SUCCESS != rc) { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); @@ -531,18 +535,18 @@ static void opal_spncbfunc(int status, opal_jobid_t jobid, void *cbdata) char nspace[PMIX_MAX_NSLEN]; if (NULL != opalcaddy->spwncbfunc) { - rc = pmix2x_convert_opalrc(status); - /* convert the jobid */ - (void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid); - opalcaddy->spwncbfunc(rc, nspace, opalcaddy->cbdata); + rc = pmix2x_convert_opalrc(status); + /* convert the jobid */ + (void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid); + opalcaddy->spwncbfunc(rc, nspace, opalcaddy->cbdata); } OBJ_RELEASE(opalcaddy); } static pmix_status_t server_spawn_fn(const pmix_proc_t *p, - const pmix_info_t job_info[], size_t ninfo, - const pmix_app_t apps[], size_t napps, - pmix_spawn_cbfunc_t cbfunc, void *cbdata) + const pmix_info_t job_info[], size_t ninfo, + const pmix_app_t apps[], size_t napps, + pmix_spawn_cbfunc_t cbfunc, void *cbdata) { pmix2x_opalcaddy_t *opalcaddy; opal_process_name_t proc; @@ -552,12 +556,12 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p, int rc; if (NULL == host_module || NULL == host_module->spawn) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_SUPPORTED; } /* convert the nspace/rank to an opal_process_name_t */ if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) { - return pmix2x_convert_opalrc(rc); + return pmix2x_convert_opalrc(rc); } proc.vpid = pmix2x_convert_rank(p->rank); @@ -568,46 +572,46 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p, /* convert the job info */ for (k=0; k < ninfo; k++) { - oinfo = OBJ_NEW(opal_value_t); - opal_list_append(&opalcaddy->info, &oinfo->super); - oinfo->key = strdup(job_info[k].key); - if (OPAL_SUCCESS != (rc = pmix2x_value_unload(oinfo, &job_info[k].value))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + oinfo = OBJ_NEW(opal_value_t); + opal_list_append(&opalcaddy->info, &oinfo->super); + oinfo->key = strdup(job_info[k].key); + if (OPAL_SUCCESS != (rc = pmix2x_value_unload(oinfo, &job_info[k].value))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } } /* convert the apps */ for (n=0; n < napps; n++) { - app = OBJ_NEW(opal_pmix_app_t); - opal_list_append(&opalcaddy->apps, &app->super); - if (NULL != apps[n].cmd) { - app->cmd = strdup(apps[n].cmd); - } - app->argc = apps[n].argc; - if (NULL != apps[n].argv) { - app->argv = opal_argv_copy(apps[n].argv); - } - if (NULL != apps[n].env) { - app->env = opal_argv_copy(apps[n].env); - } - app->maxprocs = apps[n].maxprocs; - for (k=0; k < apps[n].ninfo; k++) { - oinfo = OBJ_NEW(opal_value_t); - opal_list_append(&app->info, &oinfo->super); - oinfo->key = strdup(apps[n].info[k].key); - if (OPAL_SUCCESS != (rc = pmix2x_value_unload(oinfo, &apps[n].info[k].value))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } - } + app = OBJ_NEW(opal_pmix_app_t); + opal_list_append(&opalcaddy->apps, &app->super); + if (NULL != apps[n].cmd) { + app->cmd = strdup(apps[n].cmd); + } + app->argc = apps[n].argc; + if (NULL != apps[n].argv) { + app->argv = opal_argv_copy(apps[n].argv); + } + if (NULL != apps[n].env) { + app->env = opal_argv_copy(apps[n].env); + } + app->maxprocs = apps[n].maxprocs; + for (k=0; k < apps[n].ninfo; k++) { + oinfo = OBJ_NEW(opal_value_t); + opal_list_append(&app->info, &oinfo->super); + oinfo->key = strdup(apps[n].info[k].key); + if (OPAL_SUCCESS != (rc = pmix2x_value_unload(oinfo, &apps[n].info[k].value))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } + } } /* pass it up */ rc = host_module->spawn(&proc, &opalcaddy->info, &opalcaddy->apps, opal_spncbfunc, opalcaddy); if (OPAL_SUCCESS != rc) { - OPAL_ERROR_LOG(rc); - OBJ_RELEASE(opalcaddy); + OPAL_ERROR_LOG(rc); + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); @@ -615,8 +619,8 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p, static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata) + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) { int rc; pmix2x_opalcaddy_t *opalcaddy; @@ -625,7 +629,7 @@ static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs, opal_value_t *oinfo; if (NULL == host_module || NULL == host_module->connect) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_SUPPORTED; } /* setup the caddy */ @@ -635,30 +639,30 @@ static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs, /* convert the array of pmix_proc_t to the list of procs */ for (n=0; n < nprocs; n++) { - nm = OBJ_NEW(opal_namelist_t); - opal_list_append(&opalcaddy->procs, &nm->super); - if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + nm = OBJ_NEW(opal_namelist_t); + opal_list_append(&opalcaddy->procs, &nm->super); + if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } nm->name.vpid = pmix2x_convert_rank(procs[n].rank); } /* convert the info */ for (n=0; n < ninfo; n++) { - 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))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + 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))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } } /* pass it up */ rc = host_module->connect(&opalcaddy->procs, &opalcaddy->info, opal_opcbfunc, opalcaddy); if (OPAL_SUCCESS != rc) { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); @@ -666,8 +670,8 @@ static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs, static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t nprocs, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata) + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) { int rc; pmix2x_opalcaddy_t *opalcaddy; @@ -676,7 +680,7 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro opal_value_t *oinfo; if (NULL == host_module || NULL == host_module->disconnect) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_SUPPORTED; } /* setup the caddy */ @@ -686,38 +690,38 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro /* convert the array of pmix_proc_t to the list of procs */ for (n=0; n < nprocs; n++) { - nm = OBJ_NEW(opal_namelist_t); - opal_list_append(&opalcaddy->procs, &nm->super); - if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + nm = OBJ_NEW(opal_namelist_t); + opal_list_append(&opalcaddy->procs, &nm->super); + if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } nm->name.vpid = pmix2x_convert_rank(procs[n].rank); } /* convert the info */ for (n=0; n < ninfo; n++) { - 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))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + 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))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } } /* pass it up */ rc = host_module->disconnect(&opalcaddy->procs, &opalcaddy->info, opal_opcbfunc, opalcaddy); if (OPAL_SUCCESS != rc) { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); } static pmix_status_t server_register_events(pmix_status_t *codes, size_t ncodes, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata) + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix2x_opalcaddy_t *opalcaddy; size_t n; @@ -731,35 +735,35 @@ static pmix_status_t server_register_events(pmix_status_t *codes, size_t ncodes, /* convert the info */ for (n=0; n < ninfo; n++) { - 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))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + 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))) { + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); + } } /* pass it up */ rc = host_module->register_events(&opalcaddy->info, opal_opcbfunc, opalcaddy); if (OPAL_SUCCESS != rc) { - OBJ_RELEASE(opalcaddy); + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); } static pmix_status_t server_deregister_events(pmix_status_t *codes, size_t ncodes, - pmix_op_cbfunc_t cbfunc, void *cbdata) + pmix_op_cbfunc_t cbfunc, void *cbdata) { return PMIX_ERR_NOT_SUPPORTED; } static pmix_status_t server_notify_event(pmix_status_t code, - const pmix_proc_t *source, - pmix_data_range_t range, - pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata) + const pmix_proc_t *source, + pmix_data_range_t range, + pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) { return PMIX_ERR_NOT_SUPPORTED; } @@ -771,10 +775,10 @@ static void _info_rel(void *cbdata) OBJ_RELEASE(pcaddy); } static void info_cbfunc(int status, - opal_list_t *info, - void *cbdata, - opal_pmix_release_cbfunc_t release_fn, - void *release_cbdata) + opal_list_t *info, + void *cbdata, + opal_pmix_release_cbfunc_t release_fn, + void *release_cbdata) { pmix2x_opalcaddy_t *opalcaddy = (pmix2x_opalcaddy_t*)cbdata; pmix2x_opcaddy_t *pcaddy; @@ -788,43 +792,43 @@ static void info_cbfunc(int status, /* convert the list to a pmix_info_t array */ if (NULL != info) { - pcaddy->ninfo = opal_list_get_size(info); - if (0 < pcaddy->ninfo) { - PMIX_INFO_CREATE(pcaddy->info, pcaddy->ninfo); - n = 0; - OPAL_LIST_FOREACH(kv, info, opal_value_t) { - (void)strncpy(pcaddy->info[n].key, kv->key, PMIX_MAX_KEYLEN); - pmix2x_value_load(&pcaddy->info[n].value, kv); - } - } + pcaddy->ninfo = opal_list_get_size(info); + if (0 < pcaddy->ninfo) { + PMIX_INFO_CREATE(pcaddy->info, pcaddy->ninfo); + n = 0; + OPAL_LIST_FOREACH(kv, info, opal_value_t) { + (void)strncpy(pcaddy->info[n].key, kv->key, PMIX_MAX_KEYLEN); + pmix2x_value_load(&pcaddy->info[n].value, kv); + } + } } /* we are done with the incoming data */ if (NULL != release_fn) { - release_fn(release_cbdata); + release_fn(release_cbdata); } /* provide the answer downward */ if (NULL != opalcaddy->infocbfunc) { - opalcaddy->infocbfunc(pcaddy->status, pcaddy->info, pcaddy->ninfo, - opalcaddy->cbdata, _info_rel, pcaddy); + opalcaddy->infocbfunc(pcaddy->status, pcaddy->info, pcaddy->ninfo, + opalcaddy->cbdata, _info_rel, pcaddy); } OBJ_RELEASE(opalcaddy); } 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_info_cbfunc_t cbfunc, - void *cbdata) + 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) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_SUPPORTED; } /* setup the caddy */ @@ -834,38 +838,43 @@ static pmix_status_t server_query(pmix_proc_t *proct, /* 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); - return pmix2x_convert_opalrc(rc); + opal_output(0, "FILE: %s LINE %d", __FILE__, __LINE__); + OBJ_RELEASE(opalcaddy); + return pmix2x_convert_opalrc(rc); } requestor.vpid = pmix2x_convert_rank(proct->rank); - /* convert the info */ - for (n=0; n < ninfo; n++) { - 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))) { - OBJ_RELEASE(opalcaddy); - return pmix2x_convert_opalrc(rc); - } + /* 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(&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, - info_cbfunc, opalcaddy))) { - OBJ_RELEASE(opalcaddy); + &opalcaddy->info, + info_cbfunc, opalcaddy))) { + OBJ_RELEASE(opalcaddy); } return pmix2x_convert_opalrc(rc); } static void toolcbfunc(int status, - opal_process_name_t proc, - void *cbdata) + opal_process_name_t proc, + void *cbdata) { pmix2x_opalcaddy_t *opalcaddy = (pmix2x_opalcaddy_t*)cbdata; pmix_status_t rc; @@ -880,14 +889,14 @@ static void toolcbfunc(int status, /* pass it down */ if (NULL != opalcaddy->toolcbfunc) { - opalcaddy->toolcbfunc(rc, &p, opalcaddy->cbdata); + opalcaddy->toolcbfunc(rc, &p, opalcaddy->cbdata); } OBJ_RELEASE(opalcaddy); } static void server_tool_connection(pmix_info_t *info, size_t ninfo, - pmix_tool_connection_cbfunc_t cbfunc, - void *cbdata) + pmix_tool_connection_cbfunc_t cbfunc, + void *cbdata) { pmix2x_opalcaddy_t *opalcaddy; size_t n; @@ -902,18 +911,93 @@ static void server_tool_connection(pmix_info_t *info, size_t ninfo, /* convert the info */ for (n=0; n < ninfo; n++) { - 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))) { - OBJ_RELEASE(opalcaddy); - err = pmix2x_convert_opalrc(rc); - if (NULL != cbfunc) { - cbfunc(err, NULL, cbdata); - } - } + 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))) { + OBJ_RELEASE(opalcaddy); + err = pmix2x_convert_opalrc(rc); + if (NULL != cbfunc) { + cbfunc(err, NULL, cbdata); + } + } } /* 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); +} diff --git a/opal/mca/pmix/pmix2x/pmix2x_server_south.c b/opal/mca/pmix/pmix2x/pmix2x_server_south.c index c73e7fc124..cbf68f39d1 100644 --- a/opal/mca/pmix/pmix2x/pmix2x_server_south.c +++ b/opal/mca/pmix/pmix2x/pmix2x_server_south.c @@ -53,26 +53,26 @@ static size_t errhdler_ref = 0; #define PMIX_WAIT_FOR_COMPLETION(a) \ do { \ - while ((a)) { \ - usleep(10); \ - } \ + while ((a)) { \ + usleep(10); \ + } \ } while (0) static void errreg_cbfunc (pmix_status_t status, - size_t errhandler_ref, - void *cbdata) + size_t errhandler_ref, + void *cbdata) { volatile bool *active = (volatile bool*)cbdata; errhdler_ref = errhandler_ref; opal_output_verbose(5, opal_pmix_base_framework.framework_output, - "PMIX server errreg_cbfunc - error handler registered status=%d, reference=%lu", - status, (unsigned long)errhandler_ref); + "PMIX server errreg_cbfunc - error handler registered status=%d, reference=%lu", + status, (unsigned long)errhandler_ref); *active = false; } int pmix2x_server_init(opal_pmix_server_module_t *module, - opal_list_t *info) + opal_list_t *info) { pmix_status_t rc; int dbg; @@ -82,28 +82,28 @@ int pmix2x_server_init(opal_pmix_server_module_t *module, volatile bool active; if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) { - asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg); - putenv(dbgvalue); + asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg); + putenv(dbgvalue); } /* convert the list to an array of pmix_info_t */ if (NULL != info) { - sz = opal_list_get_size(info); - PMIX_INFO_CREATE(pinfo, sz); - n = 0; - OPAL_LIST_FOREACH(kv, info, opal_value_t) { - (void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN); - pmix2x_value_load(&pinfo[n].value, kv); - ++n; - } + sz = opal_list_get_size(info); + PMIX_INFO_CREATE(pinfo, sz); + n = 0; + OPAL_LIST_FOREACH(kv, info, opal_value_t) { + (void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN); + pmix2x_value_load(&pinfo[n].value, kv); + ++n; + } } else { - sz = 0; - pinfo = NULL; + sz = 0; + pinfo = NULL; } if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, pinfo, sz))) { - PMIX_INFO_FREE(pinfo, sz); - return pmix2x_convert_rc(rc); + PMIX_INFO_FREE(pinfo, sz); + return pmix2x_convert_rc(rc); } PMIX_INFO_FREE(pinfo, sz); @@ -160,13 +160,13 @@ static void opcbfunc(pmix_status_t status, void *cbdata) pmix2x_opcaddy_t *op = (pmix2x_opcaddy_t*)cbdata; if (NULL != op->opcbfunc) { - op->opcbfunc(pmix2x_convert_rc(status), op->cbdata); + op->opcbfunc(pmix2x_convert_rc(status), op->cbdata); } if (op->active) { - op->status = status; - op->active = false; + op->status = status; + op->active = false; } else { - OBJ_RELEASE(op); + OBJ_RELEASE(op); } } @@ -196,61 +196,62 @@ static void _reg_nspace(int sd, short args, void *cbdata) /* convert the list to an array of pmix_info_t */ if (NULL != cd->info) { - sz = opal_list_get_size(cd->info); - PMIX_INFO_CREATE(pinfo, sz); - n = 0; - 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; - /* 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; - m = 0; - OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) { - (void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN); - pmix2x_value_load(&pmap[m].value, k2); - ++m; - } - } else { - pmix2x_value_load(&pinfo[n].value, kv); - } - ++n; - } + sz = opal_list_get_size(cd->info); + PMIX_INFO_CREATE(pinfo, sz); + n = 0; + 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_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.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); + pmix2x_value_load(&pmap[m].value, k2); + ++m; + } + } else { + pmix2x_value_load(&pinfo[n].value, kv); + } + ++n; + } } else { - sz = 0; - pinfo = NULL; + sz = 0; + pinfo = NULL; } OBJ_CONSTRUCT(&op, pmix2x_opcaddy_t); op.active = true; rc = PMIx_server_register_nspace(nspace, cd->status, pinfo, sz, - opcbfunc, (void*)&op); + opcbfunc, (void*)&op); if (PMIX_SUCCESS == rc) { - PMIX_WAIT_FOR_COMPLETION(op.active); + PMIX_WAIT_FOR_COMPLETION(op.active); } else { - op.status = rc; + op.status = rc; } /* ensure we execute the cbfunc so the caller doesn't hang */ if (NULL != cd->opcbfunc) { - cd->opcbfunc(pmix2x_convert_rc(op.status), cd->cbdata); + cd->opcbfunc(pmix2x_convert_rc(op.status), cd->cbdata); } if (NULL != pinfo) { - PMIX_INFO_FREE(pinfo, sz); + PMIX_INFO_FREE(pinfo, sz); } OBJ_DESTRUCT(&op); OBJ_RELEASE(cd); } int pmix2x_server_register_nspace(opal_jobid_t jobid, - int nlocalprocs, - opal_list_t *info, - opal_pmix_op_cbfunc_t cbfunc, - void *cbdata) + int nlocalprocs, + opal_list_t *info, + opal_pmix_op_cbfunc_t cbfunc, + void *cbdata) { pmix2x_threadshift_t *cd; @@ -265,11 +266,11 @@ int pmix2x_server_register_nspace(opal_jobid_t jobid, /* if the cbfunc is NULL, then the caller is in an event * and we can directly call the processing function */ if (NULL == cbfunc) { - _reg_nspace(0, 0, cd); + _reg_nspace(0, 0, cd); } else { - event_assign(&cd->ev, opal_pmix_base.evbase, - -1, EV_WRITE, _reg_nspace, cd); - event_active(&cd->ev, EV_WRITE, 1); + event_assign(&cd->ev, opal_pmix_base.evbase, + -1, EV_WRITE, _reg_nspace, cd); + event_active(&cd->ev, EV_WRITE, 1); } return OPAL_SUCCESS; @@ -280,12 +281,12 @@ static void tdcbfunc(pmix_status_t status, void *cbdata) pmix2x_threadshift_t *cd = (pmix2x_threadshift_t*)cbdata; if (NULL != cd->opcbfunc) { - cd->opcbfunc(pmix2x_convert_rc(status), cd->cbdata); + cd->opcbfunc(pmix2x_convert_rc(status), cd->cbdata); } if (cd->active) { - cd->active = false; + cd->active = false; } else { - OBJ_RELEASE(cd); + OBJ_RELEASE(cd); } } @@ -296,25 +297,25 @@ static void _dereg_nspace(int sd, short args, void *cbdata) /* if we don't already have it, we can ignore this */ OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { - if (jptr->jobid == cd->jobid) { - /* found it - tell the server to deregister */ - cd->active = true; - PMIx_server_deregister_nspace(jptr->nspace, tdcbfunc, cd); - PMIX_WAIT_FOR_COMPLETION(cd->active); - OBJ_RELEASE(cd); - /* now get rid of it from our list */ - opal_list_remove_item(&mca_pmix_pmix2x_component.jobids, &jptr->super); - OBJ_RELEASE(jptr); - return; - } + if (jptr->jobid == cd->jobid) { + /* found it - tell the server to deregister */ + cd->active = true; + PMIx_server_deregister_nspace(jptr->nspace, tdcbfunc, cd); + PMIX_WAIT_FOR_COMPLETION(cd->active); + OBJ_RELEASE(cd); + /* now get rid of it from our list */ + opal_list_remove_item(&mca_pmix_pmix2x_component.jobids, &jptr->super); + OBJ_RELEASE(jptr); + return; + } } /* must release the caller */ tdcbfunc(PMIX_ERR_NOT_FOUND, cd); } void pmix2x_server_deregister_nspace(opal_jobid_t jobid, - opal_pmix_op_cbfunc_t cbfunc, - void *cbdata) + opal_pmix_op_cbfunc_t cbfunc, + void *cbdata) { pmix2x_threadshift_t *cd; @@ -325,19 +326,19 @@ void pmix2x_server_deregister_nspace(opal_jobid_t jobid, cd->opcbfunc = cbfunc; cd->cbdata = cbdata; if (NULL == cbfunc) { - _dereg_nspace(0, 0, cd); + _dereg_nspace(0, 0, cd); } else { - event_assign(&cd->ev, opal_pmix_base.evbase, - -1, EV_WRITE, _dereg_nspace, cd); - event_active(&cd->ev, EV_WRITE, 1); + event_assign(&cd->ev, opal_pmix_base.evbase, + -1, EV_WRITE, _dereg_nspace, cd); + event_active(&cd->ev, EV_WRITE, 1); } } int pmix2x_server_register_client(const opal_process_name_t *proc, - uid_t uid, gid_t gid, - void *server_object, - opal_pmix_op_cbfunc_t cbfunc, - void *cbdata) + uid_t uid, gid_t gid, + void *server_object, + opal_pmix_op_cbfunc_t cbfunc, + void *cbdata) { pmix_status_t rc; pmix_proc_t p; @@ -350,10 +351,10 @@ int pmix2x_server_register_client(const opal_process_name_t *proc, OBJ_CONSTRUCT(&op, pmix2x_opcaddy_t); op.active = true; rc = PMIx_server_register_client(&p, uid, gid, server_object, - opcbfunc, (void*)&op); + opcbfunc, (void*)&op); if (PMIX_SUCCESS == rc) { - PMIX_WAIT_FOR_COMPLETION(op.active); - rc = op.status; + PMIX_WAIT_FOR_COMPLETION(op.active); + rc = op.status; } OBJ_DESTRUCT(&op); return pmix2x_convert_rc(rc); @@ -367,15 +368,15 @@ static void _dereg_client(int sd, short args, void *cbdata) /* if we don't already have it, we can ignore this */ OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { - if (jptr->jobid == cd->source->jobid) { - /* found it - tell the server to deregister */ - (void)strncpy(p.nspace, jptr->nspace, PMIX_MAX_NSLEN); - p.rank = pmix2x_convert_opalrank(cd->source->vpid); - cd->active = true; - PMIx_server_deregister_client(&p, tdcbfunc, (void*)cd); - PMIX_WAIT_FOR_COMPLETION(cd->active); - break; - } + if (jptr->jobid == cd->source->jobid) { + /* found it - tell the server to deregister */ + (void)strncpy(p.nspace, jptr->nspace, PMIX_MAX_NSLEN); + p.rank = pmix2x_convert_opalrank(cd->source->vpid); + cd->active = true; + PMIx_server_deregister_client(&p, tdcbfunc, (void*)cd); + PMIX_WAIT_FOR_COMPLETION(cd->active); + break; + } } OBJ_RELEASE(cd); } @@ -383,8 +384,8 @@ static void _dereg_client(int sd, short args, void *cbdata) /* tell the local PMIx server to cleanup this client as it is * done executing */ void pmix2x_server_deregister_client(const opal_process_name_t *proc, - opal_pmix_op_cbfunc_t cbfunc, - void *cbdata) + opal_pmix_op_cbfunc_t cbfunc, + void *cbdata) { pmix2x_threadshift_t *cd; @@ -395,11 +396,11 @@ void pmix2x_server_deregister_client(const opal_process_name_t *proc, cd->opcbfunc = cbfunc; cd->cbdata = cbdata; if (NULL == cbfunc) { - _dereg_client(0, 0, cd); + _dereg_client(0, 0, cd); } else { - event_assign(&cd->ev, opal_pmix_base.evbase, - -1, EV_WRITE, _dereg_client, cd); - event_active(&cd->ev, EV_WRITE, 1); + event_assign(&cd->ev, opal_pmix_base.evbase, + -1, EV_WRITE, _dereg_client, cd); + event_active(&cd->ev, EV_WRITE, 1); } } @@ -427,14 +428,14 @@ static void dmdx_response(pmix_status_t status, char *data, size_t sz, void *cbd rc = pmix2x_convert_rc(status); if (NULL != op->mdxcbfunc) { - op->mdxcbfunc(rc, data, sz, op->cbdata, NULL, NULL); + op->mdxcbfunc(rc, data, sz, op->cbdata, NULL, NULL); } OBJ_RELEASE(op); } /* request modex data for a local proc from the PMIx server */ int pmix2x_server_dmodex(const opal_process_name_t *proc, - opal_pmix_modex_cbfunc_t cbfunc, void *cbdata) + opal_pmix_modex_cbfunc_t cbfunc, void *cbdata) { pmix2x_opcaddy_t *op; pmix_status_t rc; @@ -451,16 +452,16 @@ int pmix2x_server_dmodex(const opal_process_name_t *proc, /* find the internally-cached data for this proc */ rc = PMIx_server_dmodex_request(&op->p, dmdx_response, op); if (PMIX_SUCCESS != rc) { - OBJ_RELEASE(op); + OBJ_RELEASE(op); } return pmix2x_convert_rc(rc); } /* tell the PMIx server to notify its local clients of an event */ int pmix2x_server_notify_event(int status, - const opal_process_name_t *source, - opal_list_t *info, - opal_pmix_op_cbfunc_t cbfunc, void *cbdata) + const opal_process_name_t *source, + opal_list_t *info, + opal_pmix_op_cbfunc_t cbfunc, void *cbdata) { opal_value_t *kv; pmix_info_t *pinfo; @@ -470,16 +471,16 @@ int pmix2x_server_notify_event(int status, /* convert the list to an array of pmix_info_t */ if (NULL != info) { - sz = opal_list_get_size(info); - PMIX_INFO_CREATE(pinfo, sz); - n = 0; - OPAL_LIST_FOREACH(kv, info, opal_value_t) { - (void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN); - pmix2x_value_load(&pinfo[n].value, kv); - } + sz = opal_list_get_size(info); + PMIX_INFO_CREATE(pinfo, sz); + n = 0; + OPAL_LIST_FOREACH(kv, info, opal_value_t) { + (void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN); + pmix2x_value_load(&pinfo[n].value, kv); + } } else { - sz = 0; - pinfo = NULL; + sz = 0; + pinfo = NULL; } /* setup the caddy */ op = OBJ_NEW(pmix2x_opcaddy_t); @@ -489,11 +490,11 @@ int pmix2x_server_notify_event(int status, op->cbdata = cbdata; /* convert the jobid */ if (NULL == source) { - (void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, OPAL_JOBID_INVALID); - op->p.rank = pmix2x_convert_opalrank(OPAL_VPID_INVALID); + (void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, OPAL_JOBID_INVALID); + op->p.rank = pmix2x_convert_opalrank(OPAL_VPID_INVALID); } else { - (void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, source->jobid); - op->p.rank = pmix2x_convert_opalrank(source->vpid); + (void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, source->jobid); + op->p.rank = pmix2x_convert_opalrank(source->vpid); } @@ -501,9 +502,9 @@ int pmix2x_server_notify_event(int status, /* the range is irrelevant here as the server is passing * the event down to its local clients */ rc = PMIx_Notify_event(rc, &op->p, PMIX_RANGE_LOCAL, - pinfo, sz, opcbfunc, op); + pinfo, sz, opcbfunc, op); if (PMIX_SUCCESS != rc) { - OBJ_RELEASE(op); + OBJ_RELEASE(op); } return pmix2x_convert_rc(rc); } diff --git a/opal/mca/pmix/pmix_server.h b/opal/mca/pmix/pmix_server.h index d83b9d17ec..cfaccd8f64 100644 --- a/opal/mca/pmix/pmix_server.h +++ b/opal/mca/pmix/pmix_server.h @@ -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; diff --git a/opal/mca/pmix/pmix_types.h b/opal/mca/pmix/pmix_types.h index 195f0fa507..1b510bca18 100644 --- a/opal/mca/pmix/pmix_types.h +++ b/opal/mca/pmix/pmix_types.h @@ -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 ****/ diff --git a/orte/orted/pmix/pmix_server.c b/orte/orted/pmix/pmix_server.c index 769640f03f..c30000827f 100644 --- a/orte/orted/pmix/pmix_server.c +++ b/orte/orted/pmix/pmix_server.c @@ -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) diff --git a/orte/orted/pmix/pmix_server_gen.c b/orte/orted/pmix/pmix_server_gen.c index a6f9215f35..eec3438d1e 100644 --- a/orte/orted/pmix/pmix_server_gen.c +++ b/orte/orted/pmix/pmix_server_gen.c @@ -342,64 +342,76 @@ 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)) { - /* get the current jobids */ - rc = opal_hash_table_get_first_key_uint32(orte_job_data, &key, (void **)&jdata, &nptr); - while (OPAL_SUCCESS == rc) { - if (ORTE_PROC_MY_NAME->jobid != jdata->jobid) { - memset(nspace, 0, 512); - (void)opal_snprintf_jobid(nspace, 512, jdata->jobid); - opal_argv_append_nosize(&nspaces, nspace); + 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) { + if (ORTE_PROC_MY_NAME->jobid != jdata->jobid) { + memset(nspace, 0, 512); + (void)opal_snprintf_jobid(nspace, 512, jdata->jobid); + opal_argv_append_nosize(&nspaces, nspace); + } + rc = opal_hash_table_get_next_key_uint32(orte_job_data, &key, (void **)&jdata, nptr, &nptr); } - 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; + } + opal_list_append(results, &kv->super); } - /* join the results into a single comma-delimited string */ - kv->type = OPAL_STRING; - if (NULL != nspaces) { - kv->data.string = opal_argv_join(nspaces, ','); - } else { - kv->data.string = NULL; - } - ++nresults; } } - 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); + } +} + diff --git a/orte/orted/pmix/pmix_server_internal.h b/orte/orted/pmix/pmix_server_internal.h index 83d8cff61d..f5eb374ce9 100644 --- a/orte/orted/pmix/pmix_server_internal.h +++ b/orte/orted/pmix/pmix_server_internal.h @@ -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, diff --git a/orte/orted/pmix/pmix_server_register_fns.c b/orte/orted/pmix/pmix_server_register_fns.c index a369a2ac1b..88221b0bfc 100644 --- a/orte/orted/pmix/pmix_server_register_fns.c +++ b/orte/orted/pmix/pmix_server_register_fns.c @@ -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 */