1
1

Fix the pmix_query API when it asks for something that returns an array of pmix_info_t. Protect the PMIX_INFO_FREE macro from NULL arrays. Update the mpi_memprobe scaling test

Signed-off-by: Ralph Castain <rhc@open-mpi.org>
Этот коммит содержится в:
Ralph Castain 2017-06-22 20:11:36 -07:00
родитель d8938ca0cc
Коммит 6ec2ad5288
3 изменённых файлов: 28 добавлений и 23 удалений

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

@ -10,6 +10,7 @@
#include <stdio.h> #include <stdio.h>
#include "mpi.h" #include "mpi.h"
#include "opal/mca/pmix/pmix.h" #include "opal/mca/pmix/pmix.h"
#include "opal/util/argv.h"
#include "orte/runtime/runtime.h" #include "orte/runtime/runtime.h"
#include "orte/util/proc_info.h" #include "orte/util/proc_info.h"
#include "orte/util/name_fns.h" #include "orte/util/name_fns.h"
@ -117,17 +118,19 @@ static void sample(void)
free(tmp); free(tmp);
OPAL_LIST_FOREACH(kv, &response, opal_value_t) { OPAL_LIST_FOREACH(kv, &response, opal_value_t) {
lt = (opal_list_t*)kv->data.ptr; lt = (opal_list_t*)kv->data.ptr;
OPAL_LIST_FOREACH(ival, lt, opal_value_t) { if (NULL != lt) {
if (0 == strcmp(ival->key, OPAL_PMIX_DAEMON_MEMORY)) { OPAL_LIST_FOREACH(ival, lt, opal_value_t) {
asprintf(&tmp, "\tDaemon: %f", ival->data.fval); if (0 == strcmp(ival->key, OPAL_PMIX_DAEMON_MEMORY)) {
opal_argv_append_nosize(&answer, tmp); asprintf(&tmp, "\tDaemon: %f", ival->data.fval);
free(tmp); opal_argv_append_nosize(&answer, tmp);
} else if (0 == strcmp(ival->key, OPAL_PMIX_CLIENT_AVG_MEMORY)) { free(tmp);
asprintf(&tmp, "\tClient: %f", ival->data.fval); } else if (0 == strcmp(ival->key, OPAL_PMIX_CLIENT_AVG_MEMORY)) {
opal_argv_append_nosize(&answer, tmp); asprintf(&tmp, "\tClient: %f", ival->data.fval);
free(tmp); opal_argv_append_nosize(&answer, tmp);
} else { free(tmp);
fprintf(stderr, "\tUnknown key: %s", ival->key); } else {
fprintf(stderr, "\tUnknown key: %s", ival->key);
}
} }
} }
} }
@ -149,7 +152,6 @@ static void sample(void)
} }
OPAL_LIST_DESTRUCT(&response); OPAL_LIST_DESTRUCT(&response);
if (0 == rank) { if (0 == rank) {
/* send the notification to release the other procs */ /* send the notification to release the other procs */
wait_for_release = true; wait_for_release = true;
@ -162,19 +164,15 @@ static void sample(void)
active = -1; active = -1;
if (OPAL_SUCCESS != opal_pmix.notify_event(MEMPROBE_RELEASE, NULL, if (OPAL_SUCCESS != opal_pmix.notify_event(MEMPROBE_RELEASE, NULL,
OPAL_PMIX_RANGE_GLOBAL, &response, OPAL_PMIX_RANGE_GLOBAL, &response,
notifycbfunc, (void*)&active)) { NULL, NULL)) {
fprintf(stderr, "Notify event failed\n"); fprintf(stderr, "Notify event failed\n");
exit(1); exit(1);
} }
while (-1 == active) { } else {
/* now wait for notification */
while (wait_for_release) {
usleep(10); usleep(10);
} }
OPAL_LIST_DESTRUCT(&response);
}
/* now wait for notification */
while (wait_for_release) {
usleep(10);
} }
} }

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

@ -905,7 +905,7 @@ typedef struct pmix_value {
free((m)->data.bo.bytes); \ free((m)->data.bo.bytes); \
} \ } \
} else if (PMIX_DATA_ARRAY == (m)->type) { \ } else if (PMIX_DATA_ARRAY == (m)->type) { \
if (NULL != (m)->data.darray) { \ if (NULL != (m)->data.darray && NULL != (m)->data.darray->array) { \
if (PMIX_STRING == (m)->data.darray->type) { \ if (PMIX_STRING == (m)->data.darray->type) { \
char **_str = (char**)(m)->data.darray->array; \ char **_str = (char**)(m)->data.darray->array; \
for (_n=0; _n < (m)->data.darray->size; _n++) { \ for (_n=0; _n < (m)->data.darray->size; _n++) { \

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

@ -714,8 +714,8 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
break; break;
/********************/ /********************/
default: default:
pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type); pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type);
return PMIX_ERROR; return PMIX_ERROR;
} }
return PMIX_SUCCESS; return PMIX_SUCCESS;
@ -765,6 +765,7 @@ pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
m=1; m=1;
tmp = NULL; tmp = NULL;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) {
PMIX_ERROR_LOG(ret);
return ret; return ret;
} }
if (NULL == tmp) { if (NULL == tmp) {
@ -775,6 +776,7 @@ pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
/* unpack the flags */ /* unpack the flags */
m=1; m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_infodirs(buffer, &ptr[i].flags, &m, PMIX_INFO_DIRECTIVES))) { if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_infodirs(buffer, &ptr[i].flags, &m, PMIX_INFO_DIRECTIVES))) {
PMIX_ERROR_LOG(ret);
return ret; return ret;
} }
/* unpack value - since the value structure is statically-defined /* unpack value - since the value structure is statically-defined
@ -782,12 +784,14 @@ pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
* avoid the malloc */ * avoid the malloc */
m=1; m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].value.type, &m, PMIX_INT))) { if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].value.type, &m, PMIX_INT))) {
PMIX_ERROR_LOG(ret);
return ret; return ret;
} }
pmix_output_verbose(20, pmix_globals.debug_output, pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: info type %d", ptr[i].value.type); "pmix_bfrop_unpack: info type %d", ptr[i].value.type);
m=1; m=1;
if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i].value))) { if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i].value))) {
PMIX_ERROR_LOG(ret);
return ret; return ret;
} }
} }
@ -1272,6 +1276,9 @@ pmix_status_t pmix_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest,
case PMIX_STATUS: case PMIX_STATUS:
nbytes = sizeof(pmix_status_t); nbytes = sizeof(pmix_status_t);
break; break;
case PMIX_INFO:
nbytes = sizeof(pmix_info_t);
break;
case PMIX_PROC: case PMIX_PROC:
nbytes = sizeof(pmix_proc_t); nbytes = sizeof(pmix_proc_t);
break; break;