Skip to content

Commit 269753f

Browse files
author
Ralph Castain
committed
Transfer back changes from debugger attach work
Silence warning Remove debug Signed-off-by: Ralph Castain <[email protected]>
1 parent bd1828c commit 269753f

File tree

11 files changed

+142
-28
lines changed

11 files changed

+142
-28
lines changed

opal/dss/dss_print.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,10 @@ int opal_dss_print_value(char **output, char *prefix, opal_value_t *src, opal_da
799799
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIME\tKey: %s\tValue: %s", prefx,
800800
src->key, ctime(&src->data.time));
801801
break;
802+
case OPAL_NAME:
803+
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_NAME\tKey: %s\tValue: %s", prefx,
804+
src->key, OPAL_NAME_PRINT(src->data.name));
805+
break;
802806
case OPAL_PTR:
803807
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PTR\tKey: %s", prefx, src->key);
804808
break;

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

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,15 @@ PMIX_EXPORT void pmix_value_load(pmix_value_t *v, void *data,
466466
pmix_data_type_t type)
467467
{
468468
pmix_byte_object_t *bo;
469+
pmix_proc_info_t *pi;
469470

470471
v->type = type;
471472
if (NULL == data) {
472473
/* just set the fields to zero */
473474
memset(&v->data, 0, sizeof(v->data));
475+
if (PMIX_BOOL == type) {
476+
v->data.flag = true; // existence of the attribute indicates true unless specified different
477+
}
474478
} else {
475479
switch(type) {
476480
case PMIX_UNDEF:
@@ -529,19 +533,63 @@ PMIX_EXPORT void pmix_value_load(pmix_value_t *v, void *data,
529533
case PMIX_TIMEVAL:
530534
memcpy(&(v->data.tv), data, sizeof(struct timeval));
531535
break;
536+
case PMIX_TIME:
537+
memcpy(&(v->data.time), data, sizeof(time_t));
538+
break;
532539
case PMIX_STATUS:
533540
memcpy(&(v->data.status), data, sizeof(pmix_status_t));
534541
break;
542+
case PMIX_PROC_RANK:
543+
memcpy(&(v->data.rank), data, sizeof(pmix_rank_t));
544+
break;
545+
case PMIX_PROC:
546+
PMIX_PROC_CREATE(v->data.proc, 1);
547+
if (NULL == v->data.proc) {
548+
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
549+
return;
550+
}
551+
memcpy(v->data.proc, data, sizeof(pmix_proc_t));
552+
break;
535553
case PMIX_BYTE_OBJECT:
536554
bo = (pmix_byte_object_t*)data;
537555
v->data.bo.bytes = bo->bytes;
538556
memcpy(&(v->data.bo.size), &bo->size, sizeof(size_t));
539557
break;
558+
case PMIX_PERSIST:
559+
memcpy(&(v->data.persist), data, sizeof(pmix_persistence_t));
560+
break;
561+
case PMIX_SCOPE:
562+
memcpy(&(v->data.scope), data, sizeof(pmix_scope_t));
563+
break;
564+
case PMIX_DATA_RANGE:
565+
memcpy(&(v->data.range), data, sizeof(pmix_data_range_t));
566+
break;
567+
case PMIX_PROC_STATE:
568+
memcpy(&(v->data.state), data, sizeof(pmix_proc_state_t));
569+
break;
570+
case PMIX_PROC_INFO:
571+
PMIX_PROC_INFO_CREATE(v->data.pinfo, 1);
572+
if (NULL == v->data.pinfo) {
573+
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
574+
return;
575+
}
576+
pi = (pmix_proc_info_t*)data;
577+
memcpy(&(v->data.pinfo->proc), &pi->proc, sizeof(pmix_proc_t));
578+
if (NULL != pi->hostname) {
579+
v->data.pinfo->hostname = strdup(pi->hostname);
580+
}
581+
if (NULL != pi->executable_name) {
582+
v->data.pinfo->executable_name = strdup(pi->executable_name);
583+
}
584+
memcpy(&(v->data.pinfo->pid), &pi->pid, sizeof(pid_t));
585+
memcpy(&(v->data.pinfo->exit_code), &pi->exit_code, sizeof(int));
586+
break;
540587
case PMIX_POINTER:
541588
memcpy(&(v->data.ptr), data, sizeof(void*));
542589
break;
543590
default:
544591
/* silence warnings */
592+
PMIX_ERROR_LOG(PMIX_ERR_UNKNOWN_DATA_TYPE);
545593
break;
546594
}
547595
}
@@ -551,6 +599,7 @@ pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data,
551599
size_t *sz, pmix_data_type_t type)
552600
{
553601
pmix_status_t rc;
602+
pmix_proc_t *pc;
554603

555604
rc = PMIX_SUCCESS;
556605
if (type != kv->type) {
@@ -637,10 +686,29 @@ pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data,
637686
memcpy(*data, &(kv->data.tv), sizeof(struct timeval));
638687
*sz = sizeof(struct timeval);
639688
break;
689+
case PMIX_TIME:
690+
memcpy(*data, &(kv->data.time), sizeof(time_t));
691+
*sz = sizeof(time_t);
692+
break;
640693
case PMIX_STATUS:
641694
memcpy(*data, &(kv->data.status), sizeof(pmix_status_t));
642695
*sz = sizeof(pmix_status_t);
643696
break;
697+
case PMIX_PROC_RANK:
698+
memcpy(*data, &(kv->data.rank), sizeof(pmix_rank_t));
699+
*sz = sizeof(pmix_rank_t);
700+
break;
701+
case PMIX_PROC:
702+
PMIX_PROC_CREATE(pc, 1);
703+
if (NULL == pc) {
704+
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
705+
rc = PMIX_ERR_NOMEM;
706+
break;
707+
}
708+
memcpy(pc, kv->data.proc, sizeof(pmix_proc_t));
709+
*sz = sizeof(pmix_proc_t);
710+
*data = pc;
711+
break;
644712
case PMIX_BYTE_OBJECT:
645713
if (NULL != kv->data.bo.bytes && 0 < kv->data.bo.size) {
646714
*data = kv->data.bo.bytes;
@@ -650,6 +718,22 @@ pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data,
650718
*sz = 0;
651719
}
652720
break;
721+
case PMIX_PERSIST:
722+
memcpy(*data, &(kv->data.persist), sizeof(pmix_persistence_t));
723+
*sz = sizeof(pmix_persistence_t);
724+
break;
725+
case PMIX_SCOPE:
726+
memcpy(*data, &(kv->data.scope), sizeof(pmix_scope_t));
727+
*sz = sizeof(pmix_scope_t);
728+
break;
729+
case PMIX_DATA_RANGE:
730+
memcpy(*data, &(kv->data.range), sizeof(pmix_data_range_t));
731+
*sz = sizeof(pmix_data_range_t);
732+
break;
733+
case PMIX_PROC_STATE:
734+
memcpy(*data, &(kv->data.state), sizeof(pmix_proc_state_t));
735+
*sz = sizeof(pmix_proc_state_t);
736+
break;
653737
case PMIX_POINTER:
654738
memcpy(*data, &(kv->data.ptr), sizeof(void*));
655739
*sz = sizeof(void*);

opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
239239
pmix_cmd_t cmd = PMIX_REQ_CMD;
240240
volatile int active;
241241
pmix_status_t code = PMIX_ERR_DEBUGGER_RELEASE;
242+
pmix_proc_t wildcard;
243+
pmix_info_t ginfo;
244+
pmix_value_t *val = NULL;
242245

243246
if (NULL == proc) {
244247
return PMIX_ERR_BAD_PARAM;
@@ -271,7 +274,6 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
271274
/* setup the globals */
272275
PMIX_CONSTRUCT(&pmix_client_globals.pending_requests, pmix_list_t);
273276
PMIX_CONSTRUCT(&pmix_client_globals.myserver, pmix_peer_t);
274-
pmix_client_globals.wait_for_debugger = false;
275277

276278
pmix_output_verbose(2, pmix_globals.debug_output,
277279
"pmix: init called");
@@ -349,21 +351,27 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
349351
return rc;
350352
}
351353

352-
/* check if we are to wait here for debugger attach */
353-
if (pmix_client_globals.wait_for_debugger) {
354+
/* lood for a debugger attach key */
355+
(void)strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
356+
wildcard.rank = PMIX_RANK_WILDCARD;
357+
PMIX_INFO_LOAD(&ginfo, PMIX_IMMEDIATE, NULL, PMIX_BOOL);
358+
if (PMIX_SUCCESS == PMIx_Get(&wildcard, PMIX_DEBUG_STOP_IN_INIT, &ginfo, 1, &val)) {
359+
PMIX_VALUE_FREE(val, 1); // cleanup memory
360+
/* if the value was found, then we need to wait for debugger attach here */
354361
/* register for the debugger release notificaation */
355362
active = -1;
356363
PMIx_Register_event_handler(&code, 1, NULL, 0,
357364
notification_fn, evhandler_reg_callbk, (void*)&active);
358365
while (-1 == active) {
359-
sleep(1);
366+
usleep(100);
360367
}
361368
if (0 != active) {
362369
return active;
363370
}
364371
/* wait for it to arrive */
365372
PMIX_WAIT_FOR_COMPLETION(waiting_for_debugger);
366373
}
374+
PMIX_INFO_DESTRUCT(&ginfo);
367375

368376
return PMIX_SUCCESS;
369377
}

opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_ops.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ BEGIN_C_DECLS
2121
typedef struct {
2222
pmix_peer_t myserver; // messaging support to/from my server
2323
pmix_list_t pending_requests; // list of pmix_cb_t pending data requests
24-
bool wait_for_debugger; // stop at the end of PMIx_Init and wait for notification of debugger release
2524
} pmix_client_globals_t;
2625

2726
extern pmix_client_globals_t pmix_client_globals;

opal/mca/pmix/pmix2x/pmix/src/common/pmix_jobdata.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,6 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata)
309309
}
310310
/* cleanup */
311311
PMIX_DESTRUCT(&buf2);
312-
} else if (0 == strcmp(kptr->key, PMIX_DEBUG_STOP_IN_INIT)) {
313-
/* set the flag - we don't store this value */
314-
if (PMIX_UNDEF == kptr->value->type) {
315-
pmix_client_globals.wait_for_debugger = true;
316-
} else {
317-
pmix_client_globals.wait_for_debugger = kptr->value->data.flag;
318-
}
319312
} else {
320313
if (PMIX_SUCCESS != (rc = _add_key_for_rank(PMIX_RANK_WILDCARD, kptr, cb))) {
321314
PMIX_ERROR_LOG(rc);

opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_notification.c

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,16 @@ PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status,
5050
cbfunc, cbdata);
5151
pmix_output_verbose(2, pmix_globals.debug_output,
5252
"pmix_server_notify_event source = %s:%d event_status = %d, rc= %d",
53-
source->nspace, source->rank, status, rc);
53+
(NULL == source) ? "UNKNOWN" : source->nspace,
54+
(NULL == source) ? PMIX_RANK_WILDCARD : source->rank, status, rc);
5455
} else {
5556
rc = notify_server_of_event(status, source, range,
5657
info, ninfo,
5758
cbfunc, cbdata);
5859
pmix_output_verbose(2, pmix_globals.debug_output,
5960
"pmix_client_notify_event source = %s:%d event_status =%d, rc=%d",
60-
source->nspace, source->rank, status, rc);
61+
(NULL == source) ? pmix_globals.myid.nspace : source->nspace,
62+
(NULL == source) ? pmix_globals.myid.rank : source->rank, status, rc);
6163
}
6264
return rc;
6365
}
@@ -95,10 +97,15 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
9597
pmix_event_chain_t *chain;
9698
size_t n;
9799

