File: dpm.c

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (2170 lines) | stat: -rw-r--r-- 84,296 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
 *                         University Research and Technology
 *                         Corporation.  All rights reserved.
 * Copyright (c) 2004-2021 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-2022 Cisco Systems, Inc.  All rights reserved.
 * Copyright (c) 2006-2009 University of Houston.  All rights reserved.
 * Copyright (c) 2009      Sun Microsystems, Inc.  All rights reserved.
 * Copyright (c) 2011-2015 Los Alamos National Security, LLC.  All rights
 *                         reserved.
 * Copyright (c) 2013-2020 Intel, Inc.  All rights reserved.
 * Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
 * Copyright (c) 2014-2020 Research Organization for Information Science
 *                         and Technology (RIST). All rights reserved.
 * Copyright (c) 2018      Amazon.com, Inc. or its affiliates.  All Rights reserved.
 * Copyright (c) 2021-2022 Nanook Consulting.  All rights reserved.
 * Copyright (c) 2018-2022 Triad National Security, LLC. All rights
 *                         reserved.
 * Copyright (c) 2022      IBM Corporation.  All rights reserved.
 * Copyright (c) 2023      Jeffrey M. Squyres.  All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "ompi_config.h"
#include "ompi/constants.h"

#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <fcntl.h>

#include "opal/util/alfg.h"
#include "opal/util/argv.h"
#include "opal/util/opal_getcwd.h"
#include "opal/util/opal_environ.h"
#include "opal/util/path.h"
#include "opal/util/proc.h"
#include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/mca/hwloc/base/base.h"
#include "opal/mca/pmix/base/base.h"

#include "ompi/communicator/communicator.h"
#include "ompi/group/group.h"
#include "ompi/proc/proc.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/runtime/ompi_rte.h"
#include "ompi/info/info.h"

#include "ompi/dpm/dpm.h"

static opal_rng_buff_t rnd;

typedef struct {
    ompi_communicator_t       *comm;
    int                       size;
    struct ompi_request_t     **reqs;
    int                       buf;
} ompi_dpm_disconnect_obj;
static int disconnect_waitall (int count, ompi_dpm_disconnect_obj **objs);
static ompi_dpm_disconnect_obj *disconnect_init(ompi_communicator_t *comm);
static int start_dvm(char **hostfiles, char **dash_host);

typedef struct {
    opal_list_item_t super;
    ompi_proc_t *p;
} ompi_dpm_proct_caddy_t;
static OBJ_CLASS_INSTANCE(ompi_dpm_proct_caddy_t,
                          opal_list_item_t,
                          NULL, NULL);

/*
 * Init the module
 */
int ompi_dpm_init(void)
{
    time_t now;

    /* seed our random number generator */
    now = time(NULL);
    if (!opal_srand(&rnd, now)) {
        return OMPI_ERROR;
    }
    return OMPI_SUCCESS;
}

static int compare_pmix_proc(const void *a, const void *b)
{
    const pmix_proc_t *proc_a = (pmix_proc_t *)a;
    const pmix_proc_t *proc_b = (pmix_proc_t *)b;

    int nspace_dif = strncmp(proc_a->nspace, proc_b->nspace, PMIX_MAX_NSLEN);
    if (nspace_dif != 0)
        return nspace_dif;

    return proc_a->rank - proc_b->rank;
}

