Skip to content

Commit 0c258c3

Browse files
author
Ralph Castain
authored
Merge pull request #3737 from rhc54/topic/fixes
Fix pmix.query support
2 parents d8938ca + 6ec2ad5 commit 0c258c3

File tree

3 files changed

+28
-23
lines changed

3 files changed

+28
-23
lines changed

contrib/scaling/mpi_memprobe.c

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <stdio.h>
1111
#include "mpi.h"
1212
#include "opal/mca/pmix/pmix.h"
13+
#include "opal/util/argv.h"
1314
#include "orte/runtime/runtime.h"
1415
#include "orte/util/proc_info.h"
1516
#include "orte/util/name_fns.h"
@@ -117,17 +118,19 @@ static void sample(void)
117118
free(tmp);
118119
OPAL_LIST_FOREACH(kv, &response, opal_value_t) {
119120
lt = (opal_list_t*)kv->data.ptr;
120-
OPAL_LIST_FOREACH(ival, lt, opal_value_t) {
121-
if (0 == strcmp(ival->key, OPAL_PMIX_DAEMON_MEMORY)) {
122-
asprintf(&tmp, "\tDaemon: %f", ival->data.fval);
123-
opal_argv_append_nosize(&answer, tmp);
124-
free(tmp);
125-
} else if (0 == strcmp(ival->key, OPAL_PMIX_CLIENT_AVG_MEMORY)) {
126-
asprintf(&tmp, "\tClient: %f", ival->data.fval);
127-
opal_argv_append_nosize(&answer, tmp);
128-
free(tmp);
129-
} else {
130-
fprintf(stderr, "\tUnknown key: %s", ival->key);
121+
if (NULL != lt) {
122+
OPAL_LIST_FOREACH(ival, lt, opal_value_t) {
123+
if (0 == strcmp(ival->key, OPAL_PMIX_DAEMON_MEMORY)) {
124+
asprintf(&tmp, "\tDaemon: %f", ival->data.fval);
125+
opal_argv_append_nosize(&answer, tmp);
126+
free(tmp);
127+
} else if (0 == strcmp(ival->key, OPAL_PMIX_CLIENT_AVG_MEMORY)) {
128+
asprintf(&tmp, "\tClient: %f", ival->data.fval);
129+
opal_argv_append_nosize(&answer, tmp);
130+
free(tmp);
131+
} else {
132+
fprintf(stderr, "\tUnknown key: %s", ival->key);
133+
}
131134
}
132135
}
133136
}
@@ -149,7 +152,6 @@ static void sample(void)
149152
}
150153
OPAL_LIST_DESTRUCT(&response);
151154

152-
153155
if (0 == rank) {
154156
/* send the notification to release the other procs */
155157
wait_for_release = true;
@@ -162,19 +164,15 @@ static void sample(void)
162164
active = -1;
163165
if (OPAL_SUCCESS != opal_pmix.notify_event(MEMPROBE_RELEASE, NULL,
164166
OPAL_PMIX_RANGE_GLOBAL, &response,
165-
notifycbfunc, (void*)&active)) {
167+
NULL, NULL)) {
166168
fprintf(stderr, "Notify event failed\n");
167169
exit(1);
168170
}
169-
while (-1 == active) {
171+
} else {
172+
/* now wait for notification */
173+
while (wait_for_release) {
170174
usleep(10);
171175
}
172-
OPAL_LIST_DESTRUCT(&response);
173-
}
174-
175-
/* now wait for notification */
176-
while (wait_for_release) {
177-
usleep(10);
178176
}
179177
}
180178

opal/mca/pmix/pmix2x/pmix/include/pmix_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ typedef struct pmix_value {
905905
free((m)->data.bo.bytes); \
906906
} \
907907
} else if (PMIX_DATA_ARRAY == (m)->type) { \
908-
if (NULL != (m)->data.darray) { \
908+
if (NULL != (m)->data.darray && NULL != (m)->data.darray->array) { \
909909
if (PMIX_STRING == (m)->data.darray->type) { \
910910
char **_str = (char**)(m)->data.darray->array; \
911911
for (_n=0; _n < (m)->data.darray->size; _n++) { \

opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,8 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
714714
break;
715715
/********************/
716716
default:
717-
pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type);
718-
return PMIX_ERROR;
717+
pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type);
718+
return PMIX_ERROR;
719719
}
720720

721721
return PMIX_SUCCESS;
@@ -765,6 +765,7 @@ pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
765765
m=1;
766766
tmp = NULL;
767767
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) {
768+
PMIX_ERROR_LOG(ret);
768769
return ret;
769770
}
770771
if (NULL == tmp) {
@@ -775,19 +776,22 @@ pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
775776
/* unpack the flags */
776777
m=1;
777778
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_infodirs(buffer, &ptr[i].flags, &m, PMIX_INFO_DIRECTIVES))) {
779+
PMIX_ERROR_LOG(ret);
778780
return ret;
779781
}
780782
/* unpack value - since the value structure is statically-defined
781783
* instead of a pointer in this struct, we directly unpack it to
782784
* avoid the malloc */
783785
m=1;
784786
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].value.type, &m, PMIX_INT))) {
787+
PMIX_ERROR_LOG(ret);
785788
return ret;
786789
}
787790
pmix_output_verbose(20, pmix_globals.debug_output,
788791
"pmix_bfrop_unpack: info type %d", ptr[i].value.type);
789792
m=1;
790793
if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i].value))) {
794+
PMIX_ERROR_LOG(ret);
791795
return ret;
792796
}
793797
}
@@ -1272,6 +1276,9 @@ pmix_status_t pmix_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest,
12721276
case PMIX_STATUS:
12731277
nbytes = sizeof(pmix_status_t);
12741278
break;
1279+
case PMIX_INFO:
1280+
nbytes = sizeof(pmix_info_t);
1281+
break;
12751282
case PMIX_PROC:
12761283
nbytes = sizeof(pmix_proc_t);
12771284
break;

0 commit comments

Comments
 (0)