100+
101+
pmix_output_verbose(2, pmix_globals.debug_output,
102+
"client: notifying server %s:%d of status %s",
103+
pmix_globals.myid.nspace, pmix_globals.myid.rank,
104+
PMIx_Error_string(status));
105+
98106
if (!pmix_globals.connected) {
99107
return PMIX_ERR_UNREACH;
100108
}
101-
102109
/* create the msg object */
103110
msg = PMIX_NEW(pmix_buffer_t);
104111

@@ -156,6 +163,9 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
156163
cb->op_cbfunc = cbfunc;
157164
cb->cbdata = cbdata;
158165
/* send to the server */
166+
pmix_output_verbose(2, pmix_globals.debug_output,
167+
"client: notifying server %s:%d - sending",
168+
pmix_globals.myid.nspace, pmix_globals.myid.rank);
159169
rc = pmix_ptl.send_recv(&pmix_client_globals.myserver, msg, notify_event_cbfunc, cb);
160170
if (PMIX_SUCCESS != rc) {
161171
PMIX_ERROR_LOG(rc);
@@ -170,6 +180,8 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
170180
return PMIX_SUCCESS;
171181

172182
cleanup:
183+
pmix_output_verbose(2, pmix_globals.debug_output,
184+
"client: notifying server - unable to send");
173185
PMIX_RELEASE(msg);
174186
/* we were unable to send anything, so we just return the error */
175187
return rc;
@@ -339,6 +351,10 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain)
339351
pmix_default_event_t *def;
340352
pmix_status_t rc = PMIX_SUCCESS;
341353