int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
                            const char *port_string, bool send_first,
                            ompi_communicator_t **newcomm)
{
    int k, size, rsize, rank, rc, rportlen=0;
    char **members = NULL, *nstring, *rport=NULL, *key, *pkey;
    bool dense, isnew;
    opal_process_name_t pname;
    opal_list_t ilist, mlist, rlist;
    pmix_info_t info, tinfo;
    pmix_value_t pval;
    pmix_pdata_t pdat;
    pmix_proc_t *procs, pxproc;
    size_t nprocs, n;
    pmix_status_t pret;
    opal_proclist_t *plt;

    ompi_communicator_t *newcomp=MPI_COMM_NULL;
    ompi_proc_t *proc;
    ompi_group_t *group=comm->c_local_group;
    ompi_proc_t **proc_list=NULL, **new_proc_list = NULL;
    int32_t i;
    ompi_group_t *new_group_pointer;
    ompi_dpm_proct_caddy_t *cd;

    /* set default error return */
    *newcomm = MPI_COMM_NULL;

    size = ompi_comm_size ( comm );
    rank = ompi_comm_rank ( comm );

    /* the "send_first" end will append ":connect" to the port name and publish
     * the list of its participating procs on that key. The receiving root proc
     * will append ":accept" to the port name and publish the list of its
     * participants on that key. Each proc will then block waiting for lookup
     * to complete on the other's key. Once that completes, the list of remote
     * procs is used to complete construction of the intercommunicator. */

    /* If there was an error during the COMM_SPAWN stage, the port string will
     * be set (in mpi/c/comm_spawn.c) with a special value that contains the error
     * code. Extract said error code, and store it in rportlen, as this value will
     * be exchanged with other peers on comm. We need to perform this exchange even
     * in error cases to avoid leaving some processes deadlock waiting on the
     * root to broadcast.
     */
    if (NULL != port_string && strstr(port_string, ":error=")) {
        /* we will set the rportlen to a negative value corresponding to the
         * error code produced by pmix spawn */
        char *value = strrchr(port_string, '=');
        assert(NULL != value);
        rportlen = atoi(++value);
        if (rportlen > 0) rportlen *= -1;
        goto bcast_rportlen;
    }

    /* everyone constructs the list of members from their communicator */
    pname.jobid = OMPI_PROC_MY_NAME->jobid;
    pname.vpid = OPAL_VPID_WILDCARD;
    if (MPI_COMM_WORLD == comm) {
        PMIX_LOAD_PROCID(&pxproc, ompi_process_info.myprocid.nspace, PMIX_RANK_WILDCARD);
        OPAL_PMIX_CONVERT_PROCT_TO_STRING(&nstring, &pxproc);
        opal_argv_append_nosize(&members, nstring);
        free(nstring);
        /* add the number of procs in this job */
        (void)opal_asprintf(&nstring, "%d", size);
        opal_argv_append_nosize(&members, nstring);
        free(nstring);
    } else {
        if (OMPI_GROUP_IS_DENSE(group)) {
            proc_list = group->grp_proc_pointers;
            dense = true;
        } else {
            proc_list = (ompi_proc_t**)calloc(group->grp_proc_count,
                                              sizeof(ompi_proc_t *));
            for (i=0 ; i<group->grp_proc_count ; i++) {
                if (NULL == (proc_list[i] = ompi_group_peer_lookup(group,i))) {
                    OMPI_ERROR_LOG(OMPI_ERR_NOT_FOUND);
                    rc = OMPI_ERR_NOT_FOUND;
                    free(proc_list);
                    goto exit;
                }
            }
            dense = false;
        }
        for (i=0; i < size; i++) {
            opal_process_name_t proc_name;
            if (ompi_proc_is_sentinel (proc_list[i])) {
                proc_name = ompi_proc_sentinel_to_name ((uintptr_t) proc_list[i]);
            } else {
                proc_name = proc_list[i]->super.proc_name;
            }
            OPAL_PMIX_CONVERT_NAME(&pxproc, &proc_name);
            OPAL_PMIX_CONVERT_PROCT_TO_STRING(&nstring, &pxproc);
            opal_argv_append_nosize(&members, nstring);
            free(nstring);
        }
        if (!dense) {
            free(proc_list);
            proc_list = NULL;
        }
    }

    if (rank == root) {
        /* the roots for each side exchange their list of participants */
        if (send_first) {
            (void)opal_asprintf(&key, "%s:connect", port_string);
            (void)opal_asprintf(&pkey, "%s:accept", port_string);
        } else {
            (void)opal_asprintf(&key, "%s:accept", port_string);
            (void)opal_asprintf(&pkey, "%s:connect", port_string);
        }
        nstring = opal_argv_join(members, ':');
        PMIX_INFO_LOAD(&info, key, nstring, PMIX_STRING);
        PMIX_LOAD_KEY(pdat.key, pkey);
        free(nstring);
        free(key);
        free(pkey);

        rc = opal_pmix_base_exchange(&info, &pdat, 600);  // give them 10 minutes
        PMIX_INFO_DESTRUCT(&info);
        if (OPAL_SUCCESS != rc) {
            PMIX_PDATA_DESTRUCT(&pdat);
            return rc;
        }

        /* save the result */
        rport = strdup(pdat.value.data.string);  // need this later
        rportlen = strlen(rport) + 1;  // retain the NULL terminator
        PMIX_PDATA_DESTRUCT(&pdat);
    }

bcast_rportlen:
    /* if we aren't in a comm_spawn, the non-root members won't have
     * the port_string - so let's make sure everyone knows the other
     * side's participants */

    /* bcast the list-length to all processes in the local comm */
    rc = comm->c_coll->coll_bcast(&rportlen, 1, MPI_INT, root, comm,
                                 comm->c_coll->coll_bcast_module);
    if (OMPI_SUCCESS != rc) {
        free(rport);
        goto exit;
    }

    /* This is the comm_spawn error case: the root couldn't do the pmix spawn
     * and is now propagating to the local group that this operation has to
     * fail. */
    if (0 >= rportlen) {
        rc = rportlen;
        /* no need to free here, the root has already done it and everyone else has not yet allocated the rport array */
        goto exit;
    }

    if (rank != root) {
        /* non root processes need to allocate the buffer manually */
        rport = (char*)malloc(rportlen);
        if (NULL == rport) {
            rc = OMPI_ERR_OUT_OF_RESOURCE;
            goto exit;
        }
    }
    /* now share the list of remote participants */
    rc = comm->c_coll->coll_bcast(rport, rportlen, MPI_BYTE, root, comm,
                                 comm->c_coll->coll_bcast_module);
    if (OMPI_SUCCESS != rc) {
        free(rport);
        goto exit;
    }

    /* initiate a list of participants for the connect,
     * starting with our own members */
    OBJ_CONSTRUCT(&mlist, opal_list_t);
    assert(NULL != members /* would mean comm had 0-sized group! */);
    for (i=0; NULL != members[i]; i++) {
        OPAL_PMIX_CONVERT_STRING_TO_PROCT(&pxproc, members[i]);
        plt = OBJ_NEW(opal_proclist_t);
        memcpy(&plt->procid, &pxproc, sizeof(pmix_proc_t));
        opal_list_append(&mlist, &plt->super);
        /* if the rank is wildcard, then we need to skip
         * the next position */
        if (PMIX_RANK_WILDCARD == pxproc.rank) {
            ++i;
        }
    }
    opal_argv_free(members);
    members = NULL;
    /* rport contains a colon-delimited list
     * of process names for the remote procs - convert it
     * into an argv array */
    members = opal_argv_split(rport, ':');
    free(rport);

    /* add the list of remote procs to our list, and
     * keep a list of them for later */
    OBJ_CONSTRUCT(&ilist, opal_list_t);
    OBJ_CONSTRUCT(&rlist, opal_list_t);

    for (i=0; NULL != members[i]; i++) {
        OPAL_PMIX_CONVERT_STRING_TO_PROCT(&pxproc, members[i]);
        plt = OBJ_NEW(opal_proclist_t);
        memcpy(&plt->procid, &pxproc, sizeof(pmix_proc_t));
        opal_list_append(&mlist, &plt->super);

        if (PMIX_RANK_WILDCARD == pxproc.rank) {
            /* if the rank is wildcard, then we are including all ranks
             * of that job, and the next entry in members should be the
             * number of procs in the job */
            if (NULL == members[i+1]) {
                /* just protect against the error */
                OMPI_ERROR_LOG(OMPI_ERR_BAD_PARAM);
                opal_argv_free(members);
                OPAL_LIST_DESTRUCT(&ilist);
                OPAL_LIST_DESTRUCT(&rlist);
                OPAL_LIST_DESTRUCT(&mlist);
                rc = OMPI_ERR_BAD_PARAM;
                goto exit;
            }
            rsize = strtoul(members[i+1], NULL, 10);
            ++i;
            for (k=0; k < rsize; k++) {
                pxproc.rank = k;
                OPAL_PMIX_CONVERT_PROCT(rc, &pname, &pxproc);
                if (OPAL_SUCCESS != rc) {
                    OMPI_ERROR_LOG(rc);
                    opal_argv_free(members);
                    OPAL_LIST_DESTRUCT(&ilist);
                    OPAL_LIST_DESTRUCT(&rlist);
                    OPAL_LIST_DESTRUCT(&mlist);
                    goto exit;
                }
                /* see if this needs to be added to our ompi_proc_t array */
                proc = ompi_proc_find_and_add(&pname, &isnew);
                if (isnew) {
                    cd = OBJ_NEW(ompi_dpm_proct_caddy_t);
                    cd->p = proc;
                    opal_list_append(&ilist, &cd->super);
                }
                /* either way, add to the remote list */
                cd = OBJ_NEW(ompi_dpm_proct_caddy_t);
                cd->p = proc;
                opal_list_append(&rlist, &cd->super);
            }
        } else {
            OPAL_PMIX_CONVERT_PROCT(rc, &pname, &pxproc);
            if (OPAL_SUCCESS != rc) {
                OMPI_ERROR_LOG(rc);
                opal_argv_free(members);
                OPAL_LIST_DESTRUCT(&ilist);
                OPAL_LIST_DESTRUCT(&rlist);
                OPAL_LIST_DESTRUCT(&mlist);
                goto exit;
            }
            /* see if this needs to be added to our ompi_proc_t array */
            proc = ompi_proc_find_and_add(&pname, &isnew);
            if (isnew) {
                cd = OBJ_NEW(ompi_dpm_proct_caddy_t);
                cd->p = proc;
                opal_list_append(&ilist, &cd->super);
            }
            /* either way, add to the remote list */
            cd = OBJ_NEW(ompi_dpm_proct_caddy_t);
            cd->p = proc;
            opal_list_append(&rlist, &cd->super);
        }
    }
    opal_argv_free(members);

    /* convert the list of members to a pmix_proc_t array */
    nprocs = opal_list_get_size(&mlist);
    PMIX_PROC_CREATE(procs, nprocs);
    n = 0;
    OPAL_LIST_FOREACH(plt, &mlist, opal_proclist_t) {
        memcpy(&procs[n], &plt->procid, sizeof(pmix_proc_t));
        ++n;
    }
    OPAL_LIST_DESTRUCT(&mlist);

    /* tell the host RTE to connect us - this will download
     * all known data for the nspace's of participating procs
     * so that add_procs will not result in a slew of lookups */
    PMIX_INFO_CONSTRUCT(&tinfo);
    PMIX_INFO_LOAD(&tinfo, PMIX_TIMEOUT, &ompi_pmix_connect_timeout, PMIX_UINT32);

    /*
     * sort procs so that all ranks call PMIx_Connect() with the processes in same order
     */
    qsort(procs, nprocs, sizeof(pmix_proc_t), compare_pmix_proc);
    pret = PMIx_Connect(procs, nprocs, &tinfo, 1);
    PMIX_INFO_DESTRUCT(&tinfo);
    PMIX_PROC_FREE(procs, nprocs);
    rc = opal_pmix_convert_status(pret);
    if (OPAL_SUCCESS != rc) {
        OMPI_ERROR_LOG(rc);
        OPAL_LIST_DESTRUCT(&ilist);
        OPAL_LIST_DESTRUCT(&rlist);
        goto exit;
    }
    if (!opal_list_is_empty(&ilist)) {
        int prn, nprn = 0;
        char *val;
        opal_process_name_t wildcard_rank;
        i = 0;  /* start from the begining */

        /* convert the list of new procs to a proc_t array */
        new_proc_list = (ompi_proc_t**)calloc(opal_list_get_size(&ilist),
                                              sizeof(ompi_proc_t *));
        /* Extract the modex info for the first proc on the ilist, and then
         * remove all processors in the same jobid from the list by getting
         * their connection information and moving them into the proc array.
         */
        do {
            uint32_t *local_ranks_in_jobid = NULL;
            ompi_dpm_proct_caddy_t* next = NULL;
            cd = (ompi_dpm_proct_caddy_t*)opal_list_get_first(&ilist);
            proc = cd->p;
            wildcard_rank.jobid = proc->super.proc_name.jobid;
            wildcard_rank.vpid = OMPI_NAME_WILDCARD->vpid;
            /* retrieve the local peers for the specified jobid */
            OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_LOCAL_PEERS,
                                           &wildcard_rank, &val, PMIX_STRING);
            if (OPAL_SUCCESS == rc && NULL != val) {
                char **peers = opal_argv_split(val, ',');
                free(val);
                nprn = opal_argv_count(peers);
                local_ranks_in_jobid = (uint32_t*)calloc(nprn, sizeof(uint32_t));
                for (prn = 0; NULL != peers[prn]; prn++) {
                    local_ranks_in_jobid[prn] = strtoul(peers[prn], NULL, 10);
                }
                opal_argv_free(peers);
            }

            OPAL_LIST_FOREACH_SAFE(cd, next, &ilist, ompi_dpm_proct_caddy_t) {
                proc = cd->p;
                if( proc->super.proc_name.jobid != wildcard_rank.jobid )
                    continue;  /* not a proc from this jobid */

                new_proc_list[i] = proc;
                opal_list_remove_item(&ilist, (opal_list_item_t*)cd);  // TODO: do we need to release cd ?
                OBJ_RELEASE(cd);
                /* ompi_proc_complete_init_single() initializes and optionally retrieves
                 * OPAL_PMIX_LOCALITY and OPAL_PMIX_HOSTNAME. since we can live without
                 * them, we are just fine */
                ompi_proc_complete_init_single(proc);
                /* if this proc is local, then get its locality */
                if (NULL != local_ranks_in_jobid) {
                    uint16_t u16;
                    for (prn=0; prn < nprn; prn++) {
                        if (local_ranks_in_jobid[prn] == proc->super.proc_name.vpid) {
                            /* get their locality string */
                            val = NULL;
                            OPAL_MODEX_RECV_VALUE_IMMEDIATE(rc, PMIX_LOCALITY_STRING,
                                                           &proc->super.proc_name, &val, PMIX_STRING);
                            if (OPAL_SUCCESS == rc && NULL != ompi_process_info.locality) {
                                u16 = opal_hwloc_compute_relative_locality(ompi_process_info.locality, val);
                                free(val);
                            } else {
                                /* all we can say is that it shares our node */
                                u16 = OPAL_PROC_ON_CLUSTER | OPAL_PROC_ON_CU | OPAL_PROC_ON_NODE;
                            }
                            proc->super.proc_flags = u16;
                            /* save the locality for later */
                            OPAL_PMIX_CONVERT_NAME(&pxproc, &proc->super.proc_name);
                            pval.type = PMIX_UINT16;
                            pval.data.uint16 = proc->super.proc_flags;
                            PMIx_Store_internal(&pxproc, PMIX_LOCALITY, &pval);
                            break;
                        }
                    }
                }
                ++i;
            }
            if (NULL != local_ranks_in_jobid) {
                free(local_ranks_in_jobid);
            }
        } while (!opal_list_is_empty(&ilist));

        /* call add_procs on the new ones */
        rc = MCA_PML_CALL(add_procs(new_proc_list, opal_list_get_size(&ilist)));
        free(new_proc_list);
        new_proc_list = NULL;
        if (OMPI_SUCCESS != rc) {
            OMPI_ERROR_LOG(rc);
            OPAL_LIST_DESTRUCT(&ilist);
            goto exit;
        }
    }
    OPAL_LIST_DESTRUCT(&ilist);

    /* now deal with the remote group */
    rsize = opal_list_get_size(&rlist);
    new_group_pointer=ompi_group_allocate(NULL, rsize);
    if (NULL == new_group_pointer) {
        rc = OMPI_ERR_OUT_OF_RESOURCE;
        OPAL_LIST_DESTRUCT(&rlist);
        goto exit;
    }
    /* assign group elements */
    i=0;
    OPAL_LIST_FOREACH(cd, &rlist, ompi_dpm_proct_caddy_t) {
        new_group_pointer->grp_proc_pointers[i++] = cd->p;
        /* retain the proc */
        OBJ_RETAIN(cd->p);
    }
    OPAL_LIST_DESTRUCT(&rlist);

    /* set up communicator structure */
    rc = ompi_comm_set ( &newcomp,                 /* new comm */
                         comm,                     /* old comm */
                         group->grp_proc_count,    /* local_size */
                         NULL,                     /* local_procs */
                         rsize,                    /* remote_size */
                         NULL  ,                   /* remote_procs */
                         NULL,                     /* attrs */
                         comm->error_handler,      /* error handler */
                         group,                    /* local group */
                         new_group_pointer,        /* remote group */
                         0);                       /* flags */
    if (OMPI_SUCCESS != rc) {
        goto exit;
    }

    OBJ_RELEASE(new_group_pointer);
    new_group_pointer = MPI_GROUP_NULL;

    /* allocate comm_cid */
    rc = ompi_comm_nextcid ( newcomp,                   /* new communicator */
                             comm,                      /* old communicator */
                             NULL,                      /* bridge comm */
                             &root,                     /* local leader */
                             (void*)port_string,        /* rendezvous point */
                             send_first,                /* send or recv first */
                             OMPI_COMM_CID_INTRA_PMIX); /* mode */
    if (OMPI_SUCCESS != rc) {
        goto exit;
    }

    /* activate comm and init coll-component */
    rc = ompi_comm_activate ( &newcomp,                  /* new communicator */
                              comm,                      /* old communicator */
                              NULL,                      /* bridge comm */
                              &root,                     /* local leader */
                              (void*)port_string,        /* rendezvous point */
                              send_first,                /* send or recv first */
                              OMPI_COMM_CID_INTRA_PMIX); /* mode */
    if (OMPI_SUCCESS != rc) {
        goto exit;
    }

    /* Question: do we have to re-start some low level stuff
       to enable the usage of fast communication devices
       between the two worlds ?
    */

 exit:
    if (OMPI_SUCCESS != rc) {
        if (MPI_COMM_NULL != newcomp && NULL != newcomp) {
            OBJ_RELEASE(newcomp);
            newcomp = MPI_COMM_NULL;
        }
    }

    *newcomm = newcomp;
    return rc;
}

