File: shmem.h.in

package info (click to toggle)
openmpi 5.0.8-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,692 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (3377 lines) | stat: -rw-r--r-- 290,312 bytes parent folder | download | duplicates (5)
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
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
/*
 * Copyright (c) 2014-2018 Mellanox Technologies, Inc.
 *                         All rights reserved.
 * Copyright (c) 2014      Intel, Inc. All rights reserved
 * Copyright (c) 2016-2019 Research Organization for Information Science
 *                         and Technology (RIST).  All rights reserved.
 * Copyright (c) 2017-2020 Cisco Systems, Inc.  All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#ifndef OSHMEM_SHMEM_H
#define OSHMEM_SHMEM_H


#include <stddef.h>     /* include for ptrdiff_t */
#include <stdint.h>     /* include for fixed width types */
#if defined(c_plusplus) || defined(__cplusplus)
#    include <complex>
#    define OSHMEM_COMPLEX_TYPE(type)    std::complex<type>
#else
#    include <complex.h>
#    define OSHMEM_COMPLEX_TYPE(type)    type complex
#endif

/*
 * SHMEM version
 */
#undef OSHMEM_MAJOR_VERSION
#undef OSHMEM_MINOR_VERSION
#undef OSHMEM_RELEASE_VERSION


#ifndef OSHMEM_DECLSPEC
#  if defined(OPAL_C_HAVE_VISIBILITY) && (OPAL_C_HAVE_VISIBILITY == 1)
#     define OSHMEM_DECLSPEC __attribute__((visibility("default")))
#  else
#     define OSHMEM_DECLSPEC
#  endif
#endif

#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define OSHMEM_HAVE_C11 1
#else
#define OSHMEM_HAVE_C11 0
#endif

#include "shmem-compat.h"

#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif

#if OSHMEM_HAVE_C11
#define __OSHMEM_VAR_ARG1_EXPAND(_arg1, ...) _arg1
#define __OSHMEM_VAR_ARG1(...) __OSHMEM_VAR_ARG1_EXPAND(__VA_ARGS__, _extra)
#define __OSHMEM_VAR_ARG2(_arg1, ...) __OSHMEM_VAR_ARG1_EXPAND(__VA_ARGS__, _extra)
static inline void __oshmem_datatype_ignore(void) {}
#endif

/*
 * SHMEM_Init_thread constants
 */
enum {
    SHMEM_THREAD_SINGLE,
    SHMEM_THREAD_FUNNELED,
    SHMEM_THREAD_SERIALIZED,
    SHMEM_THREAD_MULTIPLE
};

/*
 * OpenSHMEM API (www.openshmem.org)
 */

/*
 * Environment variables
 */

/* Following environment variables are Mellanox extension */

/* size of symmetric heap in bytes.
 * Can be qualified with the letter 'K', 'M', 'G' or 'T'
 */
#define SHMEM_HEAP_SIZE "SHMEM_SYMMETRIC_SIZE"

/*
 * Type of allocator used by symmetric heap
 */
#define SHMEM_HEAP_TYPE "SHMEM_SYMMETRIC_HEAP_ALLOCATOR"

/*
 * Constants and definitions
 */
#define SHMEM_MAJOR_VERSION             1
#define SHMEM_MINOR_VERSION             4 
#define SHMEM_VENDOR_STRING             "https://www.open-mpi.org/"
#define SHMEM_MAX_NAME_LEN              256

#define SHMEM_CTX_PRIVATE               (1<<0)
#define SHMEM_CTX_SERIALIZED            (1<<1)
#define SHMEM_CTX_NOSTORE               (1<<2)
#define SHMEM_CTX_INVALID               NULL

#define SHMEM_SIGNAL_SET                (1<<0)
#define SHMEM_SIGNAL_ADD                (1<<1)

#define SHMEM_MALLOC_ATOMICS_REMOTE     (1<<0)
#define SHMEM_MALLOC_SIGNAL_REMOTE      (1<<1)

#define SHMEM_TEAM_INVALID              NULL
#define SHMEM_TEAM_NUM_CONTEXTS         (1<<0)

/*
 * Deprecated (but still valid) names
 */
#define _SHMEM_MAJOR_VERSION            SHMEM_MAJOR_VERSION
#define _SHMEM_MINOR_VERSION            SHMEM_MINOR_VERSION
#define _SHMEM_MAX_NAME_LEN             SHMEM_MAX_NAME_LEN

#ifndef OSHMEM_SPEC_VERSION
#define OSHMEM_SPEC_VERSION (SHMEM_MAJOR_VERSION * 10000 + SHMEM_MINOR_VERSION * 100)
#endif

enum shmem_wait_ops {
    SHMEM_CMP_EQ,
    SHMEM_CMP_NE,
    SHMEM_CMP_GT,
    SHMEM_CMP_LE,
    SHMEM_CMP_LT,
    SHMEM_CMP_GE
};

/*
 * Deprecated (but still valid) names
 */
#define _SHMEM_CMP_EQ                   SHMEM_CMP_EQ
#define _SHMEM_CMP_NE                   SHMEM_CMP_NE
#define _SHMEM_CMP_GT                   SHMEM_CMP_GT
#define _SHMEM_CMP_LE                   SHMEM_CMP_LE
#define _SHMEM_CMP_LT                   SHMEM_CMP_LT
#define _SHMEM_CMP_GE                   SHMEM_CMP_GE

#define _SHMEM_BARRIER_SYNC_SIZE        (1)
#define _SHMEM_BCAST_SYNC_SIZE          (1 + _SHMEM_BARRIER_SYNC_SIZE)
#define _SHMEM_COLLECT_SYNC_SIZE        (1 + _SHMEM_BCAST_SYNC_SIZE)
#define _SHMEM_REDUCE_SYNC_SIZE         (1 + _SHMEM_BCAST_SYNC_SIZE)
#define _SHMEM_ALLTOALL_SYNC_SIZE       (_SHMEM_BARRIER_SYNC_SIZE)
#define _SHMEM_ALLTOALLS_SYNC_SIZE      (_SHMEM_BARRIER_SYNC_SIZE)
#define _SHMEM_REDUCE_MIN_WRKDATA_SIZE  (1)
#define _SHMEM_SYNC_VALUE               (-1)

#define SHMEM_BARRIER_SYNC_SIZE        _SHMEM_BARRIER_SYNC_SIZE
#define SHMEM_BCAST_SYNC_SIZE          _SHMEM_BCAST_SYNC_SIZE
#define SHMEM_COLLECT_SYNC_SIZE        _SHMEM_COLLECT_SYNC_SIZE
#define SHMEM_REDUCE_SYNC_SIZE         _SHMEM_REDUCE_SYNC_SIZE
#define SHMEM_ALLTOALL_SYNC_SIZE       _SHMEM_ALLTOALL_SYNC_SIZE
#define SHMEM_ALLTOALLS_SYNC_SIZE      _SHMEM_ALLTOALLS_SYNC_SIZE
#define SHMEM_REDUCE_MIN_WRKDATA_SIZE  _SHMEM_REDUCE_MIN_WRKDATA_SIZE
#define SHMEM_SYNC_VALUE               _SHMEM_SYNC_VALUE
#define SHMEM_SYNC_SIZE                _SHMEM_COLLECT_SYNC_SIZE


/*
 * Initialization routines
 */
OSHMEM_DECLSPEC  void shmem_init(void);
OSHMEM_DECLSPEC  int shmem_init_thread(int requested, int *provided);
OSHMEM_DECLSPEC  void shmem_finalize(void);
OSHMEM_DECLSPEC  void shmem_global_exit(int status);

/*
 * Query routines
 */
OSHMEM_DECLSPEC  int shmem_n_pes(void);
OSHMEM_DECLSPEC  int shmem_my_pe(void);
OSHMEM_DECLSPEC  void shmem_query_thread(int *provided);

/*
 * Info routines
 */
OSHMEM_DECLSPEC void shmem_info_get_version(int *major, int *minor);
OSHMEM_DECLSPEC void shmem_info_get_name(char *name);

/*
 * Accessibility routines
 */
OSHMEM_DECLSPEC int shmem_pe_accessible(int pe);
OSHMEM_DECLSPEC int shmem_addr_accessible(const void *addr, int pe);

/*
 * Symmetric heap routines
 */
OSHMEM_DECLSPEC  void* shmem_malloc(size_t size);
OSHMEM_DECLSPEC  void* shmem_calloc(size_t count, size_t size);
OSHMEM_DECLSPEC  void* shmem_align(size_t align, size_t size);
OSHMEM_DECLSPEC  void* shmem_realloc(void *ptr, size_t size);
OSHMEM_DECLSPEC  void* shmem_malloc_with_hints(size_t size, long hints);
OSHMEM_DECLSPEC  void shmem_free(void* ptr);

/*
 * Remote pointer operations
 */
OSHMEM_DECLSPEC  void *shmem_ptr(const void *ptr, int pe);

/*
 * Communication context operations
 */

typedef struct { int dummy; } * shmem_ctx_t;

#define SHMEM_CTX_DEFAULT oshmem_ctx_default

extern shmem_ctx_t oshmem_ctx_default;

OSHMEM_DECLSPEC int shmem_ctx_create(long options, shmem_ctx_t *ctx);
OSHMEM_DECLSPEC void shmem_ctx_destroy(shmem_ctx_t ctx);

/*
 * Team management operations
 */
typedef struct { int dummy; } * shmem_team_t;
typedef struct { int num_contexts; } shmem_team_config_t;

extern shmem_team_t oshmem_team_shared;
extern shmem_team_t oshmem_team_world;

#define SHMEM_TEAM_SHARED oshmem_team_shared
#define SHMEM_TEAM_WORLD  oshmem_team_world

OSHMEM_DECLSPEC int shmem_team_my_pe(shmem_team_t team);
OSHMEM_DECLSPEC int shmem_team_n_pes(shmem_team_t team);
OSHMEM_DECLSPEC int shmem_team_get_config(shmem_team_t team, long config_mask, shmem_team_config_t *config);
OSHMEM_DECLSPEC int shmem_team_translate_pe(shmem_team_t src_team, int src_pe, shmem_team_t dest_team);
OSHMEM_DECLSPEC int shmem_team_split_strided(shmem_team_t parent_team, int start, int stride, int size, const shmem_team_config_t *config, long config_mask, shmem_team_t *new_team);
OSHMEM_DECLSPEC int shmem_team_split_2d(shmem_team_t parent_team, int xrange, const shmem_team_config_t *xaxis_config, long xaxis_mask, shmem_team_t *xaxis_team, const shmem_team_config_t *yaxis_config, long yaxis_mask, shmem_team_t *yaxis_team);
OSHMEM_DECLSPEC void shmem_team_destroy(shmem_team_t team);
OSHMEM_DECLSPEC int shmem_ctx_get_team(shmem_ctx_t ctx, shmem_team_t *team);
OSHMEM_DECLSPEC int shmem_team_create_ctx(shmem_team_t team, long options, shmem_ctx_t *ctx);

/*
 * Teams-based Collectives
 */

/* Teams sync */
OSHMEM_DECLSPEC  void shmem_team_sync(shmem_team_t team);