354+
pmix_output_verbose(2, pmix_globals.debug_output,
355+
"%s:%d invoke_local_event_hdlr",
356+
pmix_globals.myid.nspace, pmix_globals.myid.rank);
357+
342358
/* sanity check */
343359
if (NULL == chain->info) {
344360
/* should never happen as the return object must
@@ -519,6 +535,10 @@ static pmix_status_t notify_client_of_event(pmix_status_t status,
519535
pmix_status_t rc;
520536
size_t n;
521537

538+
pmix_output_verbose(2, pmix_globals.debug_output,
539+
"pmix_server: notify client of event %s",
540+
PMIx_Error_string(status));
541+
522542
cd = PMIX_NEW(pmix_notify_caddy_t);
523543
cd->status = status;
524544
if (NULL == source) {
@@ -538,15 +558,20 @@ static pmix_status_t notify_client_of_event(pmix_status_t status,
538558
} else if (strncmp(info[n].key, PMIX_EVENT_CUSTOM_RANGE, PMIX_MAX_KEYLEN)) {
539559
/* provides an array of pmix_proc_t identifying the procs
540560
* that are to receive this notification */
541-
if (PMIX_DATA_ARRAY != info[n].value.type ||
542-
NULL == info[n].value.data.darray ||
543-
NULL == info[n].value.data.darray->array) {
561+
if (PMIX_DATA_ARRAY == info[n].value.type &&
562+
NULL != info[n].value.data.darray &&
563+
NULL != info[n].value.data.darray->array) {
564+
cd->ntargets = info[n].value.data.darray->size;
565+
PMIX_PROC_CREATE(cd->targets, cd->ntargets);
566+
memcpy(cd->targets, info[n].value.data.darray->array, cd->ntargets * sizeof(pmix_proc_t));
567+
} else if (PMIX_PROC == info[n].value.type) {
568+
cd->ntargets = 1;
569+
PMIX_PROC_CREATE(cd->targets, cd->ntargets);
570+
memcpy(cd->targets, info[n].value.data.proc, sizeof(pmix_proc_t));
571+
} else {
544572
/* this is an error */
545573
return PMIX_ERR_BAD_PARAM;
546574
}
547-
cd->ntargets = info[n].value.data.darray->size;
548-
PMIX_PROC_CREATE(cd->targets, cd->ntargets);
549-
memcpy(cd->targets, info[n].value.data.darray->array, cd->ntargets * sizeof(pmix_proc_t));
550575
}
551576
}
552577
}