static int construct_peers(ompi_group_t *group, opal_list_t *peers)
{
    int i;
    opal_namelist_t *nm, *n2;
    ompi_proc_t *proct;
    opal_process_name_t proc_name;

    for (i=0; i < group->grp_proc_count; i++) {
        if (OMPI_GROUP_IS_DENSE(group)) {
            proct = group->grp_proc_pointers[i];
        } else {
            proct = ompi_group_peer_lookup(group, i);
        }
        if (NULL == proct) {
            OMPI_ERROR_LOG(OMPI_ERR_NOT_FOUND);
            return OMPI_ERR_NOT_FOUND;
        }
        if (ompi_proc_is_sentinel (proct)) {
            proc_name = ompi_proc_sentinel_to_name ((uintptr_t)proct);
        } else {
            proc_name = proct->super.proc_name;
        }

        /* add to the list of peers */
        nm = OBJ_NEW(opal_namelist_t);
        nm->name = proc_name;
        /* need to maintain an ordered list to ensure the tracker signatures
         * match across all procs */
        OPAL_LIST_FOREACH(n2, peers, opal_namelist_t) {
            if (opal_compare_proc(nm->name, n2->name) < 0) {
                opal_list_insert_pos(peers, &n2->super, &nm->super);
                nm = NULL;
                break;
            }
        }
        if (NULL != nm) {
            /* append to the end */
            opal_list_append(peers, &nm->super);
        }
    }
    return OMPI_SUCCESS;
}

int ompi_dpm_disconnect(ompi_communicator_t *comm)
{
    int ret;
    pmix_status_t rc;
    ompi_group_t *group;
    opal_list_t coll;
    opal_namelist_t *nm;
    pmix_proc_t *procs;
    size_t nprocs, n;

    /* Note that we explicitly use an RTE-based barrier (vs. an MPI
       barrier).  See a lengthy comment in
       ompi/runtime/ompi_mpi_finalize.c for a much more detailed
       rationale. */

    /* setup the collective */
    OBJ_CONSTRUCT(&coll, opal_list_t);
    /* RHC: assuming for now that this must flow across all
     * local and remote group members */
    group = comm->c_local_group;
    if (OMPI_SUCCESS != (ret = construct_peers(group, &coll))) {
        OMPI_ERROR_LOG(ret);
        OPAL_LIST_DESTRUCT(&coll);
        return ret;
    }
    /* do the same for the remote group */
    group = comm->c_remote_group;
    if (OMPI_SUCCESS != (ret = construct_peers(group, &coll))) {
        OMPI_ERROR_LOG(ret);
        OPAL_LIST_DESTRUCT(&coll);
        return ret;
    }
    nprocs = opal_list_get_size(&coll);
    PMIX_PROC_CREATE(procs, nprocs);
    n = 0;
    OPAL_LIST_FOREACH(nm, &coll, opal_namelist_t) {
        OPAL_PMIX_CONVERT_NAME(&procs[n], &nm->name);
        ++n;
    }
    OPAL_LIST_DESTRUCT(&coll);

    /* ensure we tell the host RM to disconnect us - this
     * is a blocking operation so just use a fence */
    if (PMIX_SUCCESS != (rc = PMIx_Fence(procs, nprocs, NULL, 0))) {
        ret = opal_pmix_convert_status(rc);
        OMPI_ERROR_LOG(ret);
        PMIX_PROC_FREE(procs, nprocs);
        return ret;
    }
    PMIX_PROC_FREE(procs, nprocs);

    return ret;
}

typedef struct {
    char *name;
    char **conflicts;
} dpm_conflicts_t;

static dpm_conflicts_t mapby_modifiers[] = {
    {.name = "oversubscribe", .conflicts = (char *[]){"nooversubscribe", NULL}},
    {.name = "nooversubscribe", .conflicts = (char *[]){"oversubscribe", NULL}},
    {.name = ""}
};

static dpm_conflicts_t rankby_modifiers[] = {
    {.name = ""}
};

static dpm_conflicts_t bindto_modifiers[] = {
    {.name = ""}
};

static int check_modifiers(const char *modifier, char **checks, dpm_conflicts_t *conflicts)
{
    int n, m, k;

    for (n=0; 0 != strlen(conflicts[n].name); n++) {
        if (0 == strcasecmp(conflicts[n].name, modifier)) {
            for (m=0; NULL != checks[m]; m++) {
                for (k=0; NULL != conflicts[n].conflicts[k]; k++) {
                    if (0 == strcasecmp(checks[m], conflicts[n].conflicts[k])) {
                        return OMPI_ERR_BAD_PARAM;
                    }
                }
            }
            break;
        }
    }
    return OMPI_SUCCESS;
}