/* Teams alltoall */
OSHMEM_DECLSPEC  int shmem_char_alltoall(shmem_team_t team, char *target, const char *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_short_alltoall(shmem_team_t team, short *target, const short *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int_alltoall(shmem_team_t team, int *target, const int *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_long_alltoall(shmem_team_t team, long *target, const long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_float_alltoall(shmem_team_t team, float *target, const float *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_double_alltoall(shmem_team_t team, double *target, const double *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_longlong_alltoall(shmem_team_t team, long long *target, const long long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_schar_alltoall(shmem_team_t team, signed char *target, const signed char *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uchar_alltoall(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ushort_alltoall(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint_alltoall(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ulong_alltoall(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ulonglong_alltoall(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_longdouble_alltoall(shmem_team_t team, long double *target, const long double *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int8_alltoall(shmem_team_t team, int8_t *target, const int8_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int16_alltoall(shmem_team_t team, int16_t *target, const int16_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int32_alltoall(shmem_team_t team, int32_t *target, const int32_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int64_alltoall(shmem_team_t team, int64_t *target, const int64_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint8_alltoall(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint16_alltoall(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint32_alltoall(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint64_alltoall(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_size_alltoall(shmem_team_t team, size_t *target, const size_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ptrdiff_alltoall(shmem_team_t team, ptrdiff_t *target, const ptrdiff_t *source, size_t nelems);
#if OSHMEM_HAVE_C11
#define shmem_alltoall(...)                                             \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                        \
            char*:        shmem_char_alltoall,               	        \
            short*:       shmem_short_alltoall,              	        \
            int*:         shmem_int_alltoall,                	        \
            long*:        shmem_long_alltoall,               	        \
            long long*:   shmem_longlong_alltoall,           	        \
            signed char*:        shmem_schar_alltoall,       	        \
            unsigned char*:      shmem_uchar_alltoall,       	        \
            unsigned short*:     shmem_ushort_alltoall,      	        \
            unsigned int*:       shmem_uint_alltoall,        	        \
            unsigned long*:      shmem_ulong_alltoall,       	        \
            unsigned long long*: shmem_ulonglong_alltoall,   	        \
            float*:       shmem_float_alltoall,              	        \
            double*:      shmem_double_alltoall,             	        \
            long double*: shmem_longdouble_alltoall,         	        \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC  int shmem_alltoallmem(shmem_team_t team, void *target, const void *source, size_t nelems);

/* Teams alltoalls */
OSHMEM_DECLSPEC  int shmem_char_alltoalls(shmem_team_t team, char *target, const char *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_short_alltoalls(shmem_team_t team, short *target, const short *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int_alltoalls(shmem_team_t team, int *target, const int *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_long_alltoalls(shmem_team_t team, long *target, const long *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_float_alltoalls(shmem_team_t team, float *target, const float *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_double_alltoalls(shmem_team_t team, double *target, const double *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_longlong_alltoalls(shmem_team_t team, long long *target, const long long *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_schar_alltoalls(shmem_team_t team, signed char *target, const signed char *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uchar_alltoalls(shmem_team_t team, unsigned char *target, const unsigned char *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ushort_alltoalls(shmem_team_t team, unsigned short *target, const unsigned short *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint_alltoalls(shmem_team_t team, unsigned int *target, const unsigned int *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ulong_alltoalls(shmem_team_t team, unsigned long *target, const unsigned long *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ulonglong_alltoalls(shmem_team_t team, unsigned long long *target, const unsigned long long *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_longdouble_alltoalls(shmem_team_t team, long double *target, const long double *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int8_alltoalls(shmem_team_t team, int8_t *target, const int8_t *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int16_alltoalls(shmem_team_t team, int16_t *target, const int16_t *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int32_alltoalls(shmem_team_t team, int32_t *target, const int32_t *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int64_alltoalls(shmem_team_t team, int64_t *target, const int64_t *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint8_alltoalls(shmem_team_t team, uint8_t *target, const uint8_t *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint16_alltoalls(shmem_team_t team, uint16_t *target, const uint16_t *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint32_alltoalls(shmem_team_t team, uint32_t *target, const uint32_t *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint64_alltoalls(shmem_team_t team, uint64_t *target, const uint64_t *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_size_alltoalls(shmem_team_t team, size_t *target, const size_t *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ptrdiff_alltoalls(shmem_team_t team, ptrdiff_t *target, const ptrdiff_t *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);
#if OSHMEM_HAVE_C11
#define shmem_alltoalls(...)                                             \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                        \
            char*:        shmem_char_alltoalls,                    \
            short*:       shmem_short_alltoalls,                   \
            int*:         shmem_int_alltoalls,                     \
            long*:        shmem_long_alltoalls,                    \
            long long*:   shmem_longlong_alltoalls,                \
            signed char*:        shmem_schar_alltoalls,            \
            unsigned char*:      shmem_uchar_alltoalls,            \
            unsigned short*:     shmem_ushort_alltoalls,           \
            unsigned int*:       shmem_uint_alltoalls,             \
            unsigned long*:      shmem_ulong_alltoalls,            \
            unsigned long long*: shmem_ulonglong_alltoalls,        \
            float*:       shmem_float_alltoalls,                   \
            double*:      shmem_double_alltoalls,                  \
            long double*: shmem_longdouble_alltoalls,              \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC  int shmem_alltoallsmem(shmem_team_t team, void *target, const void *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems);


/* Teams broadcast */
OSHMEM_DECLSPEC  int shmem_char_broadcast(shmem_team_t team, char *target, const char *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_short_broadcast(shmem_team_t team, short *target, const short *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_int_broadcast(shmem_team_t team, int *target, const int *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_long_broadcast(shmem_team_t team, long *target, const long *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_float_broadcast(shmem_team_t team, float *target, const float *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_double_broadcast(shmem_team_t team, double *target, const double *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_longlong_broadcast(shmem_team_t team, long long *target, const long long *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_schar_broadcast(shmem_team_t team, signed char *target, const signed char *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_uchar_broadcast(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_ushort_broadcast(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_uint_broadcast(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_ulong_broadcast(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_ulonglong_broadcast(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_longdouble_broadcast(shmem_team_t team, long double *target, const long double *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_int8_broadcast(shmem_team_t team, int8_t *target, const int8_t *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_int16_broadcast(shmem_team_t team, int16_t *target, const int16_t *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_int32_broadcast(shmem_team_t team, int32_t *target, const int32_t *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_int64_broadcast(shmem_team_t team, int64_t *target, const int64_t *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_uint8_broadcast(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_uint16_broadcast(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_uint32_broadcast(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_uint64_broadcast(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_size_broadcast(shmem_team_t team, size_t *target, const size_t *source, size_t nelems, int PE_root);
OSHMEM_DECLSPEC  int shmem_ptrdiff_broadcast(shmem_team_t team, ptrdiff_t *target, const ptrdiff_t *source, size_t nelems, int PE_root);
#if OSHMEM_HAVE_C11
#define shmem_broadcast(...)                                       \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                   \
            char*:        shmem_char_broadcast,                    \
            short*:       shmem_short_broadcast,                   \
            int*:         shmem_int_broadcast,                     \
            long*:        shmem_long_broadcast,                    \
            long long*:   shmem_longlong_broadcast,                \
            signed char*:        shmem_schar_broadcast,            \
            unsigned char*:      shmem_uchar_broadcast,            \
            unsigned short*:     shmem_ushort_broadcast,           \
            unsigned int*:       shmem_uint_broadcast,             \
            unsigned long*:      shmem_ulong_broadcast,            \
            unsigned long long*: shmem_ulonglong_broadcast,        \
            float*:       shmem_float_broadcast,                   \
            double*:      shmem_double_broadcast,                  \
            long double*: shmem_longdouble_broadcast,              \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC  int shmem_broadcastmem(shmem_team_t team, void *target, const void *source, size_t nelems, int PE_root);

/* Teams collect */
OSHMEM_DECLSPEC  int shmem_char_collect(shmem_team_t team, char *target, const char *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_short_collect(shmem_team_t team, short *target, const short *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int_collect(shmem_team_t team, int *target, const int *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_long_collect(shmem_team_t team, long *target, const long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_float_collect(shmem_team_t team, float *target, const float *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_double_collect(shmem_team_t team, double *target, const double *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_longlong_collect(shmem_team_t team, long long *target, const long long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_schar_collect(shmem_team_t team, signed char *target, const signed char *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uchar_collect(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ushort_collect(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint_collect(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ulong_collect(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ulonglong_collect(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_longdouble_collect(shmem_team_t team, long double *target, const long double *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int8_collect(shmem_team_t team, int8_t *target, const int8_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int16_collect(shmem_team_t team, int16_t *target, const int16_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int32_collect(shmem_team_t team, int32_t *target, const int32_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int64_collect(shmem_team_t team, int64_t *target, const int64_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint8_collect(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint16_collect(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint32_collect(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint64_collect(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_size_collect(shmem_team_t team, size_t *target, const size_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ptrdiff_collect(shmem_team_t team, ptrdiff_t *target, const ptrdiff_t *source, size_t nelems);
#if OSHMEM_HAVE_C11
#define shmem_collect(...)                                         \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                   \
            char*:        shmem_char_collect,                      \
            short*:       shmem_short_collect,                     \
            int*:         shmem_int_collect,                       \
            long*:        shmem_long_collect,                      \
            long long*:   shmem_longlong_collect,                  \
            signed char*:        shmem_schar_collect,              \
            unsigned char*:      shmem_uchar_collect,              \
            unsigned short*:     shmem_ushort_collect,             \
            unsigned int*:       shmem_uint_collect,               \
            unsigned long*:      shmem_ulong_collect,              \
            unsigned long long*: shmem_ulonglong_collect,          \
            float*:       shmem_float_collect,                     \
            double*:      shmem_double_collect,                    \
            long double*: shmem_longdouble_collect,                \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif


OSHMEM_DECLSPEC  int shmem_collectmem(shmem_team_t team, void *target, const void *source, size_t nelems);

/* Teams fcollect */
OSHMEM_DECLSPEC  int shmem_char_fcollect(shmem_team_t team, char *target, const char *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_short_fcollect(shmem_team_t team, short *target, const short *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int_fcollect(shmem_team_t team, int *target, const int *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_long_fcollect(shmem_team_t team, long *target, const long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_float_fcollect(shmem_team_t team, float *target, const float *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_double_fcollect(shmem_team_t team, double *target, const double *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_longlong_fcollect(shmem_team_t team, long long *target, const long long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_schar_fcollect(shmem_team_t team, signed char *target, const signed char *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uchar_fcollect(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ushort_fcollect(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint_fcollect(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ulong_fcollect(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ulonglong_fcollect(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_longdouble_fcollect(shmem_team_t team, long double *target, const long double *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int8_fcollect(shmem_team_t team, int8_t *target, const int8_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int16_fcollect(shmem_team_t team, int16_t *target, const int16_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int32_fcollect(shmem_team_t team, int32_t *target, const int32_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_int64_fcollect(shmem_team_t team, int64_t *target, const int64_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint8_fcollect(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint16_fcollect(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint32_fcollect(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_uint64_fcollect(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_size_fcollect(shmem_team_t team, size_t *target, const size_t *source, size_t nelems);
OSHMEM_DECLSPEC  int shmem_ptrdiff_fcollect(shmem_team_t team, ptrdiff_t *target, const ptrdiff_t *source, size_t nelems);
#if OSHMEM_HAVE_C11
#define shmem_fcollect(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                   \
            char*:        shmem_char_fcollect,                     \
            short*:       shmem_short_fcollect,                    \
            int*:         shmem_int_fcollect,                      \
            long*:        shmem_long_fcollect,                     \
            long long*:   shmem_longlong_fcollect,                 \
            signed char*:        shmem_schar_fcollect,             \
            unsigned char*:      shmem_uchar_fcollect,             \
            unsigned short*:     shmem_ushort_fcollect,            \
            unsigned int*:       shmem_uint_fcollect,              \
            unsigned long*:      shmem_ulong_fcollect,             \
            unsigned long long*: shmem_ulonglong_fcollect,         \
            float*:       shmem_float_fcollect,                    \
            double*:      shmem_double_fcollect,                   \
            long double*: shmem_longdouble_fcollect,               \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC  int shmem_fcollectmem(shmem_team_t team, void *target, const void *source, size_t nelems);



/* Teams reduction: AND */
OSHMEM_DECLSPEC  int shmem_uchar_and_reduce(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ushort_and_reduce(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint_and_reduce(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulong_and_reduce(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulonglong_and_reduce(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int_and_reduce(shmem_team_t team, int *target, const int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longlong_and_reduce(shmem_team_t team, long long *target, const long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int8_and_reduce(shmem_team_t team, int8_t *target, const int8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int16_and_reduce(shmem_team_t team, int16_t *target, const int16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int32_and_reduce(shmem_team_t team, int32_t *target, const int32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int64_and_reduce(shmem_team_t team, int64_t *target, const int64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint8_and_reduce(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint16_and_reduce(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint32_and_reduce(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint64_and_reduce(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_size_and_reduce(shmem_team_t team, size_t *target, const size_t *source, size_t nreduce);
#if OSHMEM_HAVE_C11
#define shmem_and_reduce(...)                                      \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                   \
            unsigned char*:      shmem_uchar_and_reduce,           \
            unsigned short*:     shmem_ushort_and_reduce,          \
            unsigned int*:       shmem_uint_and_reduce,            \
            unsigned long*:      shmem_ulong_and_reduce,           \
            unsigned long long*: shmem_ulonglong_and_reduce,       \
            int8_t*: shmem_int8_and_reduce,                        \
            int16_t*: shmem_int16_and_reduce,                      \
            int32_t*: shmem_int32_and_reduce,                      \
            int64_t*: shmem_int64_and_reduce,                      \
            long long*: shmem_longlong_and_reduce,                 \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif


/* Teams reduction: OR */
OSHMEM_DECLSPEC  int shmem_uchar_or_reduce(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ushort_or_reduce(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint_or_reduce(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulong_or_reduce(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulonglong_or_reduce(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int_or_reduce(shmem_team_t team, int *target, const int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longlong_or_reduce(shmem_team_t team, long long *target, const long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int8_or_reduce(shmem_team_t team, int8_t *target, const int8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int16_or_reduce(shmem_team_t team, int16_t *target, const int16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int32_or_reduce(shmem_team_t team, int32_t *target, const int32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int64_or_reduce(shmem_team_t team, int64_t *target, const int64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint8_or_reduce(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint16_or_reduce(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint32_or_reduce(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint64_or_reduce(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_size_or_reduce(shmem_team_t team, size_t *target, const size_t *source, size_t nreduce);
#if OSHMEM_HAVE_C11
#define shmem_or_reduce(...)                                       \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                   \
            unsigned char*:      shmem_uchar_or_reduce,            \
            unsigned short*:     shmem_ushort_or_reduce,           \
            unsigned int*:       shmem_uint_or_reduce,             \
            unsigned long*:      shmem_ulong_or_reduce,            \
            unsigned long long*: shmem_ulonglong_or_reduce,        \
            int8_t*: shmem_int8_or_reduce,                         \
            int16_t*: shmem_int16_or_reduce,                       \
            int32_t*: shmem_int32_or_reduce,                       \
            int64_t*: shmem_int64_or_reduce,                       \
            long long*: shmem_longlong_or_reduce,                  \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif



/* Teams reduction: XOR */
OSHMEM_DECLSPEC  int shmem_uchar_xor_reduce(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ushort_xor_reduce(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint_xor_reduce(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulong_xor_reduce(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulonglong_xor_reduce(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int_xor_reduce(shmem_team_t team, int *target, const int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longlong_xor_reduce(shmem_team_t team, long long *target, const long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int8_xor_reduce(shmem_team_t team, int8_t *target, const int8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int16_xor_reduce(shmem_team_t team, int16_t *target, const int16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int32_xor_reduce(shmem_team_t team, int32_t *target, const int32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int64_xor_reduce(shmem_team_t team, int64_t *target, const int64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint8_xor_reduce(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint16_xor_reduce(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint32_xor_reduce(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint64_xor_reduce(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_size_xor_reduce(shmem_team_t team, size_t *target, const size_t *source, size_t nreduce);
#if OSHMEM_HAVE_C11
#define shmem_xor_reduce(...)                                      \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                   \
            unsigned char*:      shmem_uchar_xor_reduce,           \
            unsigned short*:     shmem_ushort_xor_reduce,          \
            unsigned int*:       shmem_uint_xor_reduce,            \
            unsigned long*:      shmem_ulong_xor_reduce,           \
            unsigned long long*: shmem_ulonglong_xor_reduce,       \
            int8_t*: shmem_int8_xor_reduce,                        \
            int16_t*: shmem_int16_xor_reduce,                      \
            int32_t*: shmem_int32_xor_reduce,                      \
            int64_t*: shmem_int64_xor_reduce,                      \
            long long*: shmem_longlong_xor_reduce,                 \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif

/* Teams reduction: MAX */
OSHMEM_DECLSPEC  int shmem_char_max_reduce(shmem_team_t team, char *target, const char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_short_max_reduce(shmem_team_t team, short *target, const short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int_max_reduce(shmem_team_t team, int *target, const int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_long_max_reduce(shmem_team_t team, long *target, const long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_float_max_reduce(shmem_team_t team, float *target, const float *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_double_max_reduce(shmem_team_t team, double *target, const double *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longlong_max_reduce(shmem_team_t team, long long *target, const long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_schar_max_reduce(shmem_team_t team, signed char *target, const signed char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uchar_max_reduce(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ushort_max_reduce(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint_max_reduce(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulong_max_reduce(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulonglong_max_reduce(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longdouble_max_reduce(shmem_team_t team, long double *target, const long double *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int8_max_reduce(shmem_team_t team, int8_t *target, const int8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int16_max_reduce(shmem_team_t team, int16_t *target, const int16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int32_max_reduce(shmem_team_t team, int32_t *target, const int32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int64_max_reduce(shmem_team_t team, int64_t *target, const int64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint8_max_reduce(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint16_max_reduce(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint32_max_reduce(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint64_max_reduce(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_size_max_reduce(shmem_team_t team, size_t *target, const size_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ptrdiff_max_reduce(shmem_team_t team, ptrdiff_t *target, const ptrdiff_t *source, size_t nreduce);
#if OSHMEM_HAVE_C11
#define shmem_max_reduce(...)                                      \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                   \
            char*:        shmem_char_max_reduce,                   \
            short*:       shmem_short_max_reduce,                  \
            int*:         shmem_int_max_reduce,                    \
            long*:        shmem_long_max_reduce,                   \
            long long*:   shmem_longlong_max_reduce,               \
            signed char*:        shmem_schar_max_reduce,           \
            unsigned char*:      shmem_uchar_max_reduce,           \
            unsigned short*:     shmem_ushort_max_reduce,          \
            unsigned int*:       shmem_uint_max_reduce,            \
            unsigned long*:      shmem_ulong_max_reduce,           \
            unsigned long long*: shmem_ulonglong_max_reduce,       \
            float*:       shmem_float_max_reduce,                  \
            double*:      shmem_double_max_reduce,                 \
            long double*: shmem_longdouble_max_reduce,             \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif


/* Teams reduction: MIN */
OSHMEM_DECLSPEC  int shmem_char_min_reduce(shmem_team_t team, char *target, const char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_short_min_reduce(shmem_team_t team, short *target, const short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int_min_reduce(shmem_team_t team, int *target, const int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_long_min_reduce(shmem_team_t team, long *target, const long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_float_min_reduce(shmem_team_t team, float *target, const float *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_double_min_reduce(shmem_team_t team, double *target, const double *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longlong_min_reduce(shmem_team_t team, long long *target, const long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_schar_min_reduce(shmem_team_t team, signed char *target, const signed char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uchar_min_reduce(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ushort_min_reduce(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint_min_reduce(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulong_min_reduce(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulonglong_min_reduce(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longdouble_min_reduce(shmem_team_t team, long double *target, const long double *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int8_min_reduce(shmem_team_t team, int8_t *target, const int8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int16_min_reduce(shmem_team_t team, int16_t *target, const int16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int32_min_reduce(shmem_team_t team, int32_t *target, const int32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int64_min_reduce(shmem_team_t team, int64_t *target, const int64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint8_min_reduce(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint16_min_reduce(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint32_min_reduce(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint64_min_reduce(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_size_min_reduce(shmem_team_t team, size_t *target, const size_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ptrdiff_min_reduce(shmem_team_t team, ptrdiff_t *target, const ptrdiff_t *source, size_t nreduce);
#if OSHMEM_HAVE_C11
#define shmem_min_reduce(...)                                      \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                   \
            char*:        shmem_char_min_reduce,               	\
            short*:       shmem_short_min_reduce,              	\
            int*:         shmem_int_min_reduce,                	\
            long*:        shmem_long_min_reduce,               	\
            long long*:   shmem_longlong_min_reduce,           	\
            signed char*:        shmem_schar_min_reduce,       	\
            unsigned char*:      shmem_uchar_min_reduce,       	\
            unsigned short*:     shmem_ushort_min_reduce,      	\
            unsigned int*:       shmem_uint_min_reduce,        	\
            unsigned long*:      shmem_ulong_min_reduce,       	\
            unsigned long long*: shmem_ulonglong_min_reduce,   	\
            float*:       shmem_float_min_reduce,              	\
            double*:      shmem_double_min_reduce,             	\
            long double*: shmem_longdouble_min_reduce,         	\
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif



/* Teams reduction: SUM */
OSHMEM_DECLSPEC  int shmem_char_sum_reduce(shmem_team_t team, char *target, const char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_short_sum_reduce(shmem_team_t team, short *target, const short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int_sum_reduce(shmem_team_t team, int *target, const int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_long_sum_reduce(shmem_team_t team, long *target, const long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_float_sum_reduce(shmem_team_t team, float *target, const float *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_double_sum_reduce(shmem_team_t team, double *target, const double *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longlong_sum_reduce(shmem_team_t team, long long *target, const long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_schar_sum_reduce(shmem_team_t team, signed char *target, const signed char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uchar_sum_reduce(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ushort_sum_reduce(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint_sum_reduce(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulong_sum_reduce(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulonglong_sum_reduce(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longdouble_sum_reduce(shmem_team_t team, long double *target, const long double *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int8_sum_reduce(shmem_team_t team, int8_t *target, const int8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int16_sum_reduce(shmem_team_t team, int16_t *target, const int16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int32_sum_reduce(shmem_team_t team, int32_t *target, const int32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int64_sum_reduce(shmem_team_t team, int64_t *target, const int64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint8_sum_reduce(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint16_sum_reduce(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint32_sum_reduce(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint64_sum_reduce(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_size_sum_reduce(shmem_team_t team, size_t *target, const size_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ptrdiff_sum_reduce(shmem_team_t team, ptrdiff_t *target, const ptrdiff_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_complexd_sum_reduce(shmem_team_t team, OSHMEM_COMPLEX_TYPE(double) *target, const OSHMEM_COMPLEX_TYPE(double) *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_complexf_sum_reduce(shmem_team_t team, OSHMEM_COMPLEX_TYPE(float) *target, const OSHMEM_COMPLEX_TYPE(float) *source, size_t nreduce);
#if OSHMEM_HAVE_C11
#define shmem_sum_reduce(...)                                           \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                        \
            char*:        shmem_char_sum_reduce,               		\
            short*:       shmem_short_sum_reduce,              		\
            int*:         shmem_int_sum_reduce,                		\
            long*:        shmem_long_sum_reduce,               		\
            long long*:   shmem_longlong_sum_reduce,           		\
            signed char*:        shmem_schar_sum_reduce,       		\
            unsigned char*:      shmem_uchar_sum_reduce,       		\
            unsigned short*:     shmem_ushort_sum_reduce,      		\
            unsigned int*:       shmem_uint_sum_reduce,        		\
            unsigned long*:      shmem_ulong_sum_reduce,       		\
            unsigned long long*: shmem_ulonglong_sum_reduce,   		\
            float*:       shmem_float_sum_reduce,              		\
            double*:      shmem_double_sum_reduce,             		\
            long double*: shmem_longdouble_sum_reduce,         		\
            OSHMEM_COMPLEX_TYPE(double)*: shmem_complexd_sum_reduce,    \
            OSHMEM_COMPLEX_TYPE(float)*: shmem_complexf_sum_reduce,     \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif


/* Teams reduction: PROD */
OSHMEM_DECLSPEC  int shmem_char_prod_reduce(shmem_team_t team, char *target, const char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_short_prod_reduce(shmem_team_t team, short *target, const short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int_prod_reduce(shmem_team_t team, int *target, const int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_long_prod_reduce(shmem_team_t team, long *target, const long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_float_prod_reduce(shmem_team_t team, float *target, const float *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_double_prod_reduce(shmem_team_t team, double *target, const double *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longlong_prod_reduce(shmem_team_t team, long long *target, const long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_schar_prod_reduce(shmem_team_t team, signed char *target, const signed char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uchar_prod_reduce(shmem_team_t team, unsigned char *target, const unsigned char *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ushort_prod_reduce(shmem_team_t team, unsigned short *target, const unsigned short *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint_prod_reduce(shmem_team_t team, unsigned int *target, const unsigned int *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulong_prod_reduce(shmem_team_t team, unsigned long *target, const unsigned long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ulonglong_prod_reduce(shmem_team_t team, unsigned long long *target, const unsigned long long *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_longdouble_prod_reduce(shmem_team_t team, long double *target, const long double *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int8_prod_reduce(shmem_team_t team, int8_t *target, const int8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int16_prod_reduce(shmem_team_t team, int16_t *target, const int16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int32_prod_reduce(shmem_team_t team, int32_t *target, const int32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_int64_prod_reduce(shmem_team_t team, int64_t *target, const int64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint8_prod_reduce(shmem_team_t team, uint8_t *target, const uint8_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint16_prod_reduce(shmem_team_t team, uint16_t *target, const uint16_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint32_prod_reduce(shmem_team_t team, uint32_t *target, const uint32_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_uint64_prod_reduce(shmem_team_t team, uint64_t *target, const uint64_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_size_prod_reduce(shmem_team_t team, size_t *target, const size_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_ptrdiff_prod_reduce(shmem_team_t team, ptrdiff_t *target, const ptrdiff_t *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_complexd_prod_reduce(shmem_team_t team, OSHMEM_COMPLEX_TYPE(double) *target, const OSHMEM_COMPLEX_TYPE(double) *source, size_t nreduce);
OSHMEM_DECLSPEC  int shmem_complexf_prod_reduce(shmem_team_t team, OSHMEM_COMPLEX_TYPE(float) *target, const OSHMEM_COMPLEX_TYPE(float) *source, size_t nreduce);
#if OSHMEM_HAVE_C11
#define shmem_prod_reduce(...)                                                  \
    _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),                                \
            char*:        shmem_char_prod_reduce,               		\
            short*:       shmem_short_prod_reduce,              		\
            int*:         shmem_int_prod_reduce,                		\
            long*:        shmem_long_prod_reduce,               		\
            long long*:   shmem_longlong_prod_reduce,           		\
            signed char*:        shmem_schar_prod_reduce,       		\
            unsigned char*:      shmem_uchar_prod_reduce,       		\
            unsigned short*:     shmem_ushort_prod_reduce,      		\
            unsigned int*:       shmem_uint_prod_reduce,        		\
            unsigned long*:      shmem_ulong_prod_reduce,       		\
            unsigned long long*: shmem_ulonglong_prod_reduce,   		\
            float*:       shmem_float_prod_reduce,              		\
            double*:      shmem_double_prod_reduce,             		\
            long double*: shmem_longdouble_prod_reduce,         		\
            OSHMEM_COMPLEX_TYPE(double)*: shmem_complexd_prod_reduce,           \
            OSHMEM_COMPLEX_TYPE(float)*: shmem_complexf_prod_reduce,            \
            default:      __oshmem_datatype_ignore)(__VA_ARGS__)
#endif


/*
 * Elemental put routines
 */
OSHMEM_DECLSPEC  void shmem_ctx_char_p(shmem_ctx_t ctx, char* addr, char value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_short_p(shmem_ctx_t ctx, short* addr, short value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int_p(shmem_ctx_t ctx, int* addr, int value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_long_p(shmem_ctx_t ctx, long* addr, long value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_float_p(shmem_ctx_t ctx, float* addr, float value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_double_p(shmem_ctx_t ctx, double* addr, double value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longlong_p(shmem_ctx_t ctx, long long* addr, long long value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_schar_p(shmem_ctx_t ctx, signed char* addr, signed char value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uchar_p(shmem_ctx_t ctx, unsigned char* addr, unsigned char value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ushort_p(shmem_ctx_t ctx, unsigned short* addr, unsigned short value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint_p(shmem_ctx_t ctx, unsigned int* addr, unsigned int value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulong_p(shmem_ctx_t ctx, unsigned long* addr, unsigned long value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulonglong_p(shmem_ctx_t ctx, unsigned long long* addr, unsigned long long value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longdouble_p(shmem_ctx_t ctx, long double* addr, long double value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int8_p(shmem_ctx_t ctx, int8_t* addr, int8_t value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int16_p(shmem_ctx_t ctx, int16_t* addr, int16_t value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int32_p(shmem_ctx_t ctx, int32_t* addr, int32_t value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int64_p(shmem_ctx_t ctx, int64_t* addr, int64_t value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint8_p(shmem_ctx_t ctx, uint8_t* addr, uint8_t value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint16_p(shmem_ctx_t ctx, uint16_t* addr, uint16_t value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint32_p(shmem_ctx_t ctx, uint32_t* addr, uint32_t value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint64_p(shmem_ctx_t ctx, uint64_t* addr, uint64_t value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_size_p(shmem_ctx_t ctx, size_t* addr, size_t value, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ptrdiff_p(shmem_ctx_t ctx, ptrdiff_t* addr, ptrdiff_t value, int pe);

OSHMEM_DECLSPEC  void shmem_char_p(char* addr, char value, int pe);
OSHMEM_DECLSPEC  void shmem_short_p(short* addr, short value, int pe);
OSHMEM_DECLSPEC  void shmem_int_p(int* addr, int value, int pe);
OSHMEM_DECLSPEC  void shmem_long_p(long* addr, long value, int pe);
OSHMEM_DECLSPEC  void shmem_float_p(float* addr, float value, int pe);
OSHMEM_DECLSPEC  void shmem_double_p(double* addr, double value, int pe);
OSHMEM_DECLSPEC  void shmem_longlong_p(long long* addr, long long value, int pe);
OSHMEM_DECLSPEC  void shmem_schar_p(signed char* addr, signed char value, int pe);
OSHMEM_DECLSPEC  void shmem_uchar_p(unsigned char* addr, unsigned char value, int pe);
OSHMEM_DECLSPEC  void shmem_ushort_p(unsigned short* addr, unsigned short value, int pe);
OSHMEM_DECLSPEC  void shmem_uint_p(unsigned int* addr, unsigned int value, int pe);
OSHMEM_DECLSPEC  void shmem_ulong_p(unsigned long* addr, unsigned long value, int pe);
OSHMEM_DECLSPEC  void shmem_ulonglong_p(unsigned long long* addr, unsigned long long value, int pe);
OSHMEM_DECLSPEC  void shmem_longdouble_p(long double* addr, long double value, int pe);
OSHMEM_DECLSPEC  void shmem_int8_p(int8_t* addr, int8_t value, int pe);
OSHMEM_DECLSPEC  void shmem_int16_p(int16_t* addr, int16_t value, int pe);
OSHMEM_DECLSPEC  void shmem_int32_p(int32_t* addr, int32_t value, int pe);
OSHMEM_DECLSPEC  void shmem_int64_p(int64_t* addr, int64_t value, int pe);
OSHMEM_DECLSPEC  void shmem_uint8_p(uint8_t* addr, uint8_t value, int pe);
OSHMEM_DECLSPEC  void shmem_uint16_p(uint16_t* addr, uint16_t value, int pe);
OSHMEM_DECLSPEC  void shmem_uint32_p(uint32_t* addr, uint32_t value, int pe);
OSHMEM_DECLSPEC  void shmem_uint64_p(uint64_t* addr, uint64_t value, int pe);
OSHMEM_DECLSPEC  void shmem_size_p(size_t* addr, size_t value, int pe);
OSHMEM_DECLSPEC  void shmem_ptrdiff_p(ptrdiff_t* addr, ptrdiff_t value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_p(...)                                                 \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                     \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \
                char*:        shmem_ctx_char_p,                      \
                short*:       shmem_ctx_short_p,                     \
                int*:         shmem_ctx_int_p,                       \
                long*:        shmem_ctx_long_p,                      \
                long long*:   shmem_ctx_longlong_p,                  \
                signed char*:        shmem_ctx_schar_p,              \
                unsigned char*:      shmem_ctx_uchar_p,              \
                unsigned short*:     shmem_ctx_ushort_p,             \
                unsigned int*:       shmem_ctx_uint_p,               \
                unsigned long*:      shmem_ctx_ulong_p,              \
                unsigned long long*: shmem_ctx_ulonglong_p,          \
                float*:       shmem_ctx_float_p,                     \
                double*:      shmem_ctx_double_p,                    \
                long double*: shmem_ctx_longdouble_p,                \
                default:      __oshmem_datatype_ignore),             \
            char*:        shmem_char_p,                              \
            short*:       shmem_short_p,                             \
            int*:         shmem_int_p,                               \
            long*:        shmem_long_p,                              \
            long long*:   shmem_longlong_p,                          \
            signed char*:        shmem_schar_p,                      \
            unsigned char*:      shmem_uchar_p,                      \
            unsigned short*:     shmem_ushort_p,                     \
            unsigned int*:       shmem_uint_p,                       \
            unsigned long*:      shmem_ulong_p,                      \
            unsigned long long*: shmem_ulonglong_p,                  \
            float*:       shmem_float_p,                             \
            double*:      shmem_double_p,                            \
            long double*: shmem_longdouble_p)(__VA_ARGS__)
#endif

/*
 * Block data put routines
 */
OSHMEM_DECLSPEC  void shmem_ctx_char_put(shmem_ctx_t ctx, char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_short_put(shmem_ctx_t ctx, short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int_put(shmem_ctx_t ctx, int *target, const int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_long_put(shmem_ctx_t ctx, long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_float_put(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_double_put(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longlong_put(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_schar_put(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uchar_put(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ushort_put(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint_put(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulong_put(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulonglong_put(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longdouble_put(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int8_put(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int16_put(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int32_put(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int64_put(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint8_put(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint16_put(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint32_put(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint64_put(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_size_put(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ptrdiff_put(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe);

OSHMEM_DECLSPEC  void shmem_char_put(char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_short_put(short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int_put(int *target, const int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_long_put(long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_float_put(float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_double_put(double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_longlong_put(long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_schar_put(signed char *target, const signed char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uchar_put(unsigned char *target, const unsigned char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ushort_put(unsigned short *target, const unsigned short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint_put(unsigned int *target, const unsigned int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ulong_put(unsigned long *target, const unsigned long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ulonglong_put(unsigned long long *target, const unsigned long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_longdouble_put(long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int8_put(int8_t *target, const int8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int16_put(int16_t *target, const int16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int32_put(int32_t *target, const int32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int64_put(int64_t *target, const int64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint8_put(uint8_t *target, const uint8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint16_put(uint16_t *target, const uint16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint32_put(uint32_t *target, const uint32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint64_put(uint64_t *target, const uint64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_size_put(size_t *target, const size_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ptrdiff_put(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe);
#if OSHMEM_HAVE_C11
#define shmem_put(...)                                              \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                    \
            shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),\
                char*:        shmem_ctx_char_put,                   \
                short*:       shmem_ctx_short_put,                  \
                int*:         shmem_ctx_int_put,                    \
                long*:        shmem_ctx_long_put,                   \
                long long*:   shmem_ctx_longlong_put,               \
                signed char*:        shmem_ctx_schar_put,           \
                unsigned char*:      shmem_ctx_uchar_put,           \
                unsigned short*:     shmem_ctx_ushort_put,          \
                unsigned int*:       shmem_ctx_uint_put,            \
                unsigned long*:      shmem_ctx_ulong_put,           \
                unsigned long long*: shmem_ctx_ulonglong_put,       \
                float*:       shmem_ctx_float_put,                  \
                double*:      shmem_ctx_double_put,                 \
                long double*: shmem_ctx_longdouble_put,             \
                default:      __oshmem_datatype_ignore),            \
            char*:        shmem_char_put,                           \
            short*:       shmem_short_put,                          \
            int*:         shmem_int_put,                            \
            long*:        shmem_long_put,                           \
            long long*:   shmem_longlong_put,                       \
            signed char*:        shmem_schar_put,                   \
            unsigned char*:      shmem_uchar_put,                   \
            unsigned short*:     shmem_ushort_put,                  \
            unsigned int*:       shmem_uint_put,                    \
            unsigned long*:      shmem_ulong_put,                   \
            unsigned long long*: shmem_ulonglong_put,               \
            float*:       shmem_float_put,                          \
            double*:      shmem_double_put,                         \
            long double*: shmem_longdouble_put)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC  void shmem_ctx_put8(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_put16(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_put32(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_put64(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_put128(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_putmem(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);

OSHMEM_DECLSPEC  void shmem_put8(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_put16(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_put32(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_put64(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_put128(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_putmem(void *target, const void *source, size_t len, int pe);


/*
 * Strided put routines
 */
OSHMEM_DECLSPEC void shmem_ctx_char_iput(shmem_ctx_t ctx, char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_short_iput(shmem_ctx_t ctx, short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int_iput(shmem_ctx_t ctx, int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_iput(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_float_iput(shmem_ctx_t ctx, float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_double_iput(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_iput(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_schar_iput(shmem_ctx_t ctx, signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uchar_iput(shmem_ctx_t ctx, unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ushort_iput(shmem_ctx_t ctx, unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_iput(shmem_ctx_t ctx, unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_iput(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_iput(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longdouble_iput(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int8_iput(shmem_ctx_t ctx, int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int16_iput(shmem_ctx_t ctx, int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_iput(shmem_ctx_t ctx, int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_iput(shmem_ctx_t ctx, int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint8_iput(shmem_ctx_t ctx, uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint16_iput(shmem_ctx_t ctx, uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_iput(shmem_ctx_t ctx, uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_iput(shmem_ctx_t ctx, uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_size_iput(shmem_ctx_t ctx, size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_iput(shmem_ctx_t ctx, ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);

OSHMEM_DECLSPEC void shmem_char_iput(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_short_iput(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int_iput(int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_long_iput(long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_float_iput(float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_double_iput(double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_longlong_iput(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_schar_iput(signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uchar_iput(unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ushort_iput(unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uint_iput(unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ulong_iput(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_iput(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_longdouble_iput(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int8_iput(int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int16_iput(int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int32_iput(int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int64_iput(int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uint8_iput(uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uint16_iput(uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uint32_iput(uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uint64_iput(uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_size_iput(size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ptrdiff_iput(ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
#if OSHMEM_HAVE_C11
#define shmem_iput(...)                                              \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                     \
            shmem_ctx_t:  _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),\
                char*:        shmem_ctx_char_iput,                   \
                short*:       shmem_ctx_short_iput,                  \
                int*:         shmem_ctx_int_iput,                    \
                long*:        shmem_ctx_long_iput,                   \
                long long*:   shmem_ctx_longlong_iput,               \
                signed char*:        shmem_ctx_schar_iput,           \
                unsigned char*:      shmem_ctx_uchar_iput,           \
                unsigned short*:     shmem_ctx_ushort_iput,          \
                unsigned int*:       shmem_ctx_uint_iput,            \
                unsigned long*:      shmem_ctx_ulong_iput,           \
                unsigned long long*: shmem_ctx_ulonglong_iput,       \
                float*:       shmem_ctx_float_iput,                  \
                double*:      shmem_ctx_double_iput,                 \
                long double*: shmem_ctx_longdouble_iput,             \
                default:      __oshmem_datatype_ignore),             \
            char*:        shmem_char_iput,                           \
            short*:       shmem_short_iput,                          \
            int*:         shmem_int_iput,                            \
            long*:        shmem_long_iput,                           \
            long long*:   shmem_longlong_iput,                       \
            signed char*:        shmem_schar_iput,                   \
            unsigned char*:      shmem_uchar_iput,                   \
            unsigned short*:     shmem_ushort_iput,                  \
            unsigned int*:       shmem_uint_iput,                    \
            unsigned long*:      shmem_ulong_iput,                   \
            unsigned long long*: shmem_ulonglong_iput,               \
            float*:       shmem_float_iput,                          \
            double*:      shmem_double_iput,                         \
            long double*: shmem_longdouble_iput)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC void shmem_ctx_iput8(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_iput16(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_iput32(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_iput64(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_iput128(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);

OSHMEM_DECLSPEC void shmem_iput8(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_iput16(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_iput32(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_iput64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_iput128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);

/*
 * Nonblocking put routines
 */
OSHMEM_DECLSPEC  void shmem_ctx_char_put_nbi(shmem_ctx_t ctx, char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_short_put_nbi(shmem_ctx_t ctx, short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int_put_nbi(shmem_ctx_t ctx, int *target, const int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_long_put_nbi(shmem_ctx_t ctx, long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_float_put_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_double_put_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longlong_put_nbi(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_schar_put_nbi(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uchar_put_nbi(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ushort_put_nbi(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint_put_nbi(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulong_put_nbi(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulonglong_put_nbi(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longdouble_put_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int8_put_nbi(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int16_put_nbi(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int32_put_nbi(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int64_put_nbi(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint8_put_nbi(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint16_put_nbi(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint32_put_nbi(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint64_put_nbi(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_size_put_nbi(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ptrdiff_put_nbi(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe);

OSHMEM_DECLSPEC  void shmem_char_put_nbi(char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_short_put_nbi(short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int_put_nbi(int *target, const int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_long_put_nbi(long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_float_put_nbi(float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_double_put_nbi(double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_longlong_put_nbi(long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_schar_put_nbi(signed char *target, const signed char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uchar_put_nbi(unsigned char *target, const unsigned char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ushort_put_nbi(unsigned short *target, const unsigned short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint_put_nbi(unsigned int *target, const unsigned int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ulong_put_nbi(unsigned long *target, const unsigned long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ulonglong_put_nbi(unsigned long long *target, const unsigned long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int8_put_nbi(int8_t *target, const int8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int16_put_nbi(int16_t *target, const int16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int32_put_nbi(int32_t *target, const int32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int64_put_nbi(int64_t *target, const int64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint8_put_nbi(uint8_t *target, const uint8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint16_put_nbi(uint16_t *target, const uint16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint32_put_nbi(uint32_t *target, const uint32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint64_put_nbi(uint64_t *target, const uint64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_size_put_nbi(size_t *target, const size_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ptrdiff_put_nbi(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe);
#if OSHMEM_HAVE_C11
#define shmem_put_nbi(...)                                              \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                        \
            shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),   \
                char*:        shmem_ctx_char_put_nbi,                   \
                short*:       shmem_ctx_short_put_nbi,                  \
                int*:         shmem_ctx_int_put_nbi,                    \
                long*:        shmem_ctx_long_put_nbi,                   \
                long long*:   shmem_ctx_longlong_put_nbi,               \
                signed char*:        shmem_ctx_schar_put_nbi,           \
                unsigned char*:      shmem_ctx_uchar_put_nbi,           \
                unsigned short*:     shmem_ctx_ushort_put_nbi,          \
                unsigned int*:       shmem_ctx_uint_put_nbi,            \
                unsigned long*:      shmem_ctx_ulong_put_nbi,           \
                unsigned long long*: shmem_ctx_ulonglong_put_nbi,       \
                float*:       shmem_ctx_float_put_nbi,                  \
                double*:      shmem_ctx_double_put_nbi,                 \
                long double*: shmem_ctx_longdouble_put_nbi,             \
                default:      __oshmem_datatype_ignore),                \
            char*:        shmem_char_put_nbi,                           \
            short*:       shmem_short_put_nbi,                          \
            int*:         shmem_int_put_nbi,                            \
            long*:        shmem_long_put_nbi,                           \
            long long*:   shmem_longlong_put_nbi,                       \
            signed char*:        shmem_schar_put_nbi,                   \
            unsigned char*:      shmem_uchar_put_nbi,                   \
            unsigned short*:     shmem_ushort_put_nbi,                  \
            unsigned int*:       shmem_uint_put_nbi,                    \
            unsigned long*:      shmem_ulong_put_nbi,                   \
            unsigned long long*: shmem_ulonglong_put_nbi,               \
            float*:       shmem_float_put_nbi,                          \
            double*:      shmem_double_put_nbi,                         \
            long double*: shmem_longdouble_put_nbi)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC  void shmem_ctx_put8_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_put16_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_put32_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_put64_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_put128_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_putmem_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);

OSHMEM_DECLSPEC  void shmem_put8_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_put16_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_put32_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_put64_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_put128_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_putmem_nbi(void *target, const void *source, size_t len, int pe);

/*
 * Signaled put routines
 */
OSHMEM_DECLSPEC  void shmem_ctx_char_put_signal(shmem_ctx_t ctx, char *dest, const char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_short_put_signal(shmem_ctx_t ctx, short *dest, const short *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int_put_signal(shmem_ctx_t ctx, int *dest, const int *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_long_put_signal(shmem_ctx_t ctx, long *dest, const long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_float_put_signal(shmem_ctx_t ctx, float *dest, const float *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_double_put_signal(shmem_ctx_t ctx, double *dest, const double *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longlong_put_signal(shmem_ctx_t ctx, long long *dest, const long long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_schar_put_signal(shmem_ctx_t ctx, signed char *dest, const signed char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uchar_put_signal(shmem_ctx_t ctx, unsigned char *dest, const unsigned char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ushort_put_signal(shmem_ctx_t ctx, unsigned short *dest, const unsigned short *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint_put_signal(shmem_ctx_t ctx, unsigned int *dest, const unsigned int *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulong_put_signal(shmem_ctx_t ctx, unsigned long *dest, const unsigned long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulonglong_put_signal(shmem_ctx_t ctx, unsigned long long *dest, const unsigned long long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longdouble_put_signal(shmem_ctx_t ctx, long double *dest, const long double *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int8_put_signal(shmem_ctx_t ctx, int8_t *dest, const int8_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int16_put_signal(shmem_ctx_t ctx, int16_t *dest, const int16_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int32_put_signal(shmem_ctx_t ctx, int32_t *dest, const int32_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int64_put_signal(shmem_ctx_t ctx, int64_t *dest, const int64_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint8_put_signal(shmem_ctx_t ctx, uint8_t *dest, const uint8_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint16_put_signal(shmem_ctx_t ctx, uint16_t *dest, const uint16_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint32_put_signal(shmem_ctx_t ctx, uint32_t *dest, const uint32_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint64_put_signal(shmem_ctx_t ctx, uint64_t *dest, const uint64_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_size_put_signal(shmem_ctx_t ctx, size_t *dest, const size_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ptrdiff_put_signal(shmem_ctx_t ctx, ptrdiff_t *dest, const ptrdiff_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);

OSHMEM_DECLSPEC  void shmem_char_put_signal(char *dest, const char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_short_put_signal(short *dest, const short *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_int_put_signal(int *dest, const int *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_long_put_signal(long *dest, const long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_float_put_signal(float *dest, const float *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_double_put_signal(double *dest, const double *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_longlong_put_signal(long long *dest, const long long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_schar_put_signal(signed char *dest, const signed char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uchar_put_signal(unsigned char *dest, const unsigned char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ushort_put_signal(unsigned short *dest, const unsigned short *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uint_put_signal(unsigned int *dest, const unsigned int *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ulong_put_signal(unsigned long *dest, const unsigned long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ulonglong_put_signal(unsigned long long *dest, const unsigned long long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_longdouble_put_signal(long double *dest, const long double *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_int8_put_signal(int8_t *dest, const int8_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_int16_put_signal(int16_t *dest, const int16_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_int32_put_signal(int32_t *dest, const int32_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_int64_put_signal(int64_t *dest, const int64_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uint8_put_signal(uint8_t *dest, const uint8_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uint16_put_signal(uint16_t *dest, const uint16_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uint32_put_signal(uint32_t *dest, const uint32_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uint64_put_signal(uint64_t *dest, const uint64_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_size_put_signal(size_t *dest, const size_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ptrdiff_put_signal(ptrdiff_t *dest, const ptrdiff_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);

#if OSHMEM_HAVE_C11
#define shmem_put_signal(...)                                                \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                             \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), 	      \
                char*:       shmem_ctx_char_put_signal,                      \
                short*:      shmem_ctx_short_put_signal,                     \
                int*:        shmem_ctx_int_put_signal,                       \
                long*:       shmem_ctx_long_put_signal,                      \
                long long*:  shmem_ctx_longlong_put_signal,                  \
                signed char*:        shmem_ctx_schar_put_signal,             \
                unsigned char*:      shmem_ctx_uchar_put_signal,             \
                unsigned short*:     shmem_ctx_ushort_put_signal,            \
                unsigned int*:       shmem_ctx_uint_put_signal,              \
                unsigned long*:      shmem_ctx_ulong_put_signal,             \
                unsigned long long*: shmem_ctx_ulonglong_put_signal,         \
                float*:       shmem_ctx_float_put_signal,                    \
                double*:      shmem_ctx_double_put_signal,                   \
                long double*: shmem_ctx_longdouble_put_signal,               \
                default:      __oshmem_datatype_ignore),                     \
            char*:       shmem_char_put_signal,                              \
            short*:      shmem_short_put_signal,                             \
            int*:        shmem_int_put_signal,                               \
            long*:       shmem_long_put_signal,                              \
            long long*:  shmem_longlong_put_signal,                          \
            signed char*:        shmem_schar_put_signal,                     \
            unsigned char*:      shmem_uchar_put_signal,                     \
            unsigned short*:     shmem_ushort_put_signal,                    \
            unsigned int*:       shmem_uint_put_signal,                      \
            unsigned long*:      shmem_ulong_put_signal,                     \
            unsigned long long*: shmem_ulonglong_put_signal,                 \
            float*:       shmem_float_put_signal,                            \
            double*:      shmem_double_put_signal,                           \
            long double*: shmem_longdouble_put_signal)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC void shmem_put8_signal(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_put16_signal(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_put32_signal(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_put64_signal(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_put128_signal(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);

OSHMEM_DECLSPEC void shmem_ctx_put8_signal(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_ctx_put16_signal(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_ctx_put32_signal(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_ctx_put64_signal(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_ctx_put128_signal(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);

OSHMEM_DECLSPEC void shmem_putmem_signal(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_ctx_putmem_signal(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);

/*
 * Nonblocking signaled put routines
 */
OSHMEM_DECLSPEC  void shmem_ctx_char_put_signal_nbi(shmem_ctx_t ctx, char *dest, const char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_short_put_signal_nbi(shmem_ctx_t ctx, short *dest, const short *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int_put_signal_nbi(shmem_ctx_t ctx, int *dest, const int *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_long_put_signal_nbi(shmem_ctx_t ctx, long *dest, const long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_float_put_signal_nbi(shmem_ctx_t ctx, float *dest, const float *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_double_put_signal_nbi(shmem_ctx_t ctx, double *dest, const double *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longlong_put_signal_nbi(shmem_ctx_t ctx, long long *dest, const long long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_schar_put_signal_nbi(shmem_ctx_t ctx, signed char *dest, const signed char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uchar_put_signal_nbi(shmem_ctx_t ctx, unsigned char *dest, const unsigned char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ushort_put_signal_nbi(shmem_ctx_t ctx, unsigned short *dest, const unsigned short *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint_put_signal_nbi(shmem_ctx_t ctx, unsigned int *dest, const unsigned int *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulong_put_signal_nbi(shmem_ctx_t ctx, unsigned long *dest, const unsigned long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulonglong_put_signal_nbi(shmem_ctx_t ctx, unsigned long long *dest, const unsigned long long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longdouble_put_signal_nbi(shmem_ctx_t ctx, long double *dest, const long double *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int8_put_signal_nbi(shmem_ctx_t ctx, int8_t *dest, const int8_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int16_put_signal_nbi(shmem_ctx_t ctx, int16_t *dest, const int16_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int32_put_signal_nbi(shmem_ctx_t ctx, int32_t *dest, const int32_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int64_put_signal_nbi(shmem_ctx_t ctx, int64_t *dest, const int64_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint8_put_signal_nbi(shmem_ctx_t ctx, uint8_t *dest, const uint8_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint16_put_signal_nbi(shmem_ctx_t ctx, uint16_t *dest, const uint16_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint32_put_signal_nbi(shmem_ctx_t ctx, uint32_t *dest, const uint32_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint64_put_signal_nbi(shmem_ctx_t ctx, uint64_t *dest, const uint64_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_size_put_signal_nbi(shmem_ctx_t ctx, size_t *dest, const size_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ptrdiff_put_signal_nbi(shmem_ctx_t ctx, ptrdiff_t *dest, const ptrdiff_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);

OSHMEM_DECLSPEC  void shmem_char_put_signal_nbi(char *dest, const char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_short_put_signal_nbi(short *dest, const short *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_int_put_signal_nbi(int *dest, const int *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_long_put_signal_nbi(long *dest, const long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_float_put_signal_nbi(float *dest, const float *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_double_put_signal_nbi(double *dest, const double *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_longlong_put_signal_nbi(long long *dest, const long long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_schar_put_signal_nbi(signed char *dest, const signed char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uchar_put_signal_nbi(unsigned char *dest, const unsigned char *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ushort_put_signal_nbi(unsigned short *dest, const unsigned short *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uint_put_signal_nbi(unsigned int *dest, const unsigned int *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ulong_put_signal_nbi(unsigned long *dest, const unsigned long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ulonglong_put_signal_nbi(unsigned long long *dest, const unsigned long long *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_longdouble_put_signal_nbi(long double *dest, const long double *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_int8_put_signal_nbi(int8_t *dest, const int8_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_int16_put_signal_nbi(int16_t *dest, const int16_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_int32_put_signal_nbi(int32_t *dest, const int32_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_int64_put_signal_nbi(int64_t *dest, const int64_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uint8_put_signal_nbi(uint8_t *dest, const uint8_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uint16_put_signal_nbi(uint16_t *dest, const uint16_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uint32_put_signal_nbi(uint32_t *dest, const uint32_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_uint64_put_signal_nbi(uint64_t *dest, const uint64_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_size_put_signal_nbi(size_t *dest, const size_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC  void shmem_ptrdiff_put_signal_nbi(ptrdiff_t *dest, const ptrdiff_t *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);

#if OSHMEM_HAVE_C11
#define shmem_put_signal_nbi(...)                                                \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                                 \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),             \
                char*:       shmem_ctx_char_put_signal_nbi,                      \
                short*:      shmem_ctx_short_put_signal_nbi,                     \
                int*:        shmem_ctx_int_put_signal_nbi,                       \
                long*:       shmem_ctx_long_put_signal_nbi,                      \
                long long*:  shmem_ctx_longlong_put_signal_nbi,                  \
                signed char*:        shmem_ctx_schar_put_signal_nbi,             \
                unsigned char*:      shmem_ctx_uchar_put_signal_nbi,             \
                unsigned short*:     shmem_ctx_ushort_put_signal_nbi,            \
                unsigned int*:       shmem_ctx_uint_put_signal_nbi,              \
                unsigned long*:      shmem_ctx_ulong_put_signal_nbi,             \
                unsigned long long*: shmem_ctx_ulonglong_put_signal_nbi,         \
                float*:       shmem_ctx_float_put_signal_nbi,                    \
                double*:      shmem_ctx_double_put_signal_nbi,                   \
                long double*: shmem_ctx_longdouble_put_signal_nbi,               \
                default:      __oshmem_datatype_ignore),                         \
            char*:       shmem_char_put_signal_nbi,                              \
            short*:      shmem_short_put_signal_nbi,                             \
            int*:        shmem_int_put_signal_nbi,                               \
            long*:       shmem_long_put_signal_nbi,                              \
            long long*:  shmem_longlong_put_signal_nbi,                          \
            signed char*:        shmem_schar_put_signal_nbi,                     \
            unsigned char*:      shmem_uchar_put_signal_nbi,                     \
            unsigned short*:     shmem_ushort_put_signal_nbi,                    \
            unsigned int*:       shmem_uint_put_signal_nbi,                      \
            unsigned long*:      shmem_ulong_put_signal_nbi,                     \
            unsigned long long*: shmem_ulonglong_put_signal_nbi,                 \
            float*:       shmem_float_put_signal_nbi,                            \
            double*:      shmem_double_put_signal_nbi,                           \
            long double*: shmem_longdouble_put_signal_nbi)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC void shmem_put8_signal_nbi(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_put16_signal_nbi(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_put32_signal_nbi(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_put64_signal_nbi(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_put128_signal_nbi(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);

OSHMEM_DECLSPEC void shmem_ctx_put8_signal_nbi(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_ctx_put16_signal_nbi(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_ctx_put32_signal_nbi(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_ctx_put64_signal_nbi(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_ctx_put128_signal_nbi(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);

OSHMEM_DECLSPEC void shmem_putmem_signal_nbi(void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);
OSHMEM_DECLSPEC void shmem_ctx_putmem_signal_nbi(shmem_ctx_t ctx, void *dest, const void *source, size_t nelems, uint64_t *sig_addr, uint64_t signal, int sig_op, int pe);


OSHMEM_DECLSPEC uint64_t shmem_signal_fetch(const uint64_t *sig_addr);


/*
 * Elemental get routines
 */
OSHMEM_DECLSPEC  char shmem_ctx_char_g(shmem_ctx_t ctx, const char* addr, int pe);
OSHMEM_DECLSPEC  short shmem_ctx_short_g(shmem_ctx_t ctx, const short* addr, int pe);
OSHMEM_DECLSPEC  int shmem_ctx_int_g(shmem_ctx_t ctx, const int* addr, int pe);
OSHMEM_DECLSPEC  long shmem_ctx_long_g(shmem_ctx_t ctx, const long* addr, int pe);
OSHMEM_DECLSPEC  float shmem_ctx_float_g(shmem_ctx_t ctx, const float* addr, int pe);
OSHMEM_DECLSPEC  double shmem_ctx_double_g(shmem_ctx_t ctx, const double* addr, int pe);
OSHMEM_DECLSPEC  long long shmem_ctx_longlong_g(shmem_ctx_t ctx, const long long* addr, int pe);
OSHMEM_DECLSPEC  long double shmem_ctx_longdouble_g(shmem_ctx_t ctx, const long double* addr, int pe);
OSHMEM_DECLSPEC  signed char shmem_ctx_schar_g(shmem_ctx_t ctx, const signed char* addr, int pe);
OSHMEM_DECLSPEC  unsigned char shmem_ctx_uchar_g(shmem_ctx_t ctx, const unsigned char* addr, int pe);
OSHMEM_DECLSPEC  unsigned short shmem_ctx_ushort_g(shmem_ctx_t ctx, const unsigned short* addr, int pe);
OSHMEM_DECLSPEC  unsigned int shmem_ctx_uint_g(shmem_ctx_t ctx, const unsigned int* addr, int pe);
OSHMEM_DECLSPEC  unsigned long shmem_ctx_ulong_g(shmem_ctx_t ctx, const unsigned long* addr, int pe);
OSHMEM_DECLSPEC  unsigned long long shmem_ctx_ulonglong_g(shmem_ctx_t ctx, const unsigned long long* addr, int pe);
OSHMEM_DECLSPEC  int8_t shmem_ctx_int8_g(shmem_ctx_t ctx, const int8_t* addr, int pe);
OSHMEM_DECLSPEC  int16_t shmem_ctx_int16_g(shmem_ctx_t ctx, const int16_t* addr, int pe);
OSHMEM_DECLSPEC  int32_t shmem_ctx_int32_g(shmem_ctx_t ctx, const int32_t* addr, int pe);
OSHMEM_DECLSPEC  int64_t shmem_ctx_int64_g(shmem_ctx_t ctx, const int64_t* addr, int pe);
OSHMEM_DECLSPEC  uint8_t shmem_ctx_uint8_g(shmem_ctx_t ctx, const uint8_t* addr, int pe);
OSHMEM_DECLSPEC  uint16_t shmem_ctx_uint16_g(shmem_ctx_t ctx, const uint16_t* addr, int pe);
OSHMEM_DECLSPEC  uint32_t shmem_ctx_uint32_g(shmem_ctx_t ctx, const uint32_t* addr, int pe);
OSHMEM_DECLSPEC  uint64_t shmem_ctx_uint64_g(shmem_ctx_t ctx, const uint64_t* addr, int pe);
OSHMEM_DECLSPEC  size_t shmem_ctx_size_g(shmem_ctx_t ctx, const size_t* addr, int pe);
OSHMEM_DECLSPEC  ptrdiff_t shmem_ctx_ptrdiff_g(shmem_ctx_t ctx, const ptrdiff_t* addr, int pe);

OSHMEM_DECLSPEC  char shmem_char_g(const char* addr, int pe);
OSHMEM_DECLSPEC  short shmem_short_g(const short* addr, int pe);
OSHMEM_DECLSPEC  int shmem_int_g(const int* addr, int pe);
OSHMEM_DECLSPEC  long shmem_long_g(const long* addr, int pe);
OSHMEM_DECLSPEC  float shmem_float_g(const float* addr, int pe);
OSHMEM_DECLSPEC  double shmem_double_g(const double* addr, int pe);
OSHMEM_DECLSPEC  long long shmem_longlong_g(const long long* addr, int pe);
OSHMEM_DECLSPEC  long double shmem_longdouble_g(const long double* addr, int pe);
OSHMEM_DECLSPEC  signed char shmem_schar_g(const signed char* addr, int pe);
OSHMEM_DECLSPEC  unsigned char shmem_uchar_g(const unsigned char* addr, int pe);
OSHMEM_DECLSPEC  unsigned short shmem_ushort_g(const unsigned short* addr, int pe);
OSHMEM_DECLSPEC  unsigned int shmem_uint_g(const unsigned int* addr, int pe);
OSHMEM_DECLSPEC  unsigned long shmem_ulong_g(const unsigned long* addr, int pe);
OSHMEM_DECLSPEC  unsigned long long shmem_ulonglong_g(const unsigned long long* addr, int pe);
OSHMEM_DECLSPEC  int8_t shmem_int8_g(const int8_t* addr, int pe);
OSHMEM_DECLSPEC  int16_t shmem_int16_g(const int16_t* addr, int pe);
OSHMEM_DECLSPEC  int32_t shmem_int32_g(const int32_t* addr, int pe);
OSHMEM_DECLSPEC  int64_t shmem_int64_g(const int64_t* addr, int pe);
OSHMEM_DECLSPEC  uint8_t shmem_uint8_g(const uint8_t* addr, int pe);
OSHMEM_DECLSPEC  uint16_t shmem_uint16_g(const uint16_t* addr, int pe);
OSHMEM_DECLSPEC  uint32_t shmem_uint32_g(const uint32_t* addr, int pe);
OSHMEM_DECLSPEC  uint64_t shmem_uint64_g(const uint64_t* addr, int pe);
OSHMEM_DECLSPEC  size_t shmem_size_g(const size_t* addr, int pe);
OSHMEM_DECLSPEC  ptrdiff_t shmem_ptrdiff_g(const ptrdiff_t* addr, int pe);
#if OSHMEM_HAVE_C11
#define shmem_g(...)                                                \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                    \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),\
                char*:        shmem_ctx_char_g,                     \
                short*:       shmem_ctx_short_g,                    \
                int*:         shmem_ctx_int_g,                      \
                long*:        shmem_ctx_long_g,                     \
                long long*:   shmem_ctx_longlong_g,                 \
                signed char*:        shmem_ctx_schar_g,             \
                unsigned char*:      shmem_ctx_uchar_g,             \
                unsigned short*:     shmem_ctx_ushort_g,            \
                unsigned int*:       shmem_ctx_uint_g,              \
                unsigned long*:      shmem_ctx_ulong_g,             \
                unsigned long long*: shmem_ctx_ulonglong_g,         \
                float*:       shmem_ctx_float_g,                    \
                double*:      shmem_ctx_double_g,                   \
                long double*: shmem_ctx_longdouble_g,               \
                default:      __oshmem_datatype_ignore),            \
            char*:        shmem_char_g,                             \
            short*:       shmem_short_g,                            \
            int*:         shmem_int_g,                              \
            long*:        shmem_long_g,                             \
            long long*:   shmem_longlong_g,                         \
            signed char*:        shmem_schar_g,                     \
            unsigned char*:      shmem_uchar_g,                     \
            unsigned short*:     shmem_ushort_g,                    \
            unsigned int*:       shmem_uint_g,                      \
            unsigned long*:      shmem_ulong_g,                     \
            unsigned long long*: shmem_ulonglong_g,                 \
            float*:       shmem_float_g,                            \
            double*:      shmem_double_g,                           \
            long double*: shmem_longdouble_g)(__VA_ARGS__)
#endif

/*
 * Block data get routines
 */
OSHMEM_DECLSPEC  void shmem_ctx_char_get(shmem_ctx_t ctx, char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_short_get(shmem_ctx_t ctx, short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int_get(shmem_ctx_t ctx, int *target, const int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_long_get(shmem_ctx_t ctx, long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_float_get(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_double_get(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longlong_get(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_schar_get(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uchar_get(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ushort_get(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint_get(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulong_get(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulonglong_get(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longdouble_get(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int8_get(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int16_get(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int32_get(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int64_get(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint8_get(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint16_get(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint32_get(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint64_get(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_size_get(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ptrdiff_get(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe);

OSHMEM_DECLSPEC  void shmem_char_get(char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_short_get(short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int_get(int *target, const int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_long_get(long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_float_get(float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_double_get(double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_longlong_get(long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_schar_get(signed char *target, const signed char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uchar_get(unsigned char *target, const unsigned char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ushort_get(unsigned short *target, const unsigned short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint_get(unsigned int *target, const unsigned int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ulong_get(unsigned long *target, const unsigned long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ulonglong_get(unsigned long long *target, const unsigned long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_longdouble_get(long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int8_get(int8_t *target, const int8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int16_get(int16_t *target, const int16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int32_get(int32_t *target, const int32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int64_get(int64_t *target, const int64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint8_get(uint8_t *target, const uint8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint16_get(uint16_t *target, const uint16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint32_get(uint32_t *target, const uint32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint64_get(uint64_t *target, const uint64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_size_get(size_t *target, const size_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ptrdiff_get(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe);
#if OSHMEM_HAVE_C11
#define shmem_get(...)                                              \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                    \
            shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),\
                char*:        shmem_ctx_char_get,                   \
                short*:       shmem_ctx_short_get,                  \
                int*:         shmem_ctx_int_get,                    \
                long*:        shmem_ctx_long_get,                   \
                long long*:   shmem_ctx_longlong_get,               \
                signed char*:        shmem_ctx_schar_get,           \
                unsigned char*:      shmem_ctx_uchar_get,           \
                unsigned short*:     shmem_ctx_ushort_get,          \
                unsigned int*:       shmem_ctx_uint_get,            \
                unsigned long*:      shmem_ctx_ulong_get,           \
                unsigned long long*: shmem_ctx_ulonglong_get,       \
                float*:       shmem_ctx_float_get,                  \
                double*:      shmem_ctx_double_get,                 \
                long double*: shmem_ctx_longdouble_get,             \
                default:      __oshmem_datatype_ignore),            \
            char*:        shmem_char_get,                           \
            short*:       shmem_short_get,                          \
            int*:         shmem_int_get,                            \
            long*:        shmem_long_get,                           \
            long long*:   shmem_longlong_get,                       \
            signed char*:        shmem_schar_get,                   \
            unsigned char*:      shmem_uchar_get,                   \
            unsigned short*:     shmem_ushort_get,                  \
            unsigned int*:       shmem_uint_get,                    \
            unsigned long*:      shmem_ulong_get,                   \
            unsigned long long*: shmem_ulonglong_get,               \
            float*:       shmem_float_get,                          \
            double*:      shmem_double_get,                         \
            long double*: shmem_longdouble_get)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC  void shmem_ctx_get8(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_get16(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_get32(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_get64(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_get128(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_getmem(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);

OSHMEM_DECLSPEC  void shmem_get8(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_get16(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_get32(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_get64(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_get128(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_getmem(void *target, const void *source, size_t len, int pe);

/*
 * Strided get routines
 */
OSHMEM_DECLSPEC void shmem_ctx_char_iget(shmem_ctx_t ctx, char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_short_iget(shmem_ctx_t ctx, short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int_iget(shmem_ctx_t ctx, int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_schar_iget(shmem_ctx_t ctx, signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uchar_iget(shmem_ctx_t ctx, unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ushort_iget(shmem_ctx_t ctx, unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_iget(shmem_ctx_t ctx, unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_iget(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_iget(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_float_iget(shmem_ctx_t ctx, float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_double_iget(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longdouble_iget(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int8_iget(shmem_ctx_t ctx, int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int16_iget(shmem_ctx_t ctx, int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_iget(shmem_ctx_t ctx, int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_iget(shmem_ctx_t ctx, int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint8_iget(shmem_ctx_t ctx, uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint16_iget(shmem_ctx_t ctx, uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_iget(shmem_ctx_t ctx, uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_iget(shmem_ctx_t ctx, uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_size_iget(shmem_ctx_t ctx, size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_iget(shmem_ctx_t ctx, ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);

OSHMEM_DECLSPEC void shmem_char_iget(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_short_iget(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int_iget(int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_float_iget(float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_double_iget(double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_longlong_iget(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_longdouble_iget(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_long_iget(long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_schar_iget(signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uchar_iget(unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ushort_iget(unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uint_iget(unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ulong_iget(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_iget(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int8_iget(int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int16_iget(int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int32_iget(int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int64_iget(int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uint8_iget(uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uint16_iget(uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uint32_iget(uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_uint64_iget(uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_size_iget(size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ptrdiff_iget(ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe);
#if OSHMEM_HAVE_C11
#define shmem_iget(...)                                              \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                     \
            shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)), \
                char*:        shmem_ctx_char_iget,                   \
                short*:       shmem_ctx_short_iget,                  \
                int*:         shmem_ctx_int_iget,                    \
                long*:        shmem_ctx_long_iget,                   \
                long long*:   shmem_ctx_longlong_iget,               \
                signed char*:        shmem_ctx_schar_iget,           \
                unsigned char*:      shmem_ctx_uchar_iget,           \
                unsigned short*:     shmem_ctx_ushort_iget,          \
                unsigned int*:       shmem_ctx_uint_iget,            \
                unsigned long*:      shmem_ctx_ulong_iget,           \
                unsigned long long*: shmem_ctx_ulonglong_iget,       \
                float*:       shmem_ctx_float_iget,                  \
                double*:      shmem_ctx_double_iget,                 \
                long double*: shmem_ctx_longdouble_iget,             \
                default:      __oshmem_datatype_ignore),             \
            char*:        shmem_char_iget,                           \
            short*:       shmem_short_iget,                          \
            int*:         shmem_int_iget,                            \
            long*:        shmem_long_iget,                           \
            long long*:   shmem_longlong_iget,                       \
            signed char*:        shmem_schar_iget,                   \
            unsigned char*:      shmem_uchar_iget,                   \
            unsigned short*:     shmem_ushort_iget,                  \
            unsigned int*:       shmem_uint_iget,                    \
            unsigned long*:      shmem_ulong_iget,                   \
            unsigned long long*: shmem_ulonglong_iget,               \
            float*:       shmem_float_iget,                          \
            double*:      shmem_double_iget,                         \
            long double*: shmem_longdouble_iget)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC void shmem_ctx_iget8(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_iget16(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_iget32(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_iget64(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_ctx_iget128(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);

OSHMEM_DECLSPEC void shmem_iget8(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_iget16(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_iget32(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_iget64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_iget128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);

/*
 * Nonblocking data get routines
 */
OSHMEM_DECLSPEC  void shmem_ctx_char_get_nbi(shmem_ctx_t ctx, char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_short_get_nbi(shmem_ctx_t ctx, short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int_get_nbi(shmem_ctx_t ctx, int *target, const int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_long_get_nbi(shmem_ctx_t ctx, long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longlong_get_nbi(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_schar_get_nbi(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uchar_get_nbi(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ushort_get_nbi(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint_get_nbi(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulong_get_nbi(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ulonglong_get_nbi(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_float_get_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_double_get_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_longdouble_get_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int8_get_nbi(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int16_get_nbi(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int32_get_nbi(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_int64_get_nbi(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint8_get_nbi(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint16_get_nbi(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint32_get_nbi(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_uint64_get_nbi(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_size_get_nbi(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_ptrdiff_get_nbi(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe);

OSHMEM_DECLSPEC  void shmem_char_get_nbi(char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_short_get_nbi(short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int_get_nbi(int *target, const int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_long_get_nbi(long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_longlong_get_nbi(long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_schar_get_nbi(signed char *target, const signed char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uchar_get_nbi(unsigned char *target, const unsigned char *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ushort_get_nbi(unsigned short *target, const unsigned short *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint_get_nbi(unsigned int *target, const unsigned int *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ulong_get_nbi(unsigned long *target, const unsigned long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ulonglong_get_nbi(unsigned long long *target, const unsigned long long *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_float_get_nbi(float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_double_get_nbi(double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int8_get_nbi(int8_t *target, const int8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int16_get_nbi(int16_t *target, const int16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int32_get_nbi(int32_t *target, const int32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_int64_get_nbi(int64_t *target, const int64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint8_get_nbi(uint8_t *target, const uint8_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint16_get_nbi(uint16_t *target, const uint16_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint32_get_nbi(uint32_t *target, const uint32_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_uint64_get_nbi(uint64_t *target, const uint64_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_size_get_nbi(size_t *target, const size_t *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ptrdiff_get_nbi(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe);
#if OSHMEM_HAVE_C11
#define shmem_get_nbi(...)                                           \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                     \
            shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)), \
                char*:        shmem_ctx_char_get_nbi,                \
                short*:       shmem_ctx_short_get_nbi,               \
                int*:         shmem_ctx_int_get_nbi,                 \
                long*:        shmem_ctx_long_get_nbi,                \
                long long*:   shmem_ctx_longlong_get_nbi,            \
                signed char*:        shmem_ctx_schar_get_nbi,        \
                unsigned char*:      shmem_ctx_uchar_get_nbi,        \
                unsigned short*:     shmem_ctx_ushort_get_nbi,       \
                unsigned int*:       shmem_ctx_uint_get_nbi,         \
                unsigned long*:      shmem_ctx_ulong_get_nbi,        \
                unsigned long long*: shmem_ctx_ulonglong_get_nbi,    \
                float*:       shmem_ctx_float_get_nbi,               \
                double*:      shmem_ctx_double_get_nbi,              \
                long double*: shmem_ctx_longdouble_get_nbi,          \
                default:      __oshmem_datatype_ignore),             \
            char*:        shmem_char_get_nbi,                        \
            short*:       shmem_short_get_nbi,                       \
            int*:         shmem_int_get_nbi,                         \
            long*:        shmem_long_get_nbi,                        \
            long long*:   shmem_longlong_get_nbi,                    \
            signed char*:        shmem_schar_get_nbi,                \
            unsigned char*:      shmem_uchar_get_nbi,                \
            unsigned short*:     shmem_ushort_get_nbi,               \
            unsigned int*:       shmem_uint_get_nbi,                 \
            unsigned long*:      shmem_ulong_get_nbi,                \
            unsigned long long*: shmem_ulonglong_get_nbi,            \
            float*:       shmem_float_get_nbi,                       \
            double*:      shmem_double_get_nbi,                      \
            long double*: shmem_longdouble_get_nbi)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC  void shmem_ctx_get8_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_get16_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_get32_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_get64_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_get128_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_ctx_getmem_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe);

OSHMEM_DECLSPEC  void shmem_get8_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_get16_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_get32_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_get64_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_get128_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC  void shmem_getmem_nbi(void *target, const void *source, size_t len, int pe);

/*
 * Atomic operations
 */
/* Atomic swap */
OSHMEM_DECLSPEC int shmem_ctx_int_atomic_swap(shmem_ctx_t ctx, int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_ctx_long_atomic_swap(shmem_ctx_t ctx, long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_swap(shmem_ctx_t ctx, long long *target, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_swap(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_swap(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_swap(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC float shmem_ctx_float_atomic_swap(shmem_ctx_t ctx, float *target, float value, int pe);
OSHMEM_DECLSPEC double shmem_ctx_double_atomic_swap(shmem_ctx_t ctx, double *target, double value, int pe);
OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_swap(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_swap(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_swap(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_swap(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC size_t shmem_ctx_size_atomic_swap(shmem_ctx_t ctx, size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC ptrdiff_t shmem_ctx_ptrdiff_atomic_swap(shmem_ctx_t ctx, ptrdiff_t *target, ptrdiff_t value, int pe);

OSHMEM_DECLSPEC int shmem_int_atomic_swap(int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_swap(long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_swap(long long*target, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_swap(unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_swap(unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_swap(unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC float shmem_float_atomic_swap(float *target, float value, int pe);
OSHMEM_DECLSPEC double shmem_double_atomic_swap(double *target, double value, int pe);
OSHMEM_DECLSPEC int32_t shmem_int32_atomic_swap(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_int64_atomic_swap(int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_swap(uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_swap(uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC size_t shmem_size_atomic_swap(size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC ptrdiff_t shmem_ptrdiff_atomic_swap(ptrdiff_t *target, ptrdiff_t value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_swap(...)                                       \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                     \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \
                int*:         shmem_ctx_int_atomic_swap,             \
                long*:        shmem_ctx_long_atomic_swap,            \
                long long*:   shmem_ctx_longlong_atomic_swap,        \
                unsigned int*:       shmem_ctx_uint_atomic_swap,     \
                unsigned long*:      shmem_ctx_ulong_atomic_swap,    \
                unsigned long long*: shmem_ctx_ulonglong_atomic_swap,\
                float*:       shmem_ctx_float_atomic_swap,           \
                double*:      shmem_ctx_double_atomic_swap,          \
                default:      __oshmem_datatype_ignore),             \
            int*:         shmem_int_atomic_swap,                     \
            long*:        shmem_long_atomic_swap,                    \
            long long*:   shmem_longlong_atomic_swap,                \
            unsigned int*:       shmem_uint_atomic_swap,             \
            unsigned long*:      shmem_ulong_atomic_swap,            \
            unsigned long long*: shmem_ulonglong_atomic_swap,        \
            float*:       shmem_float_atomic_swap,                   \
            double*:      shmem_double_atomic_swap)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC int shmem_int_swap(int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_swap(long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_swap(long long*target, long long value, int pe);
OSHMEM_DECLSPEC float shmem_float_swap(float *target, float value, int pe);
OSHMEM_DECLSPEC double shmem_double_swap(double *target, double value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_swap(dst, val, pe)                             \
    _Generic(&*(dst),                                        \
            int*:         shmem_int_swap,                    \
            long*:        shmem_long_swap,                   \
            long long*:   shmem_longlong_swap,               \
            float*:       shmem_float_swap,                  \
            double*:      shmem_double_swap)(dst, val, pe)
#endif

/* Atomic set */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_set(shmem_ctx_t ctx, int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_set(shmem_ctx_t ctx, long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_set(shmem_ctx_t ctx, long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_set(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_set(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_set(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_float_atomic_set(shmem_ctx_t ctx, float *target, float value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_double_atomic_set(shmem_ctx_t ctx, double *target, double value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_set(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_set(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_set(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_set(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_size_atomic_set(shmem_ctx_t ctx, size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_atomic_set(shmem_ctx_t ctx, ptrdiff_t *target, ptrdiff_t value, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_set(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_set(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_set(long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_set(unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_set(unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_set(unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_float_atomic_set(float *target, float value, int pe);
OSHMEM_DECLSPEC void shmem_double_atomic_set(double *target, double value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_set(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_set(int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_set(uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_set(uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC void shmem_size_atomic_set(size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC void shmem_ptrdiff_atomic_set(ptrdiff_t *target, ptrdiff_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_set(...)                                       \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                    \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),\
                int*:         shmem_ctx_int_atomic_set,             \
                long*:        shmem_ctx_long_atomic_set,            \
                long long*:   shmem_ctx_longlong_atomic_set,        \
                unsigned int*:       shmem_ctx_uint_atomic_set,     \
                unsigned long*:      shmem_ctx_ulong_atomic_set,    \
                unsigned long long*: shmem_ctx_ulonglong_atomic_set,\
                float*:       shmem_ctx_float_atomic_set,           \
                double*:      shmem_ctx_double_atomic_set,          \
                default:      __oshmem_datatype_ignore),            \
            int*:         shmem_int_atomic_set,                     \
            long*:        shmem_long_atomic_set,                    \
            long long*:   shmem_longlong_atomic_set,                \
            unsigned int*:         shmem_uint_atomic_set,           \
            unsigned long*:        shmem_ulong_atomic_set,          \
            unsigned long long*:   shmem_ulonglong_atomic_set,      \
            float*:       shmem_float_atomic_set,                   \
            double*:      shmem_double_atomic_set)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC void shmem_int_set(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_set(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_set(long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_float_set(float *target, float value, int pe);
OSHMEM_DECLSPEC void shmem_double_set(double *target, double value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_set(dst, val, pe)                             \
    _Generic(&*(dst),                                       \
            int*:         shmem_int_set,                    \
            long*:        shmem_long_set,                   \
            long long*:   shmem_longlong_set,               \
            float*:       shmem_float_set,                  \
            double*:      shmem_double_set)(dst, val, pe)
#endif

/* Atomic conditional swap */
OSHMEM_DECLSPEC int shmem_ctx_int_atomic_compare_swap(shmem_ctx_t ctx, int *target, int cond, int value, int pe);
OSHMEM_DECLSPEC long shmem_ctx_long_atomic_compare_swap(shmem_ctx_t ctx, long *target, long cond, long value, int pe);
OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_compare_swap(shmem_ctx_t ctx, long long *target, long long cond, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_compare_swap(shmem_ctx_t ctx, unsigned int *target, unsigned int cond, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_compare_swap(shmem_ctx_t ctx, unsigned long *target, unsigned long cond, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_compare_swap(shmem_ctx_t ctx, unsigned long long *target, unsigned long long cond, unsigned long long value, int pe);
OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_compare_swap(shmem_ctx_t ctx, int32_t *target, int32_t cond, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_compare_swap(shmem_ctx_t ctx, int64_t *target, int64_t cond, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_compare_swap(shmem_ctx_t ctx, uint32_t *target, uint32_t cond, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_compare_swap(shmem_ctx_t ctx, uint64_t *target, uint64_t cond, uint64_t value, int pe);
OSHMEM_DECLSPEC size_t shmem_ctx_size_atomic_compare_swap(shmem_ctx_t ctx, size_t *target, size_t cond, size_t value, int pe);
OSHMEM_DECLSPEC ptrdiff_t shmem_ctx_ptrdiff_atomic_compare_swap(shmem_ctx_t ctx, ptrdiff_t *target, ptrdiff_t cond, ptrdiff_t value, int pe);

OSHMEM_DECLSPEC int shmem_int_atomic_compare_swap(int *target, int cond, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_compare_swap(long *target, long cond, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_compare_swap(long long *target, long long cond, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_compare_swap(unsigned int *target, unsigned int cond, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_compare_swap(unsigned long *target, unsigned long cond, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_compare_swap(unsigned long long *target, unsigned long long cond, unsigned long long value, int pe);
OSHMEM_DECLSPEC int32_t shmem_int32_atomic_compare_swap(int32_t *target, int32_t cond, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_int64_atomic_compare_swap(int64_t *target, int64_t cond, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_compare_swap(uint32_t *target, uint32_t cond, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_compare_swap(uint64_t *target, uint64_t cond, uint64_t value, int pe);
OSHMEM_DECLSPEC size_t shmem_size_atomic_compare_swap(size_t *target, size_t cond, size_t value, int pe);
OSHMEM_DECLSPEC ptrdiff_t shmem_ptrdiff_atomic_compare_swap(ptrdiff_t *target, ptrdiff_t cond, ptrdiff_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_compare_swap(...)                                \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                      \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),  \
                int*:         shmem_ctx_int_atomic_compare_swap,      \
                long*:        shmem_ctx_long_atomic_compare_swap,     \
                long long*:   shmem_ctx_longlong_atomic_compare_swap, \
                unsigned int*:       shmem_ctx_uint_atomic_compare_swap,      \
                unsigned long*:      shmem_ctx_ulong_atomic_compare_swap,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_compare_swap, \
                default:      __oshmem_datatype_ignore),              \
            int*:         shmem_int_atomic_compare_swap,              \
            long*:        shmem_long_atomic_compare_swap,             \
            long long*:   shmem_longlong_atomic_compare_swap,         \
            unsigned int*:       shmem_uint_atomic_compare_swap,      \
            unsigned long*:      shmem_ulong_atomic_compare_swap,     \
            unsigned long long*: shmem_ulonglong_atomic_compare_swap)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC int shmem_int_cswap(int *target, int cond, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_cswap(long *target, long cond, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_cswap(long long *target, long long cond, long long value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_cswap(dst, cond, val, pe)                       \
    _Generic(&*(dst),                                         \
            int*:         shmem_int_cswap,                    \
            long*:        shmem_long_cswap,                   \
            long long*:   shmem_longlong_cswap)(dst, cond, val, pe)
#endif

/* Atomic Fetch&Add */
OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_add(shmem_ctx_t ctx, int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_add(shmem_ctx_t ctx, long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_add(shmem_ctx_t ctx, long long *target, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_add(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_add(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_add(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_fetch_add(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_fetch_add(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_fetch_add(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_fetch_add(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC size_t shmem_ctx_size_atomic_fetch_add(shmem_ctx_t ctx, size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC ptrdiff_t shmem_ctx_ptrdiff_atomic_fetch_add(shmem_ctx_t ctx, ptrdiff_t *target, ptrdiff_t value, int pe);

OSHMEM_DECLSPEC int shmem_int_atomic_fetch_add(int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_fetch_add(long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_add(long long *target, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_add(unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_add(unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_add(unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC int32_t shmem_int32_atomic_fetch_add(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_int64_atomic_fetch_add(int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_fetch_add(uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_fetch_add(uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC size_t shmem_size_atomic_fetch_add(size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC ptrdiff_t shmem_ptrdiff_atomic_fetch_add(ptrdiff_t *target, ptrdiff_t value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_add(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                           \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),       \
                int*:         shmem_ctx_int_atomic_fetch_add,              \
                long*:        shmem_ctx_long_atomic_fetch_add,             \
                long long*:   shmem_ctx_longlong_atomic_fetch_add,         \
                unsigned int*:       shmem_ctx_uint_atomic_fetch_add,      \
                unsigned long*:      shmem_ctx_ulong_atomic_fetch_add,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_add, \
                default:      __oshmem_datatype_ignore),                   \
            int*:         shmem_int_atomic_fetch_add,                      \
            long*:        shmem_long_atomic_fetch_add,                     \
            long long*:   shmem_longlong_atomic_fetch_add,                 \
            unsigned int*:       shmem_uint_atomic_fetch_add,              \
            unsigned long*:      shmem_ulong_atomic_fetch_add,             \
            unsigned long long*: shmem_ulonglong_atomic_fetch_add)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC int shmem_int_fadd(int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_fadd(long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_fadd(long long *target, long long value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_fadd(dst, val, pe)                             \
    _Generic(&*(dst),                                        \
            int*:         shmem_int_fadd,                    \
            long*:        shmem_long_fadd,                   \
            long long*:   shmem_longlong_fadd)(dst, val, pe)
#endif

/* Atomic Fetch&And */
OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_and(shmem_ctx_t ctx, int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_and(shmem_ctx_t ctx, long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_and(shmem_ctx_t ctx, long long *target, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_fetch_and(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_fetch_and(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_fetch_and(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_fetch_and(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe);

OSHMEM_DECLSPEC int shmem_int_atomic_fetch_and(int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_fetch_and(long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_and(long long *target, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_and(unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_and(unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_and(unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC int32_t shmem_int32_atomic_fetch_and(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_int64_atomic_fetch_and(int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_fetch_and(uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_fetch_and(uint64_t *target, uint64_t value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_and(...)                                           \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                              \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),          \
                int*:         shmem_ctx_int_atomic_fetch_and,                 \
                long*:        shmem_ctx_long_atomic_fetch_and,                \
                long long*:   shmem_ctx_longlong_atomic_fetch_and,            \
                unsigned int*:         shmem_ctx_uint_atomic_fetch_and,       \
                unsigned long*:        shmem_ctx_ulong_atomic_fetch_and,      \
                unsigned long long*:   shmem_ctx_ulonglong_atomic_fetch_and,  \
                default:               __oshmem_datatype_ignore),             \
            int*:         shmem_int_atomic_fetch_and,                         \
            long*:        shmem_long_atomic_fetch_and,                        \
            long long*:   shmem_longlong_atomic_fetch_and,                    \
            unsigned int*:         shmem_uint_atomic_fetch_and,               \
            unsigned long*:        shmem_ulong_atomic_fetch_and,              \
            unsigned long long*:   shmem_ulonglong_atomic_fetch_and)(__VA_ARGS__)
#endif

/* Atomic Fetch&Or */
OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_or(shmem_ctx_t ctx, int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_or(shmem_ctx_t ctx, long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_or(shmem_ctx_t ctx, long long *target, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_fetch_or(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_fetch_or(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_fetch_or(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_fetch_or(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe);

OSHMEM_DECLSPEC int shmem_int_atomic_fetch_or(int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_fetch_or(long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_or(long long *target, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_or(unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_or(unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_or(unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC int32_t shmem_int32_atomic_fetch_or(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_int64_atomic_fetch_or(int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_fetch_or(uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_fetch_or(uint64_t *target, uint64_t value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_or(...)                                           \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                             \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),         \
                int*:         shmem_ctx_int_atomic_fetch_or,                 \
                long*:        shmem_ctx_long_atomic_fetch_or,                \
                long long*:   shmem_ctx_longlong_atomic_fetch_or,            \
                unsigned int*:         shmem_ctx_uint_atomic_fetch_or,       \
                unsigned long*:        shmem_ctx_ulong_atomic_fetch_or,      \
                unsigned long long*:   shmem_ctx_ulonglong_atomic_fetch_or,  \
                default:               __oshmem_datatype_ignore),            \
            int*:         shmem_int_atomic_fetch_or,                         \
            long*:        shmem_long_atomic_fetch_or,                        \
            long long*:   shmem_longlong_atomic_fetch_or,                    \
            unsigned int*:         shmem_uint_atomic_fetch_or,               \
            unsigned long*:        shmem_ulong_atomic_fetch_or,              \
            unsigned long long*:   shmem_ulonglong_atomic_fetch_or)(__VA_ARGS__)
#endif

/* Atomic Fetch&Xor */
OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_xor(shmem_ctx_t ctx, int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_xor(shmem_ctx_t ctx, long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_xor(shmem_ctx_t ctx, long long *target, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_fetch_xor(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_fetch_xor(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_fetch_xor(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_fetch_xor(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe);

OSHMEM_DECLSPEC int shmem_int_atomic_fetch_xor(int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_fetch_xor(long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_xor(long long *target, long long value, int pe);
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_xor(unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_xor(unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_xor(unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC int32_t shmem_int32_atomic_fetch_xor(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmem_int64_atomic_fetch_xor(int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_fetch_xor(uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_fetch_xor(uint64_t *target, uint64_t value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_xor(...)                                           \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                              \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),          \
                int*:         shmem_ctx_int_atomic_fetch_xor,                 \
                long*:        shmem_ctx_long_atomic_fetch_xor,                \
                long long*:   shmem_ctx_longlong_atomic_fetch_xor,            \
                unsigned int*:         shmem_ctx_uint_atomic_fetch_xor,       \
                unsigned long*:        shmem_ctx_ulong_atomic_fetch_xor,      \
                unsigned long long*:   shmem_ctx_ulonglong_atomic_fetch_xor,  \
                default:               __oshmem_datatype_ignore),             \
            int*:         shmem_int_atomic_fetch_xor,                         \
            long*:        shmem_long_atomic_fetch_xor,                        \
            long long*:   shmem_longlong_atomic_fetch_xor,                    \
            unsigned int*:         shmem_uint_atomic_fetch_xor,               \
            unsigned long*:        shmem_ulong_atomic_fetch_xor,              \
            unsigned long long*:   shmem_ulonglong_atomic_fetch_xor)(__VA_ARGS__)
#endif

/* Atomic Fetch */
OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch(shmem_ctx_t ctx, const int *target, int pe);
OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch(shmem_ctx_t ctx, const long *target, int pe);
OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch(shmem_ctx_t ctx, const long long *target, int pe);
OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch(shmem_ctx_t ctx, const unsigned int *target, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch(shmem_ctx_t ctx, const unsigned long *target, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch(shmem_ctx_t ctx, const unsigned long long *target, int pe);
OSHMEM_DECLSPEC float shmem_ctx_float_atomic_fetch(shmem_ctx_t ctx, const float *target, int pe);
OSHMEM_DECLSPEC double shmem_ctx_double_atomic_fetch(shmem_ctx_t ctx, const double *target, int pe);
OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_fetch(shmem_ctx_t ctx, const int32_t *target, int pe);
OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_fetch(shmem_ctx_t ctx, const int64_t *target, int pe);
OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_fetch(shmem_ctx_t ctx, const uint32_t *target, int pe);
OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_fetch(shmem_ctx_t ctx, const uint64_t *target, int pe);
OSHMEM_DECLSPEC size_t shmem_ctx_size_atomic_fetch(shmem_ctx_t ctx, const size_t *target, int pe);
OSHMEM_DECLSPEC ptrdiff_t shmem_ctx_ptrdiff_atomic_fetch(shmem_ctx_t ctx, const ptrdiff_t *target, int pe);

OSHMEM_DECLSPEC int shmem_int_atomic_fetch(const int *target, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_fetch(const long *target, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch(const long long *target, int pe);
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch(const unsigned int *target, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch(const unsigned long *target, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch(const unsigned long long *target, int pe);
OSHMEM_DECLSPEC float shmem_float_atomic_fetch(const float *target, int pe);
OSHMEM_DECLSPEC double shmem_double_atomic_fetch(const double *target, int pe);
OSHMEM_DECLSPEC int32_t shmem_int32_atomic_fetch(const int32_t *target, int pe);
OSHMEM_DECLSPEC int64_t shmem_int64_atomic_fetch(const int64_t *target, int pe);
OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_fetch(const uint32_t *target, int pe);
OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_fetch(const uint64_t *target, int pe);
OSHMEM_DECLSPEC size_t shmem_size_atomic_fetch(const size_t *target, int pe);
OSHMEM_DECLSPEC ptrdiff_t shmem_ptrdiff_atomic_fetch(const ptrdiff_t *target, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch(...)                                      \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                     \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \
                int*:         shmem_ctx_int_atomic_fetch,            \
                long*:        shmem_ctx_long_atomic_fetch,           \
                long long*:   shmem_ctx_longlong_atomic_fetch,       \
                unsigned int*:       shmem_ctx_uint_atomic_fetch,      \
                unsigned long*:      shmem_ctx_ulong_atomic_fetch,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_fetch, \
                float*:       shmem_ctx_float_atomic_fetch,          \
                double*:      shmem_ctx_double_atomic_fetch,         \
                default:      __oshmem_datatype_ignore),             \
            int*:         shmem_int_atomic_fetch,                    \
            long*:        shmem_long_atomic_fetch,                   \
            long long*:   shmem_longlong_atomic_fetch,               \
            unsigned int*:       shmem_uint_atomic_fetch,            \
            unsigned long*:      shmem_ulong_atomic_fetch,           \
            unsigned long long*: shmem_ulonglong_atomic_fetch,       \
            float*:       shmem_float_atomic_fetch,                  \
            double*:      shmem_double_atomic_fetch)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC int shmem_int_fetch(const int *target, int pe);
OSHMEM_DECLSPEC long shmem_long_fetch(const long *target, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_fetch(const long long *target, int pe);
OSHMEM_DECLSPEC float shmem_float_fetch(const float *target, int pe);
OSHMEM_DECLSPEC double shmem_double_fetch(const double *target, int pe);
#if OSHMEM_HAVE_C11
#define shmem_fetch(dst, pe)                             \
    _Generic(&*(dst),                                    \
            int*:         shmem_int_fetch,               \
            long*:        shmem_long_fetch,              \
            long long*:   shmem_longlong_fetch,          \
            float*:       shmem_float_fetch,             \
            double*:      shmem_double_fetch)(dst, pe)
#endif

/* Atomic Fetch&Inc */
OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_inc(shmem_ctx_t ctx, int *target, int pe);
OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_inc(shmem_ctx_t ctx, long *target, int pe);
OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_inc(shmem_ctx_t ctx, long long *target, int pe);
OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_inc(shmem_ctx_t ctx, unsigned int *target, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_inc(shmem_ctx_t ctx, unsigned long *target, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_inc(shmem_ctx_t ctx, unsigned long long *target, int pe);
OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_fetch_inc(shmem_ctx_t ctx, int32_t *target, int pe);
OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_fetch_inc(shmem_ctx_t ctx, int64_t *target, int pe);
OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_fetch_inc(shmem_ctx_t ctx, uint32_t *target, int pe);
OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_fetch_inc(shmem_ctx_t ctx, uint64_t *target, int pe);
OSHMEM_DECLSPEC size_t shmem_ctx_size_atomic_fetch_inc(shmem_ctx_t ctx, size_t *target, int pe);
OSHMEM_DECLSPEC ptrdiff_t shmem_ctx_ptrdiff_atomic_fetch_inc(shmem_ctx_t ctx, ptrdiff_t *target, int pe);

OSHMEM_DECLSPEC int shmem_int_atomic_fetch_inc(int *target, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_fetch_inc(long *target, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_inc(long long *target, int pe);
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_inc(unsigned int *target, int pe);
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_inc(unsigned long *target, int pe);
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_inc(unsigned long long *target, int pe);
OSHMEM_DECLSPEC int32_t shmem_int32_atomic_fetch_inc(int32_t *target, int pe);
OSHMEM_DECLSPEC int64_t shmem_int64_atomic_fetch_inc(int64_t *target, int pe);
OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_fetch_inc(uint32_t *target, int pe);
OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_fetch_inc(uint64_t *target, int pe);
OSHMEM_DECLSPEC size_t shmem_size_atomic_fetch_inc(size_t *target, int pe);
OSHMEM_DECLSPEC ptrdiff_t shmem_ptrdiff_atomic_fetch_inc(ptrdiff_t *target, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_inc(...)                                 \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                     \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \
                int*:         shmem_ctx_int_atomic_fetch_inc,       \
                long*:        shmem_ctx_long_atomic_fetch_inc,      \
                long long*:   shmem_ctx_longlong_atomic_fetch_inc,  \
                unsigned int*:       shmem_ctx_uint_atomic_fetch_inc,      \
                unsigned long*:      shmem_ctx_ulong_atomic_fetch_inc,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_inc, \
                default:      __oshmem_datatype_ignore),             \
            int*:         shmem_int_atomic_fetch_inc,               \
            long*:        shmem_long_atomic_fetch_inc,              \
            long long*:   shmem_longlong_atomic_fetch_inc,          \
            unsigned int*:       shmem_uint_atomic_fetch_inc,       \
            unsigned long*:      shmem_ulong_atomic_fetch_inc,      \
            unsigned long long*: shmem_ulonglong_atomic_fetch_inc)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC int shmem_int_finc(int *target, int pe);
OSHMEM_DECLSPEC long shmem_long_finc(long *target, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_finc(long long *target, int pe);
#if OSHMEM_HAVE_C11
#define shmem_finc(dst, pe)                            \
    _Generic(&*(dst),                                  \
            int*:         shmem_int_finc,              \
            long*:        shmem_long_finc,             \
            long long*:   shmem_longlong_finc)(dst, pe)
#endif

/* Atomic Add */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_add(shmem_ctx_t ctx, int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_add(shmem_ctx_t ctx, long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_add(shmem_ctx_t ctx, long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_add(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_add(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_add(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_add(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_add(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_add(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_add(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_size_atomic_add(shmem_ctx_t ctx, size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_atomic_add(shmem_ctx_t ctx, ptrdiff_t *target, ptrdiff_t value, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_add(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_add(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_add(long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_add(unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_add(unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_add(unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_add(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_add(int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_add(uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_add(uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC void shmem_size_atomic_add(size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC void shmem_ptrdiff_atomic_add(ptrdiff_t *target, ptrdiff_t value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_add(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                     \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \
                int*:         shmem_ctx_int_atomic_add,              \
                long*:        shmem_ctx_long_atomic_add,             \
                long long*:   shmem_ctx_longlong_atomic_add,         \
                unsigned int*:       shmem_ctx_uint_atomic_add,      \
                unsigned long*:      shmem_ctx_ulong_atomic_add,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_add, \
                default:      __oshmem_datatype_ignore),             \
            int*:         shmem_int_atomic_add,                      \
            long*:        shmem_long_atomic_add,                     \
            long long*:   shmem_longlong_atomic_add,                 \
            unsigned int*:       shmem_uint_atomic_add,              \
            unsigned long*:      shmem_ulong_atomic_add,             \
            unsigned long long*: shmem_ulonglong_atomic_add)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC void shmem_int_add(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_add(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_add(long long *target, long long value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_add(dst, val, pe)                             \
    _Generic(&*(dst),                                       \
            int*:         shmem_int_add,                    \
            long*:        shmem_long_add,                   \
            long long*:   shmem_longlong_add)(dst, val, pe)
#endif

/* Atomic And */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_and(shmem_ctx_t ctx, int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_and(shmem_ctx_t ctx, long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_and(shmem_ctx_t ctx, long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_and(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_and(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_and(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_and(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_and(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_and(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_and(long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_and(unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_and(unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_and(unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_and(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_and(int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_and(uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_and(uint64_t *target, uint64_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_and(...)                                          \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                       \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),   \
                int*:         shmem_ctx_int_atomic_and,                \
                long*:        shmem_ctx_long_atomic_and,               \
                long long*:   shmem_ctx_longlong_atomic_and,           \
                unsigned int*:         shmem_ctx_uint_atomic_and,      \
                unsigned long*:        shmem_ctx_ulong_atomic_and,     \
                unsigned long long*:   shmem_ctx_ulonglong_atomic_and, \
                default:               __oshmem_datatype_ignore),      \
            int*:         shmem_int_atomic_and,                        \
            long*:        shmem_long_atomic_and,                       \
            long long*:   shmem_longlong_atomic_and,                   \
            unsigned int*:         shmem_uint_atomic_and,              \
            unsigned long*:        shmem_ulong_atomic_and,             \
            unsigned long long*:   shmem_ulonglong_atomic_and)(__VA_ARGS__)
#endif

/* Atomic Or */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_or(shmem_ctx_t ctx, int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_or(shmem_ctx_t ctx, long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_or(shmem_ctx_t ctx, long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_or(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_or(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_or(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_or(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_or(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_or(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_or(long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_or(unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_or(unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_or(unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_or(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_or(int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_or(uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_or(uint64_t *target, uint64_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_or(...)                                          \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                      \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),  \
                int*:         shmem_ctx_int_atomic_or,                \
                long*:        shmem_ctx_long_atomic_or,               \
                long long*:   shmem_ctx_longlong_atomic_or,           \
                unsigned int*:         shmem_ctx_uint_atomic_or,      \
                unsigned long*:        shmem_ctx_ulong_atomic_or,     \
                unsigned long long*:   shmem_ctx_ulonglong_atomic_or, \
                default:               __oshmem_datatype_ignore),     \
            int*:         shmem_int_atomic_or,                        \
            long*:        shmem_long_atomic_or,                       \
            long long*:   shmem_longlong_atomic_or,                   \
            unsigned int*:         shmem_uint_atomic_or,              \
            unsigned long*:        shmem_ulong_atomic_or,             \
            unsigned long long*:   shmem_ulonglong_atomic_or)(__VA_ARGS__)
#endif

/* Atomic Xor */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_xor(shmem_ctx_t ctx, int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_xor(shmem_ctx_t ctx, long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_xor(shmem_ctx_t ctx, long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_xor(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_xor(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_xor(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_xor(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_xor(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_xor(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_xor(long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_xor(unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_xor(unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_xor(unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_xor(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_xor(int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_xor(uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_xor(uint64_t *target, uint64_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_xor(...)                                          \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                       \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),   \
                int*:         shmem_ctx_int_atomic_xor,                \
                long*:        shmem_ctx_long_atomic_xor,               \
                long long*:   shmem_ctx_longlong_atomic_xor,           \
                unsigned int*:         shmem_ctx_uint_atomic_xor,      \
                unsigned long*:        shmem_ctx_ulong_atomic_xor,     \
                unsigned long long*:   shmem_ctx_ulonglong_atomic_xor, \
                default:               __oshmem_datatype_ignore),      \
            int*:         shmem_int_atomic_xor,                        \
            long*:        shmem_long_atomic_xor,                       \
            long long*:   shmem_longlong_atomic_xor,                   \
            unsigned int*:         shmem_uint_atomic_xor,              \
            unsigned long*:        shmem_ulong_atomic_xor,             \
            unsigned long long*:   shmem_ulonglong_atomic_xor)(__VA_ARGS__)
#endif

/* Atomic Inc */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_inc(shmem_ctx_t ctx, int *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_inc(shmem_ctx_t ctx, long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_inc(shmem_ctx_t ctx, long long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_inc(shmem_ctx_t ctx, unsigned int *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_inc(shmem_ctx_t ctx, unsigned long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_inc(shmem_ctx_t ctx, unsigned long long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_inc(shmem_ctx_t ctx, int32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_inc(shmem_ctx_t ctx, int64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_inc(shmem_ctx_t ctx, uint32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_inc(shmem_ctx_t ctx, uint64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_size_atomic_inc(shmem_ctx_t ctx, size_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_atomic_inc(shmem_ctx_t ctx, ptrdiff_t *target, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_inc(int *target, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_inc(long *target, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_inc(long long *target, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_inc(unsigned int *target, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_inc(unsigned long *target, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_inc(unsigned long long *target, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_inc(int32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_inc(int64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_inc(uint32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_inc(uint64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_size_atomic_inc(size_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ptrdiff_atomic_inc(ptrdiff_t *target, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_inc(...)                                       \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                    \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),\
                int*:         shmem_ctx_int_atomic_inc,             \
                long*:        shmem_ctx_long_atomic_inc,            \
                long long*:   shmem_ctx_longlong_atomic_inc,        \
                unsigned int*:       shmem_ctx_uint_atomic_inc,     \
                unsigned long*:      shmem_ctx_ulong_atomic_inc,    \
                unsigned long long*: shmem_ctx_ulonglong_atomic_inc,\
                default:      __oshmem_datatype_ignore),            \
            int*:         shmem_int_atomic_inc,                     \
            long*:        shmem_long_atomic_inc,                    \
            long long*:   shmem_longlong_atomic_inc,                \
            unsigned int*:       shmem_uint_atomic_inc,             \
            unsigned long*:      shmem_ulong_atomic_inc,            \
            unsigned long long*: shmem_ulonglong_atomic_inc)(__VA_ARGS__)
#endif

OSHMEM_DECLSPEC void shmem_int_inc(int *target, int pe);
OSHMEM_DECLSPEC void shmem_long_inc(long *target, int pe);
OSHMEM_DECLSPEC void shmem_longlong_inc(long long *target, int pe);
#if OSHMEM_HAVE_C11
#define shmem_inc(dst, pe)                            \
    _Generic(&*(dst),                                 \
            int*:         shmem_int_inc,              \
            long*:        shmem_long_inc,             \
            long long*:   shmem_longlong_inc)(dst, pe)
#endif


/*
 * Nonblocking Atomic Memory Operations
 */

/* Atomic Nonblocking Fetch */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_fetch_nbi(shmem_ctx_t ctx, int *fetch, const int *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_fetch_nbi(shmem_ctx_t ctx, long *fetch, const long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_fetch_nbi(shmem_ctx_t ctx, long long *fetch, const long long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_fetch_nbi(shmem_ctx_t ctx, unsigned int *fetch, const unsigned int *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_fetch_nbi(shmem_ctx_t ctx, unsigned long *fetch,  const unsigned long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_fetch_nbi(shmem_ctx_t ctx, unsigned long long *fetch, const unsigned long long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_float_atomic_fetch_nbi(shmem_ctx_t ctx, float *fetch, const float *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_double_atomic_fetch_nbi(shmem_ctx_t ctx, double *fetch, const double *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_fetch_nbi(shmem_ctx_t ctx, int32_t *fetch, const int32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_fetch_nbi(shmem_ctx_t ctx, int64_t *fetch, const int64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_fetch_nbi(shmem_ctx_t ctx, uint32_t *fetch, const uint32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_fetch_nbi(shmem_ctx_t ctx, uint64_t *fetch, const uint64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_size_atomic_fetch_nbi(shmem_ctx_t ctx, size_t *fetch, const size_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_atomic_fetch_nbi(shmem_ctx_t ctx, ptrdiff_t *fetch, const ptrdiff_t *target, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_fetch_nbi(int *fetch, const int *target, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_fetch_nbi(long *fetch, const long *target, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_fetch_nbi(long long *fetch, const long long *target, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_fetch_nbi(unsigned int *fetch, const unsigned int *target, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_fetch_nbi(unsigned long *fetch, const unsigned long *target, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_fetch_nbi(unsigned long long *fetch, const unsigned long long *target, int pe);
OSHMEM_DECLSPEC void shmem_float_atomic_fetch_nbi(float *fetch, const float *target, int pe);
OSHMEM_DECLSPEC void shmem_double_atomic_fetch_nbi(double *fetch, const double *target, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_fetch_nbi(int32_t *fetch, const int32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_fetch_nbi(int64_t *fetch, const int64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_fetch_nbi(uint32_t *fetch, const uint32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_fetch_nbi(uint64_t *fetch, const uint64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_size_atomic_fetch_nbi(size_t *fetch, const size_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ptrdiff_atomic_fetch_nbi(ptrdiff_t *fetch, const ptrdiff_t *target, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_nbi(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                           \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),       \
                int*:         shmem_ctx_int_atomic_fetch_nbi,              \
                long*:        shmem_ctx_long_atomic_fetch_nbi,             \
                long long*:   shmem_ctx_longlong_atomic_fetch_nbi,         \
                unsigned int*:       shmem_ctx_uint_atomic_fetch_nbi,      \
                unsigned long*:      shmem_ctx_ulong_atomic_fetch_nbi,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_nbi, \
                float*:       shmem_ctx_float_atomic_fetch_nbi,            \
                double*:      shmem_ctx_double_atomic_fetch_nbi,           \
                default:      __oshmem_datatype_ignore),                   \
            int*:        shmem_int_atomic_fetch_nbi,                       \
            long*:       shmem_long_atomic_fetch_nbi,                      \
            long long*:  shmem_longlong_atomic_fetch_nbi,                  \
            unsigned int*:       shmem_uint_atomic_fetch_nbi,              \
            unsigned long*:      shmem_ulong_atomic_fetch_nbi,             \
            unsigned long long*: shmem_ulonglong_atomic_fetch_nbi,         \
            float*:       shmem_float_atomic_fetch_nbi,                    \
            double*:      shmem_double_atomic_fetch_nbi)(__VA_ARGS__)
#endif


/* Atomic Nonblocking Compare and Swap */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_compare_swap_nbi(shmem_ctx_t ctx, int *fetch, int *target, int cond, int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_compare_swap_nbi(shmem_ctx_t ctx, long *fetch, long *target, long cond, long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_compare_swap_nbi(shmem_ctx_t ctx, long long *fetch, long long *target, long long cond, long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_compare_swap_nbi(shmem_ctx_t ctx, unsigned int *fetch, unsigned int *target, unsigned int cond, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_compare_swap_nbi(shmem_ctx_t ctx, unsigned long *fetch, unsigned long *target, unsigned long cond, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_compare_swap_nbi(shmem_ctx_t ctx, unsigned long long *fetch, unsigned long long *target, unsigned long long cond, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_compare_swap_nbi(shmem_ctx_t ctx, int32_t *fetch, int32_t *target, int32_t cond, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_compare_swap_nbi(shmem_ctx_t ctx, int64_t *fetch, int64_t *target, int64_t cond, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_compare_swap_nbi(shmem_ctx_t ctx, uint32_t *fetch, uint32_t *target, uint32_t cond, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_compare_swap_nbi(shmem_ctx_t ctx, uint64_t *fetch, uint64_t *target, uint64_t cond, uint64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_size_atomic_compare_swap_nbi(shmem_ctx_t ctx, size_t *fetch, size_t *target, size_t cond, size_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_atomic_compare_swap_nbi(shmem_ctx_t ctx, ptrdiff_t *fetch, ptrdiff_t *target, ptrdiff_t cond, ptrdiff_t value, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_compare_swap_nbi(int *fetch, int *target, int cond, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_compare_swap_nbi(long *fetch, long *target, long cond, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_compare_swap_nbi(long long *fetch, long long *target, long long cond, long long value, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_compare_swap_nbi(unsigned int *fetch, unsigned int *target, unsigned int cond, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_compare_swap_nbi(unsigned long *fetch, unsigned long *target, unsigned long cond, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_compare_swap_nbi(unsigned long long *fetch, unsigned long long *target, unsigned long long cond, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_compare_swap_nbi(int32_t *fetch, int32_t *target, int32_t cond, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_compare_swap_nbi(int64_t *fetch, int64_t *target, int64_t cond, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_compare_swap_nbi(uint32_t *fetch, uint32_t *target, uint32_t cond, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_compare_swap_nbi(uint64_t *fetch, uint64_t *target, uint64_t cond, uint64_t value, int pe);
OSHMEM_DECLSPEC void shmem_size_atomic_compare_swap_nbi(size_t *fetch, size_t *target, size_t cond, size_t value, int pe);
OSHMEM_DECLSPEC void shmem_ptrdiff_atomic_compare_swap_nbi(ptrdiff_t *fetch, ptrdiff_t *target, ptrdiff_t cond, ptrdiff_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_compare_swap_nbi(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                                  \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),              \
                int*:         shmem_ctx_int_atomic_compare_swap_nbi,              \
                long*:        shmem_ctx_long_atomic_compare_swap_nbi,             \
                long long*:   shmem_ctx_longlong_atomic_compare_swap_nbi,         \
                unsigned int*:       shmem_ctx_uint_atomic_compare_swap_nbi,      \
                unsigned long*:      shmem_ctx_ulong_atomic_compare_swap_nbi,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_compare_swap_nbi, \
                default:      __oshmem_datatype_ignore),                          \
            int*:        shmem_int_atomic_compare_swap_nbi,                       \
            long*:       shmem_long_atomic_compare_swap_nbi,                      \
            long long*:  shmem_longlong_atomic_compare_swap_nbi,                  \
            unsigned int*:       shmem_uint_atomic_compare_swap_nbi,              \
            unsigned long*:      shmem_ulong_atomic_compare_swap_nbi,             \
            unsigned long long*: shmem_ulonglong_atomic_compare_swap_nbi)(__VA_ARGS__)
#endif

/* Atomic Nonblocking Swap */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_swap_nbi(shmem_ctx_t ctx, int *fetch, int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_swap_nbi(shmem_ctx_t ctx, long *fetch, long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_swap_nbi(shmem_ctx_t ctx, long long *fetch, long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_swap_nbi(shmem_ctx_t ctx, unsigned int *fetch, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_swap_nbi(shmem_ctx_t ctx, unsigned long *fetch, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_swap_nbi(shmem_ctx_t ctx, unsigned long long *fetch, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_float_atomic_swap_nbi(shmem_ctx_t ctx, float *fetch, float *target, float value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_double_atomic_swap_nbi(shmem_ctx_t ctx, double *fetch, double *target, double value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_swap_nbi(shmem_ctx_t ctx, int32_t *fetch, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_swap_nbi(shmem_ctx_t ctx, int64_t *fetch, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_swap_nbi(shmem_ctx_t ctx, uint32_t *fetch, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_swap_nbi(shmem_ctx_t ctx, uint64_t *fetch, uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_size_atomic_swap_nbi(shmem_ctx_t ctx, size_t *fetch, size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_atomic_swap_nbi(shmem_ctx_t ctx, ptrdiff_t *fetch, ptrdiff_t *target,  ptrdiff_t value, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_swap_nbi(int *fetch, int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_swap_nbi(long *fetch, long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_swap_nbi(long long *fetch, long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_swap_nbi(unsigned int *fetch, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_swap_nbi(unsigned long *fetch, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_swap_nbi(unsigned long long *fetch, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_float_atomic_swap_nbi(float *fetch, float *target, float value, int pe);
OSHMEM_DECLSPEC void shmem_double_atomic_swap_nbi(double *fetch, double *target, double value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_swap_nbi(int32_t *fetch, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_swap_nbi(int64_t *fetch, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_swap_nbi(uint32_t *fetch, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_swap_nbi(uint64_t *fetch, uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC void shmem_size_atomic_swap_nbi(size_t *fetch, size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC void shmem_ptrdiff_atomic_swap_nbi(ptrdiff_t *fetch, ptrdiff_t *target, ptrdiff_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_swap_nbi(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                          \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),      \
                int*:         shmem_ctx_int_atomic_swap_nbi,              \
                long*:        shmem_ctx_long_atomic_swap_nbi,             \
                long long*:   shmem_ctx_longlong_atomic_swap_nbi,         \
                unsigned int*:       shmem_ctx_uint_atomic_swap_nbi,      \
                unsigned long*:      shmem_ctx_ulong_atomic_swap_nbi,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_swap_nbi, \
                float*:      shmem_ctx_float_atomic_swap_nbi,             \
                double*:      shmem_ctx_double_atomic_swap_nbi,           \
                default:      __oshmem_datatype_ignore),                  \
            int*:        shmem_int_atomic_swap_nbi,                       \
            long*:       shmem_long_atomic_swap_nbi,                      \
            long long*:  shmem_longlong_atomic_swap_nbi,                  \
            unsigned int*:       shmem_uint_atomic_swap_nbi,              \
            unsigned long*:      shmem_ulong_atomic_swap_nbi,             \
            unsigned long long*: shmem_ulonglong_atomic_swap_nbi,         \
            float*:      shmem_float_atomic_swap_nbi,                     \
            double*:     shmem_double_atomic_swap_nbi)(__VA_ARGS__)
#endif



/* Atomic Nonblocking Fetch and Increment */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_fetch_inc_nbi(shmem_ctx_t ctx, int *fetch, int *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_fetch_inc_nbi(shmem_ctx_t ctx, long *fetch, long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_fetch_inc_nbi(shmem_ctx_t ctx, long long *fetch, long long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_fetch_inc_nbi(shmem_ctx_t ctx, unsigned int *fetch, unsigned int *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_fetch_inc_nbi(shmem_ctx_t ctx, unsigned long *fetch,  unsigned long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_fetch_inc_nbi(shmem_ctx_t ctx, unsigned long long *fetch, unsigned long long *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_fetch_inc_nbi(shmem_ctx_t ctx, int32_t *fetch, int32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_fetch_inc_nbi(shmem_ctx_t ctx, int64_t *fetch, int64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_fetch_inc_nbi(shmem_ctx_t ctx, uint32_t *fetch, uint32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_fetch_inc_nbi(shmem_ctx_t ctx, uint64_t *fetch, uint64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_size_atomic_fetch_inc_nbi(shmem_ctx_t ctx, size_t *fetch, size_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_atomic_fetch_inc_nbi(shmem_ctx_t ctx, ptrdiff_t *fetch, ptrdiff_t *target, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_fetch_inc_nbi(int *fetch, int *target, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_fetch_inc_nbi(long *fetch, long *target, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_fetch_inc_nbi(long long *fetch, long long *target, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_fetch_inc_nbi(unsigned int *fetch, unsigned int *target, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_fetch_inc_nbi(unsigned long *fetch, unsigned long *target, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_fetch_inc_nbi(unsigned long long *fetch, unsigned long long *target, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_fetch_inc_nbi(int32_t *fetch, int32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_fetch_inc_nbi(int64_t *fetch, int64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_fetch_inc_nbi(uint32_t *fetch, uint32_t *target, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_fetch_inc_nbi(uint64_t *fetch, uint64_t *target, int pe);
OSHMEM_DECLSPEC void shmem_size_atomic_fetch_inc_nbi(size_t *fetch, size_t *target, int pe);
OSHMEM_DECLSPEC void shmem_ptrdiff_atomic_fetch_inc_nbi(ptrdiff_t *fetch, ptrdiff_t *target, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_inc_nbi(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                               \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),           \
                int*:         shmem_ctx_int_atomic_fetch_inc_nbi,              \
                long*:        shmem_ctx_long_atomic_fetch_inc_nbi,             \
                long long*:   shmem_ctx_longlong_atomic_fetch_inc_nbi,         \
                unsigned int*:       shmem_ctx_uint_atomic_fetch_inc_nbi,      \
                unsigned long*:      shmem_ctx_ulong_atomic_fetch_inc_nbi,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_inc_nbi, \
                default:      __oshmem_datatype_ignore),                       \
            int*:        shmem_int_atomic_fetch_inc_nbi,                       \
            long*:       shmem_long_atomic_fetch_inc_nbi,                      \
            long long*:  shmem_longlong_atomic_fetch_inc_nbi,                  \
            unsigned int*:       shmem_uint_atomic_fetch_inc_nbi,              \
            unsigned long*:      shmem_ulong_atomic_fetch_inc_nbi,             \
            unsigned long long*: shmem_ulonglong_atomic_fetch_inc_nbi)(__VA_ARGS__)
#endif


/* Atomic Nonblocking Fetch and Add */
OSHMEM_DECLSPEC void shmem_ctx_int_atomic_fetch_add_nbi(shmem_ctx_t ctx, int *fetch, int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_long_atomic_fetch_add_nbi(shmem_ctx_t ctx, long *fetch, long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_fetch_add_nbi(shmem_ctx_t ctx, long long *fetch, long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_fetch_add_nbi(shmem_ctx_t ctx, unsigned int *fetch, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_fetch_add_nbi(shmem_ctx_t ctx, unsigned long *fetch,  unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_fetch_add_nbi(shmem_ctx_t ctx, unsigned long long *fetch, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_fetch_add_nbi(shmem_ctx_t ctx, int32_t *fetch, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_fetch_add_nbi(shmem_ctx_t ctx, int64_t *fetch, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_fetch_add_nbi(shmem_ctx_t ctx, uint32_t *fetch, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_fetch_add_nbi(shmem_ctx_t ctx, uint64_t *fetch, uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_size_atomic_fetch_add_nbi(shmem_ctx_t ctx, size_t *fetch, size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_atomic_fetch_add_nbi(shmem_ctx_t ctx, ptrdiff_t *fetch, ptrdiff_t *target, ptrdiff_t value, int pe);

OSHMEM_DECLSPEC void shmem_int_atomic_fetch_add_nbi(int *fetch, int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_fetch_add_nbi(long *fetch, long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_fetch_add_nbi(long long *fetch, long long *target, long long value, int pe);
OSHMEM_DECLSPEC void shmem_uint_atomic_fetch_add_nbi(unsigned int *fetch, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_fetch_add_nbi(unsigned long *fetch, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_fetch_add_nbi(unsigned long long *fetch, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_fetch_add_nbi(int32_t *fetch, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_fetch_add_nbi(int64_t *fetch, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_fetch_add_nbi(uint32_t *fetch, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_fetch_add_nbi(uint64_t *fetch, uint64_t *target, uint64_t value, int pe);
OSHMEM_DECLSPEC void shmem_size_atomic_fetch_add_nbi(size_t *fetch, size_t *target, size_t value, int pe);
OSHMEM_DECLSPEC void shmem_ptrdiff_atomic_fetch_add_nbi(ptrdiff_t *fetch, ptrdiff_t *target, ptrdiff_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_add_nbi(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                               \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),           \
                int*:         shmem_ctx_int_atomic_fetch_add_nbi,              \
                long*:        shmem_ctx_long_atomic_fetch_add_nbi,             \
                long long*:   shmem_ctx_longlong_atomic_fetch_add_nbi,         \
                unsigned int*:       shmem_ctx_uint_atomic_fetch_add_nbi,      \
                unsigned long*:      shmem_ctx_ulong_atomic_fetch_add_nbi,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_add_nbi, \
                default:      __oshmem_datatype_ignore),                       \
            int*:        shmem_int_atomic_fetch_add_nbi,                       \
            long*:       shmem_long_atomic_fetch_add_nbi,                      \
            long long*:  shmem_longlong_atomic_fetch_add_nbi,                  \
            unsigned int*:       shmem_uint_atomic_fetch_add_nbi,              \
            unsigned long*:      shmem_ulong_atomic_fetch_add_nbi,             \
            unsigned long long*: shmem_ulonglong_atomic_fetch_add_nbi)(__VA_ARGS__)
#endif


/* Atomic Nonblocking Fetch and And */
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_fetch_and_nbi(shmem_ctx_t ctx, unsigned int *fetch, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_fetch_and_nbi(shmem_ctx_t ctx, unsigned long *fetch,  unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_fetch_and_nbi(shmem_ctx_t ctx, unsigned long long *fetch, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_fetch_and_nbi(shmem_ctx_t ctx, int32_t *fetch, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_fetch_and_nbi(shmem_ctx_t ctx, int64_t *fetch, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_fetch_and_nbi(shmem_ctx_t ctx, uint32_t *fetch, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_fetch_and_nbi(shmem_ctx_t ctx, uint64_t *fetch, uint64_t *target, uint64_t value, int pe);

OSHMEM_DECLSPEC void shmem_uint_atomic_fetch_and_nbi(unsigned int *fetch, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_fetch_and_nbi(unsigned long *fetch, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_fetch_and_nbi(unsigned long long *fetch, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_fetch_and_nbi(int32_t *fetch, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_fetch_and_nbi(int64_t *fetch, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_fetch_and_nbi(uint32_t *fetch, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_fetch_and_nbi(uint64_t *fetch, uint64_t *target, uint64_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_and_nbi(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                               \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),           \
                unsigned int*:       shmem_ctx_uint_atomic_fetch_and_nbi,      \
                unsigned long*:      shmem_ctx_ulong_atomic_fetch_and_nbi,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_and_nbi, \
                int32_t*: shmem_ctx_int32_atomic_fetch_and_nbi,                \
                int64_t*: shmem_ctx_int64_atomic_fetch_and_nbi,                \
                default:      __oshmem_datatype_ignore),                       \
            unsigned int*:       shmem_uint_atomic_fetch_and_nbi,              \
            unsigned long*:      shmem_ulong_atomic_fetch_and_nbi,             \
            int32_t*: shmem_int32_atomic_fetch_and_nbi,                        \
            int64_t*: shmem_int64_atomic_fetch_and_nbi,                        \
            unsigned long long*: shmem_ulonglong_atomic_fetch_and_nbi)(__VA_ARGS__)
#endif

/* Atomic Nonblocking Fetch and OR */
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_fetch_or_nbi(shmem_ctx_t ctx, unsigned int *fetch, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_fetch_or_nbi(shmem_ctx_t ctx, unsigned long *fetch,  unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_fetch_or_nbi(shmem_ctx_t ctx, unsigned long long *fetch, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_fetch_or_nbi(shmem_ctx_t ctx, int32_t *fetch, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_fetch_or_nbi(shmem_ctx_t ctx, int64_t *fetch, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_fetch_or_nbi(shmem_ctx_t ctx, uint32_t *fetch, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_fetch_or_nbi(shmem_ctx_t ctx, uint64_t *fetch, uint64_t *target, uint64_t value, int pe);

OSHMEM_DECLSPEC void shmem_uint_atomic_fetch_or_nbi(unsigned int *fetch, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_fetch_or_nbi(unsigned long *fetch, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_fetch_or_nbi(unsigned long long *fetch, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_fetch_or_nbi(int32_t *fetch, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_fetch_or_nbi(int64_t *fetch, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_fetch_or_nbi(uint32_t *fetch, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_fetch_or_nbi(uint64_t *fetch, uint64_t *target, uint64_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_or_nbi(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                              \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),          \
                unsigned int*:       shmem_ctx_uint_atomic_fetch_or_nbi,      \
                unsigned long*:      shmem_ctx_ulong_atomic_fetch_or_nbi,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_or_nbi, \
                int32_t*: shmem_ctx_int32_atomic_fetch_or_nbi,                \
                int64_t*: shmem_ctx_int64_atomic_fetch_or_nbi,                \
                default:      __oshmem_datatype_ignore),                      \
            unsigned int*:       shmem_uint_atomic_fetch_or_nbi,              \
            unsigned long*:      shmem_ulong_atomic_fetch_or_nbi,             \
            int32_t*: shmem_int32_atomic_fetch_or_nbi,                        \
            int64_t*: shmem_int64_atomic_fetch_or_nbi,                        \
            unsigned long long*: shmem_ulonglong_atomic_fetch_or_nbi)(__VA_ARGS__)
#endif


/* Atomic Nonblocking Fetch and XOR */
OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_fetch_xor_nbi(shmem_ctx_t ctx, unsigned int *fetch, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_fetch_xor_nbi(shmem_ctx_t ctx, unsigned long *fetch,  unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_fetch_xor_nbi(shmem_ctx_t ctx, unsigned long long *fetch, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_fetch_xor_nbi(shmem_ctx_t ctx, int32_t *fetch, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_fetch_xor_nbi(shmem_ctx_t ctx, int64_t *fetch, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_fetch_xor_nbi(shmem_ctx_t ctx, uint32_t *fetch, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_fetch_xor_nbi(shmem_ctx_t ctx, uint64_t *fetch, uint64_t *target, uint64_t value, int pe);

OSHMEM_DECLSPEC void shmem_uint_atomic_fetch_xor_nbi(unsigned int *fetch, unsigned int *target, unsigned int value, int pe);
OSHMEM_DECLSPEC void shmem_ulong_atomic_fetch_xor_nbi(unsigned long *fetch, unsigned long *target, unsigned long value, int pe);
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_fetch_xor_nbi(unsigned long long *fetch, unsigned long long *target, unsigned long long value, int pe);
OSHMEM_DECLSPEC void shmem_int32_atomic_fetch_xor_nbi(int32_t *fetch, int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmem_int64_atomic_fetch_xor_nbi(int64_t *fetch, int64_t *target, int64_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint32_atomic_fetch_xor_nbi(uint32_t *fetch, uint32_t *target, uint32_t value, int pe);
OSHMEM_DECLSPEC void shmem_uint64_atomic_fetch_xor_nbi(uint64_t *fetch, uint64_t *target, uint64_t value, int pe);

#if OSHMEM_HAVE_C11
#define shmem_atomic_fetch_xor_nbi(...)                                        \
    _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)),                               \
            shmem_ctx_t:  _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),           \
                unsigned int*:       shmem_ctx_uint_atomic_fetch_xor_nbi,      \
                unsigned long*:      shmem_ctx_ulong_atomic_fetch_xor_nbi,     \
                unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_xor_nbi, \
                int32_t*: shmem_ctx_int32_atomic_fetch_xor_nbi,                \
                int64_t*: shmem_ctx_int64_atomic_fetch_xor_nbi,                \
                default:      __oshmem_datatype_ignore),                       \
            unsigned int*:       shmem_uint_atomic_fetch_xor_nbi,              \
            unsigned long*:      shmem_ulong_atomic_fetch_xor_nbi,             \
            int32_t*: shmem_int32_atomic_fetch_xor_nbi,                        \
            int64_t*: shmem_int64_atomic_fetch_xor_nbi,                        \
            unsigned long long*: shmem_ulonglong_atomic_fetch_xor_nbi)(__VA_ARGS__)
#endif

/*
 *
 * Control of profiling
 *
 */
OSHMEM_DECLSPEC void shmem_pcontrol(int level, ...);

/*
 * Lock functions
 */
OSHMEM_DECLSPEC void shmem_set_lock(volatile long *lock);
OSHMEM_DECLSPEC void shmem_clear_lock(volatile long *lock);
OSHMEM_DECLSPEC int shmem_test_lock(volatile long *lock);

/*
 * P2P sync routines
 */
OSHMEM_DECLSPEC  void shmem_short_wait(volatile short *addr, short value);
OSHMEM_DECLSPEC  void shmem_int_wait(volatile int *addr, int value);
OSHMEM_DECLSPEC  void shmem_long_wait(volatile long *addr, long value);
OSHMEM_DECLSPEC  void shmem_longlong_wait(volatile long long *addr, long long value);
OSHMEM_DECLSPEC  void shmem_wait(volatile long *addr, long value);

OSHMEM_DECLSPEC  void shmem_short_wait_until(volatile short *addr, int cmp, short value);
OSHMEM_DECLSPEC  void shmem_int_wait_until(volatile int *addr, int cmp, int value);
OSHMEM_DECLSPEC  void shmem_long_wait_until(volatile long *addr, int cmp, long value);
OSHMEM_DECLSPEC  void shmem_longlong_wait_until(volatile long long *addr, int cmp, long long value);
OSHMEM_DECLSPEC  void shmem_ushort_wait_until(volatile unsigned short *addr, int cmp, unsigned short value);
OSHMEM_DECLSPEC  void shmem_uint_wait_until(volatile unsigned int *addr, int cmp, unsigned int value);
OSHMEM_DECLSPEC  void shmem_ulong_wait_until(volatile unsigned long *addr, int cmp, unsigned long value);
OSHMEM_DECLSPEC  void shmem_ulonglong_wait_until(volatile unsigned long long *addr, int cmp, unsigned long long value);
OSHMEM_DECLSPEC  void shmem_int32_wait_until(volatile int32_t *addr, int cmp, int32_t value);
OSHMEM_DECLSPEC  void shmem_int64_wait_until(volatile int64_t *addr, int cmp, int64_t value);
OSHMEM_DECLSPEC  void shmem_uint32_wait_until(volatile uint32_t *addr, int cmp, uint32_t value);
OSHMEM_DECLSPEC  void shmem_uint64_wait_until(volatile uint64_t *addr, int cmp, uint64_t value);
OSHMEM_DECLSPEC  void shmem_size_wait_until(volatile size_t *addr, int cmp, size_t value);
OSHMEM_DECLSPEC  void shmem_ptrdiff_wait_until(volatile ptrdiff_t *addr, int cmp, ptrdiff_t value);
#if OSHMEM_HAVE_C11
#define shmem_wait_until(addr, cmp, value)                  \
    _Generic(&*(addr),                                      \
        short*:       shmem_short_wait_until,               \
        int*:         shmem_int_wait_until,                 \
        long*:        shmem_long_wait_until,                \
        long long*:   shmem_longlong_wait_until,            \
        unsigned short*:       shmem_ushort_wait_until,     \
        unsigned int*:         shmem_uint_wait_until,       \
        unsigned long*:        shmem_ulong_wait_until,      \
        unsigned long long*:   shmem_ulonglong_wait_until)(addr, cmp, value)
#endif

OSHMEM_DECLSPEC  void shmem_short_wait_until_all(volatile short *ivars, size_t nelems, const int *status, int cmp, short value);
OSHMEM_DECLSPEC  void shmem_ushort_wait_until_all(volatile unsigned short *ivars, size_t nelems, const int *status, int cmp, unsigned short value);
OSHMEM_DECLSPEC  void shmem_int_wait_until_all(volatile int *ivars, size_t nelems, const int *status, int cmp, int value);
OSHMEM_DECLSPEC  void shmem_long_wait_until_all(volatile long *ivars, size_t nelems, const int *status, int cmp, long value);
OSHMEM_DECLSPEC  void shmem_longlong_wait_until_all(volatile long long *ivars, size_t nelems, const int *status, int cmp, long long value);
OSHMEM_DECLSPEC  void shmem_uint_wait_until_all(volatile unsigned int *ivars, size_t nelems, const int *status, int cmp, unsigned int value);
OSHMEM_DECLSPEC  void shmem_ulong_wait_until_all(volatile unsigned long *ivars, size_t nelems, const int *status, int cmp, unsigned long value);
OSHMEM_DECLSPEC  void shmem_ulonglong_wait_until_all(volatile unsigned long long *ivars, size_t nelems, const int *status, int cmp, unsigned long long value);
OSHMEM_DECLSPEC  void shmem_int32_wait_until_all(volatile int32_t *ivars, size_t nelems, const int *status, int cmp, int32_t value);
OSHMEM_DECLSPEC  void shmem_int64_wait_until_all(volatile int64_t *ivars, size_t nelems, const int *status, int cmp, int64_t value);
OSHMEM_DECLSPEC  void shmem_uint32_wait_until_all(volatile uint32_t *ivars, size_t nelems, const int *status, int cmp, uint32_t value);
OSHMEM_DECLSPEC  void shmem_uint64_wait_until_all(volatile uint64_t *ivars, size_t nelems, const int *status, int cmp, uint64_t value);
OSHMEM_DECLSPEC  void shmem_size_wait_until_all(volatile size_t *ivars, size_t nelems, const int *status, int cmp, size_t value);
OSHMEM_DECLSPEC  void shmem_ptrdiff_wait_until_all(volatile ptrdiff_t *ivars, size_t nelems, const int *status, int cmp, ptrdiff_t value);
#if OSHMEM_HAVE_C11
#define shmem_wait_until_all(ivars, nelems, status, cmp, value)          \
    _Generic(&*(ivars),                                                  \
        short*:                shmem_short_wait_until_all,               \
        unsigned short*:       shmem_ushort_wait_until_all,              \
        int*:                  shmem_int_wait_until_all,                 \
        long*:                 shmem_long_wait_until_all,                \
        long long*:            shmem_longlong_wait_until_all,            \
        unsigned int*:         shmem_uint_wait_until_all,                \
        unsigned long*:        shmem_ulong_wait_until_all,               \
        unsigned long long*:   shmem_ulonglong_wait_until_all)(ivars, nelems, status, cmp, value)
#endif

OSHMEM_DECLSPEC  size_t shmem_short_wait_until_any(volatile short *ivars, size_t nelems, const int *status, int cmp, short value);
OSHMEM_DECLSPEC  size_t shmem_ushort_wait_until_any(volatile unsigned short *ivars, size_t nelems, const int *status, int cmp, unsigned short value);
OSHMEM_DECLSPEC  size_t shmem_int_wait_until_any(volatile int *ivars, size_t nelems, const int *status, int cmp, int value);
OSHMEM_DECLSPEC  size_t shmem_long_wait_until_any(volatile long *ivars, size_t nelems, const int *status, int cmp, long value);
OSHMEM_DECLSPEC  size_t shmem_longlong_wait_until_any(volatile long long *ivars, size_t nelems, const int *status, int cmp, long long value);
OSHMEM_DECLSPEC  size_t shmem_uint_wait_until_any(volatile unsigned int *ivars, size_t nelems, const int *status, int cmp, unsigned int value);
OSHMEM_DECLSPEC  size_t shmem_ulong_wait_until_any(volatile unsigned long *ivars, size_t nelems, const int *status, int cmp, unsigned long value);
OSHMEM_DECLSPEC  size_t shmem_ulonglong_wait_until_any(volatile unsigned long long *ivars, size_t nelems, const int *status, int cmp, unsigned long long value);
OSHMEM_DECLSPEC  size_t shmem_int32_wait_until_any(volatile int32_t *ivars, size_t nelems, const int *status, int cmp, int32_t value);
OSHMEM_DECLSPEC  size_t shmem_int64_wait_until_any(volatile int64_t *ivars, size_t nelems, const int *status, int cmp, int64_t value);
OSHMEM_DECLSPEC  size_t shmem_uint32_wait_until_any(volatile uint32_t *ivars, size_t nelems, const int *status, int cmp, uint32_t value);
OSHMEM_DECLSPEC  size_t shmem_uint64_wait_until_any(volatile uint64_t *ivars, size_t nelems, const int *status, int cmp, uint64_t value);
OSHMEM_DECLSPEC  size_t shmem_size_wait_until_any(volatile size_t *ivars, size_t nelems, const int *status, int cmp, size_t value);
OSHMEM_DECLSPEC  size_t shmem_ptrdiff_wait_until_any(volatile ptrdiff_t *ivars, size_t nelems, const int *status, int cmp, ptrdiff_t value);
#if OSHMEM_HAVE_C11
#define shmem_wait_until_any(ivars, nelems, status, cmp, value)          \
    _Generic(&*(ivars),                                                  \
        short*:                shmem_short_wait_until_any,               \
        unsigned short*:       shmem_ushort_wait_until_any,              \
        int*:                  shmem_int_wait_until_any,                 \
        long*:                 shmem_long_wait_until_any,                \
        long long*:            shmem_longlong_wait_until_any,            \
        unsigned int*:         shmem_uint_wait_until_any,                \
        unsigned long*:        shmem_ulong_wait_until_any,               \
        unsigned long long*:   shmem_ulonglong_wait_until_any)(ivars, nelems, status, cmp, value)
#endif

OSHMEM_DECLSPEC  size_t shmem_short_wait_until_some(volatile short *ivars, size_t nelems,  size_t *indices, const int *status, int cmp, short value);
OSHMEM_DECLSPEC  size_t shmem_ushort_wait_until_some(volatile unsigned short *ivars, size_t nelems,  size_t *indices, const int *status, int cmp, unsigned short value);
OSHMEM_DECLSPEC  size_t shmem_int_wait_until_some(volatile int *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int value);
OSHMEM_DECLSPEC  size_t shmem_long_wait_until_some(volatile long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, long value);
OSHMEM_DECLSPEC  size_t shmem_longlong_wait_until_some(volatile long long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, long long value);
OSHMEM_DECLSPEC  size_t shmem_uint_wait_until_some(volatile unsigned int *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned int value);
OSHMEM_DECLSPEC  size_t shmem_ulong_wait_until_some(volatile unsigned long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned long value);
OSHMEM_DECLSPEC  size_t shmem_ulonglong_wait_until_some(volatile unsigned long long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned long long value);
OSHMEM_DECLSPEC  size_t shmem_int32_wait_until_some(volatile int32_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int32_t value);
OSHMEM_DECLSPEC  size_t shmem_int64_wait_until_some(volatile int64_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int64_t value);
OSHMEM_DECLSPEC  size_t shmem_uint32_wait_until_some(volatile uint32_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, uint32_t value);
OSHMEM_DECLSPEC  size_t shmem_uint64_wait_until_some(volatile uint64_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, uint64_t value);
OSHMEM_DECLSPEC  size_t shmem_size_wait_until_some(volatile size_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, size_t value);
OSHMEM_DECLSPEC  size_t shmem_ptrdiff_wait_until_some(volatile ptrdiff_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, ptrdiff_t value);
#if OSHMEM_HAVE_C11
#define shmem_wait_until_some(ivars, nelems, indices, status, cmp, value) \
    _Generic(&*(ivars),                                                   \
        short*:                shmem_short_wait_until_some,               \
        unsigned short*:       shmem_ushort_wait_until_some,              \
        int*:                  shmem_int_wait_until_some,                 \
        long*:                 shmem_long_wait_until_some,                \
        long long*:            shmem_longlong_wait_until_some,            \
        unsigned int*:         shmem_uint_wait_until_some,                \
        unsigned long*:        shmem_ulong_wait_until_some,               \
        unsigned long long*:   shmem_ulonglong_wait_until_some)(ivars, nelems, indices, status, cmp, value)
#endif

OSHMEM_DECLSPEC  void shmem_short_wait_until_all_vector(volatile short *ivars, size_t nelems, const int *status, int cmp, short *values);
OSHMEM_DECLSPEC  void shmem_ushort_wait_until_all_vector(volatile unsigned short *ivars, size_t nelems, const int *status, int cmp, unsigned short *values);
OSHMEM_DECLSPEC  void shmem_int_wait_until_all_vector(volatile int *ivars, size_t nelems, const int *status, int cmp, int *values);
OSHMEM_DECLSPEC  void shmem_long_wait_until_all_vector(volatile long *ivars, size_t nelems, const int *status, int cmp, long *values);
OSHMEM_DECLSPEC  void shmem_longlong_wait_until_all_vector(volatile long long *ivars, size_t nelems, const int *status, int cmp, long long *values);
OSHMEM_DECLSPEC  void shmem_uint_wait_until_all_vector(volatile unsigned int *ivars, size_t nelems, const int *status, int cmp, unsigned int *values);
OSHMEM_DECLSPEC  void shmem_ulong_wait_until_all_vector(volatile unsigned long *ivars, size_t nelems, const int *status, int cmp, unsigned long *values);
OSHMEM_DECLSPEC  void shmem_ulonglong_wait_until_all_vector(volatile unsigned long long *ivars, size_t nelems, const int *status, int cmp, unsigned long long *values);
OSHMEM_DECLSPEC  void shmem_int32_wait_until_all_vector(volatile int32_t *ivars, size_t nelems, const int *status, int cmp, int32_t *values);
OSHMEM_DECLSPEC  void shmem_int64_wait_until_all_vector(volatile int64_t *ivars, size_t nelems, const int *status, int cmp, int64_t *values);
OSHMEM_DECLSPEC  void shmem_uint32_wait_until_all_vector(volatile uint32_t *ivars, size_t nelems, const int *status, int cmp, uint32_t *values);
OSHMEM_DECLSPEC  void shmem_uint64_wait_until_all_vector(volatile uint64_t *ivars, size_t nelems, const int *status, int cmp, uint64_t *values);
OSHMEM_DECLSPEC  void shmem_size_wait_until_all_vector(volatile size_t *ivars, size_t nelems, const int *status, int cmp, size_t *values);
OSHMEM_DECLSPEC  void shmem_ptrdiff_wait_until_all_vector(volatile ptrdiff_t *ivars, size_t nelems, const int *status, int cmp, ptrdiff_t *values);
#if OSHMEM_HAVE_C11
#define shmem_wait_until_all_vector(ivars, nelems, status, cmp, values)         \
    _Generic(&*(ivars),                                                         \
        short*:                shmem_short_wait_until_all_vector,               \
        unsigned short*:       shmem_ushort_wait_until_all_vector,              \
        int*:                  shmem_int_wait_until_all_vector,                 \
        long*:                 shmem_long_wait_until_all_vector,                \
        long long*:            shmem_longlong_wait_until_all_vector,            \
        unsigned int*:         shmem_uint_wait_until_all_vector,                \
        unsigned long*:        shmem_ulong_wait_until_all_vector,               \
        unsigned long long*:   shmem_ulonglong_wait_until_all_vector)(ivars, nelems, status, cmp, values)
#endif


OSHMEM_DECLSPEC  size_t shmem_short_wait_until_any_vector(volatile short *ivars, size_t nelems, const int *status, int cmp, short *values);
OSHMEM_DECLSPEC  size_t shmem_ushort_wait_until_any_vector(volatile unsigned short *ivars, size_t nelems, const int *status, int cmp, unsigned short *values);
OSHMEM_DECLSPEC  size_t shmem_int_wait_until_any_vector(volatile int *ivars, size_t nelems, const int *status, int cmp, int *values);
OSHMEM_DECLSPEC  size_t shmem_long_wait_until_any_vector(volatile long *ivars, size_t nelems, const int *status, int cmp, long *values);
OSHMEM_DECLSPEC  size_t shmem_longlong_wait_until_any_vector(volatile long long *ivars, size_t nelems, const int *status, int cmp, long long *values);
OSHMEM_DECLSPEC  size_t shmem_uint_wait_until_any_vector(volatile unsigned int *ivars, size_t nelems, const int *status, int cmp, unsigned int *values);
OSHMEM_DECLSPEC  size_t shmem_ulong_wait_until_any_vector(volatile unsigned long *ivars, size_t nelems, const int *status, int cmp, unsigned long *values);
OSHMEM_DECLSPEC  size_t shmem_ulonglong_wait_until_any_vector(volatile unsigned long long *ivars, size_t nelems, const int *status, int cmp, unsigned long long *values);
OSHMEM_DECLSPEC  size_t shmem_int32_wait_until_any_vector(volatile int32_t *ivars, size_t nelems, const int *status, int cmp, int32_t *values);
OSHMEM_DECLSPEC  size_t shmem_int64_wait_until_any_vector(volatile int64_t *ivars, size_t nelems, const int *status, int cmp, int64_t *values);
OSHMEM_DECLSPEC  size_t shmem_uint32_wait_until_any_vector(volatile uint32_t *ivars, size_t nelems, const int *status, int cmp, uint32_t *values);
OSHMEM_DECLSPEC  size_t shmem_uint64_wait_until_any_vector(volatile uint64_t *ivars, size_t nelems, const int *status, int cmp, uint64_t *values);
OSHMEM_DECLSPEC  size_t shmem_size_wait_until_any_vector(volatile size_t *ivars, size_t nelems, const int *status, int cmp, size_t *values);
OSHMEM_DECLSPEC  size_t shmem_ptrdiff_wait_until_any_vector(volatile ptrdiff_t *ivars, size_t nelems, const int *status, int cmp, ptrdiff_t *values);
#if OSHMEM_HAVE_C11
#define shmem_wait_until_any_vector(ivars, nelems, status, cmp, values)         \
    _Generic(&*(ivars),                                                         \
        short*:                shmem_short_wait_until_any_vector,               \
        unsigned short*:       shmem_ushort_wait_until_any_vector,              \
        int*:                  shmem_int_wait_until_any_vector,                 \
        long*:                 shmem_long_wait_until_any_vector,                \
        long long*:            shmem_longlong_wait_until_any_vector,            \
        unsigned int*:         shmem_uint_wait_until_any_vector,                \
        unsigned long*:        shmem_ulong_wait_until_any_vector,               \
        unsigned long long*:   shmem_ulonglong_wait_until_any_vector)(ivars, nelems, status, cmp, values)
#endif


OSHMEM_DECLSPEC  size_t shmem_short_wait_until_some_vector(volatile short *ivars, size_t nelems, size_t *indices, const int *status, int cmp, short *values);
OSHMEM_DECLSPEC  size_t shmem_ushort_wait_until_some_vector(volatile unsigned short *ivars, size_t nelems, size_t *indices, const int *status , int cmp, unsigned short *values);
OSHMEM_DECLSPEC  size_t shmem_int_wait_until_some_vector(volatile int *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int *values);
OSHMEM_DECLSPEC  size_t shmem_long_wait_until_some_vector(volatile long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, long *values);
OSHMEM_DECLSPEC  size_t shmem_longlong_wait_until_some_vector(volatile long long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, long long *values);
OSHMEM_DECLSPEC  size_t shmem_uint_wait_until_some_vector(volatile unsigned int *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned int *values);
OSHMEM_DECLSPEC  size_t shmem_ulong_wait_until_some_vector(volatile unsigned long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned long *values);
OSHMEM_DECLSPEC  size_t shmem_ulonglong_wait_until_some_vector(volatile unsigned long long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned long long *values);
OSHMEM_DECLSPEC  size_t shmem_int32_wait_until_some_vector(volatile int32_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int32_t *values);
OSHMEM_DECLSPEC  size_t shmem_int64_wait_until_some_vector(volatile int64_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int64_t *values);
OSHMEM_DECLSPEC  size_t shmem_uint32_wait_until_some_vector(volatile uint32_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, uint32_t *values);
OSHMEM_DECLSPEC  size_t shmem_uint64_wait_until_some_vector(volatile uint64_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, uint64_t *values);
OSHMEM_DECLSPEC  size_t shmem_size_wait_until_some_vector(volatile size_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, size_t *values);
OSHMEM_DECLSPEC  size_t shmem_ptrdiff_wait_until_some_vector(volatile ptrdiff_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, ptrdiff_t *values);
#if OSHMEM_HAVE_C11
#define shmem_wait_until_some_vector(ivars, nelems, indices, status, cmp, values)\
    _Generic(&*(ivars),                                                          \
        short*:                shmem_short_wait_until_some_vector,               \
        unsigned short*:       shmem_ushort_wait_until_some_vector,              \
        int*:                  shmem_int_wait_until_some_vector,                 \
        long*:                 shmem_long_wait_until_some_vector,                \
        long long*:            shmem_longlong_wait_until_some_vector,            \
        unsigned int*:         shmem_uint_wait_until_some_vector,                \
        unsigned long*:        shmem_ulong_wait_until_some_vector,               \
        unsigned long long*:   shmem_ulonglong_wait_until_some_vector)(ivars, nelems, indices, status, cmp, values)
#endif

OSHMEM_DECLSPEC  int shmem_short_test(volatile short *addr, int cmp, short value);
OSHMEM_DECLSPEC  int shmem_int_test(volatile int *addr, int cmp, int value);
OSHMEM_DECLSPEC  int shmem_long_test(volatile long *addr, int cmp, long value);
OSHMEM_DECLSPEC  int shmem_longlong_test(volatile long long *addr, int cmp, long long value);
OSHMEM_DECLSPEC  int shmem_ushort_test(volatile unsigned short *addr, int cmp, unsigned short value);
OSHMEM_DECLSPEC  int shmem_uint_test(volatile unsigned int *addr, int cmp, unsigned int value);
OSHMEM_DECLSPEC  int shmem_ulong_test(volatile unsigned long *addr, int cmp, unsigned long value);
OSHMEM_DECLSPEC  int shmem_ulonglong_test(volatile unsigned long long *addr, int cmp, unsigned long long value);
OSHMEM_DECLSPEC  int shmem_int32_test(volatile int32_t *addr, int cmp, int32_t value);
OSHMEM_DECLSPEC  int shmem_int64_test(volatile int64_t *addr, int cmp, int64_t value);
OSHMEM_DECLSPEC  int shmem_uint32_test(volatile uint32_t *addr, int cmp, uint32_t value);
OSHMEM_DECLSPEC  int shmem_uint64_test(volatile uint64_t *addr, int cmp, uint64_t value);
OSHMEM_DECLSPEC  int shmem_size_test(volatile size_t *addr, int cmp, size_t value);
OSHMEM_DECLSPEC  int shmem_ptrdiff_test(volatile ptrdiff_t *addr, int cmp, ptrdiff_t value);
#if OSHMEM_HAVE_C11
#define shmem_test(addr, cmp, value)                  \
    _Generic(&*(addr),                                \
        short*:       shmem_short_test,               \
        int*:         shmem_int_test,                 \
        long*:        shmem_long_test,                \
        long long*:   shmem_longlong_test,            \
        unsigned short*:       shmem_ushort_test,     \
        unsigned int*:         shmem_uint_test,       \
        unsigned long*:        shmem_ulong_test,      \
        unsigned long long*:   shmem_ulonglong_test)(addr, cmp, value)
#endif

OSHMEM_DECLSPEC  int shmem_short_test_all(volatile short *ivars, size_t nelems, const int *status, int cmp, short value);
OSHMEM_DECLSPEC  int shmem_ushort_test_all(volatile unsigned short *ivars, size_t nelems, const int *status, int cmp, unsigned short value);
OSHMEM_DECLSPEC  int shmem_int_test_all(volatile int *ivars, size_t nelems, const int *status, int cmp, int value);
OSHMEM_DECLSPEC  int shmem_long_test_all(volatile long *ivars, size_t nelems, const int *status, int cmp, long value);
OSHMEM_DECLSPEC  int shmem_longlong_test_all(volatile long long *ivars, size_t nelems, const int *status, int cmp, long long value);
OSHMEM_DECLSPEC  int shmem_uint_test_all(volatile unsigned int *ivars, size_t nelems, const int *status, int cmp, unsigned int value);
OSHMEM_DECLSPEC  int shmem_ulong_test_all(volatile unsigned long *ivars, size_t nelems, const int *status, int cmp, unsigned long value);
OSHMEM_DECLSPEC  int shmem_ulonglong_test_all(volatile unsigned long long *ivars, size_t nelems, const int *status, int cmp, unsigned long long value);
OSHMEM_DECLSPEC  int shmem_int32_test_all(volatile int32_t *ivars, size_t nelems, const int *status, int cmp, int32_t value);
OSHMEM_DECLSPEC  int shmem_int64_test_all(volatile int64_t *ivars, size_t nelems, const int *status, int cmp, int64_t value);
OSHMEM_DECLSPEC  int shmem_uint32_test_all(volatile uint32_t *ivars, size_t nelems, const int *status, int cmp, uint32_t value);
OSHMEM_DECLSPEC  int shmem_uint64_test_all(volatile uint64_t *ivars, size_t nelems, const int *status, int cmp, uint64_t value);
OSHMEM_DECLSPEC  int shmem_size_test_all(volatile size_t *ivars, size_t nelems, const int *status, int cmp, size_t value);
OSHMEM_DECLSPEC  int shmem_ptrdiff_test_all(volatile ptrdiff_t *ivars, size_t nelems, const int *status, int cmp, ptrdiff_t value);
#if OSHMEM_HAVE_C11
#define shmem_test_all(ivars, nelems, status, cmp, value)          \
    _Generic(&*(ivars),                                            \
        short*:                shmem_short_test_all,               \
        unsigned short*:       shmem_ushort_test_all,              \
        int*:                  shmem_int_test_all,                 \
        long*:                 shmem_long_test_all,                \
        long long*:            shmem_longlong_test_all,            \
        unsigned int*:         shmem_uint_test_all,                \
        unsigned long*:        shmem_ulong_test_all,               \
        unsigned long long*:   shmem_ulonglong_test_all)(ivars, nelems, status, cmp, value)
#endif

OSHMEM_DECLSPEC  size_t shmem_short_test_any(volatile short *ivars, size_t nelems, const int *status, int cmp, short value);
OSHMEM_DECLSPEC  size_t shmem_ushort_test_any(volatile unsigned short *ivars, size_t nelems, const int *status, int cmp, unsigned short value);
OSHMEM_DECLSPEC  size_t shmem_int_test_any(volatile int *ivars, size_t nelems, const int *status, int cmp, int value);
OSHMEM_DECLSPEC  size_t shmem_long_test_any(volatile long *ivars, size_t nelems, const int *status, int cmp, long value);
OSHMEM_DECLSPEC  size_t shmem_longlong_test_any(volatile long long *ivars, size_t nelems, const int *status, int cmp, long long value);
OSHMEM_DECLSPEC  size_t shmem_uint_test_any(volatile unsigned int *ivars, size_t nelems, const int *status, int cmp, unsigned int value);
OSHMEM_DECLSPEC  size_t shmem_ulong_test_any(volatile unsigned long *ivars, size_t nelems, const int *status, int cmp, unsigned long value);
OSHMEM_DECLSPEC  size_t shmem_ulonglong_test_any(volatile unsigned long long *ivars, size_t nelems, const int *status, int cmp, unsigned long long value);
OSHMEM_DECLSPEC  size_t shmem_int32_test_any(volatile int32_t *ivars, size_t nelems, const int *status, int cmp, int32_t value);
OSHMEM_DECLSPEC  size_t shmem_int64_test_any(volatile int64_t *ivars, size_t nelems, const int *status, int cmp, int64_t value);
OSHMEM_DECLSPEC  size_t shmem_uint32_test_any(volatile uint32_t *ivars, size_t nelems, const int *status, int cmp, uint32_t value);
OSHMEM_DECLSPEC  size_t shmem_uint64_test_any(volatile uint64_t *ivars, size_t nelems, const int *status, int cmp, uint64_t value);
OSHMEM_DECLSPEC  size_t shmem_size_test_any(volatile size_t *ivars, size_t nelems, const int *status, int cmp, size_t value);
OSHMEM_DECLSPEC  size_t shmem_ptrdiff_test_any(volatile ptrdiff_t *ivars, size_t nelems, const int *status, int cmp, ptrdiff_t value);
#if OSHMEM_HAVE_C11
#define shmem_test_any(ivars, nelems, status, cmp, value)          \
    _Generic(&*(ivars),                                            \
        short*:                shmem_short_test_any,               \
        unsigned short*:       shmem_ushort_test_any,              \
        int*:                  shmem_int_test_any,                 \
        long*:                 shmem_long_test_any,                \
        long long*:            shmem_longlong_test_any,            \
        unsigned int*:         shmem_uint_test_any,                \
        unsigned long*:        shmem_ulong_test_any,               \
        unsigned long long*:   shmem_ulonglong_test_any)(ivars, nelems, status, cmp, value)
#endif

OSHMEM_DECLSPEC  size_t shmem_short_test_some(volatile short *ivars, size_t nelems, size_t *indices, const int *status, int cmp, short value) ;
OSHMEM_DECLSPEC  size_t shmem_ushort_test_some(volatile unsigned short *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned short value);
OSHMEM_DECLSPEC  size_t shmem_int_test_some(volatile int *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int value);
OSHMEM_DECLSPEC  size_t shmem_long_test_some(volatile long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, long value);
OSHMEM_DECLSPEC  size_t shmem_longlong_test_some(volatile long long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, long long value);
OSHMEM_DECLSPEC  size_t shmem_uint_test_some(volatile unsigned int *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned int value);
OSHMEM_DECLSPEC  size_t shmem_ulong_test_some(volatile unsigned long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned long value);
OSHMEM_DECLSPEC  size_t shmem_ulonglong_test_some(volatile unsigned long long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned long long value);
OSHMEM_DECLSPEC  size_t shmem_int32_test_some(volatile int32_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int32_t value);
OSHMEM_DECLSPEC  size_t shmem_int64_test_some(volatile int64_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int64_t value);
OSHMEM_DECLSPEC  size_t shmem_uint32_test_some(volatile uint32_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, uint32_t value);
OSHMEM_DECLSPEC  size_t shmem_uint64_test_some(volatile uint64_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, uint64_t value);
OSHMEM_DECLSPEC  size_t shmem_size_test_some(volatile size_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, size_t value);
OSHMEM_DECLSPEC  size_t shmem_ptrdiff_test_some(volatile ptrdiff_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, ptrdiff_t value);
#if OSHMEM_HAVE_C11
#define shmem_test_some(ivars, nelems, indices, status, cmp, value) \
    _Generic(&*(ivars),                                             \
        short*:                shmem_short_test_some,               \
        unsigned short*:       shmem_ushort_test_some,              \
        int*:                  shmem_int_test_some,                 \
        long*:                 shmem_long_test_some,                \
        long long*:            shmem_longlong_test_some,            \
        unsigned int*:         shmem_uint_test_some,                \
        unsigned long*:        shmem_ulong_test_some,               \
        unsigned long long*:   shmem_ulonglong_test_some)(ivars, nelems, indices, status, cmp, value)
#endif

OSHMEM_DECLSPEC  int shmem_short_test_all_vector(volatile short *ivars, size_t nelems, const int *status, int cmp, short *values);
OSHMEM_DECLSPEC  int shmem_ushort_test_all_vector(volatile unsigned short *ivars, size_t nelems, const int *status, int cmp, unsigned short *values);
OSHMEM_DECLSPEC  int shmem_int_test_all_vector(volatile int *ivars, size_t nelems, const int *status, int cmp, int *values);
OSHMEM_DECLSPEC  int shmem_long_test_all_vector(volatile long *ivars, size_t nelems, const int *status, int cmp, long *values);
OSHMEM_DECLSPEC  int shmem_longlong_test_all_vector(volatile long long *ivars, size_t nelems, const int *status, int cmp, long long *values);
OSHMEM_DECLSPEC  int shmem_uint_test_all_vector(volatile unsigned int *ivars, size_t nelems, const int *status, int cmp, unsigned int *values);
OSHMEM_DECLSPEC  int shmem_ulong_test_all_vector(volatile unsigned long *ivars, size_t nelems, const int *status, int cmp, unsigned long *values);
OSHMEM_DECLSPEC  int shmem_ulonglong_test_all_vector(volatile unsigned long long *ivars, size_t nelems, const int *status, int cmp, unsigned long long *values);
OSHMEM_DECLSPEC  int shmem_int32_test_all_vector(volatile int32_t *ivars, size_t nelems, const int *status, int cmp, int32_t *values);
OSHMEM_DECLSPEC  int shmem_int64_test_all_vector(volatile int64_t *ivars, size_t nelems, const int *status, int cmp, int64_t *values);
OSHMEM_DECLSPEC  int shmem_uint32_test_all_vector(volatile uint32_t *ivars, size_t nelems, const int *status, int cmp, uint32_t *values);
OSHMEM_DECLSPEC  int shmem_uint64_test_all_vector(volatile uint64_t *ivars, size_t nelems, const int *status, int cmp, uint64_t *values);
OSHMEM_DECLSPEC  int shmem_size_test_all_vector(volatile size_t *ivars, size_t nelems, const int *status, int cmp, size_t *values);
OSHMEM_DECLSPEC  int shmem_ptrdiff_test_all_vector(volatile ptrdiff_t *ivars, size_t nelems, const int *status, int cmp, ptrdiff_t *values);
#if OSHMEM_HAVE_C11
#define shmem_test_all_vector(ivars, nelems, status, cmp, values)         \
    _Generic(&*(ivars),                                                   \
        short*:                shmem_short_test_all_vector,               \
        unsigned short*:       shmem_ushort_test_all_vector,              \
        int*:                  shmem_int_test_all_vector,                 \
        long*:                 shmem_long_test_all_vector,                \
        long long*:            shmem_longlong_test_all_vector,            \
        unsigned int*:         shmem_uint_test_all_vector,                \
        unsigned long*:        shmem_ulong_test_all_vector,               \
        unsigned long long*:   shmem_ulonglong_test_all_vector)(ivars, nelems, status, cmp, values)
#endif


OSHMEM_DECLSPEC  size_t shmem_short_test_any_vector(volatile short *ivars, size_t nelems, const int *status, int cmp, short *values);
OSHMEM_DECLSPEC  size_t shmem_ushort_test_any_vector(volatile unsigned short *ivars, size_t nelems, const int *status, int cmp, unsigned short *values);
OSHMEM_DECLSPEC  size_t shmem_int_test_any_vector(volatile int *ivars, size_t nelems, const int *status, int cmp, int *values);
OSHMEM_DECLSPEC  size_t shmem_long_test_any_vector(volatile long *ivars, size_t nelems, const int *status, int cmp, long *values);
OSHMEM_DECLSPEC  size_t shmem_longlong_test_any_vector(volatile long long *ivars, size_t nelems, const int *status, int cmp, long long *values);
OSHMEM_DECLSPEC  size_t shmem_uint_test_any_vector(volatile unsigned int *ivars, size_t nelems, const int *status, int cmp, unsigned int *values);
OSHMEM_DECLSPEC  size_t shmem_ulong_test_any_vector(volatile unsigned long *ivars, size_t nelems, const int *status, int cmp, unsigned long *values);
OSHMEM_DECLSPEC  size_t shmem_ulonglong_test_any_vector(volatile unsigned long long *ivars, size_t nelems, const int *status, int cmp, unsigned long long *values);
OSHMEM_DECLSPEC  size_t shmem_int32_test_any_vector(volatile int32_t *ivars, size_t nelems, const int *status, int cmp, int32_t *values);
OSHMEM_DECLSPEC  size_t shmem_int64_test_any_vector(volatile int64_t *ivars, size_t nelems, const int *status, int cmp, int64_t *values);
OSHMEM_DECLSPEC  size_t shmem_uint32_test_any_vector(volatile uint32_t *ivars, size_t nelems, const int *status, int cmp, uint32_t *values);
OSHMEM_DECLSPEC  size_t shmem_uint64_test_any_vector(volatile uint64_t *ivars, size_t nelems, const int *status, int cmp, uint64_t *values);
OSHMEM_DECLSPEC  size_t shmem_size_test_any_vector(volatile size_t *ivars, size_t nelems, const int *status, int cmp, size_t *values);
OSHMEM_DECLSPEC  size_t shmem_ptrdiff_test_any_vector(volatile ptrdiff_t *ivars, size_t nelems, const int *status, int cmp, ptrdiff_t *values);
#if OSHMEM_HAVE_C11
#define shmem_test_any_vector(ivars, nelems, status, cmp, values)         \
    _Generic(&*(ivars),                                                   \
        short*:                shmem_short_test_any_vector,               \
        unsigned short*:       shmem_ushort_test_any_vector,              \
        int*:                  shmem_int_test_any_vector,                 \
        long*:                 shmem_long_test_any_vector,                \
        long long*:            shmem_longlong_test_any_vector,            \
        unsigned int*:         shmem_uint_test_any_vector,                \
        unsigned long*:        shmem_ulong_test_any_vector,               \
        unsigned long long*:   shmem_ulonglong_test_any_vector)(ivars, nelems, status, cmp, values)
#endif


OSHMEM_DECLSPEC  size_t shmem_short_test_some_vector(volatile short *ivars, size_t nelems, size_t *indices, const int *status, int cmp, short *values);
OSHMEM_DECLSPEC  size_t shmem_ushort_test_some_vector(volatile unsigned short *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned short *values);
OSHMEM_DECLSPEC  size_t shmem_int_test_some_vector(volatile int *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int *values);
OSHMEM_DECLSPEC  size_t shmem_long_test_some_vector(volatile long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, long *values);
OSHMEM_DECLSPEC  size_t shmem_longlong_test_some_vector(volatile long long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, long long *values);
OSHMEM_DECLSPEC  size_t shmem_uint_test_some_vector(volatile unsigned int *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned int *values);
OSHMEM_DECLSPEC  size_t shmem_ulong_test_some_vector(volatile unsigned long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned long *values);
OSHMEM_DECLSPEC  size_t shmem_ulonglong_test_some_vector(volatile unsigned long long *ivars, size_t nelems, size_t *indices, const int *status, int cmp, unsigned long long *values);
OSHMEM_DECLSPEC  size_t shmem_int32_test_some_vector(volatile int32_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int32_t *values);
OSHMEM_DECLSPEC  size_t shmem_int64_test_some_vector(volatile int64_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, int64_t *values);
OSHMEM_DECLSPEC  size_t shmem_uint32_test_some_vector(volatile uint32_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, uint32_t *values);
OSHMEM_DECLSPEC  size_t shmem_uint64_test_some_vector(volatile uint64_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, uint64_t *values);
OSHMEM_DECLSPEC  size_t shmem_size_test_some_vector(volatile size_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, size_t *values);
OSHMEM_DECLSPEC  size_t shmem_ptrdiff_test_some_vector(volatile ptrdiff_t *ivars, size_t nelems, size_t *indices, const int *status, int cmp, ptrdiff_t *values);
#if OSHMEM_HAVE_C11
#define shmem_test_some_vector(ivars, nelems, indices, status, cmp, values)    \
    _Generic(&*(ivars),                                                    	\
        short*:                shmem_short_test_some_vector,               	\
        unsigned short*:       shmem_ushort_test_some_vector,              	\
        int*:                  shmem_int_test_some_vector,                 	\
        long*:                 shmem_long_test_some_vector,                	\
        long long*:            shmem_longlong_test_some_vector,            	\
        unsigned int*:         shmem_uint_test_some_vector,                	\
        unsigned long*:        shmem_ulong_test_some_vector,               	\
        unsigned long long*:   shmem_ulonglong_test_some_vector)(ivars, nelems, indices, status, cmp, values)
#endif

/*
 * Barrier sync routines
 */
OSHMEM_DECLSPEC  void shmem_barrier(int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC  void shmem_barrier_all(void);
OSHMEM_DECLSPEC  void shmem_sync_deprecated(int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC  void shmem_sync_all(void);
OSHMEM_DECLSPEC  void shmem_fence(void);
OSHMEM_DECLSPEC  void shmem_ctx_fence(shmem_ctx_t ctx);
OSHMEM_DECLSPEC  void shmem_quiet(void);
OSHMEM_DECLSPEC  void shmem_ctx_quiet(shmem_ctx_t ctx);

#if OSHMEM_HAVE_C11
#define shmem_sync(...)                                          \
    _Generic((__OSHMEM_VAR_ARG1(__VA_ARGS__)),                   \
            shmem_team_t: shmem_team_sync,                       \
            int:          shmem_sync_deprecated)(__VA_ARGS__)
#endif
/*
 * Collective routines
 */
OSHMEM_DECLSPEC void shmem_broadcast32(void *target, const void *source, size_t nlong, int PE_root, int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC void shmem_broadcast64(void *target, const void *source, size_t nlong, int PE_root, int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC void shmem_collect32(void *target, const void *source, size_t nlong, int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC void shmem_collect64(void *target, const void *source, size_t nlong, int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC void shmem_fcollect32(void *target, const void *source, size_t nlong, int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC void shmem_fcollect64(void *target, const void *source, size_t nlong, int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC void shmem_alltoall32(void *target, const void *source, size_t nelems, int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC void shmem_alltoall64(void *target, const void *source, size_t nelems, int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC void shmem_alltoalls32(void *target, const void *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems, int PE_start, int logPE_stride, int PE_size, long *pSync);
OSHMEM_DECLSPEC void shmem_alltoalls64(void *target, const void *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems, int PE_start, int logPE_stride, int PE_size, long *pSync);


/*
 * Reduction routines
 */
OSHMEM_DECLSPEC void shmem_short_and_to_all(short *target, const short *source, int nreduce, int PE_start, int logPE_stride, int PE_size, short *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_int_and_to_all(int *target, const int *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_long_and_to_all(long *target, const long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longlong_and_to_all(long long *target, const long long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long long *pWrk, long *pSync);

OSHMEM_DECLSPEC void shmem_short_or_to_all(short *target, const short *source, int nreduce, int PE_start, int logPE_stride, int PE_size, short *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_int_or_to_all(int *target, const int *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_long_or_to_all(long *target, const long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longlong_or_to_all(long long *target, const long long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long long *pWrk, long *pSync);

OSHMEM_DECLSPEC void shmem_short_xor_to_all(short *target, const short *source, int nreduce, int PE_start, int logPE_stride, int PE_size, short *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_int_xor_to_all(int *target, const int *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_long_xor_to_all(long *target, const long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longlong_xor_to_all(long long *target, const long long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long long *pWrk, long *pSync);

OSHMEM_DECLSPEC void shmem_short_max_to_all(short *target, const short *source, int nreduce, int PE_start, int logPE_stride, int PE_size, short *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_int_max_to_all(int *target, const int *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_long_max_to_all(long *target, const long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longlong_max_to_all(long long *target, const long long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_float_max_to_all(float *target, const float *source, int nreduce, int PE_start, int logPE_stride, int PE_size, float *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_double_max_to_all(double *target, const double *source, int nreduce, int PE_start, int logPE_stride, int PE_size, double *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longdouble_max_to_all(long double *target, const long double *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long double *pWrk, long *pSync);

OSHMEM_DECLSPEC void shmem_short_min_to_all(short *target, const short *source, int nreduce, int PE_start, int logPE_stride, int PE_size, short *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_int_min_to_all(int *target, const int *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_long_min_to_all(long *target, const long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longlong_min_to_all(long long *target, const long long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_float_min_to_all(float *target, const float *source, int nreduce, int PE_start, int logPE_stride, int PE_size, float *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_double_min_to_all(double *target, const double *source, int nreduce, int PE_start, int logPE_stride, int PE_size, double *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longdouble_min_to_all(long double *target, const long double *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long double *pWrk, long *pSync);

OSHMEM_DECLSPEC void shmem_short_sum_to_all(short *target, const short *source, int nreduce, int PE_start, int logPE_stride, int PE_size, short *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_int_sum_to_all(int *target, const int *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_long_sum_to_all(long *target, const long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longlong_sum_to_all(long long *target, const long long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_float_sum_to_all(float *target, const float *source, int nreduce, int PE_start, int logPE_stride, int PE_size, float *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_double_sum_to_all(double *target, const double *source, int nreduce, int PE_start, int logPE_stride, int PE_size, double *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longdouble_sum_to_all(long double *target, const long double *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long double *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_complexf_sum_to_all(OSHMEM_COMPLEX_TYPE(float) *target, const OSHMEM_COMPLEX_TYPE(float) *source, int nreduce, int PE_start, int logPE_stride, int PE_size, OSHMEM_COMPLEX_TYPE(float) *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_complexd_sum_to_all(OSHMEM_COMPLEX_TYPE(double) *target, const OSHMEM_COMPLEX_TYPE(double) *source, int nreduce, int PE_start, int logPE_stride, int PE_size, OSHMEM_COMPLEX_TYPE(double) *pWrk, long *pSync);

OSHMEM_DECLSPEC void shmem_short_prod_to_all(short *target, const short *source, int nreduce, int PE_start, int logPE_stride, int PE_size, short *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_int_prod_to_all(int *target, const int *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_long_prod_to_all(long *target, const long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longlong_prod_to_all(long long *target, const long long *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long long *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_float_prod_to_all(float *target, const float *source, int nreduce, int PE_start, int logPE_stride, int PE_size, float *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_double_prod_to_all(double *target, const double *source, int nreduce, int PE_start, int logPE_stride, int PE_size, double *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_longdouble_prod_to_all(long double *target, const long double *source, int nreduce, int PE_start, int logPE_stride, int PE_size, long double *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_complexf_prod_to_all(OSHMEM_COMPLEX_TYPE(float) *target, const OSHMEM_COMPLEX_TYPE(float) *source, int nreduce, int PE_start, int logPE_stride, int PE_size, OSHMEM_COMPLEX_TYPE(float) *pWrk, long *pSync);
OSHMEM_DECLSPEC void shmem_complexd_prod_to_all(OSHMEM_COMPLEX_TYPE(double) *target, const OSHMEM_COMPLEX_TYPE(double) *source, int nreduce, int PE_start, int logPE_stride, int PE_size, OSHMEM_COMPLEX_TYPE(double) *pWrk, long *pSync);

/*
 * Platform specific cache management routines
 */
OSHMEM_DECLSPEC void shmem_udcflush(void);
OSHMEM_DECLSPEC void shmem_udcflush_line(void* target);
OSHMEM_DECLSPEC void shmem_set_cache_inv(void);
OSHMEM_DECLSPEC void shmem_set_cache_line_inv(void* target);
OSHMEM_DECLSPEC void shmem_clear_cache_inv(void);
OSHMEM_DECLSPEC void shmem_clear_cache_line_inv(void* target);

#if defined(c_plusplus) || defined(__cplusplus)
}
#endif


#endif /* OSHMEM_SHMEM_H */