opal/mca/pmix/pmix2x/pmix/src/runtime/pmix_init.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ PMIX_EXPORT pmix_globals_t pmix_globals = {
8383

8484
int pmix_rte_init(pmix_proc_type_t type,
8585
pmix_info_t info[], size_t ninfo,
86-
pmix_ptl_cbfunc_t notifycbfunc)
86+
pmix_ptl_cbfunc_t cbfunc)
8787
{
8888
int ret, debug_level;
8989
char *error = NULL, *evar;
@@ -192,6 +192,11 @@ int pmix_rte_init(pmix_proc_type_t type,
192192
error = "pmix_ptl_base_select";
193193
goto return_error;
194194
}
195+
/* set the notification callback function */
196+
if (PMIX_SUCCESS != (ret = pmix_ptl.set_notification_cbfunc(cbfunc))) {
197+
error = "pmix_ptl_set_notification_cbfunc";
198+
goto return_error;
199+
}
195200

196201
/* open the psec and select the active plugins */
197202
if (PMIX_SUCCESS != (ret = pmix_mca_base_framework_open(&pmix_psec_base_framework, 0))) {

opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static void pmix_tool_notify_recv(struct pmix_peer_t *peer,
107107
}
108108
/* unpack the status */
109109
cnt=1;
110-
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &chain->status, &cnt, PMIX_INT))) {
110+
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &chain->status, &cnt, PMIX_STATUS))) {
111111
PMIX_ERROR_LOG(rc);
112112
goto error;
113113
}

opal/mca/pmix/pmix2x/pmix2x_server_north.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,6 @@ static pmix_status_t server_notify_event(pmix_status_t code,
784784

785785
/* convert the source */
786786
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&src.jobid, source->nspace))) {
787-
opal_output(0, "FILE: %s LINE %d", __FILE__, __LINE__);
788787
OBJ_RELEASE(opalcaddy);
789788
return pmix2x_convert_opalrc(rc);
790789
}
@@ -881,7 +880,6 @@ static pmix_status_t server_query(pmix_proc_t *proct,
881880

882881
/* convert the requestor */
883882
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&requestor.jobid, proct->nspace))) {
884-
opal_output(0, "FILE: %s LINE %d", __FILE__, __LINE__);
885883
OBJ_RELEASE(opalcaddy);
886884
return pmix2x_convert_opalrc(rc);
887885
}
@@ -996,7 +994,6 @@ static void server_log(const pmix_proc_t *proct,
996994

997995
/* convert the requestor */
998996
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&requestor.jobid, proct->nspace))) {
999-
opal_output(0, "FILE: %s LINE %d", __FILE__, __LINE__);
1000997
OBJ_RELEASE(opalcaddy);
1001998
ret = pmix2x_convert_opalrc(rc);
1002999
if (NULL != cbfunc) {

orte/mca/schizo/flux/schizo_flux.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ static bool myenvdefined = false;
4343

4444
static orte_schizo_launch_environ_t check_launch_environment(void)
4545
{
46-
char *bind, *list, *ptr;
4746
int i;
4847

4948
if (myenvdefined) {

0 commit comments

Comments
 (0)