static int dpm_convert(opal_list_t *infos,
                       const char *infokey,
                       const char *option,
                       const char *directive,
                       const char *modifier,
                       bool deprecated)
{
    opal_info_item_t *iptr;
    char *ck, *ptr, *help_str = NULL;
    int rc;
    char **tmp;
    dpm_conflicts_t *modifiers = NULL;
    const char *attr;

    /* pick the modifiers to be checked */
    if (NULL != modifier) {
        if (0 == strcmp(option, PMIX_MAPBY)) {
            modifiers = mapby_modifiers;
        } else if (0 == strcmp(option, PMIX_RANKBY)) {
            modifiers = rankby_modifiers;
        } else if (0 == strcmp(option, PMIX_BINDTO)) {
            modifiers = bindto_modifiers;
        } else  {
            return OMPI_ERR_BAD_PARAM;
        }
    }

    /* does the matching option already exist? */
    OPAL_LIST_FOREACH(iptr, infos, opal_info_item_t) {
        if (PMIX_CHECK_KEY(&iptr->info, option)) {
            ck = strdup(iptr->info.value.data.string);
            if (NULL != (ptr = strchr(ck, ':'))) {
                *ptr = '\0';
                ++ptr;
            }
             /* were we given a directive? */
            if (NULL != directive) {
                /* does it conflict? */
               if (0 != strncasecmp(ck, directive, strlen(directive))) {
                    opal_asprintf(&help_str, "Conflicting directives \"%s %s\"", ck, directive);
#if PMIX_NUMERIC_VERSION >= 0x00040000
                    attr = PMIx_Get_attribute_string(option);
#else
                    attr = option;
#endif
                    opal_show_help("help-dpm.txt", "deprecated-fail", true,
                                   infokey, attr, help_str);
                    free(help_str);
                    free(ck);
                    return OMPI_ERR_BAD_PARAM;
                }
                /* if they match, then nothing further to do */
            }
            /* were we given a modifier? */
            if (NULL != modifier) {
                if (NULL == ptr) {
                    /* no modifiers in the existing directive - just add the new one */
                    opal_asprintf(&ptr, "%s:%s", ck, modifier);
                    free(iptr->info.value.data.string);
                    iptr->info.value.data.string = ptr;
                    free(ck);
                    return OMPI_SUCCESS;
                } else {
                    /* we already have modifiers - need to check for conflict with
                     * the one we were told to add */
                    tmp = opal_argv_split(ptr, ',');
                    rc = check_modifiers(modifier, tmp, modifiers);
                    opal_argv_free(tmp);
                    if (OMPI_SUCCESS != rc) {
                        /* we have a conflict */
                        opal_asprintf(&ptr, "  Option %s\n  Conflicting modifiers \"%s %s\"", option, infokey, modifier);
#if PMIX_NUMERIC_VERSION >= 0x00040000
                        /* TODO: remove strdup if PMIx_Get_attribute_string takes const char* */
                        char *option_dup = strdup(option);
                        attr = PMIx_Get_attribute_string(option_dup);
                        free(option_dup);
#else
                        attr = option;
#endif
                        opal_show_help("help-dpm.txt", "deprecated-fail", true,
                                       infokey, attr, ptr);
                        free(ptr);
                        free(ck);
                        return OMPI_ERR_BAD_PARAM;
                    }
                    /* add the modifier to the end */
                    opal_asprintf(&ptr, "%s,%s", iptr->info.value.data.string, modifier);
                    free(iptr->info.value.data.string);
                    iptr->info.value.data.string = ptr;
                    free(ck);
                    opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                   infokey, iptr->info.value.data.string);
                    return OMPI_SUCCESS;
                }
            }
            free(ck);
        }
    }

    /**** Get here if the specified option is not found in the
     **** current list - add it
     ****/
    if (NULL == directive && NULL == modifier) {
        return OMPI_ERR_BAD_PARAM;
    } else if (NULL == directive) {
        opal_asprintf(&ptr, ":%s", modifier);
    } else if (NULL == modifier) {
        ptr = strdup(directive);
    } else {
        opal_asprintf(&ptr, "%s:%s", directive, modifier);
    }
    iptr = OBJ_NEW(opal_info_item_t);
    PMIX_INFO_LOAD(&iptr->info, option, ptr, PMIX_STRING);
    opal_list_append(infos, &iptr->super);

    /* alert them */
    if(deprecated) {
        opal_asprintf(&help_str, "Key: %s Value: %s", option, ptr);
        opal_show_help("help-dpm.txt", "deprecated-converted", true,
                       infokey, help_str);
    }
    free(help_str);
    free(ptr);

    return OMPI_SUCCESS;
}


