This source file includes following definitions.
- orte_dt_pack_std_cntr
- orte_dt_pack_job
- orte_dt_pack_node
- orte_dt_pack_proc
- orte_dt_pack_app_context
- orte_dt_pack_exit_code
- orte_dt_pack_node_state
- orte_dt_pack_proc_state
- orte_dt_pack_job_state
- orte_dt_pack_map
- orte_dt_pack_tag
- orte_dt_pack_daemon_cmd
- orte_dt_pack_iof_tag
- orte_dt_pack_attr
- orte_dt_pack_sig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include "orte_config.h"
24 #include "orte/types.h"
25
26 #include <sys/types.h>
27
28 #include "opal/util/argv.h"
29 #include "opal/dss/dss.h"
30 #include "opal/dss/dss_internal.h"
31 #include "opal/mca/hwloc/base/base.h"
32 #include "opal/class/opal_pointer_array.h"
33
34 #include "orte/mca/errmgr/errmgr.h"
35 #include "opal/dss/dss.h"
36 #include "opal/dss/dss_internal.h"
37 #include "orte/runtime/data_type_support/orte_dt_support.h"
38
39
40
41
42 int orte_dt_pack_std_cntr(opal_buffer_t *buffer, const void *src,
43 int32_t num_vals, opal_data_type_t type)
44 {
45 int ret;
46
47
48 if (ORTE_SUCCESS != (
49 ret = opal_dss_pack_buffer(buffer, src, num_vals, ORTE_STD_CNTR_T))) {
50 ORTE_ERROR_LOG(ret);
51 }
52
53 return ret;
54 }
55
56
57
58
59
60
61
62
63 int orte_dt_pack_job(opal_buffer_t *buffer, const void *src,
64 int32_t num_vals, opal_data_type_t type)
65 {
66 int rc;
67 int32_t i, j, count, bookmark;
68 orte_job_t **jobs;
69 orte_app_context_t *app;
70 orte_proc_t *proc;
71 orte_attribute_t *kv;
72 opal_list_t *cache;
73 opal_value_t *val;
74
75
76 jobs = (orte_job_t**) src;
77
78 for (i=0; i < num_vals; i++) {
79
80 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
81 (void*)(&(jobs[i]->jobid)), 1, ORTE_JOBID))) {
82 ORTE_ERROR_LOG(rc);
83 return rc;
84 }
85
86 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
87 (void*)(&(jobs[i]->flags)), 1, ORTE_JOB_FLAGS_T))) {
88 ORTE_ERROR_LOG(rc);
89 return rc;
90 }
91
92
93 count = 0;
94 OPAL_LIST_FOREACH(kv, &jobs[i]->attributes, orte_attribute_t) {
95 if (ORTE_ATTR_GLOBAL == kv->local) {
96 ++count;
97 }
98 }
99 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&count), 1, ORTE_STD_CNTR))) {
100 ORTE_ERROR_LOG(rc);
101 return rc;
102 }
103 OPAL_LIST_FOREACH(kv, &jobs[i]->attributes, orte_attribute_t) {
104 if (ORTE_ATTR_GLOBAL == kv->local) {
105 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)&kv, 1, ORTE_ATTRIBUTE))) {
106 ORTE_ERROR_LOG(rc);
107 return rc;
108 }
109 }
110 }
111
112 cache = NULL;
113 if (orte_get_attribute(&jobs[i]->attributes, ORTE_JOB_INFO_CACHE, (void**)&cache, OPAL_PTR) &&
114 NULL != cache) {
115
116
117
118 count = opal_list_get_size(cache);
119 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&count), 1, ORTE_STD_CNTR))) {
120 ORTE_ERROR_LOG(rc);
121 return rc;
122 }
123
124 OPAL_LIST_FOREACH(val, cache, opal_value_t) {
125 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)&val, 1, OPAL_VALUE))) {
126 ORTE_ERROR_LOG(rc);
127 return rc;
128 }
129 }
130 } else {
131
132 count = 0;
133 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&count), 1, ORTE_STD_CNTR))) {
134 ORTE_ERROR_LOG(rc);
135 return rc;
136 }
137 }
138
139
140 count = opal_argv_count(jobs[i]->personality);
141 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &count, 1, OPAL_INT32))) {
142 ORTE_ERROR_LOG(rc);
143 return rc;
144 }
145 for (j=0; j < count; j++) {
146 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &jobs[i]->personality[j], 1, OPAL_STRING))) {
147 ORTE_ERROR_LOG(rc);
148 return rc;
149 }
150 }
151
152
153 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
154 (void*)(&(jobs[i]->num_apps)), 1, ORTE_APP_IDX))) {
155 ORTE_ERROR_LOG(rc);
156 return rc;
157 }
158
159
160 if (0 < jobs[i]->num_apps) {
161 for (j=0; j < jobs[i]->apps->size; j++) {
162 if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(jobs[i]->apps, j))) {
163 continue;
164 }
165 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)&app, 1, ORTE_APP_CONTEXT))) {
166 ORTE_ERROR_LOG(rc);
167 return rc;
168 }
169 }
170 }
171
172
173 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
174 (void*)(&(jobs[i]->num_procs)), 1, ORTE_VPID))) {
175 ORTE_ERROR_LOG(rc);
176 return rc;
177 }
178 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
179 (void*)(&(jobs[i]->offset)), 1, ORTE_VPID))) {
180 ORTE_ERROR_LOG(rc);
181 return rc;
182 }
183
184 if (0 < jobs[i]->num_procs) {
185
186
187 if (orte_get_attribute(&jobs[i]->attributes, ORTE_JOB_FULLY_DESCRIBED, NULL, OPAL_BOOL)) {
188 for (j=0; j < jobs[i]->procs->size; j++) {
189 if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(jobs[i]->procs, j))) {
190 continue;
191 }
192 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)&proc, 1, ORTE_PROC))) {
193 ORTE_ERROR_LOG(rc);
194 return rc;
195 }
196 }
197 }
198 }
199
200
201 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
202 (void*)(&(jobs[i]->stdin_target)), 1, ORTE_VPID))) {
203 ORTE_ERROR_LOG(rc);
204 return rc;
205 }
206
207
208 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
209 (void*)(&(jobs[i]->total_slots_alloc)), 1, ORTE_STD_CNTR))) {
210 ORTE_ERROR_LOG(rc);
211 return rc;
212 }
213
214
215
216
217
218
219 if (NULL == jobs[i]->map) {
220
221 j=0;
222 } else {
223
224 j = 1;
225 }
226 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
227 (void*)&j, 1, ORTE_STD_CNTR))) {
228 ORTE_ERROR_LOG(rc);
229 return rc;
230 }
231
232
233
234
235
236 if (NULL != jobs[i]->map) {
237 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
238 (void*)(&(jobs[i]->map)), 1, ORTE_JOB_MAP))) {
239 ORTE_ERROR_LOG(rc);
240 return rc;
241 }
242 }
243
244
245 if (NULL == jobs[i]->bookmark) {
246 bookmark = -1;
247 } else {
248 bookmark = jobs[i]->bookmark->index;
249 }
250 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &bookmark, 1, OPAL_INT32))) {
251 ORTE_ERROR_LOG(rc);
252 return rc;
253 }
254
255
256 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
257 (void*)(&(jobs[i]->state)), 1, ORTE_JOB_STATE))) {
258 ORTE_ERROR_LOG(rc);
259 return rc;
260 }
261 }
262 return ORTE_SUCCESS;
263 }
264
265
266
267
268 int orte_dt_pack_node(opal_buffer_t *buffer, const void *src,
269 int32_t num_vals, opal_data_type_t type)
270 {
271 int rc;
272 int32_t i, count;
273 orte_node_t **nodes;
274 uint8_t flag;
275 orte_attribute_t *kv;
276
277
278 nodes = (orte_node_t**) src;
279
280 for (i=0; i < num_vals; i++) {
281
282
283
284 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&(nodes[i]->name)), 1, OPAL_STRING))) {
285 ORTE_ERROR_LOG(rc);
286 return rc;
287 }
288
289
290
291
292 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&(nodes[i]->num_procs)), 1, ORTE_VPID))) {
293 ORTE_ERROR_LOG(rc);
294 return rc;
295 }
296
297
298
299
300 flag = ORTE_FLAG_TEST(nodes[i], ORTE_NODE_FLAG_OVERSUBSCRIBED);
301 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&flag), 1, OPAL_UINT8))) {
302 ORTE_ERROR_LOG(rc);
303 return rc;
304 }
305
306
307 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&(nodes[i]->state)), 1, ORTE_NODE_STATE))) {
308 ORTE_ERROR_LOG(rc);
309 return rc;
310 }
311
312
313 count = 0;
314 OPAL_LIST_FOREACH(kv, &nodes[i]->attributes, orte_attribute_t) {
315 if (ORTE_ATTR_GLOBAL == kv->local) {
316 ++count;
317 }
318 }
319 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&count), 1, ORTE_STD_CNTR))) {
320 ORTE_ERROR_LOG(rc);
321 return rc;
322 }
323 OPAL_LIST_FOREACH(kv, &nodes[i]->attributes, orte_attribute_t) {
324 if (ORTE_ATTR_GLOBAL == kv->local) {
325 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)&kv, 1, ORTE_ATTRIBUTE))) {
326 ORTE_ERROR_LOG(rc);
327 return rc;
328 }
329 }
330 }
331 }
332 return ORTE_SUCCESS;
333 }
334
335
336
337
338 int orte_dt_pack_proc(opal_buffer_t *buffer, const void *src,
339 int32_t num_vals, opal_data_type_t type)
340 {
341 int rc;
342 int32_t i, count;
343 orte_proc_t **procs;
344 orte_attribute_t *kv;
345
346
347 procs = (orte_proc_t**) src;
348
349 for (i=0; i < num_vals; i++) {
350
351 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
352 (void*)(&(procs[i]->name)), 1, ORTE_NAME))) {
353 ORTE_ERROR_LOG(rc);
354 return rc;
355 }
356
357
358 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
359 (void*)(&(procs[i]->parent)), 1, ORTE_VPID))) {
360 ORTE_ERROR_LOG(rc);
361 return rc;
362 }
363
364
365 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
366 (void*)(&(procs[i]->local_rank)), 1, ORTE_LOCAL_RANK))) {
367 ORTE_ERROR_LOG(rc);
368 return rc;
369 }
370
371
372 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
373 (void*)(&(procs[i]->node_rank)), 1, ORTE_NODE_RANK))) {
374 ORTE_ERROR_LOG(rc);
375 return rc;
376 }
377
378
379 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
380 (void*)(&(procs[i]->state)), 1, ORTE_PROC_STATE))) {
381 ORTE_ERROR_LOG(rc);
382 return rc;
383 }
384
385
386 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
387 (void*)(&(procs[i]->app_idx)), 1, ORTE_STD_CNTR))) {
388 ORTE_ERROR_LOG(rc);
389 return rc;
390 }
391
392
393 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
394 (void*)(&(procs[i]->app_rank)), 1, OPAL_UINT32))) {
395 ORTE_ERROR_LOG(rc);
396 return rc;
397 }
398
399
400 count = 0;
401 OPAL_LIST_FOREACH(kv, &procs[i]->attributes, orte_attribute_t) {
402 if (ORTE_ATTR_GLOBAL == kv->local) {
403 ++count;
404 }
405 }
406 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&count), 1, ORTE_STD_CNTR))) {
407 ORTE_ERROR_LOG(rc);
408 return rc;
409 }
410 OPAL_LIST_FOREACH(kv, &procs[i]->attributes, orte_attribute_t) {
411 if (ORTE_ATTR_GLOBAL == kv->local) {
412 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)&kv, 1, ORTE_ATTRIBUTE))) {
413 ORTE_ERROR_LOG(rc);
414 return rc;
415 }
416 }
417 }
418 }
419
420 return ORTE_SUCCESS;
421 }
422
423
424
425
426 int orte_dt_pack_app_context(opal_buffer_t *buffer, const void *src,
427 int32_t num_vals, opal_data_type_t type)
428 {
429 int rc;
430 int32_t i, count;
431 orte_app_context_t **app_context;
432 orte_attribute_t *kv;
433
434
435 app_context = (orte_app_context_t**) src;
436
437 for (i=0; i < num_vals; i++) {
438
439 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
440 (void*)(&(app_context[i]->idx)), 1, ORTE_STD_CNTR))) {
441 ORTE_ERROR_LOG(rc);
442 return rc;
443 }
444
445
446 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
447 (void*)(&(app_context[i]->app)), 1, OPAL_STRING))) {
448 ORTE_ERROR_LOG(rc);
449 return rc;
450 }
451
452
453 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
454 (void*)(&(app_context[i]->num_procs)), 1, ORTE_STD_CNTR))) {
455 ORTE_ERROR_LOG(rc);
456 return rc;
457 }
458
459
460 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
461 (void*)(&(app_context[i]->first_rank)), 1, ORTE_VPID))) {
462 ORTE_ERROR_LOG(rc);
463 return rc;
464 }
465
466
467 count = opal_argv_count(app_context[i]->argv);
468 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&count), 1, ORTE_STD_CNTR))) {
469 ORTE_ERROR_LOG(rc);
470 return rc;
471 }
472
473
474 if (0 < count) {
475 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
476 (void*)(app_context[i]->argv), count, OPAL_STRING))) {
477 ORTE_ERROR_LOG(rc);
478 return rc;
479 }
480 }
481
482
483 count = opal_argv_count(app_context[i]->env);
484 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&count), 1, ORTE_STD_CNTR))) {
485 ORTE_ERROR_LOG(rc);
486 return rc;
487 }
488
489
490 if (0 < count) {
491 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
492 (void*)(app_context[i]->env), count, OPAL_STRING))) {
493 ORTE_ERROR_LOG(rc);
494 return rc;
495 }
496 }
497
498
499 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
500 (void*)(&(app_context[i]->cwd)), 1, OPAL_STRING))) {
501 ORTE_ERROR_LOG(rc);
502 return rc;
503 }
504
505
506 count = 0;
507 OPAL_LIST_FOREACH(kv, &app_context[i]->attributes, orte_attribute_t) {
508 if (ORTE_ATTR_GLOBAL == kv->local) {
509 ++count;
510 }
511 }
512 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)(&count), 1, ORTE_STD_CNTR))) {
513 ORTE_ERROR_LOG(rc);
514 return rc;
515 }
516 OPAL_LIST_FOREACH(kv, &app_context[i]->attributes, orte_attribute_t) {
517 if (ORTE_ATTR_GLOBAL == kv->local) {
518 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)&kv, 1, ORTE_ATTRIBUTE))) {
519 ORTE_ERROR_LOG(rc);
520 return rc;
521 }
522 }
523 }
524 }
525
526 return ORTE_SUCCESS;
527 }
528
529
530
531
532 int orte_dt_pack_exit_code(opal_buffer_t *buffer, const void *src,
533 int32_t num_vals, opal_data_type_t type)
534 {
535 int rc;
536
537 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, src, num_vals, ORTE_EXIT_CODE_T))) {
538 ORTE_ERROR_LOG(rc);
539 }
540
541 return rc;
542 }
543
544
545
546
547 int orte_dt_pack_node_state(opal_buffer_t *buffer, const void *src,
548 int32_t num_vals, opal_data_type_t type)
549 {
550 int rc;
551
552 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, src, num_vals, ORTE_NODE_STATE_T))) {
553 ORTE_ERROR_LOG(rc);
554 }
555
556 return rc;
557 }
558
559
560
561
562 int orte_dt_pack_proc_state(opal_buffer_t *buffer, const void *src,
563 int32_t num_vals, opal_data_type_t type)
564 {
565 int rc;
566
567 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, src, num_vals, ORTE_PROC_STATE_T))) {
568 ORTE_ERROR_LOG(rc);
569 }
570
571 return rc;
572 }
573
574
575
576
577 int orte_dt_pack_job_state(opal_buffer_t *buffer, const void *src,
578 int32_t num_vals, opal_data_type_t type)
579 {
580 int rc;
581
582 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, src, num_vals, ORTE_JOB_STATE_T))) {
583 ORTE_ERROR_LOG(rc);
584 }
585
586 return rc;
587 }
588
589
590
591
592
593
594 int orte_dt_pack_map(opal_buffer_t *buffer, const void *src,
595 int32_t num_vals, opal_data_type_t type)
596 {
597 int rc;
598 int32_t i;
599 orte_job_map_t **maps;
600
601
602 maps = (orte_job_map_t**) src;
603
604 for (i=0; i < num_vals; i++) {
605
606 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &(maps[i]->req_mapper), 1, OPAL_STRING))) {
607 ORTE_ERROR_LOG(rc);
608 return rc;
609 }
610
611 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &(maps[i]->last_mapper), 1, OPAL_STRING))) {
612 ORTE_ERROR_LOG(rc);
613 return rc;
614 }
615
616 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &(maps[i]->mapping), 1, ORTE_MAPPING_POLICY))) {
617 ORTE_ERROR_LOG(rc);
618 return rc;
619 }
620 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &(maps[i]->ranking), 1, ORTE_RANKING_POLICY))) {
621 ORTE_ERROR_LOG(rc);
622 return rc;
623 }
624 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &(maps[i]->binding), 1, OPAL_BINDING_POLICY))) {
625 ORTE_ERROR_LOG(rc);
626 return rc;
627 }
628
629 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &(maps[i]->ppr), 1, OPAL_STRING))) {
630 ORTE_ERROR_LOG(rc);
631 return rc;
632 }
633
634 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &(maps[i]->cpus_per_rank), 1, OPAL_INT16))) {
635 ORTE_ERROR_LOG(rc);
636 return rc;
637 }
638
639 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &(maps[i]->display_map), 1, OPAL_BOOL))) {
640 ORTE_ERROR_LOG(rc);
641 return rc;
642 }
643
644 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, &(maps[i]->num_nodes), 1, OPAL_UINT32))) {
645 ORTE_ERROR_LOG(rc);
646 return rc;
647 }
648
649 }
650
651 return ORTE_SUCCESS;
652 }
653
654
655
656
657 int orte_dt_pack_tag(opal_buffer_t *buffer, const void *src,
658 int32_t num_vals, opal_data_type_t type)
659 {
660 int rc;
661
662
663 if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, src, num_vals, ORTE_RML_TAG_T))) {
664 ORTE_ERROR_LOG(rc);
665 }
666
667 return rc;
668 }
669
670
671
672
673 int orte_dt_pack_daemon_cmd(opal_buffer_t *buffer, const void *src, int32_t num_vals,
674 opal_data_type_t type)
675 {
676 int ret;
677
678
679 if (ORTE_SUCCESS != (ret = opal_dss_pack_buffer(buffer, src, num_vals, ORTE_DAEMON_CMD_T))) {
680 ORTE_ERROR_LOG(ret);
681 }
682
683 return ret;
684 }
685
686
687
688
689 int orte_dt_pack_iof_tag(opal_buffer_t *buffer, const void *src, int32_t num_vals,
690 opal_data_type_t type)
691 {
692 int ret;
693
694
695 if (ORTE_SUCCESS != (ret = opal_dss_pack_buffer(buffer, src, num_vals, ORTE_IOF_TAG_T))) {
696 ORTE_ERROR_LOG(ret);
697 }
698
699 return ret;
700 }
701
702
703
704
705
706 int orte_dt_pack_attr(opal_buffer_t *buffer, const void *src, int32_t num_vals,
707 opal_data_type_t type)
708 {
709 orte_attribute_t **ptr;
710 int32_t i, n;
711 int ret;
712
713 ptr = (orte_attribute_t **) src;
714
715 for (i = 0; i < num_vals; ++i) {
716
717 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->key, 1, ORTE_ATTR_KEY_T))) {
718 return ret;
719 }
720 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->type, 1, OPAL_DATA_TYPE))) {
721 return ret;
722 }
723
724 switch (ptr[i]->type) {
725 case OPAL_BOOL:
726 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.flag, 1, OPAL_BOOL))) {
727 return ret;
728 }
729 break;
730 case OPAL_BYTE:
731 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.byte, 1, OPAL_BYTE))) {
732 return ret;
733 }
734 break;
735 case OPAL_STRING:
736 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.string, 1, OPAL_STRING))) {
737 return ret;
738 }
739 break;
740 case OPAL_SIZE:
741 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.size, 1, OPAL_SIZE))) {
742 return ret;
743 }
744 break;
745 case OPAL_PID:
746 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.pid, 1, OPAL_PID))) {
747 return ret;
748 }
749 break;
750 case OPAL_INT:
751 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.integer, 1, OPAL_INT))) {
752 return ret;
753 }
754 break;
755 case OPAL_INT8:
756 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.int8, 1, OPAL_INT8))) {
757 return ret;
758 }
759 break;
760 case OPAL_INT16:
761 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.int16, 1, OPAL_INT16))) {
762 return ret;
763 }
764 break;
765 case OPAL_INT32:
766 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.int32, 1, OPAL_INT32))) {
767 return ret;
768 }
769 break;
770 case OPAL_INT64:
771 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.int64, 1, OPAL_INT64))) {
772 return ret;
773 }
774 break;
775 case OPAL_UINT:
776 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.uint, 1, OPAL_UINT))) {
777 return ret;
778 }
779 break;
780 case OPAL_UINT8:
781 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.uint8, 1, OPAL_UINT8))) {
782 return ret;
783 }
784 break;
785 case OPAL_UINT16:
786 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.uint16, 1, OPAL_UINT16))) {
787 return ret;
788 }
789 break;
790 case OPAL_UINT32:
791 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.uint32, 1, OPAL_UINT32))) {
792 return ret;
793 }
794 break;
795 case OPAL_UINT64:
796 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.uint64, 1, OPAL_UINT64))) {
797 return ret;
798 }
799 break;
800 case OPAL_BYTE_OBJECT:
801
802 n = ptr[i]->data.bo.size;
803 if (OPAL_SUCCESS != (ret = opal_dss_pack_int32(buffer, &n, 1, OPAL_INT32))) {
804 return ret;
805 }
806 if (0 < n) {
807 if (OPAL_SUCCESS != (ret = opal_dss_pack_byte(buffer, ptr[i]->data.bo.bytes, n, OPAL_BYTE))) {
808 return ret;
809 }
810 }
811 break;
812 case OPAL_FLOAT:
813 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.fval, 1, OPAL_FLOAT))) {
814 return ret;
815 }
816 break;
817 case OPAL_TIMEVAL:
818 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.tv, 1, OPAL_TIMEVAL))) {
819 return ret;
820 }
821 break;
822 case OPAL_PTR:
823
824 break;
825 case OPAL_VPID:
826 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.vpid, 1, ORTE_VPID))) {
827 return ret;
828 }
829 break;
830 case OPAL_JOBID:
831 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.jobid, 1, ORTE_JOBID))) {
832 return ret;
833 }
834 break;
835 case OPAL_NAME:
836 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.name, 1, ORTE_NAME))) {
837 return ret;
838 }
839 break;
840 case OPAL_ENVAR:
841 if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->data.envar, 1, OPAL_ENVAR))) {
842 return ret;
843 }
844 break;
845
846 default:
847 opal_output(0, "PACK-ORTE-ATTR: UNSUPPORTED TYPE %d", (int)ptr[i]->type);
848 return OPAL_ERROR;
849 }
850 }
851
852 return OPAL_SUCCESS;
853 }
854
855
856
857
858 int orte_dt_pack_sig(opal_buffer_t *buffer, const void *src, int32_t num_vals,
859 opal_data_type_t type)
860 {
861 orte_grpcomm_signature_t **ptr;
862 int32_t i;
863 int rc;
864
865 ptr = (orte_grpcomm_signature_t **) src;
866
867 for (i = 0; i < num_vals; ++i) {
868
869 if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &ptr[i]->sz, 1, OPAL_SIZE))) {
870 ORTE_ERROR_LOG(rc);
871 return rc;
872 }
873 if (0 < ptr[i]->sz) {
874
875 if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, ptr[i]->signature, ptr[i]->sz, ORTE_NAME))) {
876 ORTE_ERROR_LOG(rc);
877 return rc;
878 }
879 }
880 }
881
882 return ORTE_SUCCESS;
883 }