int ompi_dpm_spawn(int count, const char *array_of_commands[],
                   char **array_of_argv[],
                   const int array_of_maxprocs[],
                   const MPI_Info array_of_info[],
                   const char *port_name)
{
    int rc, i, j;
    int have_wdir=0;
    int flag=0;
    opal_cstring_t *info_str;
    uint32_t ui32;
    bool personality = false;
    char *tmp;
    pmix_app_t *apps, *app;
    opal_list_t job_info;
    opal_list_t app_info;
    opal_info_item_t *info;
    bool local_spawn, non_mpi;
    char **envars;
    size_t ninfo, n;
    pmix_info_t *pinfo = NULL;
    pmix_status_t pret;
    pmix_nspace_t nspace;
    size_t scount = count;
    char **hostfiles = NULL, **dash_host = NULL;
#if PMIX_NUMERIC_VERSION >= 0x00040000
    const char *checkkey;
#endif

    /* parse the info object */
    /* check potentially for
      Standard keys:
       - "arch": desired architecture
       - "wdir": directory, where executable can be found
       - "path": list of directories where to look for the executable
       - "file": filename, where additional information is provided.
       - "soft": see page 92 of MPI-2.
       - "host": desired host where to spawn the processes
       - "mpi_initial_errhandler": the error handler attached to predefined communicators.
      Non-standard keys:
       - "hostfile": hostfile containing hosts where procs are
       to be spawned
       - "add-host": add the specified hosts to the known list
       of available resources and spawn these
       procs on them
       - "add-hostfile": add the hosts in the hostfile to the
       known list of available resources and spawn
       these procs on them
       - "env": a newline-delimited list of envar values to be
       placed into the app's environment (of form "foo=bar")
       - "ompi_prefix": the path to the root of the directory tree where ompi
       executables and libraries can be found on all nodes
       used to spawn these procs
       - "mapper": indicate the mapper to be used for the job
       - "display_map": display the map of the spawned job
       - "npernode": number of procs/node to spawn
       - "pernode": spawn one proc/node
       - "ppr": spawn specified number of procs per specified object
       - "map_by": specify object by which the procs should be mapped
       - "rank_by": specify object by which the procs should be ranked
       - "bind_to": specify object to which the procs should be bound
       - "ompi_preload_binary": move binaries to nodes prior to execution
       - "ompi_preload_files": move specified files to nodes prior to execution
       - "ompi_non_mpi": spawned job will not call MPI_Init
       - "ompi_param": list of MCA params to be in the spawned job's environment
    */

    /* setup the job object */
    OBJ_CONSTRUCT(&job_info, opal_list_t);
    PMIX_APP_CREATE(apps, scount);

    /* Convert the list of commands to array of pmix_app_t */
    for (i = 0; i < count; ++i) {
        app = &apps[i];
        OBJ_CONSTRUCT(&app_info, opal_list_t);
        /* copy over the name of the executable */
        app->cmd = strdup(array_of_commands[i]);
        opal_argv_append_nosize(&app->argv, app->cmd);

        /* record the number of procs to be generated */
        app->maxprocs = array_of_maxprocs[i];

        /* copy over the argv array */
        if (MPI_ARGVS_NULL != array_of_argv &&
            MPI_ARGV_NULL != array_of_argv[i]) {
            for (j=0; NULL != array_of_argv[i][j]; j++) {
                opal_argv_append_nosize(&app->argv, array_of_argv[i][j]);
            }
        }

        /* Add environment variable with the contact information for the
           child processes.
        */
        opal_setenv("OMPI_PARENT_PORT", port_name, true, &app->env);
        for (j = 0; NULL != environ[j]; ++j) {
            if (0 == strncmp(OPAL_MCA_PREFIX, environ[j], strlen(OPAL_MCA_PREFIX))) {
                opal_argv_append_nosize(&app->env, environ[j]);
            }
        }

        /* Check for well-known info keys */
        have_wdir = 0;
        if ( array_of_info != NULL && array_of_info[i] != MPI_INFO_NULL ) {
            /* check for personality - this is a job-level key */
            ompi_info_get (array_of_info[i], "personality", &info_str, &flag);
            if ( flag ) {
                /* deprecate --> PMIX_PERSONALITY */
                opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                "personality", "PMIX_PERSONALITY");
                personality = true;
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PERSONALITY, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
            ompi_info_get (array_of_info[i], "PMIX_PERSONALITY", &info_str, &flag);
            if ( flag ) {
                personality = true;
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PERSONALITY, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_PERSONALITY");
            ompi_info_get (array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                personality = true;
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PERSONALITY, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#endif

            /* check for standard form keys, do not deprecate they are part of
             * MPI standard ch. 10.3.4 */

            /* check for 'host' */
            ompi_info_get (array_of_info[i], "host", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_HOST, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                opal_argv_append_nosize(&dash_host, info_str->string);
                OBJ_RELEASE(info_str);
            }
            ompi_info_get (array_of_info[i], "PMIX_HOST", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_HOST, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                opal_argv_append_nosize(&dash_host, info_str->string);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_HOST");
            ompi_info_get (array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_HOST, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                opal_argv_append_nosize(&dash_host, info_str->string);
                OBJ_RELEASE(info_str);
            }
#endif

            /* check for 'wdir' */
            ompi_info_get (array_of_info[i], "wdir", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_WDIR, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                OBJ_RELEASE(info_str);
                have_wdir = 1;
            }
            if (!have_wdir) {
                ompi_info_get (array_of_info[i], "PMIX_WDIR", &info_str, &flag);
                if ( flag ) {
                    info = OBJ_NEW(opal_info_item_t);
                    PMIX_INFO_LOAD(&info->info, PMIX_WDIR, info_str->string, PMIX_STRING);
                    opal_list_append(&app_info, &info->super);
                    OBJ_RELEASE(info_str);
                    have_wdir = 1;
                }
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            if (!have_wdir) {
                checkkey = PMIx_Get_attribute_string("PMIX_WDIR");
                ompi_info_get (array_of_info[i], checkkey, &info_str, &flag);
                if ( flag ) {
                    info = OBJ_NEW(opal_info_item_t);
                    PMIX_INFO_LOAD(&info->info, PMIX_WDIR, info_str->string, PMIX_STRING);
                    opal_list_append(&app_info, &info->super);
                    OBJ_RELEASE(info_str);
                    have_wdir = 1;
                }
            }
#endif

            /* check for 'mpi_initial_errhandler' */
            ompi_info_get (array_of_info[i], "mpi_initial_errhandler", &info_str, &flag);
            if ( flag ) {
                /* this is set as an environment because it must be available
                 * before pmix_init */
                opal_setenv("OMPI_MCA_mpi_initial_errhandler", info_str->string, true, &app->env);
                OBJ_RELEASE(info_str);
            }

            /* 'path', 'arch', 'file', 'soft'  -- to be implemented */

            /* non-standard keys
             * Keys that correspond to prun/mpiexec parameters
             * do not deprecate PMIX unprefixed forms to remain identical
             * to the command line parameter;
             * Keys that are not corresponding to an mpiexec parameter are
             * deprecated in the non-prefixed form */

            /* check for 'hostfile' */
            ompi_info_get (array_of_info[i], "hostfile", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_HOSTFILE, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                opal_argv_append_nosize(&hostfiles, info_str->string);
                OBJ_RELEASE(info_str);
            }
            ompi_info_get (array_of_info[i], "PMIX_HOSTFILE", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_HOSTFILE, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                opal_argv_append_nosize(&hostfiles, info_str->string);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_HOSTFILE");
            ompi_info_get (array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_HOSTFILE, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                opal_argv_append_nosize(&hostfiles, info_str->string);
                OBJ_RELEASE(info_str);
            }
#endif

            /* check for 'add-hostfile' */
            ompi_info_get (array_of_info[i], "add-hostfile", &info_str, &flag);
            if ( flag ) {
                /* deprecate --> PMIX_ADD_HOSTFILE */
                opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                "add-hostfile", "PMIX_ADD_HOSTFILE");
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_ADD_HOSTFILE, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                OBJ_RELEASE(info_str);
            }
            ompi_info_get (array_of_info[i], "PMIX_ADD_HOSTFILE", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_ADD_HOSTFILE, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_ADD_HOSTFILE");
            ompi_info_get (array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_ADD_HOSTFILE, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#endif

            /* check for 'add-host' */
            ompi_info_get (array_of_info[i], "add-host", &info_str, &flag);
            if ( flag ) {
                /* deprecate --> PMIX_ADD_HOST */
                opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                "add-host", "PMIX_ADD_HOST");
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_ADD_HOST, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                OBJ_RELEASE(info_str);
            }
            ompi_info_get (array_of_info[i], "PMIX_ADD_HOST", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_ADD_HOST, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_ADD_HOST");
            ompi_info_get (array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_ADD_HOST, info_str->string, PMIX_STRING);
                opal_list_append(&app_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#endif

            /* check for env */
            ompi_info_get (array_of_info[i], "env", &info_str, &flag);
            if ( flag ) {
                /* deprecate --> PMIX_ENVAR */
                opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                "env", "PMIX_ENVAR");
                envars = opal_argv_split(info_str->string, '\n');
                OBJ_RELEASE(info_str);
                for (j=0; NULL != envars[j]; j++) {
                    opal_argv_append_nosize(&app->env, envars[j]);
                }
                opal_argv_free(envars);
            }
            ompi_info_get (array_of_info[i], "PMIX_ENVAR", &info_str, &flag);
            if ( flag ) {
                envars = opal_argv_split(info_str->string, '\n');
                OBJ_RELEASE(info_str);
                for (j=0; NULL != envars[j]; j++) {
                    opal_argv_append_nosize(&app->env, envars[j]);
                }
                opal_argv_free(envars);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_ENVAR");
            ompi_info_get (array_of_info[i], "PMIX_ENVAR", &info_str, &flag);
            if ( flag ) {
                envars = opal_argv_split(info_str->string, '\n');
                OBJ_RELEASE(info_str);
                for (j=0; NULL != envars[j]; j++) {
                    opal_argv_append_nosize(&app->env, envars[j]);
                }
                opal_argv_free(envars);
            }
#endif

            /* check for 'ompi_prefix' (OMPI-specific -- to effect the same
             * behavior as --prefix option to prun)
             *
             * This is a job-level key
             */
            ompi_info_get (array_of_info[i], "ompi_prefix", &info_str, &flag);
            if ( flag ) {
                /* deprecate --> PMIX_PREFIX */
                opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                "ompi_prefix", "PMIX_PREFIX");
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PREFIX, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
            ompi_info_get (array_of_info[i], "PMIX_PREFIX", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PREFIX, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_PREFIX");
            ompi_info_get (array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PREFIX, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#endif

            /* check for 'mapper' - a job-level key */
            ompi_info_get(array_of_info[i], "mapper", &info_str, &flag);
            if ( flag ) {
                /* deprecate --> PMIX_MAPPER */
                opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                "mapper", "PMIX_MAPPER");
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_MAPPER, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
            ompi_info_get(array_of_info[i], "PMIX_MAPPER", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_MAPPER, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_MAPPER");
            ompi_info_get(array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_MAPPER, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#endif

            /* check for 'display_map' - a job-level key */
            ompi_info_get_bool(array_of_info[i], "display_map", &local_spawn, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_DISPLAY_MAP, &local_spawn, PMIX_BOOL);
                opal_list_append(&job_info, &info->super);
            }

            /* check for 'npernode' and 'ppr' - job-level key */
            ompi_info_get (array_of_info[i], "npernode", &info_str, &flag);
            if ( flag ) {
                opal_asprintf(&tmp, "PPR:%s:NODE", info_str->string);
                rc = dpm_convert(&job_info, "npernode", PMIX_MAPBY, tmp, NULL, true);
                free(tmp);
                OBJ_RELEASE(info_str);
                if (OMPI_SUCCESS != rc) {
                    OPAL_LIST_DESTRUCT(&job_info);
                    OPAL_LIST_DESTRUCT(&app_info);
                    PMIX_APP_FREE(apps, scount);
                    if (NULL != hostfiles) {
                        opal_argv_free(hostfiles);
                    }
                    if (NULL != dash_host) {
                        opal_argv_free(dash_host);
                    }
                    return MPI_ERR_SPAWN;
                }
            }
            ompi_info_get (array_of_info[i], "pernode", &info_str, &flag);
            if ( flag ) {
                rc = dpm_convert(&job_info, "pernode", PMIX_MAPBY, "PPR:1:NODE", NULL, true);
                OBJ_RELEASE(info_str);
                if (OMPI_SUCCESS != rc) {
                    OPAL_LIST_DESTRUCT(&job_info);
                    OPAL_LIST_DESTRUCT(&app_info);
                    PMIX_APP_FREE(apps, scount);
                    if (NULL != hostfiles) {
                        opal_argv_free(hostfiles);
                    }
                    if (NULL != dash_host) {
                        opal_argv_free(dash_host);
                    }
                    return MPI_ERR_SPAWN;
                }
            }
            ompi_info_get (array_of_info[i], "ppr", &info_str, &flag);
            if ( flag ) {
                /* must have correct syntax with two colons */
                if (NULL == (tmp = strchr(info_str->string, ':'))) {
                    opal_show_help("help-dpm.txt", "bad-ppr", true, info_str->string);
                    OPAL_LIST_DESTRUCT(&job_info);
                    OPAL_LIST_DESTRUCT(&app_info);
                    PMIX_APP_FREE(apps, scount);
                    if (NULL != hostfiles) {
                        opal_argv_free(hostfiles);
                    }
                    if (NULL != dash_host) {
                        opal_argv_free(dash_host);
                    }
                    OBJ_RELEASE(info_str);
                    return MPI_ERR_SPAWN;
                }
                ++tmp; // step over first colon
                if (NULL == strchr(tmp, ':')) {
                    opal_show_help("help-dpm.txt", "bad-ppr", true, info_str->string);
                    OPAL_LIST_DESTRUCT(&job_info);
                    OPAL_LIST_DESTRUCT(&app_info);
                    PMIX_APP_FREE(apps, scount);
                    if (NULL != hostfiles) {
                        opal_argv_free(hostfiles);
                    }
                    if (NULL != dash_host) {
                        opal_argv_free(dash_host);
                    }
                    OBJ_RELEASE(info_str);
                    return MPI_ERR_SPAWN;
                }
                rc = dpm_convert(&job_info, "ppr", PMIX_MAPBY, info_str->string, NULL, true);
                OBJ_RELEASE(info_str);
                if (OMPI_SUCCESS != rc) {
                    OPAL_LIST_DESTRUCT(&job_info);
                    OPAL_LIST_DESTRUCT(&app_info);
                    PMIX_APP_FREE(apps, scount);
                    if (NULL != hostfiles) {
                        opal_argv_free(hostfiles);
                    }
                    if (NULL != dash_host) {
                        opal_argv_free(dash_host);
                    }
                    return MPI_ERR_SPAWN;
                }
            }

            /* check for 'map_by' - job-level key */
            ompi_info_get(array_of_info[i], "map_by", &info_str, &flag);
            if ( flag ) {
                rc = dpm_convert(&job_info, "map_by", PMIX_MAPBY, info_str->string, NULL, false);
                OBJ_RELEASE(info_str);
                if (OMPI_SUCCESS != rc) {
                    OPAL_LIST_DESTRUCT(&job_info);
                    OPAL_LIST_DESTRUCT(&app_info);
                    PMIX_APP_FREE(apps, scount);
                    if (NULL != hostfiles) {
                        opal_argv_free(hostfiles);
                    }
                    if (NULL != dash_host) {
                        opal_argv_free(dash_host);
                    }
                    return MPI_ERR_SPAWN;
                }
            }
            ompi_info_get(array_of_info[i], "PMIX_MAPBY", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_MAPBY, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_MAPBY");
            ompi_info_get(array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_MAPBY, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#endif

            /* check for 'rank_by' - job-level key */
            ompi_info_get(array_of_info[i], "rank_by", &info_str, &flag);
            if ( flag ) {
                rc = dpm_convert(&job_info, "rank_by", PMIX_RANKBY, info_str->string, NULL, false);
                OBJ_RELEASE(info_str);
                if (OMPI_SUCCESS != rc) {
                    OPAL_LIST_DESTRUCT(&job_info);
                    OPAL_LIST_DESTRUCT(&app_info);
                    PMIX_APP_FREE(apps, scount);
                    return MPI_ERR_SPAWN;
                }
            }
            ompi_info_get(array_of_info[i], "PMIX_RANKBY", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_RANKBY, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_RANKBY");
            ompi_info_get(array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_RANKBY, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#endif

            /* check for 'bind_to' - job-level key */
            ompi_info_get(array_of_info[i], "bind_to", &info_str, &flag);
            if ( flag ) {
                rc = dpm_convert(&job_info, "bind_to", PMIX_BINDTO, info_str->string, NULL, false);
                OBJ_RELEASE(info_str);
                if (OMPI_SUCCESS != rc) {
                    OPAL_LIST_DESTRUCT(&job_info);
                    OPAL_LIST_DESTRUCT(&app_info);
                    PMIX_APP_FREE(apps, scount);
                    return MPI_ERR_SPAWN;
                }
            }
            ompi_info_get(array_of_info[i], "PMIX_BINDTO", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_BINDTO, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_BINDTO");
            ompi_info_get(array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_BINDTO, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#endif

            /* check for 'preload_binary' - job-level key */
            ompi_info_get_bool(array_of_info[i], "ompi_preload_binary", &local_spawn, &flag);
            if ( flag ) {
                /* deprecate --> PMIX_PRELOAD_BIN */
                opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                "ompi_preload_binary", "PMIX_PRELOAD_BIN");
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PRELOAD_BIN, &local_spawn, PMIX_BOOL);
                opal_list_append(&job_info, &info->super);
            }
            ompi_info_get_bool(array_of_info[i], "PMIX_PRELOAD_BIN", &local_spawn, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PRELOAD_BIN, &local_spawn, PMIX_BOOL);
                opal_list_append(&job_info, &info->super);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_PRELOAD_BIN");
            ompi_info_get_bool(array_of_info[i], checkkey, &local_spawn, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PRELOAD_BIN, &local_spawn, PMIX_BOOL);
                opal_list_append(&job_info, &info->super);
            }
#endif

            /* check for 'preload_files' - job-level key */
            ompi_info_get (array_of_info[i], "ompi_preload_files", &info_str, &flag);
            if ( flag ) {
                /* deprecate --> PMIX_PRELOAD_FILES */
                opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                "ompi_preload_files", "PMIX_PRELOAD_FILES");
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PRELOAD_FILES, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
            ompi_info_get (array_of_info[i], "PMIX_PRELOAD_FILES", &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PRELOAD_FILES, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_PRELOAD_FILES");
            ompi_info_get (array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_PRELOAD_FILES, info_str->string, PMIX_STRING);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#endif

            /* see if this is a non-mpi job - if so, then set the flag so PRTE
             * knows what to do - job-level key
             */
            ompi_info_get_bool(array_of_info[i], "ompi_non_mpi", &non_mpi, &flag);
            if (flag && non_mpi) {
                opal_show_help("help-dpm.txt", "deprecated-inform", true,
                                "ompi_non_mpi", "No longer relevant as RTE automatically detects this scenario");
            }

            /* see if this is an MCA param that the user wants applied to the child job */
            ompi_info_get (array_of_info[i], "ompi_param", &info_str, &flag);
            if ( flag ) {
                opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                "ompi_param", "PMIX_ENVAR");
                opal_argv_append_unique_nosize(&app->env, info_str->string, true);
                OBJ_RELEASE(info_str);
            }

            /* see if user specified what to do with stdin - defaults to
             * not forwarding stdin to child processes - job-level key
             */
            ompi_info_get (array_of_info[i], "ompi_stdin_target", &info_str, &flag);
            if ( flag ) {
                /* deprecate --> PMIX_STDIN_TGT */
                opal_show_help("help-dpm.txt", "deprecated-converted", true,
                                "ompi_stdin_target", "PMIX_STDIN_TGT");
                if (0 == strcmp(info_str->string, "all")) {
                    ui32 = OPAL_VPID_WILDCARD;
                } else if (0 == strcmp(info_str->string, "none")) {
                    ui32 = OPAL_VPID_INVALID;
                } else {
                    ui32 = strtoul(info_str->string, NULL, 10);
                }
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_STDIN_TGT, &ui32, PMIX_UINT32);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
            ompi_info_get (array_of_info[i], "PMIX_STDIN_TGT", &info_str, &flag);
            if ( flag ) {
                if (0 == strcmp(info_str->string, "all")) {
                    ui32 = OPAL_VPID_WILDCARD;
                } else if (0 == strcmp(info_str->string, "none")) {
                    ui32 = OPAL_VPID_INVALID;
                } else {
                    ui32 = strtoul(info_str->string, NULL, 10);
                }
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_STDIN_TGT, &ui32, PMIX_UINT32);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#if PMIX_NUMERIC_VERSION >= 0x00040000
            checkkey = PMIx_Get_attribute_string("PMIX_STDIN_TGT");
            ompi_info_get (array_of_info[i], checkkey, &info_str, &flag);
            if ( flag ) {
                if (0 == strcmp(info_str->string, "all")) {
                    ui32 = OPAL_VPID_WILDCARD;
                } else if (0 == strcmp(info_str->string, "none")) {
                    ui32 = OPAL_VPID_INVALID;
                } else {
                    ui32 = strtoul(info_str->string, NULL, 10);
                }
                info = OBJ_NEW(opal_info_item_t);
                PMIX_INFO_LOAD(&info->info, PMIX_STDIN_TGT, &ui32, PMIX_UINT32);
                opal_list_append(&job_info, &info->super);
                OBJ_RELEASE(info_str);
            }
#endif
        }

        /* default value: If the user did not tell us where to look for the
         * executable, we assume the current working directory
         */
        if ( !have_wdir ) {
            char cwd[OPAL_PATH_MAX];
            if (OMPI_SUCCESS != (rc = opal_getcwd(cwd, OPAL_PATH_MAX))) {
                OMPI_ERROR_LOG(rc);
                PMIX_APP_FREE(apps, (size_t)count);
                if (NULL != hostfiles) {
                    opal_argv_free(hostfiles);
                }
                if (NULL != dash_host) {
                    opal_argv_free(dash_host);
                }
                return rc;
            }
            info = OBJ_NEW(opal_info_item_t);
            PMIX_INFO_LOAD(&info->info, PMIX_WDIR, cwd, PMIX_STRING);
            opal_list_append(&app_info, &info->super);
        }

        /* leave the map info alone - the launcher will
         * decide where to put things
         */

        ninfo = opal_list_get_size(&app_info);
        if (0 < ninfo) {
            PMIX_INFO_CREATE(app->info, ninfo);
            app->ninfo = ninfo;
            n = 0;
            OPAL_LIST_FOREACH(info, &app_info, opal_info_item_t) {
                PMIX_INFO_XFER(&app->info[n], &info->info);
                ++n;
            }
        }
        OPAL_LIST_DESTRUCT(&app_info);
    } /* for (i = 0 ; i < count ; ++i) */

    /* default the personality - job-level key */
    if (!personality) {
        info = OBJ_NEW(opal_info_item_t);
        PMIX_INFO_LOAD(&info->info, PMIX_PERSONALITY, "ompi5", PMIX_STRING);
        opal_list_append(&job_info, &info->super);
    }

    if (opal_process_info.is_singleton) {
        /* The GDS 'hash' component is known to work for singleton, so
         * recommend it. The user may set this envar to override the setting.
         */
        setenv("PMIX_MCA_gds", "hash", 0);
        /* Start the DVM */
        rc = start_dvm(hostfiles, dash_host);
        if (OPAL_SUCCESS != rc) {
            if (NULL != pinfo) {
                PMIX_INFO_FREE(pinfo, ninfo);
            }
            PMIX_APP_FREE(apps, scount);
            if (NULL != hostfiles) {
                opal_argv_free(hostfiles);
            }
            if (NULL != dash_host) {
                opal_argv_free(dash_host);
            }
            return MPI_ERR_SPAWN;
        }
        /* tell it to forward output to us */
        info = OBJ_NEW(opal_info_item_t);
        PMIX_INFO_LOAD(&info->info, PMIX_FWD_STDOUT, NULL, PMIX_BOOL);
        opal_list_append(&job_info, &info->super);
        info = OBJ_NEW(opal_info_item_t);
        PMIX_INFO_LOAD(&info->info, PMIX_FWD_STDERR, NULL, PMIX_BOOL);
        opal_list_append(&job_info, &info->super);
        info = OBJ_NEW(opal_info_item_t);
        PMIX_INFO_LOAD(&info->info, PMIX_FWD_STDDIAG, NULL, PMIX_BOOL);
        opal_list_append(&job_info, &info->super);
    }
    if (NULL != hostfiles) {
        opal_argv_free(hostfiles);
    }
    if (NULL != dash_host) {
        opal_argv_free(dash_host);
    }

    /* spawn procs */
    ninfo = opal_list_get_size(&job_info);
    if (0 < ninfo) {
        PMIX_INFO_CREATE(pinfo, ninfo);
        n = 0;
        OPAL_LIST_FOREACH(info, &job_info, opal_info_item_t) {
            PMIX_INFO_XFER(&pinfo[n], &info->info);
            ++n;
        }
    }
    OPAL_LIST_DESTRUCT(&job_info);

    pret = PMIx_Spawn(pinfo, ninfo, apps, count, nspace);
    rc = opal_pmix_convert_status(pret);
    if (NULL != pinfo) {
        PMIX_INFO_FREE(pinfo, ninfo);
    }
    PMIX_APP_FREE(apps, scount);

    if (OPAL_SUCCESS != rc) {
        return MPI_ERR_SPAWN;
    }

    return OMPI_SUCCESS;
}

/* Create a rendezvous tag consisting of our name + a random number */
int ompi_dpm_open_port(char *port_name)
{
    uint32_t r;
    char *tmp;

    r = opal_rand(&rnd);
    opal_convert_process_name_to_string(&tmp, OMPI_PROC_MY_NAME);
    snprintf(port_name, MPI_MAX_PORT_NAME-1, "%s:%u", tmp, r);
    port_name[MPI_MAX_PORT_NAME - 1] = '\0';
    free(tmp);
    return OMPI_SUCCESS;
}

int ompi_dpm_close_port(const char *port_name)
{
    /* nothing to do here - user is responsible for the memory */
    return OMPI_SUCCESS;
}

int ompi_dpm_dyn_init(void)
{
    int root=0, rc;
    bool send_first = true;
    ompi_communicator_t *newcomm=NULL;
    char *port_name=NULL, *tmp, *ptr;

    /* check for appropriate env variable */
    tmp = getenv("OMPI_PARENT_PORT");
    if (NULL == tmp) {
        /* nothing to do */
        return OMPI_SUCCESS;
    }

    /* the value passed to us may have quote marks around it to protect
     * the value if passed on the command line. We must remove those
    * to have a correct string
     */
     if ('"' == tmp[0]) {
        /* if the first char is a quote, then so will the last one be */
        tmp[strlen(tmp)-1] = '\0';
        ptr = &tmp[1];
    } else {
        ptr = &tmp[0];
    }
    port_name = strdup(ptr);
    if (NULL == port_name) {
        return OMPI_ERR_OUT_OF_RESOURCE;
    }

    rc = ompi_dpm_connect_accept(MPI_COMM_WORLD, root, port_name, send_first, &newcomm);
    free(port_name);
    if (OMPI_SUCCESS != rc) {
        return rc;
    }

    /* originally, we set comm_parent to comm_null (in comm_init),
     * now we have to decrease the reference counters to the according
     * objects
     */
    OBJ_RELEASE(ompi_mpi_comm_parent->c_local_group);
    OBJ_RELEASE(ompi_mpi_comm_parent->error_handler);
    OBJ_RELEASE(ompi_mpi_comm_parent);

    /* Set the parent communicator */
    ompi_mpi_comm_parent = newcomm;

    /* Set name for debugging purposes */
    snprintf(newcomm->c_name, MPI_MAX_OBJECT_NAME, "MPI_COMM_PARENT");
    newcomm->c_flags |= OMPI_COMM_NAMEISSET;

    return OMPI_SUCCESS;
}

static void cleanup_dpm_disconnect_objs(ompi_dpm_disconnect_obj **objs, int count)
{
    for(int i = 0; i < count; i++) {
        if (NULL != objs[i]->reqs) {
            free(objs[i]->reqs);
        }
        free(objs[i]);
    }
    free(objs);
}

/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* this routine runs through the list of communicators
   and does the disconnect for all dynamic communicators */
int ompi_dpm_dyn_finalize(void)
{
    int i,j=0, max=0;
    ompi_dpm_disconnect_obj **objs=NULL;
    ompi_communicator_t *comm=NULL;

    if (1 <ompi_comm_num_dyncomm) {
        objs = (ompi_dpm_disconnect_obj**)malloc(ompi_comm_num_dyncomm *
                               sizeof(ompi_dpm_disconnect_obj*));
        if (NULL == objs) {
            return OMPI_ERR_OUT_OF_RESOURCE;
        }

        max = ompi_comm_get_num_communicators();
        for (i=3; i<max; i++) {
            comm = ompi_comm_lookup(i);
            if (NULL != comm &&  OMPI_COMM_IS_DYNAMIC(comm)) {
                objs[j++] = disconnect_init(comm);
            }
        }

        if (j != ompi_comm_num_dyncomm) {
            cleanup_dpm_disconnect_objs(objs, j);
            return OMPI_ERROR;
        }

        disconnect_waitall(ompi_comm_num_dyncomm, objs);
        cleanup_dpm_disconnect_objs(objs, ompi_comm_num_dyncomm);
    }

    return OMPI_SUCCESS;
}

/* the next two routines implement a kind of non-blocking barrier.
the only difference is, that you can wait for the completion
of more than one initiated ibarrier. This is required for waiting
for all still connected processes in MPI_Finalize.

disconnect_init returns a handle, which has to be passed in
to disconnect_waitall. The second routine blocks, until
all non-blocking barriers described by the handles are finished.
The communicators can than be released.
*/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/

static ompi_dpm_disconnect_obj *disconnect_init(ompi_communicator_t *comm)
{
    ompi_dpm_disconnect_obj *obj=NULL;
    int ret;
    int i;

    obj = (ompi_dpm_disconnect_obj*)calloc(1,sizeof(ompi_dpm_disconnect_obj));
    if (NULL == obj) {
        opal_output(0, "Could not allocate disconnect object");
        return NULL;
    }

    if (OMPI_COMM_IS_INTER(comm)) {
        obj->size = ompi_comm_remote_size(comm);
    } else {
        obj->size = ompi_comm_size(comm);
    }

    obj->comm = comm;
    obj->reqs = (ompi_request_t**)malloc(2*obj->size*sizeof(ompi_request_t *));
    if (NULL == obj->reqs) {
        opal_output(0, "Could not allocate request array for disconnect object");
        free(obj);
        return NULL;
    }

    /* initiate all isend_irecvs. We use a dummy buffer stored on
       the object, since we are sending zero size messages anyway. */
    for (i=0; i < obj->size; i++) {
        ret = MCA_PML_CALL(irecv(&(obj->buf), 0, MPI_INT, i,
                                 OMPI_COMM_BARRIER_TAG, comm,
                                 &(obj->reqs[2*i])));

        if (OMPI_SUCCESS != ret) {
            opal_output(0, "dpm_disconnect_init: error %d in irecv to process %d", ret, i);
            free(obj->reqs);
            free(obj);
            return NULL;
        }
        ret = MCA_PML_CALL(isend(&(obj->buf), 0, MPI_INT, i,
                                 OMPI_COMM_BARRIER_TAG,
                                 MCA_PML_BASE_SEND_SYNCHRONOUS,
                                 comm, &(obj->reqs[2*i+1])));

        if (OMPI_SUCCESS != ret) {
            opal_output(0, "dpm_disconnect_init: error %d in isend to process %d", ret, i);
            free(obj->reqs);
            free(obj);
            return NULL;
        }
    }

    /* return handle */
    return obj;
}
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* - count how many requests are active
 * - generate a request array large enough to hold
     all active requests
 * - call waitall on the overall request array
 * - free the objects
 */
static int disconnect_waitall (int count, ompi_dpm_disconnect_obj **objs)
{

    ompi_request_t **reqs=NULL;
    char *treq=NULL;
    int totalcount = 0;
    int i;
    int ret;

    for (i=0; i<count; i++) {
        if (NULL == objs[i]) {
            opal_output(0, "Error in comm_disconnect_waitall");
            return OMPI_ERROR;
        }

        totalcount += objs[i]->size;
    }

    reqs = (ompi_request_t**)malloc(2*totalcount*sizeof(ompi_request_t *));
    if (NULL == reqs) {
        opal_output(0, "ompi_comm_disconnect_waitall: error allocating memory");
        return OMPI_ERROR;
    }

    /* generate a single, large array of pending requests */
    treq = (char *)reqs;
    for (i=0; i<count; i++) {
        memcpy(treq, objs[i]->reqs, 2*objs[i]->size * sizeof(ompi_request_t *));
        treq += 2*objs[i]->size * sizeof(ompi_request_t *);
    }

    /* force all non-blocking all-to-alls to finish */
    ret = ompi_request_wait_all(2*totalcount, reqs, MPI_STATUSES_IGNORE);

    free(reqs);

    return ret;
}

/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
static bool ompi_dpm_group_is_dyn (ompi_group_t *group, ompi_jobid_t thisjobid)
{
    int size = group ? ompi_group_size (group) : 0;

    for (int i = 0 ; i < size ; ++i) {
        opal_process_name_t name = ompi_group_get_proc_name (group, i);

        if (thisjobid != ((ompi_process_name_t *) &name)->jobid) {
            /* at least one is different */
            return true;
        }
    }

    return false;
}

/* All we want to do in this function is determine if the number of
 * jobids in the local and/or remote group is > 1. This tells us to
 * set the disconnect flag. We don't actually care what the true
 * number -is-, only that it is > 1
 */
void ompi_dpm_mark_dyncomm(ompi_communicator_t *comm)
{
    bool found;
    ompi_jobid_t thisjobid;

    /* special case for MPI_COMM_NULL */
    if (comm == MPI_COMM_NULL) {
        return;
    }

    thisjobid = ompi_group_get_proc_name (comm->c_local_group, 0).jobid;

    /* loop over all processes in local group and check for
     * a different jobid
     */
    found = ompi_dpm_group_is_dyn (comm->c_local_group, thisjobid);
    if (!found) {
        /* if inter-comm, loop over all processes in remote_group
         * and see if any are different from thisjobid
         */
        found = ompi_dpm_group_is_dyn (comm->c_remote_group, thisjobid);
    }

    /* if a different jobid was found, set the disconnect flag*/
    if (found) {
        ompi_comm_num_dyncomm++;
        OMPI_COMM_SET_DYNAMIC(comm);
    }
}

#if OMPI_HAVE_PRRTE

#define DVM_URI_MSG_LGTH   256

static void set_handler_default(int sig)
{
    struct sigaction act;

    act.sa_handler = SIG_DFL;
    act.sa_flags = 0;
    sigemptyset(&act.sa_mask);

    sigaction(sig, &act, (struct sigaction *)0);
}

static int start_dvm(char **hostfiles, char **dash_host)
{
    pmix_status_t pret;
    int rc;
    char **args = NULL;
    char *cmd, *tmp;
    int p[2];
    int death_pipe[2];
    pid_t pid;
    sigset_t sigs;
    pmix_info_t info;
    int buffer_length, num_chars_read, chunk;
    char *uri;

    /* find the prte binary using the install_dirs support - this also
     * checks to ensure that we can see this executable and it *is* executable by us
     */
    cmd = opal_find_absolute_path("prte");
    if (NULL == cmd) {
        /* guess we couldn't do it - best to abort */
        OMPI_ERROR_LOG(OMPI_ERROR);
        return OMPI_ERROR;
    }

    /* A pipe is used to communicate between the parent and child to
     indicate whether the exec ultimately succeeded or failed, and to
     pass back the URL of the DVM so we can connect to it
     */
    if (pipe(p) < 0) {
        OMPI_ERROR_LOG(OMPI_ERROR);
        free(cmd);
        return OMPI_ERROR;
    }

    /* we also have to give the DVM a pipe it can watch to know when
     * we terminated. Since the DVM is going to be a child of us, it
     * can't just use waitpid to see when we leave - so it will watch
     * the pipe instead
     */
    if (pipe(death_pipe) < 0) {
        OMPI_ERROR_LOG(OMPI_ERROR);
        close(p[0]);
        close(p[1]);
        free(cmd);
        return OMPI_ERROR;
    }

   /* we need to start the PRRTE DVM first so we can
     * spawn processes - see if they gave us any hostfile
     * or dash-host options we should pass along */
    opal_argv_append_nosize(&args, "prte");
    /* ensure we use the PRRTE personality */
    opal_argv_append_nosize(&args, "--prtemca");
    opal_argv_append_nosize(&args, "schizo");
    opal_argv_append_nosize(&args, "prte");
    if (NULL != hostfiles) {
        tmp = opal_argv_join(hostfiles, ',');
        opal_argv_append_nosize(&args, "--hostfile");
        opal_argv_append_nosize(&args, tmp);
        free(tmp);
    }
    if (NULL != dash_host) {
        tmp = opal_argv_join(dash_host, ',');
        opal_argv_append_nosize(&args, "--host");
        opal_argv_append_nosize(&args, tmp);
        free(tmp);
    }
    opal_argv_append_nosize(&args, "--no-ready-msg");
    opal_argv_append_nosize(&args, "--report-uri");
    opal_asprintf(&tmp, "%d", p[1]);
    opal_argv_append_nosize(&args, tmp);
    free(tmp);
    opal_argv_append_nosize(&args, "--singleton");
    opal_argv_append_nosize(&args, OMPI_PRINT_ID(OMPI_PROC_MYID));
    opal_argv_append_nosize(&args, "--keepalive");
    opal_asprintf(&tmp, "%d", death_pipe[0]);
    opal_argv_append_nosize(&args, tmp);
    free(tmp);

    /* Fork off the child */
    pid = fork();
    if (pid < 0) {
        OMPI_ERROR_LOG(OMPI_ERROR);
        close(p[0]);
        close(p[1]);
        close(death_pipe[0]);
        close(death_pipe[1]);
        free(cmd);
        opal_argv_free(args);
        return OMPI_ERROR;
    }

    if (pid == 0) {
        close(p[0]);
        close(death_pipe[1]);
        /* I am the child - exec me */

        /* Set signal handlers back to the default.  Do this close
         to the execve() because the event library may (and likely
         will) reset them.  If we don't do this, the event
         library may have left some set that, at least on some
         OS's, don't get reset via fork() or exec().  Hence, the
         prted could be unkillable (for example). */
        set_handler_default(SIGTERM);
        set_handler_default(SIGINT);
        set_handler_default(SIGHUP);
        set_handler_default(SIGPIPE);
        set_handler_default(SIGCHLD);

        /* Unblock all signals, for many of the same reasons that
         we set the default handlers, above.  This is noticeable
         on Linux where the event library blocks SIGTERM, but we
         don't want that blocked by the prted (or, more
         specifically, we don't want it to be blocked by the
         prted and then inherited by the PRTE processes that it
         forks, making them unkillable by SIGTERM). */
        sigprocmask(0, 0, &sigs);
        sigprocmask(SIG_UNBLOCK, &sigs, 0);

        execv(cmd, args);

        /* if I get here, the execv failed! */
        opal_show_help("help-dpm.txt", "execv-error",
                       true, cmd, strerror(errno));
        exit(1);

    }

    free(cmd);
    /* I am the parent - wait to hear something back and
     * report results
     */
    close(p[1]);  /* parent closes the write - prte will write its contact info to it*/
    close(death_pipe[0]);  /* parent closes the death_pipe's read */
    opal_argv_free(args);

    /* setup the buffer to read the DVM's uri */
    buffer_length = DVM_URI_MSG_LGTH;
    chunk = DVM_URI_MSG_LGTH-1;
    num_chars_read = 0;
    uri = (char*)malloc(buffer_length);
    memset(uri, 0, buffer_length);

    while (0 != (rc = read(p[0], &uri[num_chars_read], chunk))) {
        if (rc < 0 && (EAGAIN == errno || EINTR == errno)) {
            continue;
        } else if (rc < 0) {
            num_chars_read = -1;
            break;
        }
        /* we read something - better get more */
        num_chars_read += rc;
        chunk -= rc;
        if (0 == chunk) {
            chunk = DVM_URI_MSG_LGTH;
            uri = realloc((void*)uri, buffer_length+chunk);
            memset(&uri[buffer_length], 0, chunk);
            buffer_length += chunk;
        }
    }
    close(p[0]);

    if (num_chars_read <= 0) {
        /* we didn't get anything back - this is bad */
        OMPI_ERROR_LOG(OMPI_ERROR);
        free(uri);
        return OMPI_ERROR;
    }

    /* connect to the spawned PRRTE daemon */
    PMIX_INFO_LOAD(&info, PMIX_SERVER_URI, uri, PMIX_STRING);
    free(uri);
    pret = PMIx_Init(NULL, &info, 1);
    rc = opal_pmix_convert_status(pret);
    if (OPAL_SUCCESS != rc) {
        return MPI_ERR_SPAWN;
    }
    /* decrement the PMIx init refcount */
    PMIx_Finalize(NULL, 0);

    /* push our information up to the server */
    PMIx_Commit();

    /* we are no longer a singleton */
     opal_process_info.is_singleton = false;

    return OMPI_SUCCESS;
}
#else
static int start_dvm(char **hostfiles, char **dash_host)
{
    return OMPI_ERROR;
}
#endif